@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap');

:root {
    --ink: #18262c;
    --muted: #728086;
    --paper: #f7f9f8;
    --card: #ffffff;
    --line: #e1e8e5;
    --green: #147d63;
    --green-dark: #0b5b49;
    --green-soft: #e1f3ed;
    --amber: #b7791f;
    --amber-soft: #fff5dc;
    --red: #b64848;
    --red-soft: #ffebeb;
    --shadow: 0 12px 30px rgba(25, 57, 49, .07);
    --page-gradient: radial-gradient(circle at 84% 12%, #dff5eb 0, transparent 35%), var(--paper);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--page-gradient); color: var(--ink); font-family: 'DM Sans', system-ui, sans-serif; }
body { font-size: 15px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }
h1, h2, h3 { font-family: 'Manrope', sans-serif; letter-spacing: -.03em; margin: 0; }
h1 { font-size: clamp(1.8rem, 3vw, 2.45rem); }
/* FocusOnNavigate targets the page heading so assistive technology announces
   each route. The non-interactive heading should not show the browser's
   default focus rectangle. */
main h1[tabindex="-1"]:focus { outline: none; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
p { line-height: 1.55; }

.app-shell { background: var(--page-gradient); display: flex; min-height: 100vh; }
.sidebar { background: #103e37; color: #d9eee7; display: flex; flex: 0 0 254px; flex-direction: column; min-height: 100vh; padding: 28px 16px 20px; }
.brand { align-items: center; display: flex; gap: 11px; padding: 0 12px 31px; }
.brand-mark { align-items: center; background: #b7e9d8; border-radius: 11px; color: #103e37; display: flex; font-family: Manrope, sans-serif; font-size: 1.35rem; font-weight: 800; height: 38px; justify-content: center; width: 38px; }
.brand-mark img { height: 30px; object-fit: contain; width: 30px; }
.brand strong { color: #f5fffb; display: block; font-family: Manrope, sans-serif; font-size: 1.24rem; letter-spacing: -.06em; line-height: 1; }
.brand small { color: #9ac4b8; display: block; font-size: .67rem; letter-spacing: .08em; margin-top: 4px; text-transform: uppercase; }
.tenant-picker { border-bottom: 1px solid rgba(212, 243, 234, .14); border-top: 1px solid rgba(212, 243, 234, .14); padding: 17px 12px 19px; }
.tenant-picker label { color: #8fbdb1; display: block; font-size: .68rem; font-weight: 700; letter-spacing: .1em; margin-bottom: 8px; text-transform: uppercase; }
.tenant-picker select { background: #1a554b; border: 1px solid rgba(215, 246, 237, .2); border-radius: 8px; color: #f4fffb; max-width: 100%; outline: 0; padding: 9px 10px; width: 100%; }
.tenant-picker .muted { color: #8fbdb1; font-size: .82rem; }
.inline-error { color: #ffc6ba; display: block; font-size: .78rem; line-height: 1.35; }
.main-nav { display: flex; flex-direction: column; gap: 3px; padding-top: 20px; }
.main-nav a { align-items: center; border-radius: 8px; color: #b7d6ce; display: flex; gap: 12px; padding: 11px 12px; transition: background .15s, color .15s; }
.main-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.main-nav a.active { background: #d5f2e8; color: #123f37; font-weight: 700; }
.nav-icon { display: inline-flex; font-size: 1.1rem; justify-content: center; opacity: .82; width: 19px; }
.nav-heading { color: #6d9b90; font-size: .66rem; font-weight: 700; letter-spacing: .13em; margin: 20px 12px 6px; text-transform: uppercase; }
.sidebar-footer { border-top: 1px solid rgba(212, 243, 234, .14); margin-top: auto; padding: 18px 12px 0; }
.user-chip { align-items: center; display: flex; gap: 10px; min-width: 0; }
.avatar { align-items: center; background: #28695b; border-radius: 50%; color: #dcf7ed; display: flex; flex: 0 0 31px; font-size: .7rem; font-weight: 700; height: 31px; justify-content: center; }
.user-copy { display: flex; flex-direction: column; min-width: 0; }
.user-copy strong { color: #e7faf4; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy small { color: #82afa2; font-size: .68rem; margin-top: 2px; }
.logout-link { background: none; border: 0; color: #91baae; cursor: pointer; display: block; font: inherit; font-size: .77rem; margin-top: 17px; padding: 0; }
.logout-link:hover { color: #fff; }
.content-area { flex: 1; min-width: 0; padding: 42px clamp(22px, 5vw, 72px) 70px; }
.global-page-actions { display: flex; justify-content: flex-end; margin-bottom: 18px; }
.page-head { align-items: flex-start; display: flex; gap: 24px; justify-content: space-between; margin-bottom: 30px; }
.page-head p { color: var(--muted); margin: 8px 0 0; }
.eyebrow { color: var(--green); display: block; font-size: .68rem; font-weight: 800; letter-spacing: .14em; margin-bottom: 10px; text-transform: uppercase; }
.head-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 9px; }
.button { align-items: center; border: 0; border-radius: 8px; display: inline-flex; font-weight: 700; gap: 7px; justify-content: center; min-height: 40px; padding: 0 16px; }
.button.primary { background: var(--green); color: #fff; }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { background: var(--card); border: 1px solid #78b9a7; box-shadow: 0 3px 10px rgba(25, 57, 49, .1); color: var(--green-dark); }
.button.secondary:hover { background: var(--green-soft); border-color: var(--green); }
.button.ghost { background: transparent; color: var(--green-dark); }
.button.danger { background: var(--red-soft); color: var(--red); }
.button.small { font-size: .77rem; min-height: 32px; padding: 0 10px; }
.button:disabled { cursor: not-allowed; opacity: .52; }
.grid { display: grid; gap: 17px; }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 28px; }
.stat-card, .card { background: var(--card); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.stat-card { padding: 20px; }
.stat-label { color: var(--muted); font-size: .76rem; font-weight: 600; }
.stat-value { font-family: Manrope, sans-serif; font-size: 2rem; font-weight: 800; letter-spacing: -.07em; margin-top: 9px; }
.stat-note { color: var(--green); font-size: .74rem; margin-top: 6px; }
.card { padding: 22px; }
.card-head { align-items: center; display: flex; gap: 15px; justify-content: space-between; margin-bottom: 18px; }
.card-head p { color: var(--muted); font-size: .82rem; margin: 4px 0 0; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; min-width: 620px; width: 100%; }
th { color: #81908e; font-size: .68rem; font-weight: 800; letter-spacing: .08em; padding: 0 12px 11px; text-align: left; text-transform: uppercase; }
td { border-top: 1px solid #edf1ef; padding: 14px 12px; vertical-align: middle; }
tr:hover td { background: #fbfdfc; }
.primary-text { font-weight: 700; }
.secondary-text { color: var(--muted); font-size: .78rem; margin-top: 3px; }
.badge { border-radius: 999px; display: inline-flex; font-size: .7rem; font-weight: 800; padding: 5px 9px; }
.badge.success { background: var(--green-soft); color: var(--green-dark); }
.badge.warning { background: var(--amber-soft); color: var(--amber); }
.badge.danger { background: var(--red-soft); color: var(--red); }
.badge.neutral { background: #edf1f0; color: #687775; }
.form-grid { display: grid; gap: 15px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: #53635f; font-size: .77rem; font-weight: 700; }
.field label.check-field { align-items: center; display: flex; flex-direction: row; gap: 8px; }
.field label.check-field input[type="checkbox"] { accent-color: var(--green); min-height: auto; width: auto; }
.field input, .field select, .field textarea, .filter input, .filter select { background: #fff; border: 1px solid #ccd8d4; border-radius: 7px; color: var(--ink); min-height: 40px; outline: 0; padding: 8px 10px; width: 100%; }
.field textarea { min-height: 82px; resize: vertical; }
.field .field-hint { color: var(--muted); font-size: .72rem; font-weight: 400; }
.field input:focus, .field select:focus, .field textarea:focus, .filter input:focus, .filter select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20, 125, 99, .1); }
.field small, .validation-message { color: var(--red); font-size: .75rem; }
.form-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 18px; }
.alert { border-radius: 8px; font-size: .82rem; margin: 0 0 18px; padding: 12px 14px; }
.alert.error { background: var(--red-soft); color: #903f3f; }
.alert.success { background: var(--green-soft); color: var(--green-dark); }
.alert.info { background: #edf4fb; color: #34617f; }
.empty-state { align-items: center; display: flex; flex-direction: column; justify-content: center; min-height: 38vh; padding: 40px; text-align: center; }
.empty-state p { color: var(--muted); margin: 9px 0 20px; max-width: 430px; }
.loading { color: var(--muted); padding: 28px 0; text-align: center; }
.filters { align-items: flex-end; display: flex; flex-wrap: wrap; gap: 11px; margin-bottom: 17px; }
.filter { display: flex; flex: 1 1 150px; flex-direction: column; gap: 5px; }
.filter label { color: var(--muted); font-size: .7rem; font-weight: 700; }
.split-grid { grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); }
.device-state { align-items: center; display: flex; gap: 9px; }
.state-dot { background: #9ca9a7; border-radius: 50%; height: 9px; width: 9px; }
.state-dot.online { background: #22a67e; box-shadow: 0 0 0 4px #dff6ec; }
.state-dot.stale { background: #d4952b; }
.stat-list { display: grid; gap: 0; }
.stat-list-row { align-items: center; border-bottom: 1px solid #edf1ef; display: flex; justify-content: space-between; padding: 12px 0; }
.stat-list-row:last-child { border-bottom: 0; }
.stat-list-row span { color: var(--muted); font-size: .8rem; }
.stat-list-row strong { font-size: .82rem; text-align: right; }
.vehicle-list { display: flex; flex-wrap: wrap; gap: 5px; }
.vehicle-chip { align-items: center; background: #f1f5f3; border: 1px solid #e0e9e5; border-radius: 5px; display: inline-flex; font-size: .74rem; gap: 5px; padding: 4px 7px; }
.vehicle-chip button { background: transparent; border: 0; color: var(--red); line-height: 1; padding: 0; }
.modal-backdrop { align-items: center; background: rgba(12, 32, 28, .42); display: flex; inset: 0; justify-content: center; padding: 20px; position: fixed; z-index: 20; }
.modal { background: #fff; border-radius: 13px; box-shadow: 0 25px 60px rgba(0,0,0,.2); max-width: 540px; padding: 25px; width: 100%; }
.modal p { color: var(--muted); font-size: .86rem; }
.login-shell { min-height: 100vh; }
.living-auth-shell { background: var(--page-gradient); display: flex; min-height: 100vh; }
.living-auth-brand-panel { background: linear-gradient(155deg, #103e37 0%, #1a554b 100%); color: #fff; display: flex; flex: 0 0 45%; flex-direction: column; justify-content: space-between; min-height: 100vh; overflow: hidden; padding: 48px clamp(35px, 7vw, 112px); position: relative; }
.living-auth-brand-panel::after { border: 1px solid rgba(212, 243, 234, .14); border-radius: 50%; content: ''; height: 490px; position: absolute; right: -215px; top: 21%; width: 490px; }
.living-auth-brand-panel::before { background: radial-gradient(circle, rgba(74, 180, 147, .28), transparent 68%); content: ''; height: 420px; position: absolute; right: -100px; top: 13%; width: 420px; }
.living-auth-brand { align-items: center; display: flex; gap: 12px; position: relative; z-index: 1; }
.living-auth-brand-mark { align-items: center; background: #f3eadf; border-radius: 12px; display: inline-flex; height: 44px; justify-content: center; width: 44px; }
.living-auth-brand-mark img { height: 32px; object-fit: contain; width: 32px; }
.living-auth-brand strong { display: block; font-family: 'Manrope', sans-serif; font-size: 1.42rem; letter-spacing: -.05em; line-height: 1; }
.living-auth-brand small { color: #a9b1d4; display: block; font-size: .67rem; letter-spacing: .1em; margin-top: 5px; text-transform: uppercase; }
.living-auth-brand-copy { max-width: 390px; position: relative; z-index: 1; }
.living-auth-eyebrow { color: #a7e1ce; display: block; font-size: .68rem; font-weight: 800; letter-spacing: .15em; margin-bottom: 13px; text-transform: uppercase; }
.living-auth-brand-copy h1 { color: #fff; font-family: 'Manrope', sans-serif; font-size: clamp(2.2rem, 4vw, 3.55rem); letter-spacing: -.065em; line-height: 1.04; margin: 0; }
.living-auth-brand-copy p { color: #b5b9d6; font-size: 1rem; line-height: 1.65; margin: 21px 0 0; max-width: 320px; }
.living-auth-brand-foot { align-items: center; color: #8c95bb; display: flex; font-size: .73rem; gap: 8px; letter-spacing: .03em; position: relative; z-index: 1; }
.living-auth-brand-foot img { height: 31px; object-fit: contain; width: 31px; }
.living-brand-footer-copy { display: flex; flex-direction: column; gap: 4px; }
.living-release-version { font-size: .7rem; font-weight: 400; letter-spacing: .02em; }
.living-sidebar-brand-foot { align-items: center; color: #a9c4bc; display: flex; font-size: .73rem; gap: 8px; margin-top: 16px; text-decoration: none; }
.living-sidebar-brand-foot img { height: 27px; object-fit: contain; width: 27px; }
.living-auth-card { align-self: center; background: #fff; border: 1px solid #e2e6ef; border-radius: 16px; box-shadow: 0 24px 65px rgba(26, 32, 75, .09); margin: auto; max-width: 438px; padding: 38px; text-align: left; width: calc(100% - 48px); }
.living-auth-card-heading { align-items: flex-start; display: flex; gap: 13px; margin-bottom: 29px; }
.living-auth-card-icon { align-items: center; background: #e1f3ed; border-radius: 10px; color: #147d63; display: inline-flex; flex: 0 0 40px; height: 40px; justify-content: center; }
.living-auth-card-icon svg { fill: currentColor; height: 21px; width: 21px; }
.living-auth-card-icon img { height: 28px; object-fit: contain; width: 28px; }
.living-auth-card-heading h2 { color: #182033; font-family: 'Manrope', sans-serif; font-size: 1.42rem; letter-spacing: -.045em; margin: 0; }
.living-auth-card-heading p { color: #697089; font-size: .84rem; margin: 5px 0 0; }
.living-auth-card form { display: grid; gap: 7px; text-align: left; }
.living-auth-card label { color: #4e596d; font-size: .78rem; font-weight: 700; margin-top: 8px; }
.living-auth-card input { background: #fbfcff; border: 1px solid #d8dce7; border-radius: 8px; color: #182033; font-size: .91rem; min-height: 45px; outline: 0; padding: 0 12px; transition: border-color .15s, box-shadow .15s; width: 100%; }
.living-auth-card input:focus { border-color: #147d63; box-shadow: 0 0 0 3px rgba(20, 125, 99, .13); }
.living-auth-card button { align-items: center; background: #147d63; border: 0; border-radius: 8px; color: #fff; cursor: pointer; display: flex; font-size: .9rem; font-weight: 800; justify-content: space-between; margin-top: 17px; min-height: 46px; padding: 0 15px; transition: background .15s, transform .15s; width: 100%; }
.living-auth-card button:hover { background: #0b5b49; transform: translateY(-1px); }
.living-auth-card button span { font-size: 1.2rem; font-weight: 400; }
.living-auth-alert { border-radius: 7px; font-size: .78rem; margin: 0 0 14px; padding: 9px 10px; }
.living-auth-alert.error { background: #fff0f0; color: #b54848; }
.living-auth-alert.success { background: #e4f6ef; color: #176b57; }
.living-auth-password-link, .living-auth-secondary-link { color: #147d63; display: block; font-size: .76rem; font-weight: 700; margin-top: 15px; text-align: center; text-decoration: none; }
.living-auth-password-link:hover, .living-auth-secondary-link:hover { color: #0b5b49; text-decoration: underline; }
.living-auth-hint { color: #7b8498; font-size: .72rem; line-height: 1.5; margin: 22px 0 0; text-align: center; }
.living-auth-security-note { color: #99a1b1; font-size: .71rem; margin: 20px 0 0; text-align: center; }
.living-auth-security-note span { color: #239b84; font-size: .65rem; margin-right: 4px; }
.living-password-card .living-password-notice { background: #f4faf7; border: 1px solid #d8eee5; border-radius: 8px; color: #37675a; font-size: .78rem; line-height: 1.5; margin: -10px 0 17px; padding: 10px 11px; }
.living-password-card .password-requirement { color: #7b8498; font-size: .7rem; margin: -2px 0 3px; }
.account-password-link { color: #a7e1ce; display: block; font-size: .68rem; font-weight: 700; margin-top: 3px; text-decoration: none; }
.account-password-link:hover { color: #fff; text-decoration: underline; }
.token-box { background: #f4faf7; border: 1px dashed #83b9a9; border-radius: 8px; color: var(--green-dark); font-family: ui-monospace, SFMono-Regular, monospace; font-size: .76rem; overflow-wrap: anywhere; padding: 12px; }
.actions { align-items: center; display: flex; flex-wrap: wrap; gap: 7px; }
.text-right { text-align: right; }
.gatehouse-eyebrow { margin-top: 15px; }
.gatehouse-switcher { margin: -5px 0 20px; min-width: 0; }
.gatehouse-switcher-label { color: var(--muted); display: block; font-size: .76rem; font-weight: 700; margin-bottom: 8px; }
.gatehouse-switcher-links { display: grid; gap: 8px; grid-auto-columns: minmax(220px, 280px); grid-auto-flow: column; overflow-x: auto; padding-bottom: 3px; }
.gatehouse-switch-link { align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); display: flex; font-size: .82rem; font-weight: 700; height: 48px; min-width: 0; padding: 0 14px; text-decoration: none; }
.gatehouse-switch-link span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gatehouse-switch-link:hover, .gatehouse-switch-link:focus-visible { border-color: var(--green); color: var(--green-dark); }
.gatehouse-switch-link.active { background: #e4f6ef; border-color: var(--green); color: var(--green-dark); }
.gatehouse-list-shell { overflow: hidden; }
.gatehouse-grid { display: grid; gap: 17px; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.gatehouse-card { border: 1px solid var(--line); border-radius: 11px; display: flex; flex-direction: column; min-width: 0; padding: 19px; }
.gatehouse-card .card-head { align-items: flex-start; }
.gatehouse-card-badges { align-items: center; display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.gatehouse-mode-badge { align-self: flex-start; margin-bottom: 0; }
.gatehouse-open-button { margin-top: 17px; width: 100%; }
.gatehouse-operation-grid { align-items: stretch; display: grid; gap: 20px; grid-template-areas: "analysis primary" "analysis offline" "pipeline pipeline"; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.gatehouse-latest-column, .gatehouse-control-column { display: contents; }
.gatehouse-result-column { grid-area: analysis; min-width: 0; }
.gatehouse-primary-controls .card-head, .gatehouse-offline-card .card-head, .analysis-card .card-head, .pipeline-card .card-head { margin-bottom: 14px; }
.gatehouse-primary-controls { display: grid; gap: 14px; grid-area: primary; min-width: 0; }
.gatehouse-offline-card { grid-area: offline; min-width: 0; }
.analysis-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.latest-result-grid { grid-template-columns: minmax(0, 1fr); }
.analysis-card { min-width: 0; }
.analysis-card .card-head { align-items: flex-start; }
.analysis-content { align-items: center; display: grid; gap: 15px; grid-template-columns: minmax(110px, 1fr) minmax(110px, .8fr); }
.analysis-crop { align-items: center; aspect-ratio: 16 / 7; background: #edf1f0; border-radius: 8px; color: var(--muted); display: flex; font-size: .75rem; justify-content: center; overflow: hidden; text-align: center; }
.analysis-crop.face-crop { aspect-ratio: 1; justify-self: start; max-width: 125px; width: 100%; }
.analysis-crop img { height: 100%; object-fit: contain; width: 100%; }
.analysis-details { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.analysis-details strong { font-family: Manrope, sans-serif; font-size: 1.25rem; overflow-wrap: anywhere; }
.analysis-details span { color: var(--muted); font-size: .78rem; }
.pipeline-card { grid-area: pipeline; }
.pipeline-card .stat-list { column-gap: 20px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pipeline-actions { margin-top: 14px; }
.access-filters .button { flex: 0 0 auto; }
.access-history-list { display: grid; gap: 12px; }
.access-history-item { border: 1px solid var(--line); border-radius: 10px; padding: 17px; }
.access-history-heading { align-items: flex-start; display: flex; gap: 15px; justify-content: space-between; }
.access-history-title { align-items: baseline; display: flex; flex-wrap: wrap; gap: 0 10px; }
.access-history-title > * { color: var(--ink); font-size: .9rem; font-weight: 700; }
.access-gate-name { min-width: 0; overflow-wrap: anywhere; }
.access-device-id { color: var(--muted); display: block; font-size: .68rem; margin-top: 2px; }
.access-signal-grid { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 16px; }
.access-signal { background: #f7faf9; border-radius: 8px; display: flex; flex-direction: column; min-width: 0; padding: 11px; }
.access-signal span, .access-reason span { color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.access-signal strong { font-size: .84rem; margin-top: 4px; overflow-wrap: anywhere; }
.access-signal small { color: var(--muted); font-size: .7rem; margin-top: 3px; }
.access-reason { border-top: 1px solid #edf1ef; display: flex; flex-direction: column; gap: 4px; margin: 14px 0 0; padding-top: 12px; }
.access-reason strong { font-size: .82rem; }
.history-evidence { border-top: 1px solid #edf1ef; margin-top: 14px; padding-top: 12px; }
.history-evidence-toggle { min-height: 36px; }
.history-evidence-panel { margin-top: 12px; }
.history-evidence-loading { color: var(--muted); font-size: .82rem; margin: 0 0 10px; }
.history-evidence-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.history-evidence-role { background: #f7faf9; border: 1px solid var(--line); border-radius: 9px; display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 12px; }
.history-evidence-role > header { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.history-evidence-role h3 { font-size: .92rem; margin: 0; }
.history-evidence-role > strong { font-size: .82rem; overflow-wrap: anywhere; }
.history-evidence-image { align-items: center; aspect-ratio: 16 / 8; background: #edf1f0; border-radius: 7px; color: var(--muted); display: flex; font-size: .76rem; justify-content: center; overflow: hidden; padding: 8px; text-align: center; }
.history-evidence-image-face { aspect-ratio: 1; max-width: 220px; }
.history-evidence-image img { height: 100%; object-fit: contain; width: 100%; }
.history-evidence-note { color: var(--muted); font-size: .75rem; margin: 10px 0 0; }

@media (max-width: 980px) {
    .sidebar { flex-basis: 220px; }
    .content-area { padding: 30px 28px 60px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split-grid { grid-template-columns: 1fr; }
    .gatehouse-operation-grid { grid-template-areas: "analysis" "primary" "offline" "pipeline"; grid-template-columns: 1fr; }
    .gatehouse-latest-column, .gatehouse-control-column { display: contents; }
    .gatehouse-result-column { grid-area: analysis; }
    .gatehouse-primary-controls { grid-area: primary; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gatehouse-offline-card { grid-area: offline; }
    .pipeline-card { grid-area: pipeline; }
    .pipeline-card .stat-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
    .app-shell { display: block; }
    .sidebar { min-height: auto; padding: 16px 14px; position: relative; }
    .brand { padding-bottom: 17px; }
    .tenant-picker { padding: 13px 12px; }
    .main-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 12px; }
    .nav-heading { display: none; }
    .sidebar-footer { margin-top: 15px; padding-top: 13px; }
    .logout-link { display: inline-block; margin-left: 43px; margin-top: -1px; }
    .content-area { padding: 25px 15px 45px; }
    .page-head { display: block; margin-bottom: 21px; }
    .head-actions { margin-top: 17px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .wide { grid-column: auto; }
    .card { padding: 17px; }
    .gatehouse-grid { grid-template-columns: 1fr; }
    .gatehouse-primary-controls, .analysis-grid, .analysis-content, .access-signal-grid, .pipeline-card .stat-list, .history-evidence-grid { grid-template-columns: 1fr; }
    .analysis-crop.face-crop { max-width: none; }
    .analysis-crop.face-crop, .analysis-crop { aspect-ratio: 16 / 9; }
    .filters .button { width: 100%; }
    .access-history-item { padding: 14px; }
    .living-auth-shell { display: block; }
    .living-auth-brand-panel { min-height: 290px; padding: 28px 24px 33px; }
    .living-auth-brand-copy { margin-top: 42px; }
    .living-auth-brand-copy h1 { font-size: 2rem; }
    .living-auth-brand-copy p { display: none; }
    .living-auth-brand-foot { display: flex; margin-top: 20px; }
    .living-auth-card { margin: -16px auto 24px; padding: 28px 23px; position: relative; width: calc(100% - 30px); }
}
