/* Shared product components. Existing page layouts remain responsible for geometry. */
body { font-size: 14px; line-height: 1.5; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, select, textarea { accent-color: var(--accent); }
.app-shell { grid-template-columns: 248px minmax(0, 1fr); grid-template-rows: 72px minmax(0, 1fr); }
.sidebar { background: var(--panel); padding: 18px 12px 14px; }
.brand { padding-bottom: 18px; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; box-shadow: none; background: var(--accent); color: var(--on-accent); }
.brand strong { font-size: 15px; font-weight: 650; }
.brand small { color: var(--muted); font-size: 11px; }
.navigation-search input { background: var(--panel-2); }
nav a, nav summary { color: var(--muted); border-radius: 6px; }
nav a:hover, nav summary:hover { background: var(--panel-hover); color: var(--text); }
nav a.active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 2px 0 var(--accent); }
nav details a { border-left-color: var(--line); }
nav details:has(a.active) > summary { color: var(--text); }
.topbar { background: var(--panel); backdrop-filter: none; padding: 12px 24px; }
.topbar h1 { font-size: 21px; font-weight: 650; letter-spacing: -.02em; }
.eyebrow { color: var(--muted); text-transform: none; letter-spacing: 0; }
main { padding: 22px 24px 40px; }
.panel, .metric, .camera-card, .workspace-disclosure { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.panel h3, .field, .quick-list, .vehicle-title { color: var(--text); }
.page-header h2 { font-size: 20px; font-weight: 650; }
.page-header p, .help-text, .record-details dt { color: var(--muted); }
.toolbar { background: var(--panel-2); border-radius: 6px; padding: 12px; gap: 12px; }
.button, .icon-button { border-radius: 6px; box-shadow: none; transition: border-color 120ms; }
.button { min-height: 38px; background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); font-size: 13px; font-weight: 600; padding: 8px 12px; }
.button:hover { filter: none; background: var(--accent-2); border-color: var(--accent-2); }
.button.secondary, .button.ghost, .icon-button { color: var(--text); background: var(--panel); border: 1px solid var(--line); }
.button.secondary:hover, .button.ghost:hover, .icon-button:hover { background: var(--panel-hover); border-color: var(--line-strong); }
.button.danger, .button.bad { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.button.danger:hover, .button.bad:hover { background: var(--danger-soft); border-color: var(--danger); }
.button.warning { color: var(--warning); background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, var(--line)); }
.button.warning:hover { color: var(--warning); background: color-mix(in srgb, var(--warning) 12%, var(--warning-soft)); border-color: var(--warning); }
.button.success { color: var(--on-positive); background: var(--positive-button); border-color: var(--positive-button); }
.button.success:hover { color: var(--on-positive); background: var(--positive-button-hover); border-color: var(--positive-button-hover); }
.button.small { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.button:disabled, .button:disabled:hover, .icon-button:disabled { opacity: 1; color: var(--disabled-text); background: var(--disabled-bg); border-color: var(--line); cursor: not-allowed; filter: none; }
.button[aria-busy="true"] { cursor: progress; }
.button > [data-button-label], .button > span, .button .ui-icon { color: inherit; -webkit-text-fill-color: currentColor; }
.button { line-height: 1.4; white-space: normal; text-align: center; overflow-wrap: anywhere; }
.button > span { min-width: 0; }
.table-wrap td.plate, .table-scroll td.plate { color: var(--text); background: transparent; }
.button .ui-icon { width: 18px; height: 18px; flex: 0 0 18px; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; min-height: 36px; padding: 7px; flex: 0 0 36px; }
.icon-button svg { display: block; width: 20px; height: 20px; flex: none; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { color: var(--text); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 6px; min-height: 38px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:disabled, select:disabled, textarea:disabled { background: var(--panel-2); color: var(--muted); }
.theme-picker { display: flex; align-items: center; gap: 7px; color: var(--muted); flex: 0 0 auto; }
.theme-picker select { width: auto; min-width: 108px; max-width: 150px; padding: 7px 26px 7px 9px; font-size: 12px; background: var(--panel); }
.theme-picker .ui-icon { width: 17px; height: 17px; flex-basis: 17px; }
.status { border-radius: 5px; padding: 3px 7px; font-size: 12px; font-weight: 550; }
.status.ok, .live-status.ok { background: var(--success-soft); color: var(--success); }
.status.warn, .live-status.warn { background: var(--warning-soft); color: var(--warning); }
.status.bad, .live-status.bad { background: var(--danger-soft); color: var(--danger); }
.notice-panel, .pending-state { background: var(--accent-soft); color: var(--text); border-color: var(--line); }
.error-box, .inline-error { color: var(--danger); }
.error-box { border: 1px solid var(--danger); background: var(--danger-soft); border-radius: 8px; padding: 16px; }
.warning-box, .lane-context.warning { background: var(--warning-soft); color: var(--warning); }
.lane-context, .vehicle-summary { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.operator-plate-form { background: var(--panel); border-color: var(--line); border-radius: 6px; }
.exit-session-summary, .live-session-grid { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.exit-session-summary .amount-due { border-color: var(--line); }
.exit-session-summary .amount-due strong, .live-due { color: var(--accent); font-variant-numeric: tabular-nums; }
.live-frame-button, .camera-frame, .dashboard-live-frame { background: var(--camera-bg); }
.live-frame-hint { color: var(--camera-text); }
.plate { background: var(--plate-bg); color: var(--plate-text); border-color: var(--line-strong); }
table { color: var(--text); }
th { color: var(--muted); background: var(--panel-2); font-size: 12px; }
td, th { border-color: var(--line); }
tbody tr:hover { background: var(--panel-2); }
dialog { color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-dialog); }
dialog::backdrop { background: var(--overlay); backdrop-filter: none; }
.dialog-header, .dialog-footer { border-color: var(--line); }
.notification-card, .notification-row, .payment-row { background: var(--panel); border-color: var(--line); }
.notification-row.unread, .notification-card.unread { background: var(--accent-soft); }
.connection { font-size: 11px; }
.connection.ready span { background: var(--success); }
.data-freshness { color: var(--muted); font-size: 11px; }
.data-freshness[data-stale="true"] { color: var(--warning); }
.login-body { background: var(--bg); }
.login-shell { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
.login-intro { color: var(--text); background: var(--panel-2); }
.login-intro .brand strong, .login-intro h1 { color: var(--text); }
.login-intro p, .login-intro .brand small, .login-version { color: var(--muted); }
.login-card, .password-input input { background: var(--panel); color: var(--text); }
.login-card h2 { font-size: 23px; }
.login-intro-copy h1 { font-size: 30px; line-height: 1.2; }
.login-theme { position: absolute; top: 20px; right: 20px; }
.login-body .login-shell { margin-top: 76px; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .topbar, main { grid-column: 1; }
}
@media (max-width: 680px) {
  .topbar { padding: 10px 14px; gap: 8px; }
  .topbar h1 { font-size: 18px; }
  .topbar-actions { gap: 6px; }
  .theme-picker .ui-icon { display: none; }
  .theme-picker select { min-width: 0; max-width: 110px; font-size: 11px; }
  main { padding: 16px 14px 32px; }
  .refresh-button { padding: 8px; }
  .refresh-button [data-button-label] { display: none; }
  .login-theme { top: 14px; right: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Command hierarchy: opening is primary; closing remains clearly available. */
[data-barrier="CLOSE"], [data-barrier-close] { background: var(--panel); color: var(--text); border-color: var(--line-strong); }
[data-barrier="CLOSE"]:hover, [data-barrier-close]:hover { background: var(--panel-hover); border-color: var(--line-strong); }
.client-notice-history { padding: 12px 16px; color: var(--muted); border-top: 1px solid var(--line); }
.client-notice-history small { display: block; font-size: 11px; }

/* VK-style in-app notifications: a stable stack, without moving the workspace. */
.app-shell { grid-template-rows: 72px minmax(0, 1fr); }
.topbar { grid-row: 1; }
.app-shell > main { grid-row: 2; }
.toast-region { position: fixed; z-index: 100; top: auto; bottom: max(20px, env(safe-area-inset-bottom)); right: max(20px, env(safe-area-inset-right)); width: min(376px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 96px); margin: 0; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; pointer-events: none; }
.toast-region:empty { display: none; }
.toast-region .toast { --toast-accent: var(--accent); --toast-surface: var(--accent-soft); display: grid; grid-template-columns: 40px minmax(0, 1fr) 32px; align-items: start; gap: 12px; width: 100%; max-width: none; min-height: 76px; margin: 0; padding: 14px 12px 14px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--panel); box-shadow: var(--shadow-notice); backdrop-filter: none; overflow-wrap: anywhere; pointer-events: auto; animation: notice-enter 160ms ease-out; }
.toast-region .toast-success { --toast-accent: var(--success); --toast-surface: var(--success-soft); }
.toast-region .toast-warning { --toast-accent: var(--warning); --toast-surface: var(--warning-soft); }
.toast-region .toast-error, .toast-region .toast-security { --toast-accent: var(--danger); --toast-surface: var(--danger-soft); }
.toast-region .toast-icon { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 50%; color: var(--toast-accent); background: var(--toast-surface); }
.toast-region .toast-icon svg { width: 22px; height: 22px; display: block; }
.toast-region .toast-body, .toast-region .toast-link { display: flex; flex-direction: column; gap: 4px; min-width: 0; color: inherit; text-decoration: none; line-height: 1.45; }
.toast-region .toast-body strong { color: var(--text); font-size: 14px; font-weight: 650; }
.toast-region .toast-body > span, .toast-region .toast-link > span { color: var(--muted); font-size: 13px; }
.toast-region .toast-link:hover strong { color: var(--accent); text-decoration: none; }
.toast-region .toast-close { display: grid; place-items: center; width: 32px; height: 32px; min-height: 32px; margin: -4px -2px 0 0; padding: 6px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; }
.toast-region .toast-close:hover, .toast-region .toast-close:focus-visible { color: var(--text); background: var(--panel-hover); }
.toast-region .toast-close svg { display: block; width: 20px; height: 20px; }
.toast-region .toast-progress { display: none; }
.toast-region .toast-count { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.toast-region .toast-action { align-self: start; display: inline-flex; align-items: center; min-height: 32px; color: var(--accent); background: transparent; border: 0; padding: 4px 0; text-align: left; font-weight: 600; cursor: pointer; }
@keyframes notice-enter { from { opacity: 0; transform: translateY(8px); } }
.notification-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; align-items: start; gap: 12px; background: var(--panel); border-color: var(--line); }
.notification-item > div { min-width: 0; overflow-wrap: anywhere; }
.notification-item strong { display: block; line-height: 1.4; color: var(--text); }
.notification-item p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.notification-item .icon-button { margin-top: -4px; background: transparent; border-color: transparent; }
.notification-item .icon-button:hover { background: var(--panel-hover); }
.notification-dialog .dialog-header { gap: 12px; }
.notification-dialog .dialog-header h2 { margin: 0; font-size: 18px; }
.notification-dialog .dialog-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.client-notice-history { padding: 14px 18px; color: var(--muted); overflow-wrap: anywhere; }
.client-notice-history small { display: block; }
.toast-region { scrollbar-width: thin; overscroll-behavior: contain; }
.toast-region .toast-body { min-width: 0; }
.toast-region .toast-icon, .notification-symbol { flex-shrink: 0; }
.notification-item.unread { background: var(--accent-soft); }
.notification-symbol { display: grid; place-items: center; width: 36px; height: 36px; color: var(--accent); background: var(--accent-soft); border-radius: 50%; }
.notification-item.ERROR .notification-symbol, .notification-item.CRITICAL .notification-symbol { color: var(--danger); background: var(--danger-soft); }
.notification-item.WARNING .notification-symbol { color: var(--warning); background: var(--warning-soft); }
.manual-gate-dialog .dialog-header { display: flex; gap: 12px; align-items: start; justify-content: space-between; padding: 0 0 14px; }
.manual-gate-dialog .dialog-header h3 { flex: 1; line-height: 1.4; }
.manual-gate-dialog .dialog-header .icon-button { margin: -6px -6px 0 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading h3, .section-heading p { margin: 0 0 5px; }
.whitelist-group-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; margin-top: 16px; }
.whitelist-group-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px; min-width: 0; overflow-wrap: anywhere; }
.whitelist-group-card small { color: var(--muted); }
.whitelist-group-card p { font-size: 13px; margin: 8px 0; }
.access-entry-grid { margin-top: 16px; }
.access-finance-note { background: var(--accent-soft); color: var(--text); border-radius: 6px; padding: 10px 12px; font-size: 13px; margin: 0; }
.incident-detail { display: block; margin-top: 5px; color: var(--muted); }
.incident-toolbar { display: flex; flex-wrap: wrap; align-items: end; }
.incident-toolbar > .field { flex: 0 1 260px; }
.incident-toolbar > .button { width: auto; }
.incident-bulk-dialog .dialog-body p { margin-top: 0; }
.whitelist-group-dialog .dialog-header, .incident-bulk-dialog .dialog-header { align-items: start; gap: 12px; }
.modal-close { display: grid; place-items: center; width: 40px; height: 40px; padding: 8px; border-radius: 10px; color: var(--camera-text); background: rgb(12 20 32 / 80%); }
.modal-close svg { width: 24px; height: 24px; }
.barrier-state { display: grid; justify-items: end; gap: 3px; text-align: right; }
.barrier-state .status { display: inline-flex; align-items: center; gap: 5px; white-space: normal; }
.barrier-state .status .ui-icon { width: 14px; height: 14px; flex: 0 0 14px; }
.barrier-state small { color: var(--muted); font-size: 10px; max-width: 160px; }
.barrier-state .status.neutral { background: var(--panel-2); color: var(--muted); }
.barrier-hold-actions .button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.zone-sensor[data-state="IDLE"] i { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.zone-sensor[data-state="UNKNOWN"] i, .zone-sensor[data-state="DISABLED"] i { background: var(--line-strong); }
.zone-sensor[data-state="STALE"] i { background: var(--warning); }
.zone-sensor[data-state="ERROR"] i { background: var(--danger); }
@media (max-width: 680px) {
  .topbar h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 17px; }
  .incident-toolbar > .field, .incident-toolbar > .button { flex: 1 1 100%; width: 100%; }
  .section-heading { align-items: start; flex-wrap: wrap; }
  .section-heading .button { width: 100%; }
  .notification-item { grid-template-columns: 36px minmax(0, 1fr) 36px; gap: 10px; padding: 14px 12px; }
  .toast-region { bottom: max(12px, env(safe-area-inset-bottom)); right: max(12px, env(safe-area-inset-right)); width: calc(100vw - 24px); max-height: 50dvh; }
  .toast-region .toast { grid-template-columns: 36px minmax(0, 1fr) 36px; gap: 10px; padding: 12px; }
  .toast-region .toast-icon { width: 36px; height: 36px; }
  .toast-region .toast-close { width: 36px; height: 36px; }
}
