:root {
  --bg: #151515;
  --panel: #1f1f1f;
  --panel-soft: #2a2a2a;
  --ink: #f1f1f1;
  --muted: #9a9a9a;
  --line: #343434;
  --line-strong: #464646;
  --blue: #3b9cff;
  --blue-dark: #2383e2;
  --green: #2fbf71;
  --red: #ff6b57;
  --nav: #1b1b1b;
  --nav-soft: #262626;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.26);
  --composer-shadow: 0 22px 68px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 70% 18%, rgba(255, 255, 255, 0.035), transparent 34%),
    var(--bg);
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 15, 15, 0.86);
  backdrop-filter: blur(16px);
}

.login-overlay[hidden] {
  display: none;
}

.login-panel {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1d1d1d;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}

.login-brand h1,
.login-brand p {
  margin: 0;
}

.login-brand h1 {
  font-size: 24px;
}

.login-brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.login-panel label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 10px;
}

.captcha-btn {
  width: 128px;
  height: 38px;
  padding: 0;
  overflow: hidden;
  background: #f7f7f7;
}

.captcha-btn img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
}

.login-submit {
  width: 100%;
  color: #101010;
  border-color: #f0f0f0;
  background: #f0f0f0;
  font-weight: 700;
}

.login-submit:hover:not(:disabled) {
  background: #ffffff;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.session-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 18px 0;
  color: #f8fafc;
  background: var(--nav);
  border-right: 1px solid #2d2d2d;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  margin-bottom: 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #111111;
  background: #f0f0f0;
  font-weight: 700;
}

.brand h1,
.topbar h2,
.panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 22px;
}

.brand span,
.session-head,
.empty.dark {
  color: #aab6c5;
}

.primary {
  color: #f5f5f5;
  border-color: #383838;
  background: #2b2b2b;
}

.primary:hover {
  background: #333333;
}

.full {
  width: 100%;
}

.sidebar-action-btn {
  width: 100%;
  margin-bottom: 8px;
  color: #d7d7d7;
  border-color: transparent;
  background: transparent;
  text-align: left;
}

.sidebar-action-btn:hover {
  color: #ffffff;
  border-color: #353535;
  background: var(--nav-soft);
}

button,
select,
input {
  height: 38px;
}

button,
input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
}

button {
  padding: 0 14px;
  color: var(--ink);
  background: var(--panel);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

button:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: #282828;
}

.primary:hover:not(:disabled) {
  background: #333333;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

input,
select,
textarea {
  width: 100%;
  color: var(--ink);
  background: var(--panel);
  outline: none;
}

input,
select {
  padding: 0 10px;
}

textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
  line-height: 1.55;
}

::placeholder {
  color: #7d7d7d;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #6c6c6c;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field.compact label {
  color: #aab6c5;
}

.session-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
}

.session-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
}

.session-list {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  flex: 1;
  margin-top: 8px;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.sidebar-user {
  position: relative;
  margin: 16px -18px 0;
  padding: 12px 14px;
  border-top: 1px solid #303030;
  background: rgba(255, 255, 255, 0.02);
}

.user-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: auto;
  min-height: 56px;
  padding: 6px 4px;
  border-color: transparent;
  color: #f1f1f1;
  background: transparent;
  text-align: left;
}

.user-card:hover {
  border-color: transparent;
  background: #262626;
}

.user-avatar,
.user-menu-avatar {
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #d9c8ff;
  background: #3a314b;
  font-weight: 800;
}

.user-avatar {
  width: 42px;
  height: 42px;
  font-size: 16px;
}

.user-copy,
.user-menu-copy {
  display: grid;
  min-width: 0;
}

.user-copy strong,
.user-menu-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy strong {
  color: #f5f5f5;
  font-size: 15px;
}

.user-copy span,
.user-menu-copy span {
  color: #9b9b9b;
  font-size: 13px;
}

.user-device {
  position: relative;
  justify-self: end;
  width: 14px;
  height: 22px;
  border: 2px solid #8c8c8c;
  border-radius: 4px;
}

.user-device::after {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #8c8c8c;
  content: "";
  transform: translateX(-50%);
}

.user-menu {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(100% + 8px);
  z-index: 120;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #202020;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.user-menu[hidden] {
  display: none;
}

.user-menu-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  height: auto;
  min-height: 46px;
  padding: 6px 8px;
  border-color: transparent;
  color: #efefef;
  background: transparent;
  text-align: left;
}

.user-menu-item:hover,
.user-menu-item.active {
  background: #303030;
}

.user-menu-avatar {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.workspace-group {
  display: grid;
  position: relative;
  align-self: start;
  gap: 6px;
}

.workspace-group.menu-open {
  z-index: 40;
}

.workspace-header {
  display: grid;
  position: relative;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.workspace-header:hover,
.workspace-group.active .workspace-header {
  border-color: #353535;
  background: var(--nav-soft);
}

.workspace-title {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border-color: transparent;
  color: #dddddd;
  text-align: left;
  background: transparent;
}

.workspace-title:hover {
  background: transparent;
  border-color: transparent;
}

.workspace-title strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-actions {
  display: flex;
  position: relative;
  align-items: center;
  gap: 4px;
  padding-right: 6px;
  opacity: 0;
}

.workspace-header:hover .workspace-actions,
.workspace-group.menu-open .workspace-actions,
.workspace-group.active .workspace-actions {
  opacity: 1;
}

.workspace-action-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-color: transparent;
  color: #c9c9c9;
  background: transparent;
  font-size: 16px;
  line-height: 1;
}

.workspace-action-btn:hover {
  color: #ffffff;
  background: #343434;
}

.workspace-collapse-btn {
  overflow: hidden;
}

.workspace-collapse-icon {
  display: block;
  width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
  transform-origin: center center;
  transition: transform 0.15s ease;
}

.workspace-group.collapsed .workspace-collapse-icon {
  transform: rotate(-90deg);
}

.workspace-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 6px;
  z-index: 30;
  min-width: 104px;
  padding: 5px;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #202020;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

.workspace-menu[hidden] {
  display: none;
}

.workspace-menu button {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border-color: transparent;
  color: #ffb8ad;
  text-align: left;
  background: transparent;
}

.workspace-menu button:hover {
  color: #ffffff;
  background: #44201f;
}

.workspace-empty {
  padding: 5px 10px 5px 22px;
  color: #777777;
  font-size: 12px;
}

.session-row {
  position: relative;
}

.session-row.menu-open {
  z-index: 35;
}

.session-item {
  display: grid;
  width: 100%;
  min-height: 44px;
  padding: 9px 42px 9px 22px;
  color: #e4e4e4;
  text-align: left;
  background: transparent;
  border-color: transparent;
}

.session-item:hover,
.session-item.active {
  color: #ffffff;
  background: var(--nav-soft);
  border-color: #353535;
}

.session-item strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-item span {
  display: none;
}

.session-menu-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-color: transparent;
  color: #c9c9c9;
  background: transparent;
  opacity: 0;
  transform: translateY(-50%);
}

.session-row:hover .session-menu-btn,
.session-row.menu-open .session-menu-btn {
  opacity: 1;
}

.session-menu-btn:hover {
  color: #ffffff;
  background: #343434;
}

.session-menu {
  position: fixed;
  z-index: 100;
  min-width: 104px;
  padding: 5px;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #202020;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

.session-menu[hidden] {
  display: none;
}

.session-menu button {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border-color: transparent;
  color: #ffb8ad;
  text-align: left;
  background: transparent;
}

.session-menu button:hover {
  color: #ffffff;
  background: #44201f;
}

.chat-main {
  display: grid;
  position: relative;
  grid-template-rows: minmax(0, 1fr) auto auto;
  min-width: 0;
  min-height: 0;
  padding: 18px 22px;
  overflow: hidden;
  background: #151515;
}

.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(31, 31, 31, 0.72);
  box-shadow: none;
}

.topbar h2 {
  font-size: 20px;
}

.topbar span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  margin: 14px 0;
  padding: 20px;
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #1a1a1a;
  box-shadow: none;
}

.message-list[hidden],
.composer[hidden] {
  display: none;
}

.message-list.empty-state {
  align-items: center;
  justify-content: center;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.skill-page,
.model-page {
  min-height: 0;
  margin: 14px 0;
  padding: 44px min(8vw, 86px) 28px;
  overflow: auto;
  border-radius: 8px;
  background: #151515;
}

.skill-page[hidden],
.model-page[hidden] {
  display: none;
}

.skill-hero {
  display: grid;
  position: relative;
  gap: 22px;
  max-width: 1180px;
  margin: 0 auto 28px;
}

.skill-back-btn {
  position: absolute;
  top: 2px;
  left: -46px;
  color: #dcdcdc;
  font-size: 28px;
  line-height: 1;
  background: transparent;
  border-color: transparent;
}

.skill-hero h2 {
  margin: 0;
  color: #f5f5f5;
  font-size: 44px;
  line-height: 1.1;
}

.skill-hero p {
  margin: -8px 0 14px;
  color: #a7a7a7;
  font-size: 20px;
  font-weight: 700;
}

.skill-search {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  height: 64px;
  padding: 0 24px;
  border: 1px solid #545454;
  border-radius: 999px;
  background: #2b2b2b;
}

.skill-search:focus-within {
  border-color: #747474;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.skill-search span {
  position: relative;
  width: 22px;
  height: 22px;
  border: 2px solid #b5b5b5;
  border-radius: 50%;
}

.skill-search span::after {
  position: absolute;
  right: -7px;
  bottom: -5px;
  width: 9px;
  height: 2px;
  border-radius: 2px;
  background: #b5b5b5;
  content: "";
  transform: rotate(45deg);
}

.skill-search input {
  height: 100%;
  padding: 0;
  border: 0;
  color: #f2f2f2;
  background: transparent;
  font-size: 24px;
  font-weight: 700;
}

.skill-search input:focus {
  box-shadow: none;
}

.skill-content {
  display: grid;
  gap: 26px;
  max-width: 1180px;
  margin: 0 auto;
}

.skill-group {
  display: grid;
  gap: 12px;
}

.skill-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.skill-group-head h3 {
  margin: 0;
  color: #f0f0f0;
  font-size: 18px;
}

.skill-group-head span {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: #bdbdbd;
  background: #282828;
  font-size: 12px;
  font-weight: 700;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.skill-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  min-height: 116px;
  padding: 14px;
  border: 1px solid #383838;
  border-radius: 8px;
  background: #202020;
}

.skill-card-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #171717;
  background: #dedede;
  font-weight: 800;
}

.skill-card-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.skill-card h4 {
  overflow: hidden;
  margin: 0;
  color: #f3f3f3;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-card p {
  display: -webkit-box;
  min-height: 38px;
  margin: 0;
  overflow: hidden;
  color: #b4b4b4;
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.skill-card small {
  overflow: hidden;
  color: #7e7e7e;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-empty {
  padding: 18px;
  border: 1px solid #343434;
  border-radius: 8px;
  color: #9b9b9b;
  background: #202020;
  font-size: 14px;
}

.skill-empty.compact {
  min-height: 76px;
}

.skill-empty.error {
  color: var(--red);
}

.model-content {
  display: grid;
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto;
}

.model-toolbar {
  display: flex;
  justify-content: flex-end;
}

.model-primary-btn {
  height: 34px;
  border-color: #424242;
  color: #f2f2f2;
  background: #2a2a2a;
}

.model-list {
  display: grid;
  gap: 10px;
}

.model-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 92px;
  padding: 14px;
  border: 1px solid #383838;
  border-radius: 8px;
  background: #202020;
}

.model-card-body {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.model-card h4,
.model-card p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-card h4 {
  color: #f3f3f3;
  font-size: 16px;
}

.model-card p {
  color: #b9b9b9;
  font-size: 13px;
}

.model-card small {
  overflow: hidden;
  color: #7f7f7f;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-card-actions {
  display: flex;
  gap: 8px;
}

.model-card-actions button {
  height: 30px;
  padding: 0 10px;
  border-color: #3b3b3b;
  background: #282828;
}

.model-card-actions .danger {
  color: #ffb8ad;
}

.model-editor {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.48);
}

.model-editor[hidden] {
  display: none;
}

.model-form {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 18px;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #202020;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.36);
}

.model-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.model-form-head strong {
  color: #f3f3f3;
  font-size: 18px;
}

.model-form label {
  display: grid;
  gap: 7px;
}

.model-form label span {
  color: #aab6c5;
  font-size: 13px;
  font-weight: 700;
}

.model-form input {
  height: 40px;
}

.model-submit-btn {
  width: 100%;
  color: #ffffff;
  background: #303030;
}

.empty-session-panel {
  display: grid;
  gap: 12px;
  max-width: 760px;
  margin-bottom: 150px;
  text-align: center;
}

.empty-session-panel h2 {
  margin: 0;
  color: #f3f3f3;
  font-size: 28px;
  font-weight: 700;
}

.empty-session-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.message {
  display: flex;
  max-width: 88%;
}

.message.assistant {
  width: 100%;
  max-width: 100%;
}

.message.user {
  align-self: flex-end;
}

.message.user .bubble {
  border-color: #3d3d3d;
  color: var(--ink);
  background: #2b2b2b;
}

.bubble {
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #242424;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.assistant .bubble {
  width: 100%;
  padding: 0;
  border-color: transparent;
  background: transparent;
}

.thinking {
  width: 100%;
  margin: 8px 0 14px;
  color: #9b9b9b;
  font-size: 13px;
  line-height: 1.5;
}

.thinking-label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  color: #9f9f9f;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.thinking-label::marker {
  display: none;
  content: "";
}

.thinking-label::-webkit-details-marker {
  display: none;
}

.thinking-label::after {
  width: 7px;
  height: 7px;
  border: solid #8f8f8f;
  border-width: 0 2px 2px 0;
  content: "";
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.thinking-label::before {
  height: 1px;
  background: #303030;
  content: "";
  grid-column: 2;
  grid-row: 1;
}

.thinking[open] .thinking-label::after {
  transform: rotate(45deg);
}

.thinking-body {
  margin-top: 8px;
  padding: 9px 11px;
  border-left: 3px solid #596677;
  border-radius: 8px;
  color: #c8c8c8;
  background: #2a2a2a;
  font-style: italic;
}

.answer {
  color: var(--ink);
  margin-bottom: 10px;
}

.message-attachments {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.message-attachment {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: min(280px, 100%);
  padding: 7px 9px;
  border: 1px solid #444444;
  border-radius: 8px;
  background: #242424;
}

.message-attachment-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  color: #151515;
  background: #d8d8d8;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.message-attachment-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.message-attachment-meta strong {
  overflow: hidden;
  color: #f0f0f0;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-attachment-meta small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.thinking:last-child,
.answer:last-child {
  margin-bottom: 0;
}

.composer {
  padding: 4px 8px 6px;
  border: 1px solid #383838;
  border-radius: 24px;
  background: #292929;
  box-shadow: var(--composer-shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.composer:hover,
.composer:focus-within {
  border-color: #4a4a4a;
  box-shadow: 0 28px 78px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.chat-main.empty-session .composer {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(760px, calc(100% - 44px));
  transform: translate(-50%, 18%);
  z-index: 5;
}

.approval-panel {
  display: grid;
  gap: 4px;
  justify-self: center;
  width: min(300px, calc(100% - 44px));
  margin: 0 auto 8px;
  padding: 6px;
  border: 1px solid #3d3d3d;
  border-radius: 10px;
  background: #242424;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.26);
}

.chat-main.empty-session .approval-panel {
  position: absolute;
  top: calc(50% - 84px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
}

.approval-panel[hidden] {
  display: none;
}

.approval-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.approval-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.approval-copy span {
  overflow: hidden;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.approval-actions,
.approval-custom {
  display: grid;
  gap: 4px;
}

.approval-actions {
  grid-template-columns: 1fr;
}

.approval-custom {
  grid-template-columns: 1fr;
}

.approval-actions button {
  width: 100%;
  height: 26px;
  min-width: 0;
  padding: 0 8px;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  line-height: 1;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #2b2b2b;
}

.approval-custom input {
  min-width: 0;
  height: 26px;
  padding: 0 8px;
  border-color: #3d3d3d;
  background: #1f1f1f;
  font-size: 11px;
}

.approval-custom button {
  justify-self: stretch;
  width: 100%;
  height: 26px;
  padding: 0 8px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  background: #2b2b2b;
}

.composer textarea {
  min-height: 24px;
  height: 30px;
  max-height: 120px;
  padding: 3px 8px 1px;
  border-color: transparent;
  border-radius: 18px;
  background: transparent;
  resize: none;
  line-height: 1.45;
  transition: height 0.18s ease, min-height 0.18s ease;
}

.composer.expanded textarea,
.composer:hover textarea,
.composer textarea:focus {
  height: 82px;
  min-height: 82px;
}

.composer textarea:focus {
  border-color: transparent;
  box-shadow: none;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 0;
}

.attachment-chip {
  height: 22px;
  max-width: 220px;
  padding: 0 9px;
  border-radius: 999px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--panel-soft);
}

.composer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  margin-top: 0;
}

.toolbar-select {
  width: fit-content;
  height: 24px;
  min-width: 0;
  max-width: none;
  padding: 0 20px 0 10px;
  border-color: transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background-color: transparent;
  field-sizing: content;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.permission-select {
  max-width: none;
}

.workspace-select {
  max-width: none;
}

.model-select {
  max-width: none;
  color: var(--ink);
}

.tool-icon-btn {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-color: transparent;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  font-size: 18px;
  line-height: 1;
}

.tool-icon-btn:hover,
.toolbar-select:hover {
  background: var(--panel-soft);
}

.toolbar-spacer {
  flex: 1;
}

.context-meter {
  --context-progress: 0deg;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #292929 55%, transparent 57%),
    conic-gradient(var(--blue) var(--context-progress), #4a4a4a 0);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.context-meter.full {
  background:
    radial-gradient(circle at center, #292929 55%, transparent 57%),
    conic-gradient(var(--red) var(--context-progress), #4a4a4a 0);
  color: var(--red);
}

.send-btn {
  display: grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  color: #151515;
  border-color: transparent;
  background: #d6d6d6;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.send-btn:hover:not(:disabled) {
  background: #ffffff;
  transform: translateY(-1px);
}

.send-icon {
  position: relative;
  width: 12px;
  height: 12px;
}

.send-btn.idle .send-icon::before {
  position: absolute;
  left: 5px;
  top: 1px;
  width: 2px;
  height: 10px;
  border-radius: 2px;
  background: #151515;
  content: "";
}

.send-btn.idle .send-icon::after {
  position: absolute;
  left: 1px;
  top: 1px;
  width: 7px;
  height: 7px;
  border: solid #151515;
  border-width: 2px 2px 0 0;
  content: "";
  transform: rotate(-45deg);
}

.send-btn.running .send-icon {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: #151515;
}

.panel {
  padding: 16px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel h3 {
  font-size: 17px;
}

.panel .field {
  margin-bottom: 10px;
}

.badge {
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--green);
  background: #e9f7ef;
  font-size: 12px;
  font-weight: 700;
}

.badge.muted {
  color: var(--muted);
  background: var(--panel-soft);
}

.badge.error {
  color: var(--red);
  background: #fff0ed;
}

.events-panel {
  min-height: 0;
  flex: 1;
}

.timeline {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 356px);
  overflow: auto;
}

.event-item {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.event-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.event-content {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.empty {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 250px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .session-sidebar,
  .chat-main {
    padding: 14px;
  }

  .sidebar-user {
    margin: 16px -14px -14px;
  }

  .message-list {
    min-height: 52vh;
  }

  .skill-page,
  .model-page {
    min-height: 64vh;
    padding: 22px 0 18px;
  }

  .skill-hero {
    gap: 16px;
  }

  .skill-back-btn {
    position: static;
    justify-self: start;
  }

  .skill-hero h2 {
    font-size: 34px;
  }

  .skill-hero p {
    font-size: 17px;
  }

  .skill-search {
    height: 54px;
    padding: 0 18px;
  }

  .skill-search input {
    font-size: 20px;
  }

  .topbar {
    display: grid;
    min-width: 0;
    width: 100%;
  }

  .message {
    max-width: 100%;
  }

  .composer-toolbar {
    flex-wrap: wrap;
  }

  .toolbar-spacer {
    flex-basis: 100%;
    height: 0;
  }

  .workspace-select,
  .permission-select,
  .model-select {
    min-width: 0;
    flex: 1;
  }

  .approval-actions,
  .approval-custom {
    display: grid;
    grid-template-columns: 1fr;
  }

}
