
:root {
  color-scheme: dark;
  --bg: #0d1110;
  --surface: #141a18;
  --surface-2: #1a211f;
  --surface-3: #202925;
  --ink: #edf3f0;
  --ink-soft: #c8d3ce;
  --muted: #93a29c;
  --line: #2b3531;
  --line-strong: #3b4843;
  --accent: #4bd2a4;
  --accent-ink: #06251c;
  --blue: #78afe7;
  --amber: #e5ad59;
  --danger: #ff8279;
  --success: #6ed8ad;
  --focus: #9ce8ce;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 7px;
  --font-ui: "Segoe UI Variable Text", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  --font-data: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --shadow-overlay: 0 22px 60px rgb(0 0 0 / 32%);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}

button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  cursor: pointer;
  transition:
    background-color 160ms var(--ease-out),
    border-color 160ms var(--ease-out),
    color 160ms var(--ease-out),
    transform 160ms var(--ease-out);
}

button:hover {
  background: #69dfb6;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  border-color: var(--line);
  background: var(--surface-3);
  color: var(--muted);
  cursor: default;
  transform: none;
}

button.secondary {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

button.secondary:hover {
  border-color: var(--accent);
  background: rgb(75 210 164 / 8%);
}

button.danger {
  min-height: 34px;
  border-color: transparent;
  padding: 6px 8px;
  background: transparent;
  color: var(--danger);
  font-weight: 500;
}

button.danger:hover {
  border-color: rgb(255 130 121 / 28%);
  background: rgb(255 130 121 / 8%);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

::selection {
  background: rgb(75 210 164 / 32%);
  color: var(--ink);
}

* {
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: var(--line-strong);
  background-clip: padding-box;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

.app-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: rgb(13 17 16 / 88%);
  backdrop-filter: blur(16px);
}

.app-bar-inner {
  width: min(1240px, calc(100% - 32px));
  min-height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  content: "";
  background: var(--accent);
}

.brand-mark::before {
  top: 7px;
  left: 7px;
  width: 14px;
  height: 2px;
}

.brand-mark::after {
  top: 7px;
  left: 7px;
  width: 2px;
  height: 14px;
}

.brand-copy {
  min-width: 0;
}

.brand-name {
  display: block;
  font-size: 15px;
  font-weight: 720;
  letter-spacing: .01em;
}

.brand-subtitle {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 620;
  text-decoration: none;
  transition:
    border-color 160ms var(--ease-out),
    background-color 160ms var(--ease-out);
}

.nav-button:hover {
  border-color: var(--accent);
  background: rgb(75 210 164 / 8%);
}

.page-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
  animation: enter 360ms var(--ease-out) both;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.page-heading h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -.025em;
}

.page-heading p {
  max-width: 58ch;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.page-stamp {
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-bottom: 24px;
  overflow: hidden;
  border-block: 1px solid var(--line);
  background: rgb(20 26 24 / 58%);
}

.metric {
  min-width: 0;
  min-height: 82px;
  padding: 12px 13px 11px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 7px;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-data);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-meta {
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-meter {
  height: 3px;
  margin-top: 8px;
  overflow: hidden;
  background: var(--surface-3);
}

.metric-meter span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 240ms var(--ease-out);
}

.metric-meter.memory span {
  background: var(--blue);
}

.metric-meter.rootdisk span {
  background: var(--amber);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgb(110 216 173 / 10%);
}

.live-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgb(255 130 121 / 10%);
}

.action-bar {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr);
  margin-bottom: 24px;
  border-block: 1px solid var(--line);
}

.action-block {
  min-width: 0;
  padding: 16px 0;
}

.action-block + .action-block {
  border-left: 1px solid var(--line);
  padding-left: 20px;
}

.action-block + .action-block .action-content {
  padding-right: 0;
}

.action-label {
  margin: 0 0 9px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 680;
}

.action-content {
  min-width: 0;
  padding-right: 20px;
}

.form-line {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  transition:
    border-color 160ms var(--ease-out),
    background-color 160ms var(--ease-out);
}

input[type="text"],
input[type="password"] {
  min-height: 40px;
  padding: 9px 11px;
}

input[type="file"] {
  min-height: 40px;
  padding: 7px 9px;
  color: var(--ink-soft);
  font-size: 13px;
}

input[type="file"]::file-selector-button {
  min-height: 26px;
  margin-right: 9px;
  border: 0;
  border-radius: 5px;
  padding: 5px 9px;
  background: var(--surface-3);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

input:hover,
textarea:hover {
  border-color: #51635b;
}

input::placeholder,
textarea::placeholder {
  color: #8f9f98;
}

.upload-progress {
  display: none;
  height: 3px;
  margin-top: 9px;
  overflow: hidden;
  background: var(--surface-3);
}

.upload-progress.active {
  display: block;
}

.upload-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 180ms var(--ease-out);
}

.upload-status {
  min-height: 17px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.notice {
  margin: 0 0 18px;
  border: 1px solid rgb(75 210 164 / 28%);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: rgb(75 210 164 / 7%);
  color: var(--ink-soft);
  font-size: 13px;
}

.notice.error {
  border-color: rgb(255 130 121 / 30%);
  background: rgb(255 130 121 / 7%);
  color: #ffc4bf;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.breadcrumbs a {
  color: var(--ink-soft);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.breadcrumb-separator {
  color: var(--line-strong);
}

.file-list {
  overflow: hidden;
  border-block: 1px solid var(--line);
}

.file-table {
  width: 100%;
  border-collapse: collapse;
}

.file-table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 680;
  letter-spacing: .08em;
  text-align: left;
  text-transform: uppercase;
}

.file-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
  vertical-align: middle;
}

.file-table tr:last-child td {
  border-bottom: 0;
}

.file-table tbody tr {
  transition: background-color 140ms var(--ease-out);
}

.file-table tbody tr:hover {
  background: rgb(75 210 164 / 4%);
}

.file-name {
  position: relative;
  display: inline-block;
  min-width: 0;
  max-width: 100%;
  padding-left: 17px;
  color: var(--ink);
  font-weight: 560;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.file-name::before {
  position: absolute;
  top: .47em;
  left: 0;
  width: 7px;
  height: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  content: "";
}

.file-name.folder {
  color: var(--accent);
}

.file-name.folder::before {
  border-color: var(--accent);
  background: rgb(75 210 164 / 14%);
}

.file-size,
.file-time {
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.action-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
}

.action-link:hover {
  background: rgb(75 210 164 / 8%);
}

.inline {
  display: inline;
}

.empty {
  padding: 54px 20px !important;
  color: var(--muted) !important;
  text-align: center;
}

.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-shell {
  width: min(1040px, 100%);
  min-height: 620px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-overlay);
  animation: enter 360ms var(--ease-out) both;
}

.login-intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 34px;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
}

.login-intro h1 {
  max-width: 10ch;
  margin: 56px 0 0;
  font-size: 44px;
  line-height: 1.03;
  letter-spacing: -.035em;
}

.login-intro p {
  max-width: 34ch;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.login-signals {
  display: grid;
  gap: 0;
  margin-top: 44px;
  border-top: 1px solid var(--line);
}

.login-signal {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.login-signal strong {
  color: var(--ink-soft);
  font-family: var(--font-data);
  font-weight: 550;
  text-align: right;
}

.login-form-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 42px;
}

.login-form-panel h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.15;
}

.login-form-panel > p {
  margin: 7px 0 28px;
  color: var(--muted);
  font-size: 13px;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 620;
}

.field input {
  margin: 0;
}

.login-form-panel button[type="submit"] {
  width: 100%;
  margin-top: 24px;
}

.ai-page {
  height: 100dvh;
  overflow: hidden;
}

.ai-shell {
  width: min(1080px, calc(100% - 32px));
  height: calc(100dvh - 65px);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding-top: 16px;
}

.ai-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.ai-heading h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -.015em;
}

.model-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--ink-soft);
  font-family: var(--font-data);
  font-size: 10px;
  white-space: nowrap;
}

.model-badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  content: "";
}

.messages {
  overflow-y: auto;
  padding: 22px 4px 24px;
  scroll-behavior: smooth;
}

.message {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 22px;
  animation: message-in 220ms var(--ease-out) both;
}

.message-role {
  padding-top: 3px;
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.bubble {
  max-width: 78ch;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.72;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message.user {
  grid-template-columns: minmax(0, 1fr) 66px;
}

.message.user .message-role {
  grid-column: 2;
  grid-row: 1;
  text-align: right;
}

.message.user .bubble {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  background: var(--surface-2);
  color: var(--ink);
}

.welcome {
  width: min(620px, 100%);
  margin: 9vh auto 0;
  color: var(--muted);
  text-align: center;
}

.welcome strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.03em;
}

.welcome p {
  max-width: 42ch;
  margin: 0 auto;
  font-size: 14px;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.composer textarea {
  min-height: 44px;
  max-height: 180px;
  resize: none;
  border: 0;
  padding: 10px 8px;
  background: transparent;
}

.composer button[type="submit"] {
  min-width: 78px;
}

.status {
  grid-column: 1 / -1;
  min-height: 16px;
  color: var(--muted);
  font-size: 11px;
}

.status.error {
  color: var(--danger);
}

.error-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.error-panel {
  width: min(560px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-overlay);
  animation: enter 320ms var(--ease-out) both;
}

.error-code {
  color: var(--danger);
  font-family: var(--font-data);
  font-size: 12px;
}

.error-panel h1 {
  margin: 14px 0 8px;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -.025em;
}

.error-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.error-panel .nav-button {
  margin-top: 24px;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

@media (max-width: 1024px) {
  .metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .metric:nth-child(4n) {
    border-right: 0;
  }

  .metric:nth-child(n + 5) {
    border-top: 1px solid var(--line);
  }

  .metric:last-child {
    grid-column: span 2;
  }

  .login-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .login-intro {
    min-height: 280px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .login-intro h1 {
    margin-top: 28px;
  }
}

@media (max-width: 760px) {
  .app-bar-inner,
  .page-shell,
  .ai-shell {
    width: calc(100% - 20px);
  }

  .app-bar-inner {
    min-height: 58px;
  }

  .brand-subtitle {
    display: none;
  }

  .page-shell {
    padding-top: 20px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .page-heading h1 {
    font-size: 25px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric:nth-child(odd) {
    border-right: 1px solid var(--line);
  }

  .metric:nth-child(n + 5) {
    border-top: 0;
  }

  .metric:last-child {
    grid-column: auto;
    border-bottom: 0;
  }

  .action-bar {
    grid-template-columns: 1fr;
  }

  .action-block + .action-block {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-left: 0;
  }

  .action-content {
    padding-right: 0;
  }

  .file-table thead {
    display: none;
  }

  .file-table,
  .file-table tbody,
  .file-table tr,
  .file-table td {
    display: block;
    width: 100%;
  }

  .file-table tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }

  .file-table tr:last-child {
    border-bottom: 0;
  }

  .file-table td {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 10px;
    padding: 5px 12px;
    border: 0;
  }

  .file-table td::before {
    color: var(--muted);
    font-family: var(--font-data);
    font-size: 10px;
    content: attr(data-label);
  }

  .file-table .actions {
    justify-content: flex-start;
  }

  .empty {
    display: block !important;
    padding: 42px 16px !important;
  }

  .empty::before {
    display: none;
  }

  .login-page {
    padding: 10px;
  }

  .login-intro,
  .login-form-panel {
    padding: 24px;
  }

  .login-intro h1 {
    font-size: 36px;
  }

  .login-signals {
    margin-top: 28px;
  }

  .ai-shell {
    height: calc(100dvh - 59px);
  }

  .message,
  .message.user {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .message .message-role,
  .message.user .message-role {
    grid-column: 1;
    grid-row: 1;
    padding: 0;
    text-align: left;
  }

  .message .bubble,
  .message.user .bubble {
    grid-column: 1;
    grid-row: 2;
    justify-self: stretch;
    max-width: none;
  }

  .welcome {
    margin-top: 6vh;
  }

  .welcome strong {
    font-size: 25px;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer button[type="submit"] {
    width: 100%;
  }
}

@media (pointer: coarse) {
  button,
  .nav-button,
  .action-link,
  input[type="text"],
  input[type="password"],
  input[type="file"] {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
