/* Theme: light blue, clean studio-software look. Change colours here only. */
:root {
  --bg: #f2f7fd; --card: #fff; --ink: #0f2742; --muted: #5d6f86; --line: #dce7f3;
  --accent: #1a73e8; --accent-dark: #0d4fa8; --accent-soft: #e8f1fd; --accent-ink: #fff;
  --nav-1: #0c3c78; --nav-2: #1667c9;
  --ok: #157347; --ok-bg: #dcf5e7; --err: #b42318; --err-bg: #fde8e7;
  --shadow: 0 1px 2px rgba(15,39,66,.06), 0 4px 14px rgba(15,39,66,.06);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 "Segoe UI", system-ui, sans-serif; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
.top { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px;
       padding: 10px 22px; background: linear-gradient(90deg, var(--nav-1), var(--nav-2)); color: #fff;
       box-shadow: 0 2px 12px rgba(12,60,120,.25); }
.top a { color: #e3eefc; text-decoration: none; }
.top a:hover { color: #fff; }
.top nav > a, details.menu summary { padding: 6px 10px; border-radius: 8px; transition: background .15s; }
.top nav > a:hover, details.menu summary:hover, details.menu[open] summary { background: rgba(255,255,255,.14); color: #fff; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: .01em; color: #fff !important; }
.brand::before { content: "SJ"; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: #fff; color: var(--nav-1); font-size: 13px; font-weight: 800; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.brand-logo { display: flex; align-items: center; background: #fff; border-radius: 10px; padding: 3px 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.brand-logo img { height: 46px; display: block; }
.login-logo { text-align: center; margin-bottom: 6px; }
.login-logo img { max-width: 260px; width: 100%; display: block; margin: 0 auto 6px; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; align-items: center; }
details.menu { position: relative; }
details.menu summary { cursor: pointer; color: #e3eefc; list-style: none; margin: 0; }
details.menu summary::after { content: " ▾"; font-size: 11px; opacity: .8; }
details.menu summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; top: 38px; left: 0; z-index: 30; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 6px; min-width: 200px; box-shadow: 0 12px 32px rgba(15,39,66,.18); }
/* long menus (More) must always fit: two columns, scroll inside if the screen is short, never off the right edge */
.menu-list { max-height: calc(100vh - 70px); overflow-y: auto; }
details.menu:last-of-type .menu-list { left: auto; right: 0; display: grid; grid-template-columns: repeat(2, minmax(190px, 1fr)); }
@media (max-width: 520px) { details.menu:last-of-type .menu-list { grid-template-columns: 1fr; } .menu-list { position: fixed; left: 8px !important; right: 8px !important; top: 60px; } }
.fw-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.fw-grid .svc-pick label { flex-wrap: nowrap; white-space: nowrap; }
.team-pick { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.team-pick label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; border: 1px solid var(--line);
  border-radius: 9px; padding: 4px 4px 4px 10px; }
.team-pick select { width: auto; padding: 4px 6px; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; margin-top: 4px; }
.svc-pick { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 5px 8px; }
.svc-pick label { flex: 1; margin: 0; font-weight: 500; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.svc-pick input[type=checkbox] { width: auto; }
.svc-pick input[name^=qty_] { width: 56px; padding: 4px 6px; }
.top .menu-list a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--ink); }
.top .menu-list a:hover { background: var(--accent-soft); color: var(--accent-dark); }
.me { display: flex; gap: 12px; align-items: center; font-size: 13px; color: #d5e4f8; }
.page { max-width: 1180px; margin: 26px auto; padding: 0 18px; }
.narrow { max-width: 420px; margin: 9vh auto; padding: 0 16px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }
h1 { font-size: 24px; margin: 0 0 18px; color: var(--ink); letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 26px 0 10px; color: var(--nav-1); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 16px;
  box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.grid > .card { margin-bottom: 0; }
.stat { position: relative; overflow: hidden; border-top: 4px solid var(--accent); transition: transform .15s, box-shadow .15s; }
.grid > .stat:nth-child(4n+2) { border-top-color: #0ea5b7; }
.grid > .stat:nth-child(4n+3) { border-top-color: #6366f1; }
.grid > .stat:nth-child(4n+4) { border-top-color: #f59e0b; }
a.stat:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,39,66,.12); }
.stat .num { font-size: 28px; font-weight: 700; color: var(--nav-1); }
.stat .lbl { color: var(--muted); font-size: 13px; }
label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 4px; color: #23405f; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid #cddcec; border-radius: 9px;
  font: inherit; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26,115,232,.18); }
button, .btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 0;
  border-radius: 9px; padding: 9px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  box-shadow: 0 1px 2px rgba(26,115,232,.3); transition: background .15s, box-shadow .15s; }
button:hover, .btn:hover { background: var(--accent-dark); color: #fff; }
button.secondary, .btn.secondary { background: var(--accent-soft); color: var(--accent-dark); box-shadow: none; }
button.secondary:hover, .btn.secondary:hover { background: #d4e5fb; color: var(--accent-dark); }
button.danger { background: var(--err); }
button.danger:hover { background: #8f1c13; }
button.link, button.link:hover { background: none; color: #e3eefc; padding: 0; font-weight: 400; box-shadow: none; }
form.inline { display: inline; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 140px; }
.actions { margin-top: 16px; display: flex; gap: 10px; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { background: #eaf2fb; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #3f5a7a; font-weight: 600; }
tr:last-child > td { border-bottom: 0; }
tr:hover > td { background: #f7fafe; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.flash { padding: 11px 15px; border-radius: 10px; margin-bottom: 14px; border-left: 4px solid currentColor; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--err-bg); color: var(--err); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #e6edf5; color: #3f5a7a; }
.badge.ok, .badge.active, .badge.verified { background: var(--ok-bg); color: var(--ok); }
.badge.disabled, .badge.failed { background: var(--err-bg); color: var(--err); }
/* login page */
body.login { background: radial-gradient(circle at 20% 10%, #dbeafe 0, transparent 45%),
  radial-gradient(circle at 85% 90%, #cfe3fb 0, transparent 40%), linear-gradient(160deg, #f5f9ff, #e3eefc); min-height: 100vh; }
body.login .card { padding: 30px; border-radius: 18px; box-shadow: 0 20px 50px rgba(12,60,120,.15); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-brand .logo { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; color: #fff;
  font-weight: 800; background: linear-gradient(135deg, var(--nav-1), var(--nav-2)); box-shadow: 0 6px 16px rgba(22,103,201,.35); }
.login-brand h1 { margin: 0; font-size: 22px; }
body.login button { width: 100%; padding: 11px; }
code { word-break: break-all; }
a.plain { color: inherit; text-decoration: none; }
a.plain:hover { border-color: var(--accent); }
.badge.new { background: #dbeafe; color: #1e40af; }
.badge.contacted, .badge.qualified { background: #fef3c7; color: #92400e; }
.badge.quotation { background: #ede9fe; color: #5b21b6; }
.badge.booked { background: var(--ok-bg); color: var(--ok); }
.badge.lost { background: #e7e5e4; color: #57534e; }
.two-col { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
dl.facts dt { color: var(--muted); font-size: 13px; }
dl.facts dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; background: #f1f6fc; }
.timeline li.in { background: #fff; border: 1px solid var(--line); }
.timeline li.out { background: #eef6ff; border: 1px solid #bfdbfe; }
.timeline li.internal { background: transparent; border: 1px dashed var(--line); color: var(--muted); font-size: 13px; }
.timeline .meta { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.timeline .body { white-space: pre-wrap; }
.warn { background: #fef3c7; color: #92400e; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.overdue { color: var(--err); font-weight: 600; }
textarea { min-height: 70px; }
.badge.enquiry { background: #dbeafe; color: #1e40af; }
.badge.in_production { background: #fef3c7; color: #92400e; }
.badge.completed, .badge.closed { background: #e0e7ff; color: #3730a3; }
.badge.cancelled { background: #e7e5e4; color: #57534e; }
.badge.q-draft { background: #e6edf5; }
.badge.q-sent { background: #ede9fe; color: #5b21b6; }
.badge.q-accepted { background: var(--ok-bg); color: var(--ok); }
.badge.q-rejected { background: var(--err-bg); color: var(--err); }
.badge.q-superseded { background: #f5f5f4; color: #a8a29e; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.checks label { font-weight: 400; margin: 0; display: flex; gap: 6px; align-items: center; }
.checks input { width: auto; }
.fn { border-bottom: 1px solid var(--line); padding: 10px 0; }
.fn.cancelled { opacity: .55; text-decoration: line-through; }
.crew-row { align-items: center; padding: 6px 0; margin: 0; }
.crew-row.cancelled { opacity: .5; }
.crew-row input, .crew-row select { padding: 6px 8px; }
details > summary { margin-top: 6px; }
pre.msg { white-space: pre-wrap; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font: 13px/1.5 "Segoe UI", system-ui, sans-serif; }
.badge.pr-draft { background: #e6edf5; }
.badge.pr-shared { background: #dbeafe; color: #1e40af; }
.badge.pr-submitted { background: #fef3c7; color: #92400e; }
.badge.pr-approved { background: var(--ok-bg); color: var(--ok); }
.badge.pr-superseded { background: #f5f5f4; color: #a8a29e; }
.badge.ed-new, .badge.ed-assigned { background: #e6edf5; }
.badge.ed-in_progress { background: #dbeafe; color: #1e40af; }
.badge.ed-qc, .badge.ed-revision { background: #fef3c7; color: #92400e; }
.badge.ed-client_review { background: #ede9fe; color: #5b21b6; }
.badge.ed-final, .badge.ed-delivered { background: var(--ok-bg); color: var(--ok); }
.badge.ed-cancelled { background: #f5f5f4; color: #a8a29e; }
.badge.al-design, .badge.al-changes { background: #fef3c7; color: #92400e; }
.badge.al-client_review { background: #ede9fe; color: #5b21b6; }
.badge.al-approved, .badge.al-printing, .badge.al-framing { background: #dbeafe; color: #1e40af; }
.badge.al-received, .badge.al-ready, .badge.al-delivered { background: var(--ok-bg); color: var(--ok); }
.badge.al-cancelled { background: #f5f5f4; color: #a8a29e; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 110px; gap: 10px; align-items: center; margin: 6px 0; }
.bar-track { background: #eaf2fb; border-radius: 6px; height: 18px; overflow: hidden; }
.bar-fill { background: var(--accent); height: 100%; border-radius: 6px; }
.bar-num { font-size: 13px; }
@media (max-width: 640px) { .bar-row { grid-template-columns: 90px 1fr 80px; } }
.badge.mk-draft { background: #e6edf5; }
.badge.mk-awaiting_approval { background: #fef3c7; color: #92400e; }
.badge.mk-approved { background: #dbeafe; color: #1e40af; }
.badge.mk-published { background: var(--ok-bg); color: var(--ok); }
.badge.mk-rejected { background: var(--err-bg); color: var(--err); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.ph { background: var(--card); border: 2px solid var(--line); border-radius: 8px; overflow: hidden; }
.ph.sel { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok-bg); }
.ph img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; background: #e6edf5; cursor: zoom-in; }
.ph .pbody { padding: 6px 8px; font-size: 12px; }
.ph .pbody input[type=text], .ph .pbody textarea { font-size: 12px; padding: 4px 6px; min-height: 0; }
.ph .pname { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick { display: flex; align-items: center; gap: 6px; font-weight: 600; margin: 4px 0; }
.pick input { width: 20px; height: 20px; }
.sticky { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 0; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); display: none; align-items: center; justify-content: center; z-index: 50; }
.lightbox img { max-width: 96vw; max-height: 92vh; }
.lightbox.open { display: flex; }
@media (max-width: 640px) { .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; } }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-h { font-size: 12px; color: var(--muted); text-transform: uppercase; padding: 4px; }
.cal-d { background: var(--card); border: 1px solid var(--line); border-radius: 6px; min-height: 92px; padding: 4px; overflow: hidden; }
.cal-d.empty { background: transparent; border-color: transparent; }
.cal-d.today { border-color: var(--accent); }
.cal-n { font-size: 12px; font-weight: 700; }
.cal-e { display: block; font-size: 11px; line-height: 1.3; padding: 2px 4px; margin-top: 2px; border-radius: 4px;
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #dbeafe; color: #1e40af; }
.cal-e.booked, .cal-e.in_production { background: var(--ok-bg); color: var(--ok); }
@media (max-width: 640px) { .cal-d { min-height: 60px; } .cal-e { font-size: 10px; } }
.muted { color: var(--muted); font-size: 13px; }
pre.json { white-space: pre-wrap; word-break: break-all; font-size: 12px; margin: 0; max-width: 360px; }
details summary { cursor: pointer; color: var(--accent); font-size: 13px; }
@media (max-width: 640px) { .top { padding: 10px 16px; } .me { width: 100%; } }

/* phone quotation builder */
.seg { display: flex; gap: 6px; margin-bottom: 6px; }
.seg button { flex: 1; background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: none; padding: 9px 6px; font-size: 13px; }
.seg button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.fnrow { border: 1px solid var(--line); border-radius: 12px; padding: 8px; margin-bottom: 8px; background: #fff; }
.fnrow .team { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.fnrow .team label { display: flex; align-items: center; gap: 4px; margin: 0; font-weight: 500; font-size: 13px; }
.fnrow .team select { width: auto; padding: 4px 6px; font-size: 14px; }
.chk { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; margin: 4px 0 !important; }
.chk input { width: auto; }
