:root {
  color-scheme: light dark;
  --bg: #0f0f10;
  --panel: #171719;
  --panel-2: #202124;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --line: #2f3034;
  --accent: #f4f4f5;
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-surface {
  width: min(100%, 380px);
  display: grid;
  gap: 24px;
}

.login-brand {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.brand-row,
.sidebar-top,
.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  font-weight: 650;
}

.login-brand .brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 20px;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 0;
}

.form-error {
  margin: 18px 0 0;
  border: 1px solid #7f1d1d;
  border-radius: 7px;
  background: #2b1111;
  color: #fecaca;
  padding: 10px 11px;
  font-size: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  padding: 0 11px;
}

button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: var(--bg);
  padding: 0 13px;
  cursor: pointer;
}

.ghost-button {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 18px;
}

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-list a {
  border-radius: 7px;
  color: var(--muted);
  padding: 9px 10px;
}

.nav-list a.active,
.nav-list a:hover {
  background: var(--panel-2);
  color: var(--text);
}

.user-block {
  margin-top: auto;
  display: grid;
  gap: 2px;
  border-top: 1px solid var(--line);
  color: var(--text);
  padding-top: 14px;
}

.user-block small,
.muted {
  color: var(--muted);
}

.main-panel {
  padding: 22px;
}

.panel-header {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.stat-tile,
.workspace-pane {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
}

.stat-tile {
  display: grid;
  gap: 8px;
}

.stat-tile span {
  color: var(--muted);
  font-size: 13px;
}

.stat-tile strong {
  font-size: 24px;
}

.metric-list,
.audit-list {
  display: grid;
  gap: 10px;
}

.metric-row,
.audit-row {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.metric-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.metric-row span,
.audit-row span,
.audit-row small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.file-list {
  display: grid;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 10px 13px;
}

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

.file-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.file-row strong,
.file-row small {
  overflow-wrap: anywhere;
}

.file-row small {
  color: var(--muted);
}

.ghost-link {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  padding: 7px 10px;
}

.thread-panel {
  margin-top: 18px;
}

.command-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.command-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
}

.command-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 10px;
}

.command-confirm[hidden] {
  display: none;
}

.command-confirm span {
  flex: 1;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.turn-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.turn {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 13px;
}

.turn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tts-controls {
  display: flex;
  gap: 6px;
}

.icon-button {
  min-height: 30px;
  border-color: var(--line);
  background: transparent;
  color: var(--text);
  padding: 0 9px;
  font-size: 12px;
}

.turn p {
  margin: 8px 0 0;
  color: var(--text);
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

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

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

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

  .command-form {
    grid-template-columns: 1fr;
  }
}
