/* Approved preview-7 visual primitives, adapted for the authenticated production shell.
   This stylesheet replaces the former overlapping legacy/workflow cascade. */
:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #fff;
  --surface-raised: #fff;
  --surface-soft: #eef0f4;
  --text: #17191f;
  --text-secondary: #646975;
  --border: #e1e4e9;
  --border-strong: #cfd3db;
  --accent: #7057e8;
  --accent-strong: #5d43d3;
  --accent-soft: #eeeaff;
  --action: #7057e8;
  --action-hover: #5d43d3;
  --on-action: #fff;
  --success: #16785a;
  --success-soft: #e5f6ef;
  --warning: #9c6200;
  --warning-soft: #fff2d6;
  --danger: #b43e4d;
  --danger-soft: #ffeaed;
  --info: #2766a8;
  --info-soft: #e8f2ff;
  --shadow-sm: 0 1px 2px rgb(17 24 39 / 5%), 0 6px 18px rgb(17 24 39 / 4%);
  --shadow-lg: 0 18px 48px rgb(20 22 30 / 16%);
  --ink: var(--text); /* Shared unsaved-changes dialog. */
  --muted: var(--text-secondary);
  --line: var(--border);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  color: var(--text);
  background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111218;
    --surface: #1b1d24;
    --surface-raised: #21242c;
    --surface-soft: #272a33;
    --text: #f1f2f5;
    --text-secondary: #adb1bc;
    --border: #30333d;
    --border-strong: #414550;
    --accent: #9278f6;
    --accent-strong: #b09cff;
    --accent-soft: #302a4f;
    --success: #6bd5ad;
    --success-soft: #183a31;
    --warning: #f1bd62;
    --warning-soft: #41321c;
    --danger: #ff8c99;
    --danger-soft: #49242b;
    --info: #78b7f7;
    --info-soft: #1d344d;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 20%), 0 6px 18px rgb(0 0 0 / 12%);
    --shadow-lg: 0 18px 48px rgb(0 0 0 / 40%);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select, summary { cursor: pointer; }
button { -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .55; cursor: wait; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, summary:focus-visible,
.photo-input:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
svg { width: 22px; height: 22px; flex: 0 0 auto; }
.ui-icon { vertical-align: middle; }
p { margin: 0 0 14px; overflow-wrap: anywhere; }
h1, h2, h3 { text-wrap: balance; overflow-wrap: anywhere; }
small { font-size: 12px; }
.muted, .small-copy { color: var(--text-secondary); }
.small-copy { font-size: 13px; line-height: 1.55; }
.required-mark { color: var(--danger); font-weight: 700; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }

/* Authenticated header; no test identities or participant switching. */
.app-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { max-width: 1080px; margin: auto; padding: 12px 16px 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.header-actions { display: flex; align-items: center; gap: 4px; }
.app-shell, .workspace { min-height: 100dvh; }
.workspace { margin: 0; padding: 0; }
.main-content { max-width: 1080px; margin: auto; padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
main { min-width: 0; }
footer { padding: 24px 0 0; color: var(--text-secondary); font-size: 12px; text-align: center; }

/* Up to four role-aware tabs; the address directory is under Team. */
#bottom-nav { position: fixed; z-index: 30; bottom: 0; left: 50%; transform: translateX(-50%); display: grid; grid-template-columns: repeat(var(--nav-count, 4), minmax(0, 1fr)); width: 100%; max-width: 1080px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
.nav-item { min-width: 0; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; border-radius: 12px; padding: 6px 2px; color: var(--text-secondary); background: transparent; font-size: 11px; font-weight: 650; line-height: 1.2; }
.nav-item.active { color: var(--accent-strong); background: var(--accent-soft); }
.nav-icon { position: relative; display: flex; }
.nav-icon svg { width: 21px; height: 21px; }
.nav-icon small { position: absolute; left: 13px; top: -5px; min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; border-radius: 9px; background: var(--danger); color: var(--surface); font-size: 10px; font-weight: 750; }
.nav-label { max-width: 100%; white-space: nowrap; }

.heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px; }
.heading h1 { flex: 1 1 auto; margin: 0; font-size: 28px; line-height: 1.2; font-weight: 760; letter-spacing: -.55px; }
.heading p { flex: 1 0 100%; margin: 0; font-size: 14px; color: var(--text-secondary); line-height: 1.45; }
.heading .buttons { margin: 0; }
.buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; max-width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 14px; font-weight: 700; line-height: 1.3; text-align: center; text-decoration: none; overflow-wrap: anywhere; }
.button:hover { background: var(--surface-soft); text-decoration: none; }
.button.primary { background: var(--action); border-color: var(--action); color: var(--on-action); }
.button.primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
.button.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.button.ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.button.small { font-size: 13px; padding: 9px 12px; }
.button.icon { width: 40px; min-height: 40px; padding: 8px; border-color: transparent; background: transparent; }
.button.icon:hover { background: var(--surface-soft); }
.button svg { width: 20px; height: 20px; }
.intro { padding: 12px 14px; margin-bottom: 16px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-strong); font-size: 14px; }
.intro p { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; min-width: 0; min-height: 70px; padding: 10px 12px; gap: 2px; border: 1px solid var(--border); border-radius: 14px; color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); text-align: left; }
.kpi-month { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; background: var(--accent-soft); }
.kpi b { font-size: 23px; line-height: 1.1; font-weight: 760; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; line-height: 1.35; color: var(--text-secondary); }
.kpi.kpi-month span { color: var(--text); font-size: 15px; font-weight: 700; }
.kpi.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.kpi.active b { color: var(--accent-strong); }
.kpi.red b { color: var(--danger); }
.filters { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.3fr; gap: 8px; margin-bottom: 16px; }
.filters input, .filters select, .field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea { display: block; width: 100%; max-width: 100%; min-width: 0; min-height: 48px; padding: 12px; border: 1px solid var(--border-strong); border-radius: 13px; background: var(--surface); color: var(--text); font-size: 16px; font-weight: 400; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: var(--text-secondary); opacity: 1; }
.section-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.section-line h2 { margin: 0; font-size: 16px; font-weight: 700; }
.section-line > span { font-size: 12px; color: var(--text-secondary); flex-shrink: 0; }
.list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 12px; }
.ticket { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); text-align: left; overflow-wrap: anywhere; }
.ticket:hover { border-color: var(--border-strong); background: var(--surface-raised); }
.ticket-overdue { border-left: 3px solid var(--danger); padding-left: 14px; }
.ticket-top, .ticket-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ticket-id { font-size: 12px; color: var(--text-secondary); font-weight: 750; letter-spacing: .3px; }
.ticket-title { display: block; font-size: 16px; font-weight: 750; line-height: 1.35; }
.ticket-address { display: flex; align-items: flex-start; gap: 5px; font-size: 13px; line-height: 1.45; color: var(--text-secondary); }
.ticket-address svg { width: 15px; height: 19px; }
.ticket-address > span { min-width: 0; }
.ticket-meta { display: flex; flex-direction: column; gap: 4px; font-size: 13px; line-height: 1.45; color: var(--text-secondary); }
.blocker-note { color: var(--warning); }
.ticket-bottom { margin-top: auto; padding-top: 4px; }
.ticket-due { text-align: right; color: var(--text-secondary); font-size: 12px; line-height: 1.4; font-weight: 650; }
.ticket-overdue .ticket-due { color: var(--danger); }
.badge { display: inline-flex; align-items: center; width: fit-content; max-width: 100%; padding: 5px 9px; border-radius: 999px; background: var(--surface-soft); color: var(--text-secondary); font-size: 11px; font-weight: 750; line-height: 1.4; }
.badge.new { color: var(--info); background: var(--info-soft); }
.badge.in_progress, .badge.urgent { color: var(--warning); background: var(--warning-soft); }
.badge.awaiting { color: var(--accent-strong); background: var(--accent-soft); }
.badge.overdue, .badge.emergency { color: var(--danger); background: var(--danger-soft); }
.badge.uk { color: var(--info); background: var(--info-soft); box-shadow: inset 0 0 0 1px currentColor; }
.badge.completed { color: var(--success); background: var(--success-soft); }
.ticket-top .badge, .ticket-bottom .badge { flex-shrink: 0; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.empty { grid-column: 1 / -1; padding: 28px 20px; color: var(--text-secondary); border: 1px dashed var(--border-strong); border-radius: 16px; text-align: center; }
.empty strong { display: block; margin-bottom: 8px; color: var(--text); }
.empty p { margin-top: 12px; }

.panel, .person-card, .message { min-width: 0; padding: 20px; margin-bottom: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); }
.panel h2 { margin: 0 0 14px; font-size: 20px; line-height: 1.3; font-weight: 750; letter-spacing: -.2px; }
.panel h3 { margin: 20px 0 10px; font-size: 16px; line-height: 1.4; }
.panel p { font-size: 15px; line-height: 1.55; }
.panel p.small-copy { font-size: 13px; }
.panel .chips + p { margin-top: 14px; }
.panel > :last-child { margin-bottom: 0; }
.detail-layout { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; }
.detail-layout > div { min-width: 0; }
.detail-layout .list { grid-template-columns: minmax(0, 1fr); }
.props { display: grid; grid-template-columns: minmax(90px, .7fr) minmax(0, 1.3fr); gap: 12px; margin: 0 0 18px; }
.props dt { font-size: 13px; color: var(--text-secondary); }
.props dd { margin: 0; font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.warning, .form-error { padding: 12px 14px; border-radius: 12px; background: var(--warning-soft); color: var(--warning); margin: 14px 0; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.warning p { font-size: inherit; margin: 8px 0 0; }
.danger-note, .form-error { color: var(--danger); background: var(--danger-soft); }
.form-error:empty { display: none; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { position: relative; padding: 0 0 16px 18px; border-left: 1px solid var(--border-strong); font-size: 14px; overflow-wrap: anywhere; }
.history li::before { content: ""; position: absolute; top: 6px; left: -4px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.history li:last-child { padding-bottom: 0; }
.history small { display: block; margin-top: 4px; color: var(--text-secondary); }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; min-width: 0; gap: 7px; margin: 0 0 18px; font-size: 13px; font-weight: 700; line-height: 1.45; }
.field textarea { min-height: 114px; resize: vertical; }
.field small { color: var(--text-secondary); font-size: 13px; font-weight: 400; }
.field input[type="checkbox"], .field input[type="radio"], .checks input, .service-address-list input { width: 18px; height: 18px; margin: 0; accent-color: var(--action); vertical-align: middle; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 0 0 18px; }
.checks label { display: flex; align-items: flex-start; gap: 8px; max-width: 100%; font-size: 14px; }
.checks input { flex-shrink: 0; margin-top: 2px; }
.photo-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.photo-row a { min-width: 0; }
.photo-thumb { min-width: 0; padding: 0; border: 0; background: transparent; text-align: left; color: inherit; }
.photo-row img { display: block; width: 120px; max-width: 100%; height: 96px; border-radius: 12px; border: 1px solid var(--border); object-fit: cover; background: var(--surface-soft); }
.photo-row small { display: block; margin-top: 5px; font-size: 12px; color: var(--text-secondary); }
.photo-viewer-dialog { width: min(980px, calc(100vw - 32px)); }
.photo-viewer-stage { min-height: 160px; max-height: 65dvh; overflow: auto; border-radius: 12px; background: var(--surface-soft); }
.photo-viewer-stage > img { display: block; width: 100%; max-height: 65dvh; object-fit: contain; }
.photo-viewer-stage > p, .photo-viewer-stage > button { margin: 16px; }
.photo-viewer-stage.zoomed > img { width: auto; max-width: none; max-height: none; }
.photo-viewer-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 16px 0; }
.photo-tools { margin: 8px 0 18px; }
.photo-tools > p { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.photo-input { position: relative; cursor: pointer; overflow: hidden; }
.photo-input input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.photo-counter { margin-top: 10px; font-size: 13px; color: var(--text-secondary); }
.suggest-wrap { position: relative; }
.suggestions { position: absolute; top: 100%; left: 0; right: 0; z-index: 5; max-height: 220px; overflow-y: auto; padding: 4px; background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); }
.suggestions:empty { display: none; }
.suggestions button { display: block; width: 100%; min-height: 44px; padding: 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.suggestions button:hover, .suggestions button:focus-visible { background: var(--accent-soft); color: var(--accent-strong); }
dialog { width: min(620px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); padding: 24px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overscroll-behavior: contain; }
dialog::backdrop { background: rgb(17 18 24 / 48%); backdrop-filter: blur(3px); }
#dialog-body > h2 { margin: 0 38px 20px 0; font-size: 22px; line-height: 1.3; font-weight: 750; letter-spacing: -.3px; }
#dialog-body p { font-size: 14px; }
.dialog-close { position: absolute; top: 14px; right: 14px; margin: 0; }
.dialog-close button { display: grid; place-items: center; width: 40px; height: 40px; padding: 9px; border: 0; border-radius: 12px; background: var(--surface-soft); color: var(--text-secondary); }
#action-form > .buttons { margin-top: 20px; }
#action-form > .buttons > button[type="submit"] { flex: 1; min-height: 48px; font-size: 15px; }
#toast { position: fixed; z-index: 1000; bottom: calc(88px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: none; width: max-content; max-width: calc(100vw - 32px); padding: 13px 18px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); font-size: 14px; overflow-wrap: anywhere; }

.notifications { max-width: 760px; margin: auto; }
.message.unread { border-left: 3px solid var(--accent); padding-left: 18px; }
.message-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-bottom: 12px; font-size: 13px; }
.message-head > span { color: var(--text-secondary); }
.message p { font-size: 15px; }
.people-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.people-tabs { margin-bottom: 18px; }
.people-search { max-width: 580px; }
.person-card { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 0; padding: 16px; }
.person-card h3 { font-size: 16px; font-weight: 750; margin: 0 0 10px; }
.person-card p { font-size: 13px; color: var(--text-secondary); margin: 10px 0 0; }
.person-card > .buttons { margin-top: auto; padding-top: 16px; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 12px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-strong); font-size: 14px; font-weight: 750; }
/* Team: one compact row per person instead of a large card. */
.people-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 14px; }
.people-toolbar .people-tabs { margin: 0; }
.people-toolbar .people-search { flex: 1 1 240px; max-width: 460px; margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.people-count { margin: 0 0 8px; }
.people-list { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.person-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.person-row:last-child { border-bottom: 0; }
.person-row .avatar { width: 32px; height: 32px; margin: 0; border-radius: 10px; font-size: 13px; }
.person-main { min-width: 0; }
.person-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.person-title strong { font-size: 15px; font-weight: 750; overflow-wrap: anywhere; }
.person-title .badge { padding: 2px 8px; font-size: 10.5px; }
.person-meta, .person-coverage { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.4; color: var(--text-secondary); overflow-wrap: anywhere; }
.person-coverage strong { font-weight: 650; color: var(--text); }
.person-coverage details { display: inline; }
.person-coverage summary { display: inline; margin-left: 6px; cursor: pointer; color: var(--accent-strong); }
.person-coverage ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.6; }
.person-actions { justify-content: flex-end; flex-wrap: nowrap; }
.person-actions .button { white-space: nowrap; min-height: 34px; padding: 6px 12px; font-size: 13px; }
.intro-fold summary { cursor: pointer; font-weight: 650; }
.intro-fold p { margin: 8px 0 0; }
.service-summary { margin: 14px 0 0; font-size: 13px; }
.service-summary details { margin-top: 8px; }
.service-summary ul { padding-left: 18px; line-height: 1.6; }
.service-address-list { max-height: 310px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 16px; }
.service-address-list label { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 14px; }
.service-address-list label:last-child { border-bottom: 0; }
.service-address-list input { flex: 0 0 auto; margin-top: 2px; }
.service-address-list span { min-width: 0; overflow-wrap: anywhere; }
.coverage-roaming { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.coverage-roaming > div { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.location-people > div { padding: 12px 0; border-bottom: 1px solid var(--border); }
.location-people .button { margin-top: 8px; }
.chart { display: flex; align-items: flex-end; gap: 10px; min-height: 150px; padding: 12px 2px 8px; }
.historical-chart { overflow-x: auto; overscroll-behavior-x: contain; }
.chart-column { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 0 76px; min-width: 76px; padding: 10px 6px; border: 1px solid transparent; border-radius: 10px; color: var(--text); background: transparent; }
.chart-column .bar { width: 100%; max-width: 50px; min-height: 2px; border-radius: 5px 5px 0 0; background: var(--accent); }
.chart-column small { color: var(--text-secondary); font-size: 12px; line-height: 1.4; }
.chart-column b { font-size: 14px; }
.chart-column.selected-day { border-color: var(--accent); background: var(--accent-soft); }
.diagram-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; font-size: 14px; color: var(--text-secondary); }
.diagram-line span { padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); color: var(--text); }
.inline-code { font-family: monospace; background: var(--surface-soft); padding: 2px 5px; border-radius: 4px; }

@media (min-width: 760px) {
  #bottom-nav { bottom: 12px; width: calc(100% - 48px); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); }
}
@media (max-width: 1099px) {
  .list, .people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 759px) {
  .person-row { grid-template-columns: auto minmax(0, 1fr); align-items: start; padding: 10px 12px; }
  .person-actions { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }
  .main-content { padding-top: 16px; }
  .heading h1 { font-size: 27px; }
  .heading .button { padding: 9px 11px; min-height: 40px; }
  .heading .button svg { width: 18px; height: 18px; }
  .create-long { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { min-height: 66px; padding: 10px; }
  .kpi b { font-size: 22px; }
  .filters #search, .filters #location-filter { grid-column: 1 / -1; }
  .filters input, .filters select { min-height: 46px; padding: 10px; }
  .list, .people-grid, .detail-layout { grid-template-columns: minmax(0, 1fr); }
  .detail-layout { gap: 0; }
  .panel { padding: 16px; }
  .panel h2 { font-size: 18px; }
  .two { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .ticket { padding: 16px; }
  .ticket-overdue { padding-left: 14px; }
  dialog { padding: 20px; }
}
@media (max-width: 359px) {
  .filters { grid-template-columns: minmax(0, 1fr); }
  .header-inner { padding-left: 12px; padding-right: 12px; }
  .header-actions { gap: 0; }
  .header-actions .button.icon { width: 36px; }
  .main-content { padding-left: 12px; padding-right: 12px; }
  .heading { column-gap: 8px; }
  .heading .buttons { gap: 6px; }
  .heading .button { padding: 9px; }
  .heading h1 { font-size: 25px; }
  .nav-item { font-size: 10px; }
  .props { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .props dd { margin-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

/* Preserve the original MAX entry screen and the production profile controls. */
.access-screen {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 20px calc(24px + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(circle at 20% 5%, rgb(112 87 232 / 14%), transparent 30rem),
    radial-gradient(circle at 100% 100%, rgb(22 120 90 / 10%), transparent 28rem),
    var(--bg);
}

.access-card {
  width: min(100%, 420px);
  padding: 30px 24px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.brand-mark {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 21px;
  background: linear-gradient(145deg, var(--accent), #8d70f4);
  box-shadow: 0 12px 28px rgb(112 87 232 / 28%);
  color: #fff;
}

.brand-mark svg {
  width: 34px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.access-card h1 {
  margin: 0;
  font-size: clamp(27px, 8vw, 36px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.access-content {
  display: grid;
  justify-items: center;
  margin-top: 28px;
}

.access-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 14px;
  place-items: center;
  border-radius: 18px;
  background: var(--surface-soft);
  color: var(--text-secondary);
}

.access-icon.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.access-icon svg {
  width: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.access-title {
  margin: 0;
  font-size: 17px;
  font-weight: 720;
}

.access-content .muted {
  max-width: 310px;
  margin-top: 7px;
}

.dev-access-form {
  display: grid;
  width: 100%;
  gap: 10px;
  margin-top: 18px;
  text-align: left;
}

.spinner {
  width: 34px;
  height: 34px;
  margin-bottom: 18px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


.app-header { padding-top: env(safe-area-inset-top, 0px); }
.brand-compact { display: flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.brand-dot { width: 12px; height: 12px; border: 3px solid var(--accent-soft); border-radius: 4px; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.icon-button, .profile-button { min-width: 44px; min-height: 44px; padding: 4px; border: 0; border-radius: 14px; background: transparent; }
.icon-button { position: relative; display: grid; place-items: center; }
.icon-button svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.profile-button { display: flex; align-items: center; gap: 8px; }
.profile-button .avatar { margin: 0; }
.profile-name { font-size: 14px; font-weight: 650; max-width: 240px; overflow-wrap: anywhere; }
.counter-badge { position: absolute; right: 0; top: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: var(--surface); font-size: 10px; font-weight: 750; }
.role-tabs { max-width: 1080px; margin: auto; padding: 0 16px 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.role-badge { padding: 4px 8px; border-radius: 9px; color: var(--accent-strong); background: var(--accent-soft); font-size: 11px; font-weight: 650; line-height: 1.4; }
.noscript-message { margin: 20px; padding: 16px; color: var(--danger); background: var(--danger-soft); border-radius: 12px; }
#directory-list .panel { margin-bottom: 0; }
#directory-list h3 { margin-top: 0; }
@media (max-width: 759px) { .profile-name { display: none; } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* Execution deadline shortcuts stay compact and wrap on small screens. */
.deadline-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 18px; }
.deadline-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.deadline-preset { min-height: 40px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-secondary); font: inherit; font-size: 13px; cursor: pointer; }
.deadline-preset.active { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.deadline-date { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 13px; }
.deadline-date input { min-width: 0; max-width: 170px; min-height: 40px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
.deadline-note { flex-basis: 100%; margin: 0; color: var(--text-secondary); font-size: 12px; line-height: 1.4; }
