/* dark theme — warm cinematic browns, matching the brand (was cool blue-gray) */
:root {
  --bg: #131009;
  --bg2: #1a1610;
  --bg3: #241e15;
  --line: #382f20;
  --text: #f0e9dc;
  --muted: #a3947c;
  --accent: #e6b450;
  --accent-dim: #b3873a;
  --amber: #e08a3c;
  --green: #4cc38a;
  --red: #e5716b;
  --blue: #6cb2f7;
  --radius: 10px;
}

/* light theme — warm paper tones, same gold brand */
body.light {
  --bg: #f4f1ea;
  --bg2: #fdfcf9;
  --bg3: #ece7db;
  --line: #d9d2c1;
  --text: #241f15;
  --muted: #6e6759;
  --accent: #b98a2e;
  --accent-dim: #96701f;
  --amber: #a95f1a;
  --green: #1e7d4f;
  --red: #b3372f;
  --blue: #1f5f9e;
}
body.light .hero { background: linear-gradient(135deg, #efe8d8, var(--bg2)); }
body.light .alert { background: #f7edd6; }
body.light .alert.red { background: #f6dedb; }
body.light .badge.green { border-color: #9cc7ae; }
body.light .badge.red { border-color: #d9a5a0; }
body.light .badge.blue { border-color: #a7c4de; }
body.light .badge.gold { border-color: #cfa95e; }
body.light .dp-panel { box-shadow: 0 14px 34px rgba(80, 60, 20, 0.18); }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

#app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 210px;
  background: var(--bg2);
  border-right: 1px solid var(--line);
  padding: 16px 10px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand {
  font-size: 19px;
  font-weight: 700;
  padding: 4px 10px 14px;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border-radius: 10px;
}
.brand:hover { background: var(--bg3); }
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.brand-logo { width: 42px; height: auto; border-radius: 9px; flex-shrink: 0; }
.brand span { color: var(--accent); }
.brand-sub {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.1px;
  margin-top: 2px;
  line-height: 1.3;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 2px;
  font-weight: 500;
}
.nav a.active, .nav a:hover { background: var(--bg3); color: var(--text); }
.nav a.active { color: var(--accent); }
.nav .icon { width: 20px; text-align: center; }
.nav-section {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--accent);
  padding: 8px 10px;
  margin: 14px 6px 6px;
  border-radius: 7px;
  background: linear-gradient(90deg, rgba(230, 180, 80, 0.14), rgba(230, 180, 80, 0.02));
  border-left: 3px solid var(--accent);
}
.nav-section:first-of-type { margin-top: 6px; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar-l { min-width: 0; }
.topbar h1 { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-eyebrow { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 700; }
.topbar-credits { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { padding: 22px; max-width: 1200px; }

/* ---------- Controls ---------- */
button, .btn {
  font: inherit;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 13px;
  cursor: pointer;
  font-weight: 500;
}
button:hover, .btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #1a1408; font-weight: 600; }
.btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); }
.btn-danger { color: var(--red); }
.btn-danger-filled { background: var(--red); color: #fff; border: 1px solid var(--red); font-weight: 700; padding: 7px 13px; border-radius: 8px; font-family: inherit; cursor: pointer; }
.btn-danger-filled:hover { background: #d0574f; }
.btn-sm { padding: 3px 9px; font-size: 12.5px; border-radius: 6px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: transparent; }

select, input, textarea {
  font: inherit;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  width: 100%;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); }
.topbar select { width: auto; background: var(--bg3); }
.lang-btn { white-space: nowrap; }

/* Custom language dropdown (replaces native <select> so all languages always show) */
.lang-pop {
  position: fixed; z-index: 1200;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  padding: 5px; box-shadow: 0 14px 34px rgba(0,0,0,.45);
  max-height: 60vh; overflow-y: auto; min-width: 168px;
  display: flex; flex-direction: column; gap: 2px;
}
.lang-opt {
  font: inherit; font-size: 14px; text-align: left; white-space: nowrap;
  background: transparent; border: none; color: var(--text);
  padding: 9px 12px; border-radius: 7px; cursor: pointer; width: 100%;
}
.lang-opt:hover { background: var(--bg3); }
.lang-opt.on { color: var(--accent); font-weight: 700; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat { font-size: 24px; font-weight: 700; }
.stat small { font-size: 13px; color: var(--muted); font-weight: 500; }
.card .sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 22px 0 12px;
  flex-wrap: wrap;
}
.section-head h2 { font-size: 15px; }
.section-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg2); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); background: var(--bg3); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; background: var(--bg3); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--bg3);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.badge.gold { color: var(--accent); border-color: var(--accent-dim); }
.badge.green { color: var(--green); border-color: #2c6a4e; }
.badge.red { color: var(--red); border-color: #7a3c39; }
.badge.blue { color: var(--blue); border-color: #35597e; }

/* ---------- Pipeline ---------- */
.pipeline { display: flex; gap: 6px; flex-wrap: wrap; }
.pipeline .step {
  flex: 1;
  min-width: 110px;
  text-align: center;
  padding: 9px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--bg2);
}
.pipeline .step.done { border-color: #2c6a4e; color: var(--green); }
.pipeline .step.current { background: var(--accent); border-color: var(--accent); color: #1a1408; }

/* ---------- Progress bars ---------- */
.bar { height: 7px; background: var(--bg3); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar i.green { background: var(--green); }
.bar i.red { background: var(--red); }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0;
  background: rgba(10, 7, 3, 0.72);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 16px;
  z-index: 50;
  overflow-y: auto;
}
.modal {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  padding: 20px;
}
.modal h2 { font-size: 16px; margin-bottom: 14px; }
.modal .field { margin-bottom: 12px; }
.modal label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* Save/Cancel stay pinned in view on long forms — sticky against the scrolling .modal-back,
   pulled to the modal's edges so the strip reads as part of the card */
.modal .foot {
  display: flex; justify-content: flex-end; gap: 8px;
  position: sticky; bottom: 0;
  background: var(--bg2); border-top: 1px solid var(--line);
  margin: 16px -20px -20px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  border-radius: 0 0 12px 12px;
}
.money-echo { font-size: 12px; color: var(--green); font-weight: 700; min-height: 15px; margin-top: 3px; }
.wiz-sample-link { background: none; border: none; color: var(--accent); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 6px 2px; text-decoration: underline; text-underline-offset: 3px; display: block; margin-top: 4px; }
.wiz-sample-link:hover { color: var(--text); }
.checks { display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.checks label {
  display: flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: var(--text); font-weight: 500;
  background: var(--bg3); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 8px; margin: 0; cursor: pointer;
}
.checks input { width: auto; }
.checks label:has(input:checked) { border-color: var(--accent); color: var(--accent); }

/* ---------- Call sheet ---------- */
.callsheet { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.callsheet .cs-head { text-align: center; border-bottom: 2px solid var(--accent); padding-bottom: 12px; margin-bottom: 14px; }
.callsheet .cs-head .title { font-size: 20px; font-weight: 700; }
.callsheet .cs-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; font-size: 13.5px; }
.callsheet h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--accent); margin: 16px 0 8px; }

/* ---------- Date picker ---------- */
.datepick { position: relative; }
.dp-toggle {
  width: 100%;
  text-align: left;
  background: var(--bg);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dp-toggle:focus { border-color: var(--accent); outline: none; }
.dp-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  width: 258px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
}
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-head button { padding: 2px 10px; font-size: 15px; line-height: 1.4; }
.dp-title { font-weight: 700; font-size: 13.5px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { text-align: center; font-size: 10.5px; color: var(--muted); padding: 4px 0; font-weight: 700; }
.dp-grid button {
  padding: 0;
  height: 31px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 7px;
  font-size: 12.5px;
}
.dp-grid button:hover { background: var(--bg2); border-color: var(--line); }
.dp-grid button.sun { color: var(--red); }
.dp-grid button.tdy { border-color: var(--accent-dim); }
.dp-grid button.sel { background: var(--accent); color: #1a1408; font-weight: 700; }
.dp-foot { margin-top: 10px; display: flex; justify-content: space-between; align-items: center; }
.dp-foot .dp-hint { font-size: 11px; color: var(--muted); }
.dp-foot button { padding: 3px 10px; font-size: 12px; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty p { margin-bottom: 12px; }

/* ---------- Welcome / empty-state (no project yet) ---------- */
.welcome { text-align: center; padding: 44px 16px 40px; display: flex; flex-direction: column; align-items: center; }
.welcome .clap { width: 52px; height: 52px; margin-bottom: 8px; border-radius: 12px; background: var(--bg3); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 26px; }
.welcome .eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-dim); font-weight: 700; }
.welcome-h { font-size: 24px; font-weight: 800; margin: 12px 0 10px; text-wrap: balance; color: var(--text); }
.welcome-sub { color: var(--muted); max-width: 46ch; margin: 0 0 28px; line-height: 1.6; font-size: 14.5px; }
.welcome-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; width: 100%; max-width: 440px; }
.welcome .act { font: inherit; font-size: 14.5px; font-weight: 700; border-radius: 12px; padding: 18px 16px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; line-height: 1.25; background: linear-gradient(135deg, var(--accent), var(--accent-dim)); color: #241a06; border: 1px solid rgba(0,0,0,.05); box-shadow: 0 8px 20px rgba(230,180,80,.16); transition: transform .12s, box-shadow .12s; }
.welcome .act:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(230,180,80,.26); }
.welcome .act .act-ic { font-size: 24px; }
.welcome .act small { display: block; font-weight: 600; font-size: 11.5px; color: rgba(36,26,6,.72); margin-top: 1px; }
@media (max-width: 560px) { .welcome-grid { grid-template-columns: 1fr; max-width: 360px; } }

/* ---------- Project picker (2+ films) ---------- */
.picker { min-height: 100vh; display: flex; flex-direction: column; }
.pk-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.pk-top .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; }
.pk-top .brand-logo { width: 46px; height: auto; border-radius: 8px; object-fit: contain; }
.pk-top .brand span { color: var(--accent); }
.pk-tools { display: flex; align-items: center; gap: 8px; }
.pk-body { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 26px 18px 108px; }
.pk-inline { max-width: 880px; }
.pk-hi { font-size: 22px; font-weight: 800; letter-spacing: -.01em; margin: 2px 2px 2px; }
.pk-sub { color: var(--muted); font-size: 13px; margin: 0 2px 20px; }

.pk-continue { display: flex; flex-direction: column; border-radius: 20px; padding: 20px; margin-bottom: 24px; position: relative; overflow: hidden; cursor: pointer;
  background: radial-gradient(130% 120% at 100% 0%, rgba(76,195,138,.20), transparent 55%), var(--bg2); border: 1px solid rgba(76,195,138,.4); }
.pk-lab { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--green); font-weight: 800; }
.pk-cti { font-size: 25px; font-weight: 800; letter-spacing: -.02em; margin-top: 5px; }
.pk-cdi { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.pk-prow { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.pk-ring { width: 48px; height: 48px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; }
.pk-ring i { width: 37px; height: 37px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; font-style: normal; color: var(--text); }
.pk-num { font-size: 12.5px; color: var(--muted); line-height: 1.6; } .pk-num b { color: var(--text); }
.pk-resume { margin-top: 14px; width: 100%; background: var(--green); color: #04201c; font-weight: 800; font-size: 15px; border: none; border-radius: 13px; padding: 13px; cursor: pointer; }

.pk-sh { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0 2px 12px; }
.pk-grid { display: flex; flex-direction: column; gap: 11px; }
.pk-card { display: flex; align-items: center; gap: 13px; background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 14px; cursor: pointer; text-align: left; font: inherit; color: var(--text); width: 100%; transition: border-color .12s, transform .12s; }
.pk-card:hover { border-color: rgba(230,180,80,.45); transform: translateY(-2px); }
.pk-thumb { width: 46px; height: 46px; border-radius: 13px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 800; }
.pk-thumb.pre { background: rgba(108,178,247,.16); color: var(--blue); }
.pk-thumb.post { background: rgba(176,136,249,.16); color: #b088f9; }
.pk-thumb.gold { background: rgba(230,180,80,.16); color: var(--accent); }
.pk-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pk-cn { font-size: 15.5px; font-weight: 800; }
.pk-cd { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.pk-cm { font-size: 11.5px; color: var(--muted); margin-top: 5px; } .pk-cm b { color: var(--text); font-weight: 600; }
.pk-chev { color: var(--muted); font-size: 18px; flex: none; }
.pk-actions { display: flex; gap: 6px; flex: none; }
.pk-iconbtn { background: transparent; border: 1px solid var(--line); border-radius: 9px; width: 34px; height: 34px; font-size: 14px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: border-color .12s, background .12s, transform .12s; }
.pk-iconbtn:hover { border-color: var(--accent); background: var(--bg3); transform: translateY(-1px); }
.pk-card { align-items: center; }

/* ===== Device-adaptive foundation (html.is-phone / is-tablet / is-desktop / is-touch) ===== */
/* Touch devices: give the small action buttons a comfortable tap target (44px area with the row). */
html.is-touch .btn-sm { min-height: 32px; padding: 6px 11px; }
html.is-touch select, html.is-touch input[type="date"], html.is-touch input[type="time"] { min-height: 38px; }

/* ---- Phone: content tables become stacked, labelled cards (no more sideways scrolling) ---- */
html.is-phone .content .table-wrap { overflow-x: visible; border: none; background: none; border-radius: 0; }
html.is-phone .content .table-wrap table,
html.is-phone .content .table-wrap tbody,
html.is-phone .content .table-wrap tr,
html.is-phone .content .table-wrap td,
html.is-phone .content .table-wrap th { display: block; width: auto; min-width: 0; }
html.is-phone .content .table-wrap tr:first-child { display: none; }            /* header row */
html.is-phone .content .table-wrap tr {
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg2);
  padding: 10px 13px; margin-bottom: 10px;
}
html.is-phone .content .table-wrap td {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 5px 0; border: none; text-align: right; white-space: normal;
}
html.is-phone .content .table-wrap td::before {
  content: attr(data-label); font-weight: 600; color: var(--muted);
  text-align: left; flex: none; max-width: 46%;
}
html.is-phone .content .table-wrap td:first-child {
  font-size: 15px; font-weight: 700; text-align: left; padding: 0 0 8px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
html.is-phone .content .table-wrap td:first-child::before { display: none; }    /* title cell — no label */
html.is-phone .content .table-wrap td:not([data-label]) { justify-content: flex-end; } /* action-button column */
html.is-phone .content .table-wrap td:not([data-label])::before { display: none; }

/* Phone: icon-only topbar buttons so the action row never overflows the screen */
html.is-phone .topbar .btn-ghost .btn-label { display: none; }
html.is-phone .main { overflow-x: hidden; }   /* belt-and-braces: never scroll the page sideways */

/* Phone: primary actions float into thumb reach just above the bottom nav */
.fc-fab-bar { display: none; }
html.is-phone .fc-fab-bar {
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
  position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom));
  z-index: 41; padding: 8px 12px 6px; pointer-events: none;
  background: linear-gradient(transparent, var(--bg) 45%);
}
html.is-phone .fc-fab-bar .btn-primary {
  pointer-events: auto; min-height: 48px; font-size: 15px; box-shadow: 0 10px 26px rgba(0,0,0,.5);
}
html.is-phone .content { padding-bottom: 150px; }   /* clear the bottom nav + floating actions */
.pk-newcard { display: flex; align-items: center; justify-content: center; gap: 10px; border: 1.5px dashed var(--line); border-radius: 16px; padding: 15px; color: var(--muted); cursor: pointer; font: inherit; font-weight: 700; background: transparent; width: 100%; transition: border-color .12s, color .12s; }
.pk-newcard:hover { border-color: var(--accent); color: var(--accent); }
.pk-plus { font-size: 20px; }
.pk-fab { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 924px; margin: 0 auto; background: linear-gradient(135deg, var(--accent), var(--accent-dim)); color: #241a06; font-weight: 800; font-size: 15px; border: none; border-radius: 16px; padding: 15px; cursor: pointer; box-shadow: 0 10px 26px rgba(230,180,80,.24); z-index: 20; }

@media (min-width: 720px) {
  .pk-continue { flex-direction: row; align-items: center; gap: 22px; flex-wrap: wrap; }
  .pk-cmain { flex: 1; min-width: 190px; }
  .pk-prow { margin-top: 0; }
  .pk-num { line-height: 1.7; }
  .pk-resume { width: auto; margin-top: 0; padding: 13px 26px; }
  .pk-grid { display: grid; grid-template-columns: 1fr 1fr; }
  .pk-fab { display: none; }
}
@media (max-width: 719px) { .pk-newcard { display: none; } }

/* ---------- Collapsible panels ---------- */
details.panel {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 18px;
}
details.panel summary {
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 13.5px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
details.panel summary::-webkit-details-marker { display: none; }
details.panel summary::before { content: "▸"; color: var(--muted); transition: transform 0.15s; }
details.panel[open] summary::before { transform: rotate(90deg); }
details.panel .panel-body { padding: 0 16px 16px; }
.sum-hint { color: var(--muted); font-weight: 400; font-size: 12.5px; }

/* ---------- Text clamping ---------- */
.clamp2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tax-preview {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--muted);
}
.tax-preview strong { color: var(--green); }

button:focus-visible, .btn:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

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

/* benchmark hint in the expense form */
.bench { margin-top: 7px; font-size: 12px; color: var(--muted); }
.bench.warn { color: var(--amber); font-weight: 600; }

/* falcon mark on empty states */
.empty::before {
  content: "";
  display: block;
  width: 60px;
  height: 60px;
  margin: 0 auto 12px;
  background: url("icon-192.png?v=94") center / contain no-repeat;
  border-radius: 14px;
  opacity: 0.55;
}

@media (prefers-reduced-motion: reduce) {
  tr.flash { animation: none; }
  details.panel summary::before { transition: none; }
  .toc-item, .module { transition: none; }
}
.pos { color: var(--green); }
.neg { color: var(--red); }
a { color: var(--blue); text-decoration: none; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--bg3); border: 1px solid var(--accent);
  color: var(--text); padding: 9px 18px; border-radius: 8px;
  z-index: 100; font-weight: 500;
}

/* ---------- Mobile ---------- */
@media (max-width: 780px) {
  #app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; display: flex; align-items: center; gap: 4px; overflow-x: auto; padding: 8px; border-right: none; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 10px; font-size: 16px; white-space: nowrap; }
  .brand-sub { display: none; }
  .nav { display: flex; gap: 2px; }
  .nav a { white-space: nowrap; padding: 6px 9px; }
  .nav-section { display: none; }
  .content { padding: 14px; }
  .modal .row2 { grid-template-columns: 1fr; }
}

/* ---------- SVG icons ---------- */
.nico { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- Bottom nav (mobile) & sub-nav ---------- */
.bottom-nav { display: none; }
.subnav { display: none; gap: 6px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 2px; }
.subnav a {
  white-space: nowrap; padding: 7px 14px; border-radius: 999px;
  background: var(--bg2); border: 1px solid var(--line);
  color: var(--muted); font-weight: 700; font-size: 13px; text-decoration: none;
}
.subnav a.on { background: var(--accent); border-color: var(--accent); color: #1a1408; }

/* ---------- Filter chips ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chips button { padding: 5px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.chips button.on { background: var(--accent); border-color: var(--accent); color: #1a1408; }
.chips .sep { width: 1px; background: var(--line); margin: 2px 4px; }

/* ---------- Stage strip (top of dashboard) ---------- */
.stage-strip { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 2px; }
.stage-chip {
  padding: 5px 13px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--bg2); border: 1px solid var(--line); color: var(--muted);
  cursor: pointer; white-space: nowrap;
}
.stage-chip.done { color: var(--green); border-color: #2c6a4e; }
.stage-chip.current { background: var(--accent); border-color: var(--accent); color: #1a1408; }
body.light .stage-chip.done { border-color: #9cc7ae; }

/* ---------- Dashboard: alerts, hero, quick actions ---------- */
.alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
/* alerts = "needs attention" → amber, so brand gold stays celebratory (red stays = trouble) */
.alert {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; font-size: 13.5px;
  background: #241d10; border: 1px solid var(--amber); border-radius: 10px;
}
.alert.red { background: #241313; border-color: #7a3c39; }
.alert a { margin-left: auto; white-space: nowrap; font-weight: 700; }
.hero {
  background: linear-gradient(135deg, #2b2113, var(--bg2));
  border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px;
}
.hero .k { font-size: 11px; letter-spacing: 1.5px; color: var(--accent); font-weight: 800; text-transform: uppercase; }
.hero .loc { font-size: 19px; font-weight: 800; margin: 5px 0 3px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.quick button, .quick a {
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
  padding: 13px 12px; border-radius: 12px; font-weight: 700; font-size: 13px; text-align: left;
  background: var(--bg3); color: var(--text); border: 1px solid var(--line);
  text-decoration: none; cursor: pointer; font-family: inherit;
}
.quick .nico { width: 20px; height: 20px; color: var(--accent); }

/* ---------- Sticky headers for tall tables ---------- */
.table-wrap.tall { max-height: 62vh; overflow-y: auto; }
.table-wrap.tall th { position: sticky; top: 0; z-index: 2; }

/* ---------- Toast with action (undo) ---------- */
.toast button {
  margin-left: 10px; padding: 3px 12px; font-size: 12.5px; border-radius: 6px;
  background: var(--accent); border: none; color: #1a1408; font-weight: 800;
}

/* ---------- Cross-link highlight ---------- */
a.xlink { color: var(--blue); cursor: pointer; text-decoration: none; }
a.xlink:hover { text-decoration: underline; }
tr.flash { animation: rowflash 2s ease-out; }
@keyframes rowflash { 0% { background: rgba(230, 180, 80, 0.28); } 100% { background: transparent; } }

/* ---------- First-run wizard ---------- */
.wiz { max-width: 620px; margin: 3vh auto 0; }
.wiz-step { color: var(--muted); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; font-weight: 800; margin-bottom: 8px; }
.wiz h1 { font-size: 22px; margin-bottom: 4px; }
.wiz .lead { color: var(--muted); margin-bottom: 14px; }
.wiz .field { margin-bottom: 12px; }
.wiz label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.wiz .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wiz .foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; }

/* budget builder */
.bb-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.bb-item:last-child { border-bottom: none; }
.bb-desc { font-weight: 600; font-size: 14.5px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.bb-ref { font-size: 12px; color: var(--accent); font-weight: 500; }
.bb-line { margin-top: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.bb-line input { padding: 6px 9px; font-size: 14px; }
.bb-line b { color: var(--green); font-size: 15px; font-variant-numeric: tabular-nums; }
.bb-running {
  margin-top: 16px; padding: 12px 16px; border-radius: 10px;
  background: linear-gradient(90deg, rgba(230,180,80,.14), rgba(230,180,80,.03));
  border: 1px solid var(--accent-dim); font-size: 14px; text-align: right;
}
.bb-running b { color: var(--accent); font-size: 18px; font-variant-numeric: tabular-nums; }

/* ---------- Call sheet: artist calls & print head ---------- */
.cs-print-head { display: none; align-items: center; gap: 14px; padding-bottom: 10px; margin-bottom: 12px; border-bottom: 2px solid var(--accent); }
.cs-print-head img { width: 58px; }
.cast-call-input { width: 96px !important; padding: 4px 8px !important; font-size: 13px; }

@media (max-width: 780px) {
  .sidebar { display: none; }
  .content { padding-bottom: 88px; }
  .btn-tour .btn-label { display: none; }   /* icon-only tour button — keeps the topbar uncrowded */
  .topbar select { max-width: 42vw; }
  /* accessibility: comfortable touch targets; 16px inputs stop iOS auto-zoom */
  input, select, textarea { font-size: 16px; }
  .btn-sm { min-height: 36px; }
  button, .btn { min-height: 40px; }
  .chips button, .bottom-nav a { min-height: 0; }
  .subnav { display: flex; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: var(--bg2); border-top: 1px solid var(--line);
    padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--muted); text-decoration: none; font-size: 10.5px; font-weight: 700; padding: 4px 0;
  }
  .bottom-nav a.on { color: var(--accent); }
  .bottom-nav .nico { width: 21px; height: 21px; }
  .quick { grid-template-columns: 1fr 1fr; }
}

@media print {
  @page { size: A4; margin: 12mm; }
  .sidebar, .topbar, .section-head, .subnav, .bottom-nav, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .callsheet { border: none; color: #000; background: #fff; padding: 0; }
  .callsheet .muted, .callsheet .sub { color: #444; }
  .callsheet .badge { border-color: #999; color: #111; background: #fff; }
  .callsheet th { background: #eee; color: #333; }
  .callsheet td, .callsheet th { border-color: #ccc; }
  .callsheet .table-wrap { border-color: #ccc; background: #fff; }
  .callsheet input { border: none; background: none; color: #000; }
  .cs-print-head { display: flex !important; }
}

/* ============================== Guided tour ============================== */
#tourOverlay { position: fixed; inset: 0; z-index: 800; }
.tour-catch { position: fixed; inset: 0; z-index: 800; }
.tour-ring {
  position: fixed; z-index: 850; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 9999px rgba(6, 9, 13, 0.74);
  transition: top .3s cubic-bezier(.4, 0, .2, 1), left .3s cubic-bezier(.4, 0, .2, 1),
              width .3s cubic-bezier(.4, 0, .2, 1), height .3s cubic-bezier(.4, 0, .2, 1);
}
.tour-pop {
  position: fixed; z-index: 900; width: min(342px, calc(100vw - 28px));
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55); padding: 16px 16px 14px; color: var(--text);
  transition: top .28s ease, left .28s ease;
}
.tour-pop .tp-step { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.tour-pop h4 { font-size: 16.5px; margin: 3px 0 7px; line-height: 1.25; }
.tour-pop p { font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.tour-pop p b { color: var(--text); font-weight: 600; }
.tour-pop .tp-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 15px; }
.tour-pop .tp-dots { display: flex; gap: 4px; flex-wrap: wrap; max-width: 150px; }
.tour-pop .tp-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.tour-pop .tp-dot.on { background: var(--accent); transform: scale(1.25); }
.tour-pop .tp-btns { display: flex; gap: 8px; flex-shrink: 0; }
.tour-pop .tp-skip { position: absolute; top: 9px; right: 11px; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.tour-pop .tp-skip:hover { color: var(--text); }

/* ---- Demo mode bar ---- */
.demo-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 18px; background: linear-gradient(90deg, rgba(200,146,10,.22), rgba(200,146,10,.10)); border-bottom: 1px solid rgba(200,146,10,.35); font-size: 13px; color: var(--text); }
.demo-bar b { color: var(--accent); }
.demo-bar-btns { display: flex; gap: 8px; }
.demo-bar-btns button { font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 100px; cursor: pointer; background: var(--accent); color: #1a0c04; border: none; }
.demo-bar-btns button.demo-exit { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.demo-bar-btns button.demo-exit:hover { color: var(--text); }
html.is-phone .demo-bar { padding: 7px 12px; font-size: 12px; }

/* ---- Nightly Close ---- */
.hero.close-mode { border-color: var(--accent-dim); box-shadow: 0 0 0 1px rgba(230, 180, 80, .18), 0 8px 28px rgba(0, 0, 0, .3); }
.nc-tomorrow { margin-top: 12px; padding: 10px 12px; background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; }
.nc-tomorrow .k { font-size: 12px; letter-spacing: .04em; }

/* ---- Wrap Report ---- */
.wrap-card { max-width: 460px; text-align: left; border-color: var(--accent-dim); box-shadow: 0 0 0 1px rgba(230, 180, 80, .22), 0 18px 60px rgba(0, 0, 0, .5); }
.wrap-clap { font-size: 40px; text-align: center; margin-top: 2px; }
.wrap-h { text-align: center; color: var(--accent); font-size: 21px !important; letter-spacing: .01em; margin-bottom: 2px !important; }
.wrap-film { text-align: center; font-size: 16px; font-weight: 800; margin-bottom: 2px; }
.wrap-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.wrap-stat { background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; }
.wrap-stat .wl, .wrap-depts .wl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.wrap-stat .wv { font-size: 16.5px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.wrap-stat .ws { font-size: 11px; color: var(--muted); margin-top: 2px; }
.wrap-depts { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; margin-bottom: 4px; }
.wrap-depts .wd { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.wrap-depts .wd b { font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .wrap-grid { grid-template-columns: 1fr 1fr; } }

/* ---- Setup checklist (endowed progress) ---- */
.setup-card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.setup-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.setup-head b { font-size: 13.5px; }
.setup-rows { display: flex; flex-direction: column; margin-top: 8px; }
.setup-row { display: flex; align-items: center; gap: 9px; padding: 6px 4px; font-size: 13px; color: var(--text); text-decoration: none; border-radius: 7px; }
.setup-row:hover { background: var(--bg3); }
.setup-row.ok { color: var(--muted); }
.setup-row.ok span { text-decoration: line-through; text-decoration-color: var(--line); }

/* ---- Backup / sync chip ---- */
.sync-chip { display: inline-flex; align-items: center; gap: 5px; background: none; border: none; padding: 2px 0 0; font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer; }
.sync-chip:hover { color: var(--text); border: none; }
.sync-chip.ok { color: var(--green); }
.sync-chip.warn { color: var(--amber); }

/* ---- Caught-by-FalconCine tile ---- */
.catch-card { cursor: pointer; border-color: rgba(76, 195, 138, .35); }
.catch-card:hover { border-color: var(--green); }

/* ---- Billing card ---- */
.bill-card { margin-bottom: 14px; border-color: rgba(230, 180, 80, .4); }
.bill-card.due { border-color: var(--amber); }

/* ---- Collapsible field group (keeps rarely-touched inputs out of the way) ---- */
.modal .fold { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; background: var(--bg); }
.modal .fold > summary { list-style: none; cursor: pointer; padding: 11px 13px; display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.modal .fold > summary::-webkit-details-marker { display: none; }
.modal .fold > summary::before { content: "▸"; color: var(--accent); font-size: 11px; transition: transform .15s; }
.modal .fold[open] > summary::before { transform: rotate(90deg); }
.modal .fold[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 11px; }
.modal .fold > summary .fs { margin-left: auto; font-weight: 600; color: var(--accent); font-size: 12px; text-align: right; }
.modal .fold > .field, .modal .fold > .row2 { padding: 0 13px; }
.modal .fold > *:last-child { margin-bottom: 12px; }

/* ---- Phone: don't truncate the film name to "Demo — …" ---- */
html.is-phone .topbar h1 { white-space: normal; font-size: 16px; line-height: 1.22;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
html.is-phone .topbar-credits { display: none; }   /* producer/director — desk detail, not set detail */

/* ---- Phone: stage strip scrolls; fade the edge so the cut reads as "more", not "broken" ---- */
html.is-phone .stage-strip { padding-right: 18px;   /* NB: no scroll-behavior:smooth — it would animate (and swallow) the initial position set in stageIntoView() */
  -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 86%, transparent 100%); }
html.is-phone .stage-strip::-webkit-scrollbar { display: none; }
