:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f0f4f7;
  --ink: #17202a;
  --muted: #64707d;
  --line: #d9dee3;
  --nav: #12323a;
  --nav-2: #1d4b52;
  --blue: #2563eb;
  --green: #16845b;
  --amber: #b7791f;
  --red: #c24141;
  --focus: #5b8def;
  --shadow: 0 16px 40px rgba(21, 30, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

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

a {
  color: inherit;
}

.app {
  min-height: 100vh;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(320px, 460px) minmax(0, 1fr);
}

.login-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  justify-content: center;
  padding: 44px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.login-aside {
  display: flex;
  align-items: center;
  padding: 56px;
  background:
    linear-gradient(rgba(18, 50, 58, 0.72), rgba(18, 50, 58, 0.72)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='900' viewBox='0 0 1200 900'%3E%3Crect width='1200' height='900' fill='%23e2ecec'/%3E%3Cg fill='none' stroke='%2389aeb2' stroke-width='2' opacity='.7'%3E%3Cpath d='M80 180h310v170H80zM480 120h520v230H480zM150 470h420v210H150zM680 460h360v260H680z'/%3E%3Cpath d='M130 230h210M130 280h120M530 180h390M530 230h300M220 530h260M220 585h170M735 530h250M735 585h180'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  color: #f8fbfb;
}

.brand-mark {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--nav);
  color: white;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.login-aside .eyebrow {
  color: #b9d3d6;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.12;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 16px;
}

p {
  margin: 0;
  line-height: 1.55;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.workbench {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  gap: 22px;
  padding: 18px 14px;
  background: var(--nav);
  color: #e9f2f3;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 10px;
}

.sidebar .brand-mark {
  background: #e9f2f3;
  color: var(--nav);
}

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

.nav-link {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: #dce9eb;
  text-decoration: none;
}

.nav-link:hover,
.nav-link.active {
  background: var(--nav-2);
  color: white;
}

.nav-icon {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12px;
  font-weight: 800;
}

.sidebar-foot {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.main-frame {
  display: grid;
  min-width: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

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

.content-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 18px;
}

.content-main,
.content-side {
  min-width: 0;
}

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

.stack {
  display: grid;
  gap: 14px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row.wrap {
  flex-wrap: wrap;
}

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

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

.panel.flat {
  box-shadow: none;
}

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

.item {
  display: grid;
  gap: 8px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
}

.item:hover {
  border-color: #b5c2cf;
}

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

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

.stat {
  min-height: 88px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  color: var(--ink);
  background: white;
  border: 1px solid #cdd5dc;
  border-radius: 8px;
  outline: none;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(91, 141, 239, 0.18);
}

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

.button:hover {
  filter: brightness(0.96);
}

.button.secondary {
  background: white;
  color: var(--ink);
  border-color: #cdd5dc;
}

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

.button.danger {
  background: var(--red);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e8edf2;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.badge.ready,
.badge.answered {
  background: #ddf3e9;
  color: #116747;
}

.badge.failed,
.badge.error {
  background: #fde2e2;
  color: #9a2b2b;
}

.badge.processing,
.badge.queued,
.badge.transcribing,
.badge.summarizing {
  background: #fff1d6;
  color: #8a570c;
}

.notice {
  padding: 12px;
  background: #fff7e6;
  border: 1px solid #f1d39d;
  border-radius: 8px;
  color: #6a460c;
}

.error-box {
  padding: 12px;
  background: #fdeaea;
  border: 1px solid #f3b4b4;
  border-radius: 8px;
  color: #7b2525;
}

.success-box {
  padding: 12px;
  background: #e8f7ef;
  border: 1px solid #b6e2ca;
  border-radius: 8px;
  color: #155f3f;
}

.code-block {
  overflow: auto;
  max-height: 420px;
  padding: 12px;
  background: #12181f;
  color: #eef6f7;
  border-radius: 8px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-list {
  display: grid;
  gap: 8px;
}

.source {
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.empty {
  display: grid;
  min-height: 160px;
  place-items: center;
  padding: 24px;
  background: var(--surface);
  border: 1px dashed #bcc7d1;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.recorder-meter {
  height: 10px;
  overflow: hidden;
  background: #d9e3e8;
  border-radius: 999px;
}

.recorder-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 180ms ease;
}

.hidden {
  display: none !important;
}

@media (max-width: 1040px) {
  .content-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .content-side {
    order: -1;
  }
}

@media (max-width: 780px) {
  .login-shell,
  .workbench {
    grid-template-columns: 1fr;
  }

  .login-aside {
    display: none;
  }

  .sidebar {
    min-height: auto;
  }

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

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .topbar,
  .page-head,
  .spread {
    align-items: stretch;
    flex-direction: column;
  }
}
