:root {
  color-scheme: light;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
  color: #121722;
  background: #f3f5f7;
  --page: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --ink: #121722;
  --muted: #667085;
  --faint: #8a96a3;
  --line: #dbe2ea;
  --line-strong: #b9c4d0;
  --teal: #0f766e;
  --teal-deep: #0a504c;
  --teal-soft: #dff4ef;
  --blue: #3157d5;
  --amber: #b36b00;
  --danger: #c24135;
  --danger-soft: #fff1ef;
  --shadow-soft: 0 18px 50px rgba(18, 23, 34, 0.08);
  --shadow-panel: 0 24px 80px rgba(18, 23, 34, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 340px),
    linear-gradient(90deg, rgba(49, 87, 213, 0.07), rgba(15, 118, 110, 0.06) 42%, rgba(179, 107, 0, 0.05)),
    repeating-linear-gradient(90deg, rgba(18, 23, 34, 0.035) 0 1px, transparent 1px 72px),
    var(--page);
}

body.settings-open {
  overflow: hidden;
}

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

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 680;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

button:hover {
  border-color: #aab7c5;
  background: #fbfcfd;
  box-shadow: 0 8px 20px rgba(18, 23, 34, 0.06);
}

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

button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, #119985, var(--teal-deep));
  color: #ffffff;
  box-shadow: 0 18px 34px rgba(15, 118, 110, 0.28);
}

button.primary:hover {
  background: linear-gradient(135deg, #12a690, #083f3d);
}

button.danger {
  border-color: #ffc8c1;
  color: var(--danger);
  background: var(--danger-soft);
}

button.ghost {
  background: rgba(255, 255, 255, 0.72);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(49, 87, 213, 0.24);
  outline-offset: 2px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fbfcfd;
  color: var(--ink);
}

input::placeholder,
textarea::placeholder {
  color: #9aa5ae;
}

textarea {
  min-height: clamp(420px, 50vh, 680px);
  border: 0;
  border-radius: 0;
  padding: 22px 24px 26px;
  background: transparent;
  resize: vertical;
  font-size: 18px;
  line-height: 1.78;
  scroll-margin-top: 88px;
}

textarea:focus-visible {
  outline: none;
}

label {
  display: grid;
  gap: 7px;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid rgba(219, 226, 234, 0.76);
  background: rgba(247, 249, 251, 0.82);
  backdrop-filter: blur(18px);
}

.topbar span,
.muted {
  color: var(--muted);
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-lockup > span:last-child {
  display: grid;
  gap: 1px;
}

.brand-lockup strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.brand-lockup span span {
  font-size: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #121722 0 48%, transparent 48%),
    linear-gradient(135deg, var(--teal) 48%, var(--blue));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), 0 12px 24px rgba(18, 23, 34, 0.16);
}

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

.user-chip {
  max-width: 180px;
  overflow: hidden;
  border: 1px solid rgba(185, 196, 208, 0.7);
  border-radius: 999px;
  padding: 8px 11px;
  background: rgba(255, 255, 255, 0.66);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 22px;
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 22px clamp(16px, 3vw, 34px) 34px;
}

.workspace {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.workspace-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding: 22px 24px;
  border: 1px solid rgba(219, 226, 234, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
}

.eyebrow,
.console-label {
  margin: 0 0 6px;
  color: var(--teal-deep);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workspace-hero h1 {
  max-width: 760px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.04;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 560px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.session-state {
  display: flex;
  justify-content: flex-end;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  max-width: min(520px, 42vw);
  overflow-wrap: anywhere;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  padding: 7px 13px;
  background: var(--teal-soft);
  color: var(--teal-deep);
  font-weight: 760;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status.is-recording {
  border-color: #ffc8c1;
  background: var(--danger-soft);
  color: var(--danger);
}

.status.is-busy {
  border-color: #f6dda5;
  background: #fff8e9;
  color: var(--amber);
}

.status.is-error {
  border-color: #ffc8c1;
  background: var(--danger-soft);
  color: var(--danger);
}

.capture-console {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 380px) minmax(180px, 230px);
  gap: 18px;
  align-items: center;
  overflow: hidden;
  padding: 18px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(120deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 18px),
    #111827;
  color: #ffffff;
  box-shadow: var(--shadow-panel);
}

.capture-main {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.capture-main h2 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.08;
}

.capture-main p:not(.console-label) {
  max-width: 420px;
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.68);
}

.console-label {
  color: #88e1d1;
}

.capture-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 86px;
  height: 86px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 46%, rgba(21, 184, 153, 0.36), transparent 54%),
    rgba(255, 255, 255, 0.06);
}

.capture-visual span {
  width: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #d6fff6, #16a085);
}

.capture-visual span:nth-child(1) {
  height: 24px;
}

.capture-visual span:nth-child(2) {
  height: 42px;
}

.capture-visual span:nth-child(3) {
  height: 58px;
}

.capture-visual span:nth-child(4) {
  height: 34px;
}

.capture-visual span:nth-child(5) {
  height: 46px;
}

.recording-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin: 0;
}

.capture-console .field-inline {
  flex: 1 1 210px;
}

.field-inline span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.capture-console .field-inline span {
  color: rgba(255, 255, 255, 0.68);
}

.capture-console select,
.capture-console .compact-btn {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.capture-console select option {
  color: var(--ink);
}

.compact-btn {
  flex: 0 0 auto;
  min-width: 74px;
}

.record-action {
  min-height: 66px;
  font-size: 18px;
  font-weight: 820;
}

.record-action.is-recording {
  background: linear-gradient(135deg, #ef6a5d, #a9271d);
  box-shadow: 0 18px 34px rgba(194, 65, 53, 0.28);
}

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

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 92px;
  border: 1px solid rgba(219, 226, 234, 0.86);
  border-radius: 8px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 26px rgba(18, 23, 34, 0.05);
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--blue), var(--amber));
  opacity: 0.72;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  color: #2b3835;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1;
}

.editor-shell {
  overflow: hidden;
  border: 1px solid rgba(219, 226, 234, 0.9);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.08) 0 3px, transparent 3px),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

.editor-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.06), transparent 42%),
    #ffffff;
}

.editor-topline h2,
.side-intro h2,
.section-title h2,
h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

.editor-topline h2 {
  font-size: 22px;
}

.editor-hint {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-secondary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.activity-rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.activity-card,
.admin-layout section,
.auth-panel {
  border: 1px solid rgba(219, 226, 234, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 14px 38px rgba(18, 23, 34, 0.06);
}

.activity-card,
.admin-layout section,
.auth-panel {
  padding: 16px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h2 {
  font-size: 17px;
}

.section-title span {
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.history-panel {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  justify-content: flex-end;
  background: rgba(18, 23, 34, 0.36);
  backdrop-filter: blur(8px);
}

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

.settings-panel {
  width: min(520px, 100%);
  height: 100%;
  overflow: auto;
  border-left: 1px solid rgba(219, 226, 234, 0.86);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 249, 251, 0.98)),
    var(--surface);
  box-shadow: -28px 0 80px rgba(18, 23, 34, 0.2);
}

.settings-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.settings-head h2 {
  margin: 0;
  font-size: 28px;
}

.settings-head p:not(.eyebrow) {
  margin: 8px 0 0;
  color: var(--muted);
}

.settings-section {
  margin: 16px;
  border: 1px solid rgba(219, 226, 234, 0.9);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(18, 23, 34, 0.05);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.compact {
  gap: 9px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.item {
  border: 1px solid #e5ebf0;
  border-radius: 8px;
  padding: 11px;
  background: #fbfcfd;
  word-break: break-word;
}

.item button {
  margin-top: 8px;
  padding: 7px 10px;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: #fbfcfd;
  font-size: 14px;
}

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

.auth-panel {
  width: min(420px, 100%);
  background: var(--surface);
}

.auth-panel h1 {
  margin: 0 0 16px;
}

.admin-layout {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.row-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.row-form button {
  flex: 0 0 auto;
}

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

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .activity-rail {
    display: block;
  }

  .history-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 820px) {
  body {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0) 300px),
      var(--page);
  }

  .layout {
    gap: 14px;
    padding: 14px 12px 28px;
  }

  .workspace-hero {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .workspace-hero h1 {
    font-size: 34px;
  }

  .session-state {
    justify-content: flex-start;
  }

  .status {
    max-width: 100%;
  }

  .capture-console {
    grid-template-columns: 1fr;
  }

  .capture-main {
    align-items: flex-start;
  }

  .capture-visual {
    width: 72px;
    height: 72px;
  }

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

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

  .activity-rail {
    display: block;
  }

  textarea {
    min-height: 42vh;
    padding: 18px;
    font-size: 16px;
  }
}

@media (max-width: 520px) {
  button,
  input,
  select {
    min-height: 46px;
  }

  .topbar {
    padding: 10px 12px;
  }

  .brand-lockup {
    gap: 9px;
  }

  .brand-lockup span span {
    display: none;
  }

  .user-chip {
    display: none;
  }

  .topbar .ghost {
    padding-inline: 10px;
  }

  #openSettingsBtn {
    padding-inline: 10px;
  }

  .workspace-hero h1 {
    font-size: 30px;
  }

  .hero-copy {
    font-size: 15px;
  }

  .capture-main {
    display: grid;
  }

  .recording-options {
    display: grid;
  }

  .compact-btn,
  .record-action {
    width: 100%;
  }

  .toolbar-secondary {
    grid-template-columns: 1fr;
  }

  .editor-topline {
    display: grid;
    min-height: 0;
  }

  .settings-head {
    padding: 18px 16px;
  }

  .settings-section {
    margin: 12px;
  }
}
