:root {
  --navy: #0b1530;
  --navy2: #13204a;
  --ink: #0f1424;
  --silver: #c9ced8;
  --line: #e2e5ec;
  --muted: #6b7386;
  --bg: #f4f5f8;
  --gold: #d9a441;
  --red: #c0392b;
  --green: #1e8a5a;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--navy2); }
h1, h2, h3, .caps { font-family: Oswald, Inter, sans-serif; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 .5em; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* top bar with subtle film grain */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 22px; background: var(--navy); color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.09'/%3E%3C/svg%3E"); }
.brand { font-family: Oswald; font-size: 22px; letter-spacing: .18em; color: #fff; text-decoration: none; font-weight: 700; }
.brand span { color: var(--silver); font-weight: 500; }
#topnav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#topnav a, #topnav button { color: #dfe3ec; text-decoration: none; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; padding: 6px 10px; border-radius: 6px; background: none; border: 0; cursor: pointer; font-family: Inter; }
#topnav a:hover, #topnav button:hover { background: rgba(255,255,255,.1); color: #fff; }

main { max-width: 1240px; margin: 0 auto; padding: 26px 22px 80px; }
.loading { padding: 60px; text-align: center; color: var(--muted); letter-spacing: .2em; text-transform: uppercase; }

/* cards and layout */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }

/* buttons and forms */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 15px; border-radius: 8px; border: 1px solid var(--navy); background: var(--navy); color: #fff;
  font: 600 13px Inter; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--navy2); }
.btn.ghost { background: #fff; color: var(--navy); }
.btn.ghost:hover { background: #eef1f7; }
.btn.danger { background: #fff; color: var(--red); border-color: #e5b8b2; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1a1205; }
.btn.sm { padding: 5px 10px; font-size: 11px; }
.btn:disabled { opacity: .5; cursor: default; }
label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid #cfd4de; border-radius: 8px; font: 14px Inter; background: #fff; color: var(--ink); }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9fb3e8; border-color: #7c93d4; }
.field { margin-bottom: 12px; }
input[type=checkbox] { width: auto; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 500; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font: 600 11px Inter; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px; border-bottom: 2px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:hover td { background: #fafbfd; }
td input, td select { padding: 6px 8px; font-size: 13px; }
.table-wrap { overflow-x: auto; }

/* tabs */
.project-head { margin-bottom: 14px; }
.project-head h1 { margin-bottom: 2px; }
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font: 600 12px Inter; text-transform: uppercase; letter-spacing: .08em; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a.on { color: var(--navy); border-color: var(--navy); }

/* badges and stats */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font: 600 11px Inter; text-transform: uppercase; letter-spacing: .06em; background: #eceff5; color: #44506a; }
.badge.pub { background: #dff3e9; color: var(--green); }
.badge.draft { background: #fff1d6; color: #9a6a10; }
.badge.warn { background: #fde4e1; color: var(--red); }
.stat { font-family: Oswald; font-size: 34px; line-height: 1; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 6px; }
.bar { height: 8px; background: #e7eaf1; border-radius: 9px; overflow: hidden; margin-top: 10px; }
.bar > div { height: 100%; background: var(--navy); }

/* my call hero */
.callcard { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 22px; position: relative; overflow: hidden; }
.callcard .time { font-family: Oswald; font-size: 52px; line-height: 1; margin: 6px 0; }
.callcard .label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--silver); }
.callcard a { color: #fff; }
.callcards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* project list */
.plist { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ptile { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: inherit; transition: .15s; }
.ptile:hover { border-color: var(--navy); transform: translateY(-2px); }
.ptile h3 { font-size: 20px; margin-bottom: 4px; }

/* auth */
.auth { max-width: 420px; margin: 40px auto; }

/* toast & modal */
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 100; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.bad { background: var(--red); }
.modal { position: fixed; inset: 0; background: rgba(8,12,26,.55); display: flex; align-items: flex-start; justify-content: center; padding: 50px 16px; z-index: 50; overflow-y: auto; }
.modal-card { background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 620px; }

/* call sheet */
.sheet { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 28px; max-width: 1000px; margin: 0 auto; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px; align-items: start; border-bottom: 3px solid var(--ink); padding-bottom: 16px; margin-bottom: 16px; }
.sheet-head .center { text-align: center; }
.sheet-head .bigcall { font-family: Oswald; font-size: 46px; line-height: 1; }
.sheet h4 { font: 700 11px Inter; text-transform: uppercase; letter-spacing: .1em; margin: 0 0 4px; color: var(--muted); }
.sheet .box { border: 1px solid var(--ink); padding: 10px 12px; }
.sheet table th { color: #fff; background: var(--ink); border: 0; padding: 6px 8px; }
.sheet table td { padding: 6px 8px; font-size: 13px; }
.sheet .section { margin-top: 18px; }
.sheet .dept td { background: #eef0f4; font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .08em; }
.mine td { background: #fff6dc !important; }
.yourcall { background: var(--gold); color: #1a1205; padding: 14px 18px; border-radius: 8px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.yourcall .t { font-family: Oswald; font-size: 34px; line-height: 1; }

/* stripboard */
.strips { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: start; }
.daycol { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 90px; }
.daycol.over { outline: 2px dashed var(--navy); }
.daycol h3 { font-size: 14px; margin: 2px 4px 8px; }
.strip { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; align-items: center; padding: 7px 9px; border: 1px solid rgba(0,0,0,.12); border-radius: 6px; margin-bottom: 6px; font-size: 12px; cursor: grab; }
.strip b { font-family: Oswald; font-size: 15px; }
.strip.int-day { background: #ffffff; } .strip.ext-day { background: #fff3a8; }
.strip.int-night { background: #bcd2ff; } .strip.ext-night { background: #bfe8c6; }
.strip.shot { opacity: .45; text-decoration: line-through; }
.strip select { width: auto; padding: 3px 4px; font-size: 11px; }
.dood td, .dood th { text-align: center; padding: 6px; font-size: 12px; border: 1px solid var(--line); }
.dood td:first-child, .dood th:first-child { text-align: left; }
.dood .W { background: #dfe9ff; font-weight: 700; } .dood .SW, .dood .WF, .dood .SWF { background: var(--navy); color: #fff; font-weight: 700; } .dood .H { background: #f3f3f3; color: #888; }

/* script viewer */
.script-layout { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
@media (max-width: 960px) { .script-layout { grid-template-columns: 1fr; } }
.screenplay { background: #fff; border: 1px solid var(--line); padding: 40px 50px; font-family: 'Courier Prime', Courier, monospace; font-size: 15px; line-height: 1.35; max-width: 760px; }
@media (max-width: 600px) { .screenplay { padding: 20px 16px; font-size: 13px; } }
.el { position: relative; margin: 0 0 1em; white-space: pre-wrap; cursor: pointer; border-radius: 3px; padding: 1px 4px; }
.el:hover { background: #f5f7fb; }
.el.scene { font-weight: 700; margin-top: 2em; text-transform: uppercase; display: flex; gap: 12px; }
.el.scene .num { color: var(--muted); min-width: 30px; }
.el.character { margin: 1em 0 0 37%; text-transform: uppercase; }
.el.dialogue { margin: 0 18% 0 22%; }
.el.paren { margin: 0 25% 0 30%; }
.el.transition { text-align: right; text-transform: uppercase; }
.el.centered { text-align: center; }
.el.hl { background: #fff1b8; }
.el.hl:hover { background: #ffe68a; }
.el.rehearse { color: transparent; text-shadow: 0 0 8px rgba(0,0,0,.45); }
.el.rehearse.reveal { color: inherit; text-shadow: none; }
.el.has-note::after { content: attr(data-notes); position: absolute; right: -36px; top: 0; background: var(--gold); color: #1a1205; font: 700 11px Inter; border-radius: 99px; padding: 1px 7px; }
.side { position: sticky; top: 74px; max-height: calc(100vh - 90px); overflow-y: auto; }
.linelist .ln { padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.linelist .ln:hover { background: #f5f7fb; }
.note { background: #fffaeb; border: 1px solid #f1e2b4; border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-bottom: 8px; }

/* print */
@media print {
  body { background: #fff; font-size: 12px; }
  .no-print, .topbar, .tabs, .project-head { display: none !important; }
  main { padding: 0; max-width: none; }
  .sheet { border: 0; padding: 0; }
  .card { border: 0; padding: 0; }
  .yourcall { display: none; }
  .mine td { background: none !important; }
}

/* fixes */
.brand { white-space: nowrap; }
.el.character, .el.paren { width: fit-content; }
@media (max-width: 600px) {
  .topbar { padding: 10px 14px; }
  .brand { font-size: 18px; }
  #topnav a, #topnav button { padding: 5px 6px; font-size: 11px; }
  main { padding: 18px 14px 70px; }
  .sheet { padding: 14px; }
  .sheet-head { grid-template-columns: 1fr; text-align: center; }
  .sheet-head > div { text-align: center !important; }
  h1 { font-size: 24px; }
}
