/* =====================================================================
   RED TAPE ERP — styles
   Brand colours match the Red Tape website (css/style.css).
   ===================================================================== */
:root {
  --red: #c8161d;
  --red-bright: #e8262d;
  --red-soft: #fdecec;
  --ink: #141414;
  --charcoal: #1f1f1f;
  --grey-50: #f6f6f5;
  --grey-100: #eeeeec;
  --grey-200: #e2e2df;
  --grey-300: #cfcfcb;
  --grey-500: #85857f;
  --grey-700: #4a4a46;
  --white: #fff;
  --green: #1f8a4c;
  --green-soft: #e6f4ec;
  --amber: #b26a00;
  --amber-soft: #fff3df;
  --blue: #2357c6;
  --blue-soft: #e8eefb;

  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --display: "Poppins", "Inter", "Segoe UI", sans-serif;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 18px rgba(0,0,0,.05);
  --side: 232px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--grey-50); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--grey-500); }
.small { font-size: 12px; }
.right { text-align: right; }
.hide { display: none !important; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #fff; padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.side .brand { padding: 4px 8px 22px; }
.side .brand img { width: 150px; display: block; }
.side .brand span { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #9a9a95; margin-top: 8px; }
.side a.nav { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: #cfcfca; font-weight: 500; }
.side a.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.side a.nav:hover { background: #262626; color: #fff; }
.side a.nav.on { background: var(--red); color: #fff; }
.side .grow { flex: 1; }
.side .brand .mark { display: none; width: 30px; }
/* In the plan editor the sidebar folds to icons to give the screen picker room. */
body.slim { --side: 68px; }
body.slim .side { padding: 22px 10px; align-items: center; }
body.slim .side .brand { padding: 4px 0 22px; }
body.slim .side .brand img:not(.mark), body.slim .side .brand span, body.slim .side a.nav span, body.slim .side .who { display: none; }
body.slim .side .brand .mark { display: block; }
body.slim .side a.nav { padding: 11px; }
.side .who { font-size: 12px; color: #9a9a95; padding: 12px 12px 4px; border-top: 1px solid #2a2a2a; }
.side .who b { display: block; color: #fff; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .who-acts { display: flex; gap: 6px; margin-top: 8px; }
.side .who-acts button { flex: 1; background: #222; border: 1px solid #333; color: #cfcfca; border-radius: 8px; padding: 6px 4px; font-size: 12px; font-weight: 600; cursor: pointer; }
.side .who-acts button:hover { background: #2c2c2c; color: #fff; }

/* ---------- sign in / setup / change password */
body.authing .shell, body.authing .tabbar { display: none; }
#auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--grey-50); }
.auth-card { width: min(400px, 100%); background: var(--white); border: 1px solid var(--grey-200); border-radius: 18px; box-shadow: var(--shadow); padding: 28px 26px; }
.auth-logo { width: 150px; display: block; }
.auth-sub { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--grey-500); margin: 6px 0 22px; font-weight: 700; }
.auth-card h2 { font-size: 21px; }
.auth-card p { margin: 6px 0 18px; font-size: 13px; line-height: 1.45; }
.auth-card .banner { background: var(--red-soft); color: var(--red); border-color: #f5c6c8; }
.auth-go { width: 100%; justify-content: center; padding: 11px; margin-top: 6px; font-size: 15px; }
.me-card { display: flex; align-items: center; gap: 12px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 18px; flex: none; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 18px 28px; background: var(--white); border-bottom: 1px solid var(--grey-200); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.topbar h1 { font-size: 22px; font-weight: 700; }
.topbar .sp { flex: 1; }
.page { padding: 24px 28px 60px; }

/* ---------- controls */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--grey-300); background: var(--white); border-radius: 10px; padding: 8px 14px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--grey-500); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-bright); border-color: var(--red-bright); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--grey-100); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

label.f { display: block; font-size: 12px; font-weight: 600; color: var(--grey-700); margin-bottom: 12px; }
label.f > span { display: block; margin-bottom: 5px; }
.inp, select.inp, textarea.inp { width: 100%; border: 1px solid var(--grey-300); background: var(--white); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 14px; font-weight: 500; outline: none; }
.inp:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(20,20,20,.08); }
textarea.inp { resize: vertical; min-height: 70px; line-height: 1.45; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
input[type=date].inp { padding-right: 4px; }

.seg { display: flex; background: var(--grey-100); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { flex: 1; white-space: nowrap; border: 0; background: transparent; padding: 7px 10px; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--grey-700); }
.seg button.on { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg.red button.on { background: var(--red); color: #fff; }

.days { display: flex; gap: 5px; }
.days button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--grey-300); background: var(--white); font-weight: 700; font-size: 12px; cursor: pointer; }
.days button.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; background: var(--grey-100); color: var(--grey-700); white-space: nowrap; }
.chip.led { background: var(--blue-soft); color: var(--blue); }
.chip.smd { background: var(--amber-soft); color: var(--amber); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { border: 1px solid var(--grey-300); background: var(--white); border-radius: 99px; padding: 5px 12px; font-weight: 600; font-size: 12.5px; cursor: pointer; }
.filters button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.status { display: inline-block; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.status.Proposed { background: var(--blue-soft); color: var(--blue); }
.status.Approved { background: var(--amber-soft); color: var(--amber); }
.status.Final { background: var(--green-soft); color: var(--green); }
.status.Invoiced, .status.Paid { background: #ece8fb; color: #5a3fc0; }
.status.Cancelled { background: var(--grey-100); color: var(--grey-500); text-decoration: line-through; }

/* ---------- cards & tables */
.card { background: var(--white); border: 1px solid var(--grey-200); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .hd { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--grey-100); }
.card > .hd h3 { font-size: 15px; font-weight: 700; }
.card > .bd { padding: 16px; }
.card + .card { margin-top: 14px; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--grey-500); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--grey-200); background: var(--grey-50); position: sticky; top: 0; }
table.t td { padding: 11px 12px; border-bottom: 1px solid var(--grey-100); vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #fafaf8; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 40px; text-align: center; color: var(--grey-500); }

/* ---------- dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.kpi { padding: 18px; }
.kpi .l { font-size: 12px; font-weight: 700; color: var(--grey-500); text-transform: uppercase; letter-spacing: .06em; }
.kpi .v { font-family: var(--display); font-size: 26px; font-weight: 700; margin-top: 6px; }
.kpi .s { font-size: 12.5px; color: var(--grey-500); margin-top: 4px; }
.kpi.red { background: var(--red); color: #fff; border-color: var(--red); }
.kpi.red .l, .kpi.red .s { color: rgba(255,255,255,.8); }
.grid2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding: 10px 4px 0; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .stack { width: 100%; max-width: 46px; display: flex; flex-direction: column-reverse; border-radius: 6px 6px 0 0; overflow: hidden; min-height: 2px; }
.bars .stack i { display: block; }
.bars .m { font-size: 11px; color: var(--grey-500); font-weight: 600; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--grey-700); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; margin-bottom: 10px; }
.hbar .track { grid-column: 1 / -1; height: 6px; background: var(--grey-100); border-radius: 9px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--red); border-radius: 9px; }

/* ---------- plan editor */
.sec-t { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--grey-500); margin: 2px 0 12px; }
.hint { font-size: 12px; color: var(--grey-500); margin-top: -6px; margin-bottom: 12px; line-height: 1.4; }
.picker-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--grey-100); }
.picker-tools .inp { max-width: 220px; }

.ed2 { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.ed2-main .card + .card { margin-top: 14px; }
.ed2-side { position: sticky; top: 86px; }
.ed2-side .card + .card { margin-top: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0 12px; }
.grid4 .span2 { grid-column: span 2; }
.grid4 .span3 { grid-column: span 3; }
.grid4 label.f { margin-bottom: 10px; }
.grid4 .seg button { padding: 8px 4px; }

.shuttle { display: grid; grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr); gap: 10px; align-items: stretch; }
.sbox { border: 1px solid var(--grey-300); border-radius: var(--radius-sm); overflow: hidden; display: flex; flex-direction: column; }
.shd { background: var(--grey-50); border-bottom: 1px solid var(--grey-200); padding: 8px 12px; font-weight: 700; font-size: 13px; }
.slist { height: 300px; overflow: auto; padding: 4px 0; user-select: none; outline: none; }
.sbox:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(20,20,20,.08); }
.srow2 { display: flex; align-items: center; gap: 9px; padding: 6px 12px; cursor: pointer; font-size: 13.5px; }
.srow2:hover { background: var(--grey-50); }
.srow2.hi { background: var(--red); color: #fff; }
.srow2.hi .muted, .srow2.hi small { color: rgba(255,255,255,.8); }
.srow2 > span { flex: 1; min-width: 0; }
.srow2 small { color: var(--grey-500); font-weight: 600; font-size: 11.5px; }
.srow2.none { opacity: .45; }
.sempty { padding: 24px 12px; text-align: center; color: var(--grey-500); font-size: 13px; }
.sbtns { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.sbtns button { height: 38px; border: 1px solid var(--grey-300); background: var(--white); border-radius: 9px; font-size: 20px; font-weight: 700; cursor: pointer; line-height: 1; }
.sbtns button:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

.pricebar { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.pricebar > div { min-width: 0; }
.pricebar .inp { width: 150px; }
.lbl { font-size: 12px; font-weight: 600; color: var(--grey-700); margin-bottom: 5px; }
.days-sh { max-width: 560px; }
.days-sh .slist { height: auto; min-height: 112px; max-height: 230px; }
.days-sh .srow2 { padding: 5px 12px; }
.days-sh .sbtns button { height: 30px; font-size: 17px; }
details.custom { border-top: 1px solid var(--grey-100); }
details.custom > summary { display: flex; align-items: baseline; gap: 12px; padding: 14px 16px; cursor: pointer; list-style: none; }
details.custom > summary::-webkit-details-marker { display: none; }
details.custom > summary::before { content: "▸"; color: var(--grey-500); }
details.custom[open] > summary::before { content: "▾"; }
details.custom > summary h3 { font-size: 15px; }
table.ct td { padding: 5px 12px; }
table.ct tr.cityh td { font-family: var(--display); font-weight: 800; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--grey-500); background: var(--grey-50); padding: 7px 12px; }
table.ct .seg { display: inline-flex; }
table.ct .seg button { padding: 5px 10px; font-size: 12.5px; }
table.ct .seg button:disabled { opacity: .3; cursor: not-allowed; }
.sdbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0 8px; }
.sdbar .inp { padding: 6px 8px; }
table.sdt th { padding: 7px 10px; }
table.sdt td { padding: 4px 10px; }
.sdin { width: 90px; text-align: right; padding: 5px 8px; font-weight: 700; }
.sdin:not(:placeholder-shown) { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.sdin::placeholder { font-weight: 500; color: var(--grey-500); }
div.opts { margin-top: 14px; border-top: 1px solid var(--grey-100); padding-top: 12px; }
.opts-t { font-weight: 700; font-size: 13px; color: var(--grey-700); }
details.opts { margin-top: 14px; border-top: 1px solid var(--grey-100); padding-top: 12px; }
details.opts summary, details.side-det summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--grey-700); }
details.side-det summary { padding: 13px 16px; }
details.side-det .bd { padding-top: 0; }

.sigs { display: flex; gap: 4px; flex-wrap: wrap; }
.sigs .btn { padding: 5px 9px; font-size: 12.5px; }
.more-menu { position: relative; }
.more-menu summary { list-style: none; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu > div { position: absolute; right: 0; top: 100%; margin-top: 6px; background: var(--white); border: 1px solid var(--grey-200); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 170px; z-index: 40; }
.more-menu > div button { display: flex; gap: 8px; align-items: center; width: 100%; border: 0; background: none; padding: 9px 10px; border-radius: 8px; font-weight: 600; cursor: pointer; text-align: left; }
.more-menu > div button:hover { background: var(--grey-100); }
.more-menu > div button svg { width: 15px; height: 15px; }
.more-menu .danger { color: var(--red); }

.sum .big { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.sum .big small { font-size: 13px; font-weight: 600; color: var(--grey-500); margin-left: 4px; }
.sum dl { display: grid; grid-template-columns: 1fr auto; gap: 7px 10px; margin: 14px 0 0; }
.sum dt { color: var(--grey-700); }
.sum dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.sum dd.neg { color: var(--red); }
.sum dd.pos { color: var(--green); }
.sum .tot { border-top: 1px solid var(--grey-200); padding-top: 9px; font-weight: 800; }
.sum .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.sum .stats div { background: var(--grey-50); border-radius: 10px; padding: 9px 10px; }
.sum .stats b { display: block; font-family: var(--display); font-size: 17px; }
.sum .stats span { font-size: 11.5px; color: var(--grey-500); font-weight: 600; }
.mini { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini td { padding: 6px 0; border-bottom: 1px solid var(--grey-100); }
.mini td.n { text-align: right; font-variant-numeric: tabular-nums; }
.mini tr.c td { font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--grey-500); padding-top: 10px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 16px; border-left: 2px solid var(--grey-200); position: relative; font-size: 12.5px; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--grey-300); }
.timeline li b { font-weight: 700; }
.timeline li .muted { display: block; font-size: 11.5px; }

.photos { display: grid; gap: 10px; }
.ph-mall { display: grid; grid-template-columns: 1fr 64px 64px; gap: 8px; align-items: center; font-size: 12.5px; font-weight: 600; }
.ph-slot { width: 64px; height: 48px; border-radius: 8px; border: 1px dashed var(--grey-300); background: var(--grey-50) center/cover no-repeat; cursor: pointer; display: grid; place-items: center; color: var(--grey-500); font-size: 18px; position: relative; }
.ph-slot.has { border-style: solid; color: transparent; }
.ph-slot .x { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 11px; border: 0; cursor: pointer; display: none; line-height: 18px; padding: 0; }
.ph-slot.has:hover .x { display: block; }
.ph-slot.def { border-style: dotted; }

/* ---------- network admin */
.net-mall { margin-bottom: 14px; }
.net-mall .hd { flex-wrap: wrap; }
.net-mall .fields { display: grid; grid-template-columns: 2fr 1.2fr 1fr .7fr auto; gap: 10px; align-items: end; padding: 14px 16px 0; }
.net-mall .fields label.f { margin-bottom: 0; }
.net-mall table.t td { padding: 6px 8px; }
.net-mall table.t .inp { padding: 6px 8px; font-size: 13px; }
.dayprice { font-family: var(--display); font-weight: 700; }

/* ---------- misc */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 600; opacity: 0; transition: .25s; z-index: 100; pointer-events: none; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); }
.modal-bg { position: fixed; inset: 0; background: rgba(10,10,10,.45); display: grid; place-items: center; z-index: 90; padding: 16px; }
.modal { background: var(--white); border-radius: 16px; width: min(460px, 100%); padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h3 { font-size: 18px; margin-bottom: 8px; }
.modal p { color: var(--grey-700); margin: 0 0 14px; line-height: 1.5; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.banner { background: var(--amber-soft); color: var(--amber); border: 1px solid #f3d9a8; padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: 13px; margin-bottom: 14px; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--white); box-shadow: -10px 0 40px rgba(0,0,0,.15); z-index: 80; padding: 22px; overflow: auto; transform: translateX(100%); transition: transform .25s; }
.drawer.on { transform: none; }
.drawer h3 { margin-bottom: 16px; }
.combo { position: relative; }
.combo .list { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--white); border: 1px solid var(--grey-300); border-radius: 10px; box-shadow: var(--shadow); max-height: 260px; overflow: auto; z-index: 30; display: none; }
.combo.open .list { display: block; }
.combo .list div { padding: 8px 10px; cursor: pointer; font-weight: 500; }
.combo .list div:hover, .combo .list div.hi { background: var(--grey-100); }
.combo .inp { padding-right: 30px; }
.combo .caret { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; width: 24px; height: 24px; border-radius: 6px; cursor: pointer; color: var(--grey-500); font-size: 13px; }
.combo .caret:hover { background: var(--grey-100); color: var(--ink); }
.combo .list div.cur { font-weight: 700; color: var(--red); }
.combo .list { max-height: 340px; min-width: 300px; right: auto; }
.combo .list div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo .list div.add { color: var(--red); font-weight: 700; border-top: 1px solid var(--grey-100); }

/* ---------- phone-only parts (hidden on the desktop) */
.tabbar, .mbar, .m-only, .more-menu > div button.m-only { display: none; }
.grid2.g-even { grid-template-columns: 1fr 1fr; }
.mlink { display: flex; align-items: center; gap: 12px; padding: 15px 16px; text-decoration: none; border-bottom: 1px solid var(--grey-100); }
.mlink:last-child { border-bottom: 0; }
.mlink > div { flex: 1; }
.mlink > span { font-size: 22px; color: var(--grey-500); }

@media (max-width: 1180px) {
  .ed2 { grid-template-columns: 1fr; }
  .ed2-side { position: static; }
}
@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; }
  .side .brand { padding: 0 12px 0 0; } .side .brand span, .side .grow { display: none; }
  .side .who { border: 0; padding: 0; margin-left: auto; } .side .who b, .side .who #meRole { display: none; }
  .side .who-acts { margin: 0; }
  .side a.nav { padding: 8px 10px; } .side a.nav span { display: none; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .page { padding: 16px; } .topbar { padding: 14px 16px; }
  .net-mall .fields { grid-template-columns: 1fr 1fr; }
}

/* ---------- Customise plan → "Choose screens" (pick exact screen locations in a mall) */
tr.ct-pick > td { background: var(--grey-50, #fafafa); padding: 12px 14px 14px; }
.pick-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.pick-tools .sp { flex: 1; }
.pick-list { width: 100%; border-collapse: collapse; background: var(--white, #fff); border: 1px solid var(--grey-200, #e5e7eb); border-radius: 8px; overflow: hidden; font-size: 13px; }
.pick-list th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--grey-500); padding: 8px 10px; background: var(--grey-50, #fafafa); border-bottom: 1px solid var(--grey-200, #e5e7eb); }
.pick-list td { padding: 7px 10px; border-bottom: 1px solid var(--grey-100); vertical-align: middle; }
.pick-list tr:last-child td { border-bottom: 0; }
.pick-list .n { text-align: right; font-variant-numeric: tabular-nums; }
.pick-list tr.pick.on td { background: #fff5f5; }
.pick-list tr.pick.on td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.pick-list tr.pick.on label { font-weight: 600; }
.pick-list label { cursor: pointer; display: block; }
.pick-list input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--red); cursor: pointer; }
.pick-q { display: flex; gap: 6px; align-items: center; font-size: 12px; }
.pick-q .inp { width: 64px; padding: 3px 6px; }

/* second row of dashboard tiles: not-confirmed Finals + Proposed drafts */
.kpis.kpis2 { grid-template-columns: repeat(2, 1fr); margin-top: -4px; }
.kpis2 .kpi { padding: 14px 18px; color: inherit; text-decoration: none; }
.kpis2 .kpi .v { font-size: 21px; }
.kpi.amber { border-left: 4px solid #d97706; }
.dash-note { font-size: 12.5px; line-height: 1.55; color: var(--grey-700); background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 10px 14px; margin: -2px 0 14px; }
.dash-note b { color: var(--grey-900, #111); }
@media (max-width: 760px) { .kpis.kpis2 { grid-template-columns: 1fr; } }

/* ---------- dashboard filters + last-year comparison */
.dash-f { margin-bottom: 10px; }
.dash-f .bd { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.dash-per { display: flex; gap: 6px; align-items: center; }
.dash-per .inp { width: auto; padding: 6px 10px; }
.dash-cmp { display: flex; gap: 6px; align-items: center; font-weight: 600; font-size: 13px; cursor: pointer; }
.dash-cmp input { width: 16px; height: 16px; accent-color: var(--red); }
.dash-basis { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.dash-cap { margin: 0 0 12px; font-size: 13px; }
.chg { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.chg.up { color: #15803d; background: #dcfce7; }
.chg.down { color: #b91c1c; background: #fee2e2; }
.chg.flat { color: var(--grey-500); background: var(--grey-100); }
.bars2 .pair { display: flex; align-items: flex-end; gap: 3px; height: 100%; width: 100%; max-width: 54px; justify-content: center; }
.bars2 .pair i { display: block; flex: 1; max-width: 24px; min-height: 2px; border-radius: 5px 5px 0 0; }
.bars2 .pair i.cur { background: var(--red); }
.bars2 .pair i.prev { background: var(--grey-300); }
.bars2 .b > .pair { flex: 1; }
.bars2.dense { gap: 3px; }
.bars2.dense .pair { gap: 1px; }
.bars2.dense .m { font-size: 9.5px; }
.track.ly { height: 4px; margin-top: 0; }
.mini td.n { white-space: nowrap; padding-left: 8px; }
.track.ly i { background: var(--grey-300); }
.dash-sum { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--grey-100); font-size: 13px; color: var(--grey-700); align-items: center; }
@media (max-width: 760px) { .dash-basis { margin-left: 0; } }

/* ---------- sortable headings (click: ▲ top → bottom, again: ▼ bottom → top) */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--red); }
th.sortable .arr { margin-left: 4px; font-size: 10px; opacity: .35; }
th.sortable.sorted { color: var(--red); }
th.sortable.sorted .arr { opacity: 1; }

/* ---------- on air */
.onair-nav { display: flex; gap: 6px; align-items: center; }
.onair-nav .inp { width: auto; padding: 6px 10px; }
.track { height: 6px; background: var(--grey-100); border-radius: 9px; overflow: hidden; margin: 4px 0; }
.track i { display: block; height: 100%; background: var(--red); border-radius: 9px; }
tr.dim td { opacity: .55; }
.wd { display: inline-flex; gap: 2px; }
.wd i { font-style: normal; font-size: 10.5px; font-weight: 700; width: 16px; height: 18px; display: grid; place-items: center; border-radius: 4px; background: var(--grey-100); color: var(--grey-500); }
.wd i.on { background: var(--red); color: #fff; }
.oa-malls { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.oa-mall { border: 1px solid var(--grey-200, #e5e7eb); border-radius: 10px; padding: 12px; }
.oa-mall.free { background: var(--grey-50, #fafafa); }
.oa-mh { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.oa-c { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 5px 0; border-top: 1px dashed var(--grey-200, #e5e7eb); color: inherit; text-decoration: none; }
.oa-c:first-of-type { margin-top: 6px; }
.oa-c:hover span:first-child { color: var(--red); }
.gantt { font-size: 12.5px; }
.g-row { display: grid; grid-template-columns: 240px 1fr; align-items: center; min-height: 26px; color: inherit; text-decoration: none; border-top: 1px solid var(--grey-100); }
a.g-row:hover { background: var(--grey-50, #fafafa); }
.g-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 10px; }
.g-r { position: relative; height: 26px; }
.g-head { border-top: 0; }
.g-head .g-r span { position: absolute; top: 5px; font-size: 11px; color: var(--grey-500); transform: translateX(-2px); white-space: nowrap; }
.g-bar { position: absolute; top: 7px; height: 12px; border-radius: 4px; background: var(--grey-300); }
.g-bar.live { background: var(--red); }
.g-now { position: absolute; top: 0; bottom: 0; width: 2px; background: #2563eb; opacity: .7; }
@media (max-width: 760px) {
  .g-row { grid-template-columns: 110px 1fr; }
  .onair-nav .inp { width: 140px; }
}

/* =====================================================================
   PHONE (≤ 760px): bottom tab bar, cards instead of wide tables,
   one-column plan editor with a sticky total + Save bar.
   ===================================================================== */
@media (max-width: 760px) {
  :root { --tabbar: 62px; }
  body { font-size: 15px; }
  /* 16px stops iPhone zooming into a box when you tap it */
  .inp, select.inp, textarea.inp { font-size: 16px; padding: 10px 11px; }
  .side { display: none; }
  /* minmax(0,…) so wide content (lists, tables) can't push the page wider than the phone */
  .shell, .ed2, .grid2 { grid-template-columns: minmax(0, 1fr) !important; }
  .grid4, .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .days.m-only { display: flex; }
  .more-menu > div button.m-only { display: flex; }
  .d-only { display: none !important; }

  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: var(--ink);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 0; color: #9a9a95;
    text-decoration: none; font-size: 11px; font-weight: 600; border-radius: 10px; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.on { color: #fff; }
  .tabbar a.on svg { color: var(--red-bright); }
  .tabbar a.new svg { background: var(--red); color: #fff; border-radius: 50%; padding: 3px; width: 26px; height: 26px; margin-top: -2px; }
  .main { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); max-width: calc(100% - 32px); }

  .topbar { padding: 12px 16px; gap: 10px; padding-top: calc(12px + env(safe-area-inset-top)); }
  .topbar h1 { font-size: 19px; }
  .topbar .btn.primary { padding: 8px 12px; }
  .page { padding: 14px 16px 28px; }
  .card > .hd { flex-wrap: wrap; }

  /* dashboard */
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .v { font-size: 19px; }
  .bars { gap: 4px; height: 160px; }
  .grid2.g-even { grid-template-columns: 1fr; }

  /* plans list: each row becomes a card */
  .picker-tools { padding: 12px; }
  .picker-tools .inp { max-width: none !important; }
  table.t-cards thead { display: none; }
  table.t-cards, table.t-cards tbody { display: block; }
  table.t-cards tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 13px 14px; border-bottom: 1px solid var(--grey-100);
    grid-template-areas: "ref st" "cli amt" "camp camp" "per per"; }
  table.t-cards td { display: block; padding: 0; border: 0; text-align: left; }
  table.t-cards .c-ref { grid-area: ref; }
  table.t-cards .c-ref .small { display: inline; margin-left: 6px; }
  table.t-cards .c-st { grid-area: st; justify-self: end; }
  table.t-cards .c-cli { grid-area: cli; font-weight: 600; }
  table.t-cards .c-amt { grid-area: amt; text-align: right; }
  table.t-cards .c-camp { grid-area: camp; }
  table.t-cards .c-camp:empty, table.t-cards .c-camp .small:empty { display: none; }
  table.t-cards .c-per { grid-area: per; font-size: 12.5px; color: var(--grey-700); }
  table.t-cards .c-per .small { display: inline; margin-left: 4px; }
  table.t-cards .c-x { display: none; }

  /* plan editor */
  body.slim .tabbar { display: none; }
  body.slim .main { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.slim .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
  .topbar #prof { order: 10; flex-basis: 100%; margin: 0 !important; }
  .topbar .sigs, .topbar #save { display: none; }
  .more-menu > div { max-height: 70vh; overflow: auto; }
  .more-menu > div button { padding: 12px 10px; }
  .grid4 .full-m { grid-column: 1 / -1; }
  .grid4 .span3 { grid-column: 1 / -1; }
  .combo .list { min-width: 0; right: 0; max-height: 50vh; }
  .combo .list div { padding: 11px 12px; }
  .days { justify-content: space-between; margin-bottom: 4px; }
  .days button { width: 40px; height: 40px; font-size: 13px; }
  .filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .filters button { padding: 7px 13px; white-space: nowrap; flex: none; }
  .filters > .muted { display: none; }
  .shuttle { grid-template-columns: 1fr; gap: 8px; }
  .slist { height: auto; min-height: 56px; max-height: 230px; }
  .srow2 { padding: 10px 12px; font-size: 14.5px; }
  .sbtns { flex-direction: row; justify-content: center; }
  .sbtns button { width: 54px; height: 40px; transform: rotate(90deg); }
  .pricebar { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .pricebar .inp { width: 100% !important; }
  .pricebar > div:nth-child(2), .pricebar > div:nth-child(7), .pricebar > #vmBody { grid-column: 1 / -1; }
  .pricebar #vmBody:empty { display: none; }
  .pricebar .seg button { padding: 9px 4px; }
  table.ct th:nth-child(2), table.ct td:nth-child(2), table.ct th:nth-child(3), table.ct td:nth-child(3),
  table.ct th:nth-child(5), table.ct td:nth-child(5) { display: none; }
  table.ct .seg button { padding: 7px 9px; }
  table.sdt th:nth-child(2), table.sdt td:nth-child(2) { display: none; }
  .sdin { width: 76px; }
  .sdbar .small { flex-basis: 100%; }
  .sum .big { font-size: 26px; }
  .ph-slot .x { display: block; }
  .mbar { display: flex; align-items: center; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--white); border-top: 1px solid var(--grey-200); box-shadow: 0 -6px 24px rgba(0,0,0,.08);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .mbar > div { flex: 1; min-width: 0; }
  .mbar #mbarL { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mbar b { font-family: var(--display); font-size: 19px; }
  .mbar .btn { padding: 11px 18px; font-size: 15px; }

  /* users: name + role */
  .t-users th:nth-child(2), .t-users td:nth-child(2), .t-users th:nth-child(4), .t-users td:nth-child(4) { display: none; }
  .drawer { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }

  /* clients: name, city, phone only (tap a row for the rest) */
  #rows table.t th:nth-child(3), #rows table.t td:nth-child(3), #rows table.t th:nth-child(5), #rows table.t td:nth-child(5),
  #rows table.t th:nth-child(6), #rows table.t td:nth-child(6) { display: none; }
  .picker-tools .seg { width: 100% !important; }

  /* network & rates: screens table scrolls sideways */
  .net-mall .fields { grid-template-columns: 1fr 1fr; padding: 12px 12px 0; }
  .net-mall .fields > label:first-child { grid-column: 1 / -1; }
  .net-mall .bd { overflow-x: auto; padding: 12px; }
  .net-mall table.t { min-width: 680px; }
  .net-mall table.t td:first-child .inp { min-width: 170px; }
  .modal .acts .btn { flex: 1; justify-content: center; }
}

/* ---------------------------------------------------------------- finance */
.fin-tabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--grey-200); overflow-x: auto; }
.fin-tabs a { padding: 9px 14px; font-weight: 600; font-size: 13.5px; color: var(--grey-700); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.fin-tabs a.on { color: var(--ink); border-bottom-color: var(--red); }
.age-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.age { display: block; text-decoration: none; color: inherit; border: 1px solid var(--grey-200); border-radius: var(--radius-sm); padding: 12px 14px; border-top: 4px solid #d97706; }
.age:hover { background: var(--grey-50); }
.age.ok { border-top-color: var(--green); }
.age.bad { border-top-color: var(--red); }
.age .l { font-size: 12px; font-weight: 700; color: var(--grey-500); text-transform: uppercase; letter-spacing: .04em; }
.age .v { font-family: var(--display); font-size: 19px; font-weight: 700; margin-top: 4px; }
.age .s { font-size: 12px; color: var(--grey-500); }
.pay { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; vertical-align: 2px; }
.pay.paid { background: var(--green-soft); color: var(--green); }
.pay.part { background: var(--amber-soft); color: var(--amber); }
.pay.unpaid { background: var(--red-soft); color: var(--red); }
.pay.over { background: var(--blue-soft); color: var(--blue); }
.pay.Cancelled { background: var(--grey-100); color: var(--grey-500); text-decoration: line-through; }
.late { color: var(--red); font-weight: 600; }
.kv > div { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--grey-100); font-size: 13.5px; }
.kv > div:last-child { border-bottom: 0; }
.kv span { color: var(--grey-500); }
.kv b { text-align: right; font-weight: 600; }
.kv a { color: inherit; }
.pay-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--grey-100); text-decoration: none; color: inherit; font-size: 13.5px; }
.pay-row:last-of-type { border-bottom: 0; }
a.pay-row:hover b:first-child { text-decoration: underline; }
.bill-k { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 8px; }
.bill-k > div { display: flex; flex-direction: column; gap: 2px; }
.bill-k span { font-size: 11.5px; font-weight: 700; color: var(--grey-500); text-transform: uppercase; letter-spacing: .04em; }
.bill-k b { font-family: var(--display); font-size: 16px; }
.iv-sum { background: var(--grey-50); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; margin: 4px 0 14px; }
table.t tr.tot td { font-weight: 700; border-top: 2px solid var(--grey-300); }
@media (max-width: 1000px) { .age-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .fin-tabs { margin: 0 -16px 12px; padding: 0 12px; } }
.fin-tabs { scrollbar-width: none; }
.fin-tabs::-webkit-scrollbar { display: none; }
.kpis.fin-k .v { font-size: 22px; white-space: nowrap; }
.age .v { white-space: nowrap; font-size: 17px; }
@media (max-width: 1180px) { .kpis.fin-k .v { font-size: 19px; } }
.kv > div { flex-direction: column; gap: 1px; }
.kv span { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.kv b { text-align: left; }
#lg > .bill-k { padding: 14px 16px; margin: 0; }
#lg td b, #list td.c-ref b { white-space: nowrap; }
#lg td.small { white-space: nowrap; }
.chk-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.chk { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--grey-200); background: var(--white); text-decoration: none; color: inherit; border-left: 4px solid var(--grey-300); }
.chk b { font-family: var(--display); font-size: 22px; }
.chk span { font-size: 12.5px; color: var(--grey-700); line-height: 1.3; }
.chk i { font-style: normal; font-size: 12px; color: var(--grey-500); }
.chk.bad { border-left-color: var(--red); } .chk.bad b { color: var(--red); }
.chk.warn { border-left-color: #d97706; } .chk.warn b { color: var(--amber); }
.chk.ok { opacity: .55; border-left-color: var(--green); }
.chk-card > summary { display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; list-style: none; border-left: 4px solid var(--grey-300); border-radius: var(--radius) 0 0 var(--radius); }
.chk-card > summary::-webkit-details-marker { display: none; }
.chk-card > summary h3 { font-size: 15px; font-weight: 700; }
.chk-card.bad > summary { border-left-color: var(--red); }
.chk-card.warn > summary { border-left-color: #d97706; }
.chk-card .t a { color: inherit; }
@media (max-width: 1000px) { .chk-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dupc { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; background: var(--red); color: #fff; white-space: nowrap; vertical-align: 2px; }
.dupc.maybe { background: var(--grey-100); color: var(--grey-700); }
.banner.dup { background: var(--red-soft); color: var(--red); border-color: #f5c2c4; }
.banner.info { background: var(--grey-50); color: var(--grey-700); border-color: var(--grey-200); font-weight: 500; }
.banner a { color: inherit; text-decoration: underline; }
.dup-note { display: block; text-decoration: none; color: var(--red); background: var(--red-soft); border: 1px solid #f5c2c4; border-radius: 10px; padding: 10px 14px; margin: -2px 0 14px; font-size: 13px; line-height: 1.5; }
.flagc { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; background: var(--amber-soft); color: var(--amber); white-space: nowrap; vertical-align: 2px; }
.banner.flag { margin-bottom: 8px; }
.dash-h { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 6px 0 10px; }
.dash-h h2 { font-family: var(--display); font-size: 18px; font-weight: 700; }
.dash-h a { color: inherit; }
a.kpi.red { color: #fff; }
.page > .kpis .kpi .v { white-space: nowrap; font-size: clamp(17px, 1.75vw, 26px); }
