/* ── Parable Brand Fonts ─────────────────────────────────────────────────── */

@font-face {
  font-family: "Reckless Wide";
  src: url("https://framerusercontent.com/assets/iuiBuIWapEJ0UxI31omcQ68aEwM.woff2") format("woff2");
  font-display: swap;
  font-weight: 400;
}
@font-face {
  font-family: "Uncut Sans";
  src: url("https://framerusercontent.com/assets/JjC6PhyT2D5B7FNY4YDWYTWZ4.woff2") format("woff2");
  font-display: swap;
  font-weight: 400;
}
@font-face {
  font-family: "Uncut Sans";
  src: url("https://framerusercontent.com/assets/9nA4Je6ZiHuqldqIeVLgDOpns.woff2") format("woff2");
  font-display: swap;
  font-weight: 700;
}

/* ── Brand Tokens ────────────────────────────────────────────────────────── */

:root {
  --brand-orange:       #FF853F;
  --brand-orange-light: rgba(255, 133, 63, 0.12);
  --brand-dark:         #2A3132;
  --brand-dark-hover:   #3c3d3f;
  --brand-white:        #ffffff;

  --text-primary:     #ffffff;
  --text-secondary:   rgba(255, 255, 255, 0.5);
  --text-muted:       rgba(255, 255, 255, 0.28);

  --surface:          #3a3b3d;
  --surface-muted:    #414244;
  --surface-raised:   #46474a;
  --border:           rgba(255, 255, 255, 0.08);
  --bg:               #313234;

  --font-display: "Reckless Wide", "Reckless Wide M-TRIAL Regular Placeholder", serif;
  --font-body:    "Uncut Sans", "Uncut Sans Regular Placeholder", system-ui, sans-serif;

  --radius:    8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: #272727;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: var(--brand-white);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 24px;
  z-index: 100;
}

#header .brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: .3px;
  color: var(--brand-white);
}

#header .spacer { flex: 1; }

#header nav button {
  background: none;
  border: none;
  color: rgba(255,255,255,.55);
  cursor: pointer;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-body);
  transition: background .15s, color .15s;
}
#header nav button:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.85); }
#header nav button.active { background: rgba(255,255,255,.12); color: var(--brand-white); }

#header .user-area { display: flex; align-items: center; gap: 14px; color: rgba(255,255,255,.5); font-size: 13px; margin-left: auto; }
#header .user-area button {
  background: none;
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.6);
  cursor: pointer;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-body);
  transition: border-color .15s, color .15s;
}
#header .user-area button:hover { border-color: rgba(255,255,255,.5); color: var(--brand-white); }

/* ── Two-column layout ───────────────────────────────────────────────────── */

#layout {
  display: flex;
  height: calc(100vh - 52px);
  margin-top: 52px;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

#sidebar {
  width: 240px;
  min-width: 240px;
  background: #272727;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
}

.sidebar-new-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color .15s;
}
.sidebar-new-btn:hover { color: var(--brand-orange); }

.sidebar-search-wrap {
  padding: 0 10px 10px;
}
.sidebar-search-wrap input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font-body);
  color: #fff;
  outline: none;
}
.sidebar-search-wrap input::placeholder { color: rgba(255,255,255,0.25); }
.sidebar-search-wrap input:focus { border-color: rgba(255,255,255,0.2); }

#sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 16px;
}

.sidebar-item {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s;
  margin-bottom: 2px;
}
.sidebar-item:hover { background: rgba(255,255,255,0.06); }
.sidebar-item.active { background: rgba(255, 164, 165, 0.1); }
.sidebar-item.active .sidebar-item-name { color: var(--brand-orange); }
.sidebar-item-name { font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.85); }
.sidebar-item-sub  { font-size: 11px; color: rgba(255,255,255,0.3); margin-top: 2px; }
.sidebar-item-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 6px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.4);
  vertical-align: middle;
}

/* ── Main content ────────────────────────────────────────────────────────── */

#main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
}

/* ── Welcome / empty state ───────────────────────────────────────────────── */

.welcome-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  gap: 12px;
  color: rgba(255,255,255,0.2);
}
.welcome-icon { font-size: 32px; }
.welcome-text { font-size: 14px; }

/* ── Sidebar mode toggle ─────────────────────────────────────────────────── */

.sidebar-mode-bar {
  display: flex;
  padding: 10px 8px 4px;
  gap: 4px;
}
.sidebar-mode-btn {
  flex: 1;
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  padding: 6px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.sidebar-mode-btn:hover { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.65); }
.sidebar-mode-btn.active { background: rgba(255,164,165,0.1); color: var(--brand-orange); font-weight: 600; }

/* ── Sidebar footer ───────────────────────────────────────────────────────── */

.sidebar-footer { padding: 0 8px 12px; }
.sidebar-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 4px 0 8px; }
.sidebar-add-btn {
  width: 100%;
  background: none;
  border: 1px dashed rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.35);
  font-size: 12px;
  font-family: var(--font-body);
  padding: 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.sidebar-add-btn:hover { border-color: var(--brand-orange); color: var(--brand-orange); }

/* ── Expandable cards ────────────────────────────────────────────────────── */

.card.expandable { flex-direction: column; align-items: stretch; cursor: pointer; }
.card-top { display: flex; align-items: center; gap: 14px; width: 100%; }
.card-expand-icon {
  color: rgba(255,255,255,0.18);
  font-size: 10px;
  flex-shrink: 0;
  transition: transform .18s;
}
.card.expanded .card-expand-icon { transform: rotate(90deg); }
.card-detail {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.df-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: rgba(255,255,255,0.22);
  margin-bottom: 3px;
}
.df-val { font-size: 12px; color: rgba(255,255,255,0.6); word-break: break-all; }

/* Preset step summary inside card-detail */
.step-summary { display: flex; flex-direction: column; gap: 7px; }
.step-summary-row { display: flex; align-items: center; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.step-type-pill {
  background: rgba(255,164,165,0.1);
  color: var(--brand-orange);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  text-transform: capitalize;
}
.step-delay { color: rgba(255,255,255,0.3); font-size: 11px; }
.step-template { color: rgba(255,255,255,0.4); font-style: italic; font-size: 11px; }

/* ── List toolbar (action button + search in one row) ────────────────────── */

.list-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.list-toolbar .spacer { flex: 1; }
.toolbar-search {
  position: relative;
}
.toolbar-search::before {
  content: "⌕";
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.25);
  font-size: 14px;
  pointer-events: none;
}
.toolbar-search input {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 6px 10px 6px 28px;
  font-size: 12px;
  font-family: var(--font-body);
  color: #fff;
  outline: none;
  width: 200px;
  transition: border-color .15s;
}
.toolbar-search input:focus { border-color: rgba(255,255,255,0.25); }
.toolbar-search input::placeholder { color: rgba(255,255,255,0.25); }

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */

#breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  font-size: 13px;
  color: var(--text-secondary);
}
#breadcrumb span { cursor: pointer; color: rgba(255,255,255,0.4); }
#breadcrumb span:hover { color: rgba(255,255,255,0.85); text-decoration: underline; }
#breadcrumb .sep { color: rgba(255,255,255,0.15); }
#breadcrumb .current { color: rgba(255,255,255,0.85); font-weight: 500; cursor: default; }

/* ── Page title ──────────────────────────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card-list { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover {
  border-color: var(--brand-orange);
  box-shadow: 0 2px 10px rgba(255, 164, 165, .12);
}
.card .card-main { flex: 1; }
.card .card-title { font-weight: 500; font-size: 14px; color: var(--text-primary); }
.card .card-sub   { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.card .card-actions { display: flex; gap: 6px; align-items: center; }

/* ── Badges ──────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
.badge-green  { background: rgba(74, 222, 128, 0.12); color: #86efac; }
.badge-gray   { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.5); }
.badge-yellow { background: rgba(251, 191, 36, 0.12); color: #fcd34d; }
.badge-blue   { background: var(--brand-orange-light); color: var(--brand-orange); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  transition: opacity .15s, background .15s;
  white-space: nowrap;
}
.btn:hover   { opacity: .88; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary { background: var(--brand-orange); color: #313131; font-weight: 600; }
.btn-primary:hover { opacity: 1; background: #ffb5b6; }

.btn-danger  { background: #e53935; color: #fff; }

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
}
.btn-ghost:hover { background: rgba(255,255,255,0.06); opacity: 1; border-color: rgba(255,255,255,0.25); }

.btn-sm { padding: 4px 11px; font-size: 12px; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tab-btn.active { color: #ffffff; border-bottom-color: var(--brand-orange); }
.tab-btn:hover:not(.active) { color: var(--text-primary); }

/* ── Forms ───────────────────────────────────────────────────────────────── */

.form-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
}
.form-panel h3 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}
.form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.form-group { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 160px; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.form-group input,
.form-group select,
.form-group textarea {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font-body);
  outline: none;
  width: 100%;
  color: #ffffff;
  background: var(--surface-raised);
  transition: border-color .15s;
}
.form-group select option { background: #3a3a3a; color: #ffffff; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--brand-orange); }
.form-actions { display: flex; gap: 8px; margin-top: 6px; }

/* ── Step builder ────────────────────────────────────────────────────────── */

.step-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.step-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--surface-raised);
}
.step-item-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.step-num {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--brand-orange);
}

/* ── Health panel ────────────────────────────────────────────────────────── */

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.health-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.health-card .h-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.health-card .h-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
}
.health-card .h-sub { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }

/* ── Health metric drill-down ────────────────────────────────────────────── */
.metric-clickable { cursor: pointer; transition: border-color .15s, background .15s; }
.metric-clickable:hover { border-color: var(--brand-orange); background: var(--surface-muted); }
.metric-panel {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.metric-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.metric-panel-head h3 { font-size: 15px; color: var(--text-primary); }
.resp-count { color: var(--text-secondary); font-size: 13px; font-weight: 400; margin-left: 6px; }
.metric-body { display: flex; gap: 22px; align-items: flex-start; }
.metric-chart { flex: 1 1 40%; min-width: 220px; }
.metric-list  { flex: 1 1 55%; display: flex; flex-direction: column; gap: 16px; }
.resp-section-label {
  font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  color: var(--text-secondary); margin-bottom: 8px;
}
@media (max-width: 760px) { .metric-body { flex-direction: column; } }

/* ── Preset flag checkbox ────────────────────────────────────────────────── */
.preset-flag {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 13px; color: var(--text-primary);
  margin-bottom: 16px; cursor: pointer;
}
.preset-flag input { margin-top: 2px; }
.preset-flag-hint { color: var(--text-secondary); }

/* ── Empty state ─────────────────────────────────────────────────────────── */

.empty {
  text-align: center;
  padding: 52px 24px;
  color: var(--text-muted);
  font-size: 14px;
}
.empty .empty-icon { font-size: 36px; margin-bottom: 12px; }

/* ── Loading ─────────────────────────────────────────────────────────────── */

.loading { text-align: center; padding: 44px; color: var(--text-muted); font-size: 13px; }

/* ── Error / notice bar ──────────────────────────────────────────────────── */

.error-bar {
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid;
}
.error-bar.is-error  { background: #fdecea; border-color: #f5c6c2; color: #c62828; }
.error-bar.is-notice { background: var(--brand-orange-light); border-color: var(--brand-orange); color: var(--brand-dark); }
.error-bar.is-error  { background: rgba(220, 38, 38, 0.12); border-color: rgba(220, 38, 38, 0.3); color: #fca5a5; }
.error-bar:not(.is-notice):not(.is-error) { background: rgba(220, 38, 38, 0.12); border-color: rgba(220, 38, 38, 0.3); color: #fca5a5; }

/* ── Login page ──────────────────────────────────────────────────────────── */

#login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
#login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 24px rgba(49,49,49,.06);
}
#login-box .login-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
#login-box .login-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

/* ── Login page accent bar ───────────────────────────────────────────────── */

#login-box::before {
  content: '';
  display: block;
  width: 40px;
  height: 3px;
  background: var(--brand-orange);
  border-radius: 2px;
  margin-bottom: 20px;
}
