/* Media Village Client Portal. --accent is set from Settings. */
:root {
  --accent: #1d4f91;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, white);
  --accent-line: color-mix(in srgb, var(--accent) 30%, white);
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e2e6ec;
  --border-strong: #cdd3dc;
  --text: #1b2430;
  --muted: #687586;
  --faint: #9aa5b3;
  --blue: #1f6feb; --blue-bg: #e8f1fe;
  --amber: #a15c00; --amber-bg: #fff3dc;
  --green: #18794e; --green-bg: #e3f5ec;
  --red: #c2261d; --red-bg: #fdeceb;
  --purple: #6b3fc8; --purple-bg: #f0eafd;
  --grey: #5b6675; --grey-bg: #eef1f4;
  --yellow: #8a6a00; --yellow-bg: #fff8d6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, .18);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0 0 .6em; }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }
.warn { color: var(--amber); }
.danger { color: var(--red); }
.ok { color: var(--green); }
.overdue { color: var(--red); font-weight: 600; }
.ref { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.boot, .loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 80px 20px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Shell ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 62px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; font-size: 19px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 17px; white-space: nowrap; }
.brand-text small { color: var(--muted); font-size: 14px; }
.top-right { display: flex; align-items: center; gap: 14px; }
.user { display: flex; flex-direction: column; text-align: right; line-height: 1.2; }
.user-name { font-weight: 600; font-size: 15px; }
.user-org { color: var(--muted); font-size: 14px; }
.view-switch { display: flex; background: var(--grey-bg); border-radius: 8px; padding: 3px; }
.view-switch button { display: flex; white-space: nowrap; align-items: center; gap: 6px; border: 0; background: transparent; padding: 5px 11px; border-radius: 6px; cursor: pointer; font-size: 15px; color: var(--muted); }
.view-switch button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.preview-bar { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 8px 16px; background: var(--purple-bg); color: var(--purple); font-size: 15px; }
.preview-bar button { border: 0; background: none; color: var(--purple); text-decoration: underline; cursor: pointer; font-weight: 600; }
.frame { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 62px); background: linear-gradient(to right, var(--surface) 219px, var(--border) 219px, var(--border) 220px, transparent 220px); }
.nav { position: sticky; top: 62px; align-self: start; display: flex; flex-direction: column; gap: 2px; padding: 18px 12px; height: calc(100vh - 62px); overflow-y: auto; border-right: 1px solid var(--border); background: var(--surface); }
.nav a { padding: 8px 12px; border-radius: 7px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
main { outline: none; min-width: 0; }
.page { max-width: 1320px; padding: 26px 32px 60px; }

/* ---------- Page furniture ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; max-width: 720px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 15px; margin-bottom: 10px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.toolbar-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { min-width: 220px; padding: 7px 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.filter, .inline-select { padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-count { margin-left: 6px; background: var(--grey-bg); color: var(--grey); border-radius: 10px; padding: 0 7px; font-size: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 15px; }
.chip:hover { text-decoration: none; color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav strong { min-width: 150px; text-align: center; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font-weight: 550; cursor: pointer; white-space: nowrap; line-height: 1.2; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #a51f17; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--grey-bg); color: var(--text); }
.btn-ghost.active { background: var(--accent-soft); color: var(--accent); }
.btn-sm { padding: 5px 10px; font-size: 15px; border-radius: 7px; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-primary.is-busy::after { border-color: #fff transparent #fff transparent; }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 12px; font-size: 14px; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.pill-blue { background: var(--blue-bg); color: var(--blue); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-purple { background: var(--purple-bg); color: var(--purple); }
.pill-grey { background: var(--grey-bg); color: var(--grey); }
.pill-yellow { background: var(--yellow-bg); color: var(--yellow); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- Tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; color: var(--text); box-shadow: var(--shadow); position: relative; overflow: hidden; }
a.tile:hover { border-color: var(--accent-line); text-decoration: none; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.tile-amber::before { background: #f0a020; }
.tile-red::before { background: var(--red); }
.tile-green::before { background: #22a06b; }
.tile-label { color: var(--muted); font-size: 14px; font-weight: 550; }
.tile-value { font-size: 23px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }
.tile-amber .tile-value { color: var(--amber); }
.tile-red .tile-value { color: var(--red); }
.tile-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.tile-sub .meter { margin-top: 8px; }
.tile-quiet { background: #f8f9fb; box-shadow: none; }
.tile-quiet .tile-value { color: var(--muted); font-weight: 600; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card-attn { border-color: #f0c36d; box-shadow: 0 0 0 3px #fff3dc; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.card-head .count { background: var(--grey-bg); color: var(--grey); border-radius: 10px; padding: 0 8px; font-size: 14px; font-weight: 600; }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }
.card-body.flush > .empty { padding: 26px 18px; }
.card-body.flush > div > .intro, .intro-pad { padding: 12px 18px 0; margin: 0; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid2 > .card { margin-bottom: 16px; }
.span2 { grid-column: 1 / -1; }
.mini-head { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 14px 0 4px; font-weight: 650; }
.mini-head:first-child { margin-top: 0; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; }
.empty p { margin-bottom: 10px; }
.ok-line { display: flex; align-items: center; gap: 6px; color: var(--green); margin: 0 0 6px; }
.pad { padding: 12px 18px; margin: 0; }
.error-box { max-width: 560px; margin: 60px auto; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-align: center; }
.error-box h2 { margin-bottom: 8px; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--border); }
.card-body:not(.flush) .list > li .li-link { padding-left: 0; padding-right: 0; }
.li-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 18px; color: var(--text); }
a.li-link:hover { background: #fafbfc; text-decoration: none; }
.li-main { min-width: 0; }
.li-title { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
a.li-title:hover { color: var(--accent); }
.li-meta { color: var(--muted); font-size: 14px; margin-top: 1px; }
.li-right { display: flex; align-items: center; gap: 6px; flex: none; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); align-items: baseline; }
.feed li:first-child { border-top: 0; padding-top: 0; }
.feed-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-who { font-size: 14px; white-space: nowrap; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 14px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 10px 14px; border-bottom: 1px solid var(--border); background: #fafbfc; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #fafbfc; }
.table tr.row-warn td { background: #fff9f8; }
.table .al-right { text-align: right; }
.table .col-check { width: 36px; padding-right: 0; }
.cell-title { font-weight: 600; color: var(--text); }
a.cell-title:hover { color: var(--accent); }
.cell-sub { color: var(--muted); font-size: 14px; margin-top: 1px; display: block; }
.refs { display: flex; gap: 6px; flex-wrap: wrap; }
.selection-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius); }
.selection-bar[hidden] { display: none; }
.selection-bar > span { margin-right: auto; }

/* ---------- Detail pages ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.kv { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 8px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: 15px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.banner { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; }
.banner > div { flex: 1; }
.banner .ic { margin-top: 3px; width: 18px; height: 18px; }
.banner-amber { background: var(--amber-bg); border-color: #f3d39b; color: #6d3f00; }
.banner-green { background: var(--green-bg); border-color: #b5e3cb; color: #0f5536; }
.banner-blue { background: var(--blue-bg); border-color: #c3d9fb; color: #164a9e; }
.banner-red { background: var(--red-bg); border-color: #f4c2bf; color: #8e1c15; }
.files { list-style: none; margin: 0 0 12px; padding: 0; }
.files li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 7px 0; border-bottom: 1px solid var(--border); }
.files li:last-child { border-bottom: 0; }
.files a { display: inline-flex; align-items: center; gap: 6px; font-weight: 550; }
.files li .btn { margin-left: auto; }
.uploader { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* ---------- Timeline and comments ---------- */
.timeline { list-style: none; margin: 0 0 16px; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 14px 24px; }
.tl-dot { position: absolute; left: 0; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.tl-k-status .tl-dot { border-color: var(--accent); background: var(--accent); }
.tl-k-comment .tl-dot { border-color: var(--accent); }
.tl-client.tl-k-comment .tl-dot { border-color: #8a5cf6; }
.tl-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; }
.tl-org { font-size: 14px; padding: 0 6px; border-radius: 4px; background: var(--grey-bg); color: var(--grey); }
.tl-client .tl-org { background: var(--purple-bg); color: var(--purple); }
.tl-event { color: var(--muted); font-size: 15px; white-space: pre-wrap; }
.tl-comment { margin-top: 5px; padding: 10px 12px; background: var(--bg); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-client .tl-comment { background: var(--purple-bg); }
.tl-internal .tl-comment, .tl-internal .tl-event { background: var(--yellow-bg); padding: 6px 10px; border-radius: 8px; color: #5c4700; }
.comment-box textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 8px; resize: vertical; background: var(--surface); }
.comment-box textarea:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); }
.comment-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }

/* ---------- Forms ---------- */
.form { display: flex; flex-wrap: wrap; gap: 0 14px; }
.form > * { flex: 1 1 100%; }
.form-intro { color: var(--muted); margin: 0 0 14px; }
.form-intro p { margin-bottom: 6px; }
.form-note { background: var(--bg); padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; }
.field { margin-bottom: 14px; min-width: 0; }
.field.half { flex: 1 1 calc(50% - 7px); }
.field[hidden] { display: none; }
.label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 5px; }
.req { color: var(--red); }
.hint { color: var(--muted); font-size: 14px; margin-top: 4px; }
.hint.warn { color: var(--amber); }
.field-error { color: var(--red); font-size: 14px; margin-top: 4px; }
.field-error:empty { display: none; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number], .field input[type=date], .field input[type=month], .field input[type=color], .field select, .field textarea, .requester select, .requester input {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); min-height: 38px;
}
.field input[type=color] { padding: 3px; width: 70px; }
.field input:focus, .field select:focus, .field textarea:focus, .search:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); }
.field input[type=file] { font-size: 15px; }
.field-inline { margin-bottom: 12px; }
.requester .row2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.requester input { margin-top: 8px; }
.money-input { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.money-input span { display: grid; place-items: center; padding: 0 10px; background: var(--bg); color: var(--muted); border-right: 1px solid var(--border); }
.money-input input { border: 0 !important; border-radius: 0 !important; flex: 1; min-width: 0; padding: 8px 11px; }
.money-input:focus-within { outline: 2px solid var(--accent-line); border-color: var(--accent); }
.money-input input:focus { outline: none !important; }
.segmented { display: inline-flex; background: var(--grey-bg); border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg { border: 0; background: transparent; padding: 6px 14px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 550; }
.seg.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.checklist { border: 1px solid var(--border); border-radius: 8px; max-height: 280px; overflow-y: auto; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.check-row:last-child { border-bottom: 0; }
.check-row:hover { background: #fafbfc; }
.cr-main { flex: 1; min-width: 0; }
.cr-val { font-weight: 600; white-space: nowrap; }
.checklist-total { text-align: right; margin-top: 8px; }
.details { margin-top: 10px; }
.details summary { cursor: pointer; font-weight: 600; }
.lead { font-size: 17px; }

/* Basket (call-offs) and stock take */
.basket { border: 1px solid var(--border); border-radius: 8px; max-height: 330px; overflow-y: auto; margin-top: 8px; }
.basket-row, .st-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 96px; gap: 12px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.st-row { grid-template-columns: minmax(0, 1fr) auto 96px 80px; }
.basket-row:last-child, .st-row:last-child { border-bottom: 0; }
.basket-row.chosen { background: var(--accent-soft); }
.br-avail { font-size: 15px; color: var(--muted); display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.br-avail strong { color: var(--text); }
.basket-row input, .st-row input { width: 100%; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: 7px; text-align: right; }
.basket-summary { margin-top: 8px; font-weight: 600; color: var(--accent); }
.stocktake { border: 1px solid var(--border); border-radius: 8px; max-height: 420px; overflow-y: auto; }
.st-diff { font-weight: 600; font-size: 15px; text-align: right; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 35, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; animation: fade .12s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 580px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: 88vh; }
.modal-wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 19px; }
.modal-body { padding: 18px 20px 6px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: #fafbfc; border-radius: 0 0 14px 14px; }
.modal-error { display: none; background: var(--red-bg); color: var(--red); padding: 9px 12px; border-radius: 8px; margin-bottom: 14px; font-weight: 550; }
.modal-error.show { display: block; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 400px; }
.toast { background: #1b2430; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; animation: rise .18s ease-out; }
.toast-success { background: #135e3c; }
.toast-error { background: #a8221a; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Meters and charts ---------- */
.meter { height: 7px; background: var(--grey-bg); border-radius: 6px; overflow: hidden; }
.meter-lg { height: 12px; margin: 16px 0 8px; }
.meter-fill { height: 100%; background: var(--accent); border-radius: 6px; transition: width .3s; }
.meter-amber .meter-fill { background: #e8930c; }
.meter-red .meter-fill { background: var(--red); }
.usage-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.usage-nums .big { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { margin-bottom: 12px; }
.bar-label { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; margin-bottom: 4px; }
.bar-track { height: 8px; background: var(--grey-bg); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 6px; }
.hist { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; height: 170px; align-items: end; }
.hist-col { display: flex; flex-direction: column; align-items: center; height: 100%; color: var(--muted); }
.hist-col:hover { text-decoration: none; }
.hist-bars { position: relative; flex: 1; width: 100%; max-width: 28px; }
.hist-allow { position: absolute; bottom: 0; left: 0; right: 0; border: 1.5px dashed var(--border-strong); border-bottom: 0; border-radius: 4px 4px 0 0; }
.hist-used { position: absolute; bottom: 0; left: 4px; right: 4px; background: var(--accent-line); border-radius: 4px 4px 0 0; }
.hist-col.current .hist-used { background: var(--accent); }
.hist-used.over { background: #f2a49e; }
.hist-col.current .hist-used.over { background: var(--red); }
.hist-label { font-size: 14px; margin-top: 6px; white-space: nowrap; }
.hist-key { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.key-used, .key-allow { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--accent); margin-left: 8px; }
.key-used { margin-left: 0; }
.key-allow { background: none; border: 1.5px dashed var(--border-strong); }

/* ---------- Reports, people ---------- */
.year { font-size: 16px; color: var(--muted); margin: 6px 0 10px; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 22px; }
.report-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.rc-month { font-size: 14px; color: var(--accent); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.rc-title { font-weight: 650; font-size: 17px; margin: 2px 0 8px; }
.rc-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--border-strong); border-radius: 22px; transition: .15s; }
.slider::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(16px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.perm-list { margin: 0; padding-left: 18px; }
.perm-list li { margin-bottom: 6px; }
.settings-form { max-width: 760px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
  .detail-side { order: -1; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .frame { grid-template-columns: minmax(0, 1fr); background: none; }
  .nav { position: sticky; top: 62px; z-index: 15; flex-direction: row; height: auto; overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav a { white-space: nowrap; }
  .page { padding: 18px 16px 50px; }
  .user { display: none; }
  .view-switch button { padding: 5px 8px; font-size: 14px; }
  .tiles-3 { grid-template-columns: minmax(0, 1fr); }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .table td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 14px; text-align: right; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: 14px; text-align: left; flex: none; }
  .table td.col-check::before { content: ""; }
  .table td > div { text-align: right; }
  .field.half { flex-basis: 100%; }
  .usage-nums .big { font-size: 22px; }
  .feed li { grid-template-columns: 1fr; gap: 2px; }
  .search { min-width: 0; width: 100%; }
  .topbar { padding: 0 16px; gap: 10px; }
  .brand-logo { height: 20px; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 12px; }
  .brand-text small { display: none; }
  .brand-logo { height: 16px; }
  .brand-logo + .brand-text { padding-left: 8px; }
  .brand-text strong { font-size: 15px; }
  .view-switch { display: none; } /* staff preview switch: desktop and tablet only */
  .tiles, .tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .basket-row, .st-row { grid-template-columns: minmax(0, 1fr) 80px; }
  .br-avail, .st-row .muted { grid-column: 1; }
}
@media print {
  .topbar, .nav, .actions, .toolbar, .comment-box, .uploader { display: none !important; }
  .frame { display: block; }
  body { background: #fff; }
}

/* ---------- Sign-in page ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-wrap { width: 100%; max-width: 420px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.login-brand .brand-mark { width: 48px; height: 48px; font-size: 24px; border-radius: 10px; }
.login-brand h1 { font-size: 24px; }
.login-brand p { margin: 2px 0 0; color: var(--muted); }
.login-card { padding: 28px; margin-bottom: 16px; }
.login-msg { margin: 0 0 18px; padding: 12px 14px; border-radius: 8px; background: var(--accent-soft); }
.login-error { background: var(--red-bg); color: var(--red); }
.login-remember { display: flex; align-items: center; gap: 8px; margin: 4px 0 20px; }
.login-submit { width: 100%; padding: 12px 16px; font-size: 17px; }
.login-links { margin: 18px 0 0; text-align: center; }
.login-help { text-align: center; color: var(--muted); margin: 0; }


/* ---------- Media Village logo ---------- */
.brand-logo { height: 24px; width: auto; display: block; flex-shrink: 0; }
.brand-logo + .brand-text { padding-left: 12px; border-left: 1px solid var(--border); }
.login-brand { flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.login-logo { width: 240px; max-width: 100%; height: auto; display: block; }
