:root {
  --bg: #121014;
  --bg2: #1b181f;
  --card: #201c25;
  --card2: #29242f;
  --line: #3a3342;
  --text: #f1ece6;
  --muted: #a9a0ae;
  --faint: #7d7483;
  --accent: #f2c14e;
  --danilo: #e0803a;
  --maja: #4f9bd9;
  --must: #e5484d;
  --want: #f2c14e;
  --maybe: #8e9bb0;
  --no: #5b5360;
  --ok: #46a758;
  --warn: #f2994a;
  --radius: 14px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.boot { padding: 40vh 16px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(18, 16, 20, 0.94);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: calc(var(--sat) + 8px) 12px 8px;
}
.brand { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.brand h1 { font-size: 17px; margin: 0; letter-spacing: 0.3px; }
.brand h1 span { color: var(--accent); }
.whoami { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.dnav { display: none; gap: 4px; }
.dnav button, .bnav button {
  border: 0; background: transparent; color: var(--muted); padding: 8px 12px; border-radius: 10px; font-weight: 600;
}
.dnav button[aria-current="page"] { background: var(--card2); color: var(--text); }
.bnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: rgba(18, 16, 20, 0.97);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(var(--sab) + 6px);
}
.bnav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; padding: 6px; }
.bnav button svg { width: 22px; height: 22px; }
.bnav button[aria-current="page"] { color: var(--accent); }
main { padding: 12px 12px calc(var(--sab) + 84px); max-width: 1200px; margin: 0 auto; }

@media (min-width: 900px) {
  .bnav { display: none; }
  .dnav { display: flex; }
  main { padding-bottom: 40px; }
}

/* ---------- avatars ---------- */
.av {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; font-size: 11px; font-weight: 800; color: #111; flex: none;
}
.av.danilo { background: var(--danilo); }
.av.maja { background: var(--maja); }
.av.lg { width: 30px; height: 30px; font-size: 14px; }

/* ---------- login ---------- */
.login { max-width: 420px; margin: 0 auto; padding: calc(var(--sat) + 48px) 20px 40px; }
.login h1 { font-size: 30px; margin: 0 0 4px; }
.login h1 span { color: var(--accent); }
.login p { color: var(--muted); margin: 0 0 24px; }
.login label { display: block; font-weight: 600; margin: 16px 0 6px; }
.login input {
  width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); font-size: 17px;
}
.login input.code { letter-spacing: 8px; font-size: 26px; text-align: center; font-variant-numeric: tabular-nums; }
.who { display: flex; gap: 10px; }
.who button {
  flex: 1; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); font-weight: 600;
}
.who button[aria-pressed="true"] { border-color: var(--accent); background: var(--card2); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); font-weight: 600;
}
.btn.primary { background: var(--accent); color: #1a1408; border-color: var(--accent); }
.btn.block { width: 100%; margin-top: 18px; padding: 14px; font-size: 16px; }
.btn:disabled { opacity: 0.5; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.msg { margin-top: 14px; padding: 12px; border-radius: 12px; background: var(--card); font-size: 14px; }
.msg.err { background: #3a1d22; color: #ffb4b8; }
.msg.warn { background: #3a2c17; color: #ffd59a; }
.linkbtn { background: none; border: 0; color: var(--accent); padding: 8px 0; }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; gap: 8px; margin-top: 8px; }
.search { flex: 1; position: relative; }
.search input {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); font-size: 16px;
}
.fbtn { white-space: nowrap; }
.fbtn .n { background: var(--accent); color: #111; border-radius: 9px; padding: 0 6px; font-size: 12px; }
.quick { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2);
  font-size: 13px; color: var(--muted); font-weight: 600;
}
.chip[aria-pressed="true"] { background: var(--text); color: #111; border-color: var(--text); }
.filters {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 0 4px;
}
.filters label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.filters select {
  padding: 9px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); font-size: 15px; width: 100%;
}
.filters .actions { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; }
@media (min-width: 700px) { .filters { grid-template-columns: repeat(4, 1fr); } }
.resultline { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; margin: 4px 2px 10px; }

/* ---------- film cards ---------- */
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 760px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1150px) { .grid { grid-template-columns: 1fr 1fr 1fr; } }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
}
.card.both { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 6px 24px rgba(242, 193, 78, 0.12); }
.card.nope { opacity: 0.6; }
.chead { display: flex; gap: 12px; padding: 12px; }
.thumb {
  flex: none; width: 112px; aspect-ratio: 16 / 10; border-radius: 10px; background: var(--card2) center/cover no-repeat;
  overflow: hidden; position: relative; border: 0; padding: 0;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ctitle { min-width: 0; flex: 1; }
.ctitle h2 { font-size: 16px; line-height: 1.25; margin: 0 0 2px; }
.ctitle .alt { font-size: 13px; color: var(--muted); font-style: italic; }
.meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.badge {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--card2); color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.3px;
}
.badge.sec { color: var(--accent); }
.badge.guest { background: #2d2440; color: #cdb8ff; }
.badge.prem { background: #1f2c27; color: #9fe0b6; }
.badge.both { background: var(--accent); color: #111; }

.picks { display: flex; align-items: center; gap: 8px; padding: 0 12px 10px; flex-wrap: wrap; }
.seg { display: flex; flex: 1; min-width: 230px; background: var(--bg2); border-radius: 11px; padding: 3px; gap: 3px; }
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--muted); padding: 8px 2px; border-radius: 8px; font-weight: 700; font-size: 13px;
}
.seg button[aria-pressed="true"][data-r="must"] { background: var(--must); color: #fff; }
.seg button[aria-pressed="true"][data-r="want"] { background: var(--want); color: #111; }
.seg button[aria-pressed="true"][data-r="maybe"] { background: var(--maybe); color: #111; }
.seg button[aria-pressed="true"][data-r="no"] { background: var(--no); color: #fff; }
.partner { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.partner .pr { font-weight: 700; }
.pr.must { color: var(--must); } .pr.want { color: var(--want); } .pr.maybe { color: var(--maybe); } .pr.no { color: var(--faint); }

.short { padding: 0 12px; font-size: 14px; color: #ddd5d0; }
.short p { margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card.open .short p { -webkit-line-clamp: unset; display: block; }
.more { display: none; padding: 0 12px; }
.card.open .more { display: block; }
.hero { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; margin: 10px 0 4px; background: var(--card2); }
.syn { white-space: pre-line; font-size: 14px; margin: 8px 0; color: #e6dfda; }
.langtoggle { display: flex; gap: 6px; margin-top: 8px; }
dl.crew { display: grid; grid-template-columns: max-content 1fr; gap: 3px 10px; font-size: 13px; margin: 10px 0; }
dl.crew dt { color: var(--faint); }
dl.crew dd { margin: 0; }
.stills { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.stills img { height: 90px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; flex: none; background: var(--card2); }
.links { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; margin: 8px 0; }
.toggle { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 8px 12px; text-align: left; font-size: 14px; }

.shows { border-top: 1px solid var(--line); margin-top: 8px; }
.show {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.show:last-child { border-bottom: 0; }
.show.dim { opacity: 0.45; }
.show .when { font-weight: 700; font-variant-numeric: tabular-nums; }
.show .where { color: var(--muted); font-size: 13px; grid-column: 1; }
.show .side { grid-row: 1 / span 2; grid-column: 2; display: flex; align-items: center; gap: 6px; }
.show .st { font-size: 11px; font-weight: 700; text-transform: uppercase; }
.st.sold { color: var(--must); } .st.few { color: var(--warn); }
.show .tags { grid-column: 1; display: flex; gap: 4px; flex-wrap: wrap; }
.lockbtn {
  width: 34px; height: 34px; border-radius: 50%; border: 2px dashed var(--line); background: transparent;
  font-weight: 800; font-size: 12px; color: var(--muted); padding: 0;
}
.lockbtn.danilo[aria-pressed="true"] { background: var(--danilo); border: 2px solid var(--danilo); color: #111; }
.lockbtn.maja[aria-pressed="true"] { background: var(--maja); border: 2px solid var(--maja); color: #111; }
.lockbtn.planned { border-style: solid; }
.lockbtn.danilo.planned { border-color: var(--danilo); color: var(--danilo); }
.lockbtn.maja.planned { border-color: var(--maja); color: var(--maja); }
.tix { font-size: 13px; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* ---------- plan ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.panel h3 { margin: 0 0 6px; font-size: 15px; }
.planhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.score { font-size: 13px; color: var(--muted); }
.score b { color: var(--text); font-size: 18px; }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.settings label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.settings input[type="number"] { padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); width: 100%; font-size: 16px; }
.settings .cb { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
@media (min-width: 700px) { .settings { grid-template-columns: repeat(3, 1fr); } }
.proposal { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.proposal:first-of-type { border-top: 0; }
.days { display: grid; gap: 12px; }
@media (min-width: 900px) { .days { grid-template-columns: 1fr 1fr; } }
.day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.day.off { border-color: #6f5bd3; }
.dayhead { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; background: var(--card2); gap: 8px; }
.dayhead h3 { margin: 0; font-size: 15px; }
.dayhead .dv { font-size: 12px; color: var(--muted); }
.offbadge { background: #6f5bd3; color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.lanes { position: relative; margin: 10px 12px 2px; }
.lane { position: relative; height: 18px; background: var(--bg2); border-radius: 5px; margin-bottom: 4px; }
.lane .blk { position: absolute; top: 0; bottom: 0; border-radius: 5px; min-width: 4px; }
.lane.danilo .blk { background: var(--danilo); }
.lane.maja .blk { background: var(--maja); }
.lane .blk.locked { box-shadow: inset 0 0 0 2px #fff; }
.lane .lbl { position: absolute; left: -2px; top: 1px; font-size: 10px; font-weight: 800; color: var(--faint); transform: translateX(-100%); padding-right: 4px; }
.lanes { padding-left: 14px; }
.ticks { display: flex; justify-content: space-between; font-size: 10px; color: var(--faint); margin: 0 0 4px 14px; padding: 0 12px; }
.slots { padding: 4px 0 6px; }
.slot { display: grid; grid-template-columns: 58px 1fr auto; gap: 8px; padding: 8px 12px; align-items: center; }
.slot .t { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; line-height: 1.2; }
.slot .t small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.slot .f { min-width: 0; }
.slot .f b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot .f .sub { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.lockbtn svg { display: block; margin: auto; }
.slot.danilo { border-left: 4px solid var(--danilo); }
.slot.maja { border-left: 4px solid var(--maja); }
.trans { margin: 0 12px; padding: 4px 10px 4px 58px; font-size: 12px; color: var(--muted); position: relative; }
.trans.handover { color: #9fe0b6; font-weight: 600; }
.trans.bad { color: #ffb4b8; font-weight: 600; }
.trans.parallel { color: #c7bbff; }
.rv { font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 6px; }
.rv.must { background: var(--must); color: #fff; } .rv.want { background: var(--want); color: #111; } .rv.maybe { background: var(--maybe); color: #111; }
.missed li { margin: 4px 0; font-size: 14px; }
.missed { padding-left: 18px; margin: 6px 0 0; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- info ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--sab) + 84px); z-index: 50;
  background: var(--text); color: #111; padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.4); max-width: calc(100% - 32px);
}
@media (min-width: 900px) { .toast { bottom: 24px; } }
.sync { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.sync.off { background: var(--must); }
