:root {
  /* Surfaces */
  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-2: #f4f2ee;
  --sidebar-bg: #f6f4f0;

  /* Borders */
  --border: #e8e4dc;
  --border-soft: #f0ede6;
  --border-strong: #d9d3c7;

  /* Text */
  --text: #201d19;
  --text-muted: #746e63;
  --text-faint: #a49d8f;

  /* Ink (near-black, for primary actions / strong emphasis) */
  --ink: #1c1a16;
  --ink-hover: #000000;

  /* Accent (muted indigo) */
  --accent: #5b56d6;
  --accent-hover: #4844b8;
  --accent-soft: #efeefb;
  --accent-soft-strong: #e1dff8;

  /* Status */
  --success: #3d8b68;
  --success-bg: #e8f3ec;
  --warning: #b0782c;
  --warning-bg: #f9f0df;
  --danger: #b8544a;
  --danger-bg: #fbebe8;
  --rust: #ab5d2c;
  --rust-bg: #f8ecdf;

  /* Radii */
  --radius-lg: 16px;
  --radius: 10px;
  --radius-sm: 7px;

  /* Shadows (warm-tinted, quiet) */
  --shadow-xs: 0 1px 2px rgba(32, 27, 18, 0.04);
  --shadow-sm: 0 1px 3px rgba(32, 27, 18, 0.05), 0 4px 12px rgba(32, 27, 18, 0.04);
  --shadow-md: 0 8px 24px rgba(32, 27, 18, 0.08), 0 2px 6px rgba(32, 27, 18, 0.05);
  --shadow-lg: 0 28px 64px rgba(32, 27, 18, 0.18), 0 8px 20px rgba(32, 27, 18, 0.08);

  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.01em; font-weight: 650; }

a { color: var(--accent); }

/* ---------- Layout ---------- */

.app-layout { display: flex; min-height: 100vh; align-items: stretch; }
#app-shell.hidden { display: none; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 20px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-text { min-width: 0; }
.brand-name { font-size: 13.5px; font-weight: 650; line-height: 1.25; }
.brand-tagline { font-size: 11px; color: var(--text-faint); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.view-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.view-nav-btn .nav-icon { width: 17px; height: 17px; flex: 0 0 17px; opacity: 0.8; }
.view-nav-btn:hover { background: var(--surface-2); color: var(--text); }
.view-nav-btn.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 600;
}
.view-nav-btn.active .nav-icon { opacity: 1; }

.sidebar-footer { border-top: 1px solid var(--border-soft); margin-top: 10px; padding-top: 10px; }

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
}
.sidebar-logout .nav-icon { width: 17px; height: 17px; flex: 0 0 17px; opacity: 0.75; }
.sidebar-logout:hover { background: var(--surface-2); color: var(--text); }
.sidebar-logout.hidden { display: none; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
  gap: 16px;
  flex-wrap: wrap;
}

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

.field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-faint);
}

main { padding: 22px 28px 60px; max-width: 1500px; margin: 0 auto; width: 100%; }

.view.hidden { display: none; }

/* ---------- Form controls ---------- */

select, input, textarea, button {
  font-family: inherit;
  font-size: 13.5px;
}

select, input[type="text"], input[type="search"], input[type="password"], input[type="date"], textarea {
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s;
}

select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea { resize: vertical; }

::placeholder { color: var(--text-faint); }

/* ---------- Buttons ---------- */

.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.12s, border-color 0.12s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-hover); }

.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--text-faint); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---------- Summary stat cards ---------- */

.summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  min-width: 112px;
  box-shadow: var(--shadow-xs);
}

.stat-card .stat-count { font-size: 23px; font-weight: 650; letter-spacing: -0.01em; }
.stat-card .stat-label { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

/* ---------- Toolbar ---------- */

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

#search-input, #risk-search-input, #issue-search-input, #action-item-search-input, #decision-search-input, #governance-search-input {
  flex: 1;
  min-width: 220px;
}

/* ---------- Kanban board ---------- */

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 264px;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: start;
}

.column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 220px);
  box-shadow: var(--shadow-xs);
}

.column-header {
  padding: 11px 13px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 650;
  font-size: 12.5px;
  position: sticky;
  top: 0;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  border-top: 2.5px solid transparent;
}

.column-count {
  background: var(--surface-2);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.column-body {
  padding: 9px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}

.column-empty {
  color: var(--text-faint);
  font-size: 12px;
  padding: 8px 4px;
}

.req-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
}

.req-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.req-card .req-key {
  font-size: 10.5px;
  color: var(--text-faint);
  font-weight: 650;
  letter-spacing: 0.03em;
}

.req-card .req-title {
  font-size: 13px;
  font-weight: 600;
  margin: 4px 0 7px;
  line-height: 1.35;
}

.req-card .req-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Column accent colors (subtle top border) */
.column[data-status="Draft"] .column-header { border-top-color: #a39d91; }
.column[data-status="Under Review"] .column-header { border-top-color: var(--warning); }
.column[data-status="Approved"] .column-header { border-top-color: var(--accent); }
.column[data-status="In Development"] .column-header { border-top-color: #7b5cd6; }
.column[data-status="In Testing"] .column-header { border-top-color: #2e93a6; }
.column[data-status="On Hold"] .column-header { border-top-color: var(--rust); }
.column[data-status="Done"] .column-header { border-top-color: var(--success); }
.column[data-status="Rejected"] .column-header { border-top-color: var(--danger); }

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 650;
  padding: 2.5px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-priority-Low { background: var(--success-bg); color: var(--success); }
.badge-priority-Medium { background: var(--warning-bg); color: var(--warning); }
.badge-priority-High { background: var(--rust-bg); color: var(--rust); }
.badge-priority-Critical { background: var(--danger-bg); color: var(--danger); }

.badge-type { background: var(--accent-soft); color: var(--accent-hover); }

.badge-status { background: var(--surface-2); color: var(--text-muted); }

.badge-role { background: var(--accent-soft); color: var(--accent-hover); }

.badge-overdue { background: var(--danger-bg); color: var(--danger); }

.badge-outcome-Approved { background: var(--success-bg); color: var(--success); }
.badge-outcome-Rejected { background: var(--danger-bg); color: var(--danger); }
.badge-outcome-Deferred, .badge-outcome-Conditional { background: var(--warning-bg); color: var(--warning); }

.plan-badge-free { background: var(--surface-2); color: var(--text-muted); }
.plan-badge-pro { background: var(--success-bg); color: var(--success); }

/* ---------- Billing ---------- */

.billing-plan-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }

.usage-row { margin-bottom: 14px; }
.usage-row-label { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }

.usage-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.usage-bar-fill.at-limit { background: var(--danger); }

/* ---------- Modals ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 20, 14, 0.42);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
  overflow-y: auto;
  z-index: 100;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  width: 100%;
  max-width: 640px;
  position: relative;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-soft);
}

.modal-wide { max-width: 760px; }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-faint);
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }

.modal h2 { font-size: 17px; }
.modal-subheading { font-size: 12.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); margin: 0; }

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: 13px; margin-top: 16px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.form-row { display: flex; gap: 13px; }
.form-row label { flex: 1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- Detail modal ---------- */

.req-detail-header { padding-right: 24px; }
.req-detail-header .req-key { color: var(--text-faint); font-size: 12px; font-weight: 650; letter-spacing: 0.02em; }
.req-detail-header h2 { margin: 5px 0 10px; font-size: 19px; }

.detail-badges { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }

.detail-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-soft);
  margin-top: 18px;
  overflow-x: auto;
}

.detail-tab {
  background: none;
  border: none;
  padding: 9px 12px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  margin-bottom: -1px;
  transition: color 0.12s;
}
.detail-tab:hover { color: var(--text); }
.detail-tab.active { color: var(--accent-hover); border-bottom-color: var(--accent); }
.detail-tab .tab-count { color: var(--text-faint); font-weight: 500; margin-left: 2px; }
.detail-tab.active .tab-count { color: var(--accent-hover); }

.tab-panel { padding-top: 18px; }
.tab-panel.hidden { display: none; }

.link-entity-type { background: var(--surface-2); color: var(--text-muted); }

.transition-buttons { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.transition-option { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }

.transition-buttons button {
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--accent-hover);
  border-radius: var(--radius-sm);
  padding: 6.5px 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.12s;
}
.transition-buttons button:hover { background: var(--accent-soft); }
.transition-buttons button.danger { border-color: var(--danger); color: var(--danger); }
.transition-buttons button.danger:hover { background: var(--danger-bg); }
.transition-buttons button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  background: var(--surface-2);
}
.transition-buttons button:disabled:hover { background: var(--surface-2); }

.role-note { font-size: 10.5px; color: var(--text-faint); padding-left: 2px; }

.history-list, .comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }

.history-item, .comment-item {
  border-left: 2px solid var(--border);
  padding-left: 11px;
  font-size: 13px;
}

.history-item .h-line { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.history-item .h-time, .comment-item .c-time { color: var(--text-faint); font-size: 11.5px; }
.history-item .h-note, .comment-item .c-body { margin-top: 3px; color: var(--text); }

.comment-form { display: flex; gap: 8px; margin-top: 12px; }
.comment-form textarea { flex: 1; }

.link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }

.link-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  border-left: 2px solid var(--border);
  padding-left: 11px;
}

.link-type-badge { background: var(--rust-bg); color: var(--rust); }

.link-target { color: var(--accent-hover); text-decoration: none; font-weight: 600; }
.link-target:hover { text-decoration: underline; }

.link-remove {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
}
.link-remove:hover { color: var(--danger); }

.team-role-select { margin-left: auto; padding: 3px 7px; font-size: 12px; width: auto; }

.link-form { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.link-form select { flex: 0 0 auto; }
.link-form input { flex: 1; min-width: 200px; }

.link-count-badge {
  margin-left: 6px;
  font-weight: 650;
  color: var(--text-faint);
  font-size: 10px;
}

.editable-fields { display: flex; flex-direction: column; gap: 11px; }
.editable-fields textarea { width: 100%; }
.editable-fields .form-row { gap: 11px; }

.muted { color: var(--text-muted); font-size: 13px; }

/* ---------- Data tables ---------- */

.data-table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 11px 15px; text-align: left; white-space: nowrap; }
.data-table th {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 650;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr { border-bottom: 1px solid var(--border-soft); cursor: pointer; transition: background 0.1s; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table td.cell-title { white-space: normal; font-weight: 600; }
.data-table-wrap .cell-empty { padding: 28px 14px; text-align: center; }

/* ---------- Traceability matrix ---------- */

.matrix-cell { display: flex; flex-wrap: wrap; gap: 5px; max-width: 220px; white-space: normal; }
.matrix-chip {
  display: inline-block;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 2.5px 9px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.matrix-chip:hover { background: var(--accent-soft); border-color: var(--accent-soft-strong); color: var(--accent-hover); }
.matrix-cell-empty { color: var(--text-faint); font-size: 12.5px; }

/* ---------- Dashboard ---------- */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.dashboard-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.dashboard-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.dashboard-panel-header h3 { font-size: 13.5px; font-weight: 650; }

.dashboard-panel-link {
  background: none;
  border: none;
  color: var(--accent-hover);
  font-size: 11.5px;
  font-weight: 650;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}
.dashboard-panel-link:hover { text-decoration: underline; }

.dashboard-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }

.dashboard-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  border-left: 2px solid var(--border);
  padding-left: 11px;
  cursor: pointer;
  transition: border-color 0.12s;
}
.dashboard-list-item:hover { border-left-color: var(--accent); }

.dashboard-list-item .item-title { flex: 1; min-width: 0; }

.dashboard-panel-empty { color: var(--text-faint); font-size: 12.5px; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 200;
}
.toast.hidden { display: none; }
.toast.error { background: var(--danger); }

/* ---------- Analytics ---------- */

.analytics-chart { display: flex; flex-direction: column; gap: 11px; margin-top: 18px; }

.analytics-row {
  display: grid;
  grid-template-columns: 130px 1fr 140px;
  align-items: center;
  gap: 12px;
}

.analytics-label { font-size: 12.5px; font-weight: 600; }

.analytics-bar-track {
  background: var(--surface-2);
  border-radius: 999px;
  height: 14px;
  overflow: hidden;
}

.analytics-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.analytics-value { font-size: 12.5px; text-align: right; white-space: nowrap; color: var(--text-muted); }

.analytics-leadtime {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}

.analytics-leadtime h3 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin-bottom: 6px;
  font-weight: 650;
}

.analytics-leadtime p { font-size: 14px; margin: 0; }

/* ---------- Auth screen ---------- */

.landing.hidden { display: none; }
.landing { min-height: 100vh; }

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  max-width: 1080px;
  margin: 0 auto;
}
.landing-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
}
.landing-nav-actions { display: flex; gap: 10px; }

.landing-hero {
  max-width: 720px;
  margin: 0 auto;
  padding: 72px 32px 56px;
  text-align: center;
}
.landing-eyebrow {
  display: inline-block;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.landing-hero h1 {
  font-size: 34px;
  line-height: 1.25;
  margin: 20px 0 16px;
  letter-spacing: -0.01em;
}
.landing-subhead {
  color: var(--text-muted);
  font-size: 15.5px;
  line-height: 1.6;
  max-width: 560px;
  margin: 0 auto;
}
.landing-hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 28px;
  flex-wrap: wrap;
}
.btn-lg { padding: 11px 22px; font-size: 14px; }

.landing-shot {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 32px 56px;
}
.browser-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.browser-frame-bar {
  display: flex;
  gap: 6px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.browser-frame-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-strong);
}
.browser-frame img { display: block; width: 100%; height: auto; }

.landing-gallery {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 32px 64px;
}
.landing-gallery h2 {
  text-align: center;
  font-size: 22px;
  margin: 0 0 28px;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.gallery-item {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.gallery-item img {
  display: block;
  width: 100%;
  height: 170px;
  object-fit: cover;
  object-position: top;
  border-bottom: 1px solid var(--border-soft);
}
.gallery-item figcaption {
  padding: 12px 16px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.landing-features {
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 32px 72px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: var(--shadow-xs);
}
.feature-card h3 { font-size: 14.5px; margin: 0 0 8px; }
.feature-card p { color: var(--text-muted); font-size: 13px; line-height: 1.55; margin: 0; }

.landing-footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 32px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-faint);
  font-size: 12.5px;
  border-top: 1px solid var(--border-soft);
}
.landing-footer .link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

@media (max-width: 720px) {
  .landing-features { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: 1fr; }
  .landing-hero h1 { font-size: 27px; }
  .landing-hero { padding: 48px 24px 40px; }
}

.auth-back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 14px;
}
.auth-back-btn:hover { color: var(--text); }

.auth-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 300;
}
.auth-screen.hidden { display: none; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 34px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
  text-align: center;
}
.auth-card h1 { font-size: 19px; }
.auth-card .tagline { display: block; color: var(--text-faint); font-size: 12.5px; margin-top: 5px; }

.auth-tabs { display: flex; gap: 6px; margin: 22px 0 4px; background: var(--surface-2); padding: 3px; border-radius: var(--radius-sm); }
.auth-tabs.hidden { display: none; }
.auth-tab {
  flex: 1;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 7px;
  font-weight: 600;
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s;
}
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

.auth-card .form { text-align: left; }
.auth-card .form.hidden { display: none; }
.auth-card .form-actions { justify-content: stretch; }
.auth-card .form-actions button { width: 100%; }

.auth-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 12px;
}
.auth-error.hidden { display: none; }

.auth-link-btn {
  display: block;
  margin: 12px auto 0;
  background: none;
  border: none;
  font-family: inherit;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.auth-link-btn:hover { color: var(--accent-hover); text-decoration: underline; }

.auth-hint-box {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.auth-hint-box.hidden { display: none; }

.auth-hint { margin-top: 20px; font-size: 11px; line-height: 1.6; color: var(--text-faint); }
.auth-hint code { background: var(--surface-2); padding: 1.5px 5px; border-radius: 4px; color: var(--text-muted); }
.auth-hint.hidden { display: none; }

/* ---------- Responsive ---------- */

@media (max-width: 880px) {
  .app-layout { flex-direction: column; }
  .sidebar {
    width: auto;
    flex: none;
    flex-direction: row;
    align-items: center;
    padding: 10px 14px;
    overflow-x: auto;
  }
  .sidebar-brand { padding: 0 12px 0 0; flex: 0 0 auto; }
  .sidebar-nav { flex-direction: row; flex: 1; }
  .view-nav-btn span { display: none; }
  .view-nav-btn { padding: 8px; }
  .sidebar-footer { border-top: none; margin: 0; padding: 0; }
  .sidebar-logout span { display: none; }
  main { padding: 18px 16px 48px; }
  .topbar { padding: 12px 16px; }
}
