/* POS Access Control dashboard — POS-ACCESS-CTRL-001.
   Built on the intake shell (.ik-shell / .ik-topbar) so the page keeps the POS header,
   navigation and type scale. Only this screen's own layout lives here. */

.ac-body { background: var(--ik-canvas, #F7F9FC); }

/* Visually-hidden label text. Defined here because the POS stylesheets have no such
   utility — without it every <label class="sr-only"> on this page would render as visible
   text and push the filter row apart. */
.ac-body .sr-only {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* The intake shell locks <body> to the viewport and expects the page body to be the
   scrolling region; the status bar is pinned below it. */
.ac-main {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 24px 28px;
    width: 100%;
}

.ac-head {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.ac-head h1 { font-size: 28px; font-weight: 700; margin: 0; color: var(--ik-ink, #0f172a); letter-spacing: -0.02em; }
.ac-head .ac-sub { margin: 4px 0 0; font-size: 13.5px; color: var(--ik-muted, #64748b); }
.ac-head .ac-spacer { flex: 1 1 auto; }
.ac-head-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.ac-date {
    padding: 9px 12px;
    border: 1px solid var(--ik-line, #e2e8f0);
    border-radius: 9px;
    background: #fff;
    font: inherit;
    font-size: 14px;
    color: var(--ik-ink, #0f172a);
}

/* Live indicator — the dot is decorative; the word next to it carries the state. */
.ac-live {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--ik-line, #e2e8f0);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.ac-live .ac-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; flex: none; }
.ac-live[data-state="live"] { color: var(--ik-success, #079752); }
.ac-live[data-state="live"] .ac-dot { background: var(--ik-success, #079752); animation: ac-pulse 2s ease-in-out infinite; }
.ac-live[data-state="reconnecting"] { color: var(--ik-warning, #D97706); }
.ac-live[data-state="reconnecting"] .ac-dot { background: var(--ik-warning, #D97706); }
.ac-live[data-state="interrupted"] { color: var(--ik-danger, #DC2626); }
.ac-live[data-state="interrupted"] .ac-dot { background: var(--ik-danger, #DC2626); }
.ac-live[data-state="historical"] { color: var(--ik-muted, #64748b); }

@keyframes ac-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .ac-live .ac-dot { animation: none; } }

.ac-refresh {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--ik-line, #e2e8f0);
    border-radius: 9px;
    background: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--ik-ink, #0f172a);
    cursor: pointer;
}
.ac-refresh:hover { background: #f8fafc; }
.ac-refresh[aria-busy="true"] { opacity: .6; cursor: progress; }

/* ── KPI row ───────────────────────────────────────────────────────────── */
.ac-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 8px; }
.ac-kpi {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid var(--ik-line, #e2e8f0);
    border-radius: 12px;
    padding: 18px 20px;
}
.ac-kpi-ico {
    width: 40px; height: 40px; flex: none;
    display: grid; place-items: center;
    border-radius: 10px;
    background: #eef4ff;
    color: var(--ik-primary, #0661F2);
}
.ac-kpi-ico svg { width: 20px; height: 20px; }
.ac-kpi-label { font-size: 13px; color: var(--ik-muted, #64748b); }
.ac-kpi-value { font-size: 30px; font-weight: 700; color: var(--ik-ink, #0f172a); line-height: 1.15; letter-spacing: -0.02em; }

.ac-note { margin: 10px 2px 18px; font-size: 13px; color: var(--ik-muted, #64748b); min-height: 18px; }
.ac-note:empty { margin-bottom: 8px; }

/* ── Layout ────────────────────────────────────────────────────────────── */
.ac-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.ac-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.ac-card { background: #fff; border: 1px solid var(--ik-line, #e2e8f0); border-radius: 12px; padding: 18px 20px; }
.ac-card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ac-card-head h2 { font-size: 17px; font-weight: 700; margin: 0; color: var(--ik-ink, #0f172a); }
.ac-card-head .ac-spacer { flex: 1 1 auto; }

.ac-link {
    background: none; border: none; padding: 0;
    font: inherit; font-size: 13.5px; font-weight: 600;
    color: var(--ik-primary, #0661F2); cursor: pointer;
}
.ac-link:hover { text-decoration: underline; }
.ac-link[disabled] { color: var(--ik-muted, #64748b); cursor: not-allowed; text-decoration: none; }

.ac-ghost {
    padding: 8px 14px;
    border: 1px solid var(--ik-line, #e2e8f0);
    border-radius: 8px;
    background: #fff;
    font: inherit; font-size: 13px; font-weight: 600;
    color: var(--ik-ink, #0f172a);
    cursor: pointer;
}
.ac-ghost:hover { background: #f8fafc; }
.ac-ghost[disabled] { opacity: .5; cursor: not-allowed; }

/* ── Filters ───────────────────────────────────────────────────────────── */
.ac-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ac-filters select {
    padding: 9px 12px;
    border: 1px solid var(--ik-line, #e2e8f0);
    border-radius: 9px;
    background: #fff;
    font: inherit; font-size: 13.5px;
    color: var(--ik-ink, #0f172a);
    min-width: 140px;
}
.ac-search { position: relative; flex: 1 1 220px; min-width: 180px; }
.ac-search input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    border: 1px solid var(--ik-line, #e2e8f0);
    border-radius: 9px;
    font: inherit; font-size: 13.5px;
    color: var(--ik-ink, #0f172a);
}
.ac-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: #94a3b8; }
.ac-searching { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--ik-muted, #64748b); }

/* ── Tables ────────────────────────────────────────────────────────────── */
.ac-scroll { overflow-x: auto; }
table.ac-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ac-table th {
    text-align: left; padding: 9px 12px 9px 0;
    border-bottom: 1px solid var(--ik-line, #e2e8f0);
    color: var(--ik-muted, #64748b); font-weight: 600; font-size: 12.5px; white-space: nowrap;
}
.ac-table td { padding: 11px 12px 11px 0; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.ac-table tbody tr:last-child td { border-bottom: none; }
.ac-table tbody tr:hover { background: #fafcff; }
.ac-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--ik-muted, #64748b); }
.ac-strong { font-weight: 600; color: var(--ik-ink, #0f172a); }
.ac-unnamed { color: var(--ik-danger, #DC2626); font-weight: 600; }
.ac-time { white-space: nowrap; color: var(--ik-muted, #64748b); }

/* ── Badges — the word is the signal; the colour only reinforces it ─────── */
.ac-badge {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.ac-badge[data-tone="ok"] { background: #e7f7ee; color: #0f7a46; }
.ac-badge[data-tone="bad"] { background: #fdeaea; color: #b42318; }
.ac-badge[data-tone="warn"] { background: #fef3c7; color: #92400e; }
.ac-badge[data-tone="neutral"] { background: #f1f5f9; color: #475569; }

.ac-dir { display: inline-block; padding: 3px 10px; border-radius: 6px; background: #eef4ff; color: var(--ik-primary, #0661F2); font-size: 12px; font-weight: 600; }
.ac-dir[data-dir="out"] { background: #f1f5f9; color: #475569; }

.ac-flag { display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 5px; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.ac-flag[data-kind="manual"] { background: #ede9fe; color: #5b21b6; }
.ac-flag[data-kind="bypass"] { background: #fef3c7; color: #92400e; }

.ac-dotmark { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.ac-dotmark[data-tone="ok"] { background: var(--ik-success, #079752); }
.ac-dotmark[data-tone="bad"] { background: var(--ik-danger, #DC2626); }
.ac-dotmark[data-tone="warn"] { background: var(--ik-warning, #D97706); }
.ac-dotmark[data-tone="neutral"] { background: #94a3b8; }

/* ── Empty / error states ──────────────────────────────────────────────── */
.ac-state { padding: 34px 16px; text-align: center; color: var(--ik-muted, #64748b); font-size: 13.5px; }
.ac-state[data-kind="error"] { color: var(--ik-danger, #DC2626); }
.ac-state .ac-link { margin-top: 10px; display: inline-block; }

/* ── Gate status ───────────────────────────────────────────────────────── */
.ac-gate {
    border: 1px solid var(--ik-line, #e2e8f0);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
}
.ac-gate:last-of-type { margin-bottom: 0; }
.ac-gate-top { display: flex; align-items: flex-start; gap: 10px; }
.ac-gate-name { font-weight: 600; color: var(--ik-ink, #0f172a); font-size: 14.5px; }
.ac-gate-meta { font-size: 12px; color: var(--ik-muted, #64748b); margin-top: 3px; line-height: 1.5; }
.ac-gate-actions { display: flex; gap: 8px; margin-top: 12px; }
.ac-gate-actions .ac-ghost { flex: 1; }
.ac-conn { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ik-muted, #64748b); margin-left: auto; }
.ac-sync { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 12.5px; color: var(--ik-muted, #64748b); }
.ac-sync .ac-spacer { flex: 1 1 auto; }
.ac-warnstrip {
    margin-bottom: 12px; padding: 10px 12px;
    background: #fef3c7; border: 1px solid #fcd34d; border-radius: 9px;
    font-size: 12.5px; color: #92400e;
}

/* ── Quick actions ─────────────────────────────────────────────────────── */
.ac-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ac-action {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 14px;
    border: 1px solid var(--ik-line, #e2e8f0);
    border-radius: 10px;
    background: #fff;
    font: inherit; font-size: 13.5px; font-weight: 600;
    color: var(--ik-ink, #0f172a);
    cursor: pointer;
    text-align: left;
}
.ac-action:hover:not([disabled]) { background: #f8fafc; border-color: #cbd5e1; }
.ac-action[disabled] { opacity: .45; cursor: not-allowed; }
.ac-action svg { width: 18px; height: 18px; flex: none; color: var(--ik-primary, #0661F2); }
.ac-action[data-tone="danger"] svg { color: var(--ik-danger, #DC2626); }

/* ── Alerts ────────────────────────────────────────────────────────────── */
.ac-alert {
    display: flex; gap: 11px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    text-align: left;
    width: 100%;
    background: none; border-left: none; border-right: none; border-top: none;
    font: inherit;
    cursor: pointer;
}
.ac-alert:last-of-type { border-bottom: none; }
.ac-alert:hover { background: #fafcff; }
.ac-alert-ico { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 8px; }
.ac-alert-ico[data-sev="critical"] { background: #fdeaea; color: #b42318; }
.ac-alert-ico[data-sev="warning"] { background: #fef3c7; color: #92400e; }
.ac-alert-ico[data-sev="info"] { background: #eef4ff; color: var(--ik-primary, #0661F2); }
.ac-alert-ico svg { width: 16px; height: 16px; }
.ac-alert-body { flex: 1; min-width: 0; }
.ac-alert-title { font-size: 13.5px; font-weight: 600; color: var(--ik-ink, #0f172a); }
.ac-alert-meta { font-size: 12px; color: var(--ik-muted, #64748b); margin-top: 2px; }
.ac-alert-when { font-size: 11.5px; color: var(--ik-muted, #64748b); white-space: nowrap; }
.ac-count { background: #fdeaea; color: #b42318; border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 600; }
.ac-count[data-zero="true"] { background: #f1f5f9; color: #475569; }

/* ── POS status bar ────────────────────────────────────────────────────── */
.ac-statusbar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 0;
    background: #0b1b34;
    color: #fff;
    padding: 12px 24px;
}
.ac-stat { display: flex; align-items: center; gap: 10px; padding: 0 26px; border-right: 1px solid rgba(255, 255, 255, .12); }
.ac-stat:first-child { padding-left: 0; }
.ac-stat-dot { width: 9px; height: 9px; border-radius: 50%; background: #3b82f6; flex: none; }
.ac-stat-dot[data-tone="ok"] { background: #22c55e; }
.ac-stat-dot[data-tone="warn"] { background: #f59e0b; }
.ac-stat-dot[data-tone="bad"] { background: #ef4444; }
.ac-stat-label { font-size: 11.5px; color: #94a3b8; }
.ac-stat-value { font-size: 16px; font-weight: 700; }
.ac-statusbar .ac-spacer { flex: 1 1 auto; border: none; }

/* ── Responsive — the POS runs on tablets as well as the front-desk screen ─ */
@media (max-width: 1180px) {
    .ac-grid { grid-template-columns: 1fr; }
    .ac-kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
    .ac-main { padding: 16px; }
    .ac-kpis { grid-template-columns: 1fr; }
    .ac-actions { grid-template-columns: 1fr; }
    .ac-statusbar { overflow-x: auto; }
}

/* ── Quick Find (top bar) ──────────────────────────────────────────────── */
.ac-quickfind { position: relative; margin-left: auto; margin-right: 14px; min-width: 260px; }
.ac-quickfind > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: #94a3b8; pointer-events: none; }
.ac-quickfind input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    border: 1px solid var(--ik-line, #e2e8f0);
    border-radius: 9px;
    font: inherit; font-size: 13.5px;
    background: #fff; color: var(--ik-ink, #0f172a);
}
.ac-qf-results {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: #fff;
    border: 1px solid var(--ik-line, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .14);
    max-height: 420px; overflow-y: auto;
    z-index: 60;
    padding: 6px;
}
.ac-qf-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ik-muted, #64748b); padding: 8px 10px 4px; }
.ac-qf-row {
    display: flex; flex-direction: column; gap: 2px;
    width: 100%; text-align: left;
    padding: 8px 10px; border: none; background: none; border-radius: 7px;
    font: inherit; cursor: pointer;
}
.ac-qf-row:hover { background: #f1f5f9; }

/* ── Drawer ────────────────────────────────────────────────────────────── */
.ac-drawer { position: fixed; inset: 0; z-index: 10000; display: flex; justify-content: flex-end; }
.ac-drawer[hidden] { display: none; }
.ac-drawer-scrim { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.ac-drawer-panel {
    position: relative;
    width: min(520px, 100%);
    background: #fff;
    display: flex; flex-direction: column;
    box-shadow: -16px 0 48px rgba(15, 23, 42, .18);
}
.ac-drawer-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--ik-line, #e2e8f0); }
.ac-drawer-head h2 { margin: 0; font-size: 18px; font-weight: 700; color: var(--ik-ink, #0f172a); flex: 1; min-width: 0; }
.ac-drawer-close { background: none; border: none; font-size: 26px; line-height: 1; color: var(--ik-muted, #64748b); cursor: pointer; padding: 0 4px; }
.ac-drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.ac-drawer-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--ik-line, #e2e8f0); background: #fafcff; }
.ac-drawer-foot:empty { display: none; }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.ac-field { margin-bottom: 16px; }
.ac-field > label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ik-muted, #64748b); margin-bottom: 6px; }
.ac-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--ik-line, #e2e8f0);
    border-radius: 9px;
    font: inherit; font-size: 14px;
    color: var(--ik-ink, #0f172a);
    background: #fff;
}
.ac-input:focus { outline: 2px solid rgba(6, 97, 242, .35); outline-offset: 1px; border-color: var(--ik-primary, #0661F2); }
textarea.ac-input { resize: vertical; }
.ac-field-error { margin-top: 6px; font-size: 12.5px; color: var(--ik-danger, #DC2626); font-weight: 600; }
.ac-check { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; font-size: 13.5px; }

.ac-choice { display: flex; gap: 10px; }
.ac-choice-btn {
    flex: 1; padding: 11px 12px;
    border: 1px solid var(--ik-line, #e2e8f0); border-radius: 9px;
    background: #fff; font: inherit; font-size: 14px; font-weight: 600;
    color: var(--ik-ink, #0f172a); cursor: pointer;
}
.ac-choice-btn[data-selected="true"] { border-color: var(--ik-primary, #0661F2); background: #eef4ff; color: var(--ik-primary, #0661F2); }

.ac-primary {
    padding: 10px 20px; border: none; border-radius: 9px;
    background: var(--ik-primary, #0661F2); color: #fff;
    font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.ac-primary[disabled] { opacity: .6; cursor: progress; }
.ac-danger {
    padding: 10px 20px; border: none; border-radius: 9px;
    background: var(--ik-danger, #DC2626); color: #fff;
    font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.ac-danger[disabled] { opacity: .6; cursor: progress; }

/* ── Drawer content blocks ─────────────────────────────────────────────── */
.ac-dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; margin: 0 0 18px; font-size: 13.5px; }
.ac-dl dt { color: var(--ik-muted, #64748b); }
.ac-dl dd { margin: 0; color: var(--ik-ink, #0f172a); word-break: break-word; }
.ac-subhead { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ik-muted, #64748b); margin: 20px 0 10px; }
.ac-list { margin: 0 0 16px; padding-left: 18px; font-size: 13.5px; }
.ac-muted { color: var(--ik-muted, #64748b); font-size: 12.5px; }

.ac-notice { padding: 11px 13px; border-radius: 9px; font-size: 13px; margin-bottom: 16px; }
.ac-notice[data-kind="info"] { background: #eef4ff; color: #1e40af; }
.ac-notice[data-kind="success"] { background: #e7f7ee; color: #0f7a46; }
.ac-notice[data-kind="warning"] { background: #fef3c7; color: #92400e; }
.ac-notice[data-kind="error"] { background: #fdeaea; color: #b42318; }

.ac-findresults { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.ac-findrow {
    display: flex; flex-direction: column; gap: 3px;
    width: 100%; text-align: left;
    padding: 10px 12px;
    border: 1px solid var(--ik-line, #e2e8f0); border-radius: 9px;
    background: #fff; font: inherit; cursor: pointer;
}
.ac-findrow:hover { background: #f8fafc; border-color: #cbd5e1; }

.ac-scanlist { display: flex; flex-direction: column; gap: 2px; }
.ac-scanrow { display: grid; grid-template-columns: 90px 1fr 48px auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.ac-scanrow:last-child { border-bottom: none; }

.ac-testhead { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ac-checkrow { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f1f5f9; }
.ac-checkrow:last-of-type { border-bottom: none; }
.ac-check-name { font-size: 13.5px; font-weight: 600; color: var(--ik-ink, #0f172a); }

@media (max-width: 900px) {
    .ac-quickfind { display: none; }
    .ac-drawer-panel { width: 100%; }
    .ac-dl { grid-template-columns: 1fr; gap: 2px 0; }
    .ac-dl dd { margin-bottom: 8px; }
}

/* ── Full-screen tables (scan log / wristbands / alerts) ───────────────── */
.ac-back { display: inline-block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--ik-primary, #0661F2); text-decoration: none; }
.ac-back:hover { text-decoration: underline; }

.ac-exportbar { display: inline-flex; align-items: center; gap: 8px; }
.ac-exportbar .ac-muted { max-width: 240px; }

.ac-datefilter { width: auto; min-width: 150px; }

.ac-pager { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--ik-line, #e2e8f0); }
.ac-pager .ac-spacer { flex: 1 1 auto; }
.ac-pagesize { width: auto; min-width: 140px; padding: 8px 10px; font-size: 13px; }

/* A centred modal reuses the drawer's chrome; only the placement differs. Driven by an
   explicit class rather than :has(), which an older POS tablet browser may not support. */
.ac-modal { margin: auto; width: min(460px, 100%); border-radius: 14px; max-height: 90vh; }
.ac-drawer-center { align-items: center; justify-content: center; }

/* A row that drills into the record behind it. */
.ac-table tbody tr.ac-clickable { cursor: pointer; }
.ac-table tbody tr.ac-clickable:hover { background: #f1f7ff; }
