:root {
  color-scheme: dark;
  --bg: #070707;
  --surface: #111113;
  --surface-2: #19191c;
  --surface-3: #0c0c0d;
  --text: #f7f4ec;
  --muted: #b8b3a8;
  --line: #2c2b27;
  --gold: #c8a45d;
  --gold-2: #e3c983;
  --danger: #ff8f8f;
  --ok: #9ee6b8;
  --info: #9dc7ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #22201a 0, var(--bg) 42rem);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a { color: var(--gold-2); }

[hidden] { display: none !important; }

body:not(.password-mode) #password-panel {
  display: none !important;
}

body.password-mode #login-panel {
  display: none !important;
}

.app-shell {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 86px 0 34px;
}

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, #070707 94%, transparent);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  width: min(1240px, calc(100% - 28px));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 900;
}

.brand-logo {
  display: block;
  width: 46px;
  height: auto;
  max-height: 46px;
  object-fit: contain;
}

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

.topbar-actions a,
.topbar-actions button,
.nav-pill {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 12px;
  text-decoration: none;
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.panel,
.card,
.auth-panel,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.auth-panel {
  max-width: 520px;
  margin: 24px auto;
  padding: 24px;
}

.welcome-screen {
  max-width: 520px;
  margin: 42px auto;
  padding: 34px 24px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.welcome-logo {
  width: 128px;
  max-width: 60%;
  height: auto;
  margin-bottom: 20px;
}

.loading-copy {
  margin: 0;
  color: var(--gold-2);
  font-weight: 850;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold-2);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.03;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.22rem;
}

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

.muted {
  color: var(--muted);
  line-height: 1.55;
}

form,
.form-grid,
.stack {
  display: grid;
  gap: 12px;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

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

button,
.primary-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #111;
  padding: 10px 14px;
  font: inherit;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

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

.secondary {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.danger {
  border: 1px solid color-mix(in srgb, var(--danger) 65%, var(--line));
  background: color-mix(in srgb, var(--danger) 14%, var(--surface-2));
  color: var(--text);
}

.message {
  min-height: 1.35em;
  color: var(--danger);
}

.message.success { color: var(--ok); }

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

.action-card {
  min-height: 132px;
  display: grid;
  align-content: space-between;
  gap: 16px;
  padding: 18px;
  color: var(--text);
  text-decoration: none;
}

.action-card strong {
  display: block;
  font-size: 1.35rem;
}

.action-card span {
  color: var(--muted);
  line-height: 1.45;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 390px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.list-panel,
.detail-panel,
.panel {
  padding: 16px;
}

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

.item-card {
  width: 100%;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  padding: 13px;
  text-align: left;
}

.item-card.active {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 44%, transparent);
}

.meta,
.badges,
.actions,
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 0.8rem;
}

.badge.ok { color: var(--ok); }
.badge.info { color: var(--info); }
.badge.danger { color: var(--danger); }

.tabs {
  margin: 0 0 14px;
}

.tabs button {
  min-height: 40px;
}

.tabs button.active {
  border-color: var(--gold);
  color: var(--gold-2);
}

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

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

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

.settings-list-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.settings-list {
  display: grid;
  gap: 12px;
}

.settings-row-static,
.mini-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 14px;
}

.settings-row-static {
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: start;
}

.row-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--gold) 24%, var(--surface-3));
  color: var(--gold-2);
  font-weight: 950;
}

.compact-list {
  margin-top: 8px;
}

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

.quick-chips button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  padding: 7px 10px;
  font-size: 0.84rem;
}

.prep-panel {
  max-width: 720px;
  margin: 28px auto;
  padding: 22px;
}

.prep-panel .primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
}

.empty {
  color: var(--muted);
  padding: 14px 0;
}

.check-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: start;
  gap: 10px;
}

.check-row input {
  min-height: auto;
  margin-top: 3px;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 82px;
  }

  .topbar-inner {
    width: min(100% - 20px, 1240px);
  }

  .brand span:last-child {
    display: none;
  }

  .page-head,
  .workspace,
  .split,
  .three,
  .dashboard-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar-actions {
    max-width: calc(100vw - 76px);
  }
}
