:root {
    --bg: #f4faff;
    --surface: #ffffff;
    --surface-soft: #e8f6fd;
    --text: #152536;
    --muted: #687b8d;
    --brand: #58b9e8;
    --brand-dark: #247da8;
    --border: #d5eaf4;
    --danger: #c84242;
    --shadow: 0 12px 32px rgba(42, 110, 150, 0.10);
    --radius: 22px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: #eef8fd;
    overflow: hidden;
}
.brand-mark img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #31a66f; box-shadow: 0 0 0 4px #e3f5ed; }

.page-shell { width: min(920px, 100%); margin: 0 auto; padding: 22px 18px 30px; }
.hero-card {
    display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center;
    padding: 28px; border-radius: 28px; color: #14364b;
    background: linear-gradient(145deg, #bfe9fb, #75c8ed);
    box-shadow: var(--shadow);
}
.hero-card h1 { margin: 5px 0 12px; max-width: 610px; font-size: clamp(28px, 6vw, 45px); line-height: 1.02; letter-spacing: -.035em; }
.hero-copy { margin: 0; max-width: 620px; color: rgba(21,55,76,.82); line-height: 1.6; }
.hero-card .eyebrow { color: #174e6d; }
.hero-badge {
    display: grid;
    place-items: center;
    width: 118px;
    height: 118px;
    padding: 10px;
    border-radius: 30px;
    background: rgba(255,255,255,.74);
}
.hero-badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.priority-card {
    border-color: #9fd7ee;
    background: linear-gradient(135deg, #f8fdff, #eaf8fe);
    box-shadow: 0 10px 26px rgba(57,152,201,.11);
}
.priority-card .feature-icon {
    background: #dff3fc;
    color: #2376a3;
}
.priority-nav {
    background: #e6f6fd !important;
    color: var(--brand-dark) !important;
}
.eyebrow { margin: 0 0 5px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .14em; }

.section-head { display: flex; align-items: end; justify-content: space-between; margin: 30px 2px 14px; }
.section-head.compact { margin-top: 24px; }
.section-head h2 { margin: 0; font-size: 22px; }

.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.feature-card, .map-card {
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    border-radius: var(--radius); padding: 18px; text-align: left;
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
    box-shadow: 0 6px 20px rgba(20,43,36,.035);
}
button.feature-card { width: 100%; }
.active-card:hover, .map-card:hover { transform: translateY(-1px); border-color: #a9d5ea; }
.feature-icon, .map-icon {
    display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px;
    background: var(--surface-soft); color: var(--brand); font-size: 25px; font-weight: 800;
}
.feature-card strong, .feature-card small, .map-card strong, .map-card small { display: block; }
.feature-card strong, .map-card strong { font-size: 15px; }
.feature-card small, .map-card small { margin-top: 5px; color: var(--muted); line-height: 1.35; }
.chevron { color: var(--muted); font-size: 28px; }
.coming-pill { padding: 5px 8px; background: #eef6fa; color: var(--muted); border-radius: 999px; font-size: 11px; font-weight: 700; }

.info-card { margin-top: 22px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.info-card h3 { margin: 4px 0 8px; }
.info-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.info-card strong { color: var(--text); }

.page-title { margin-bottom: 18px; }
.page-title h1 { margin: 5px 0 8px; font-size: clamp(28px, 6vw, 40px); letter-spacing: -.025em; }
.page-title > p:last-child { margin: 0; color: var(--muted); line-height: 1.5; }
.back-link { display: inline-block; margin-bottom: 20px; color: var(--brand); font-weight: 700; }

.search-panel { padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.search-form label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 750; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.search-row input { width: 100%; min-width: 0; padding: 14px 15px; border: 1px solid #bfddea; border-radius: 14px; background: #fff; outline: none; }
.search-row input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(57,152,201,.12); }
.search-row button { border: 0; border-radius: 14px; padding: 0 18px; background: var(--brand); color: #fff; font-weight: 750; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding-top: 13px; scrollbar-width: none; }
.filter-chip { flex: 0 0 auto; border: 1px solid var(--border); border-radius: 999px; padding: 8px 12px; background: #fff; color: var(--muted); }
.filter-chip.selected { background: var(--surface-soft); border-color: #aad6ea; color: var(--brand); font-weight: 750; }

.state-card { margin-top: 18px; padding: 34px 20px; text-align: center; border: 1px dashed #bdddeb; border-radius: var(--radius); color: var(--muted); }
.state-card .state-icon { display: block; font-size: 35px; color: var(--brand); }
.state-card h3 { margin: 10px 0 6px; color: var(--text); }
.state-card p { margin: 0; }
.results-list { display: grid; gap: 12px; margin-top: 18px; }
.result-card { padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.result-top { display: flex; justify-content: space-between; gap: 15px; align-items: start; }
.result-card h3 { margin: 0 0 4px; font-size: 18px; }
.result-brand { margin: 0; color: var(--muted); font-size: 13px; }
.quantity-badge { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; background: var(--surface-soft); color: var(--brand); font-size: 12px; font-weight: 800; }
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: 16px; }
.meta-box { padding: 11px 12px; background: #f6fbfe; border-radius: 13px; }
.meta-box small, .meta-box strong { display: block; }
.meta-box small { margin-bottom: 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.meta-box strong { font-size: 13px; overflow-wrap: anywhere; }
.result-actions { margin-top: 13px; }
.map-link { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); font-weight: 750; font-size: 13px; }

.map-section { margin-top: 10px; }
.map-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }

.bottom-nav {
    position: fixed; z-index: 30; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%);
    width: min(520px, calc(100% - 24px)); height: 66px; padding: 7px;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
    border: 1px solid var(--border); border-radius: 22px; background: rgba(255,255,255,.95); box-shadow: 0 12px 34px rgba(42,110,150,.16); backdrop-filter: blur(18px);
}
.bottom-nav a, .bottom-nav button { border: 0; background: transparent; display: grid; place-items: center; align-content: center; gap: 2px; border-radius: 15px; color: var(--muted); }
.bottom-nav span { font-size: 21px; line-height: 1; }
.bottom-nav small { font-size: 10px; font-weight: 700; }
.bottom-nav .current { background: var(--surface-soft); color: var(--brand); }

.toast { position: fixed; z-index: 50; left: 50%; bottom: 92px; transform: translate(-50%, 15px); width: min(420px, calc(100% - 32px)); padding: 13px 15px; border-radius: 14px; background: #17211e; color: #fff; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: var(--shadow); font-size: 13px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.loading-line { height: 3px; overflow: hidden; border-radius: 999px; background: #dceef7; }
.loading-line::after { content: ""; display: block; width: 35%; height: 100%; background: var(--brand); animation: loading 1s infinite ease-in-out; }
@keyframes loading { from { transform: translateX(-110%); } to { transform: translateX(320%); } }

@media (max-width: 640px) {
    .page-shell { padding-left: 14px; padding-right: 14px; }
    .hero-card { grid-template-columns: 1fr; padding: 23px; }
    .hero-badge { display: none; }
    .feature-grid, .map-grid { grid-template-columns: 1fr; }
    .search-row { grid-template-columns: 1fr; }
    .search-row button { padding: 13px; }
    .meta-grid { grid-template-columns: 1fr 1fr; }
}


/* Phase 1.2 cache-safe visual fixes */
.brand-mark {
    flex: 0 0 44px;
    width: 44px !important;
    height: 44px !important;
    overflow: hidden !important;
}
.brand-mark img {
    display: block !important;
    width: 40px !important;
    height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    object-fit: contain !important;
}
.hero-badge {
    width: 118px !important;
    height: 118px !important;
    overflow: hidden !important;
}
.hero-badge img {
    display: block !important;
    width: 98px !important;
    height: 98px !important;
    max-width: 98px !important;
    max-height: 98px !important;
    object-fit: contain !important;
}
.hero-card {
    background: linear-gradient(145deg, #bfe9fb, #75c8ed) !important;
    border: 1px solid rgba(255, 194, 34, .55);
}
.priority-card {
    border-left: 5px solid #f5b51b !important;
}
.priority-card .feature-icon {
    color: #e51f2b !important;
}


/* Phase 2: PWA requisition form */
button, input, select, textarea { font: inherit; }

.form-panel {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 26px;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.form-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 28px 0 16px;
    padding-top: 5px;
}
.form-section-title:first-of-type { margin-top: 0; }
.form-section-title > span {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: #dff3fc;
    color: var(--brand-dark);
    font-weight: 850;
}
.form-section-title strong,
.form-section-title small { display: block; }
.form-section-title strong { font-size: 15px; }
.form-section-title small { margin-top: 3px; color: var(--muted); font-size: 12px; }

.form-grid { display: grid; gap: 14px; }
.form-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.form-field { margin-bottom: 15px; }
.form-field label {
    display: block;
    margin-bottom: 7px;
    color: var(--text);
    font-size: 13px;
    font-weight: 760;
}
.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    min-width: 0;
    padding: 13px 14px;
    border: 1px solid #bfddea;
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-field textarea { resize: vertical; line-height: 1.5; }
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(88,185,232,.15);
}
.form-field.error input,
.form-field.error select,
.form-field.error textarea {
    border-color: #e36969;
    box-shadow: 0 0 0 3px rgba(227,105,105,.10);
}
.field-error {
    display: inline-block;
    min-height: 16px;
    margin-top: 5px;
    color: var(--danger);
    font-size: 11px;
}
.field-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 11px;
}
.optional-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}
.honeypot {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

.submission-note {
    display: flex;
    align-items: start;
    gap: 10px;
    margin: 7px 0 18px;
    padding: 13px 14px;
    border: 1px solid #cce8f4;
    border-radius: 14px;
    background: #f3fbff;
}
.submission-note > span {
    display: grid;
    place-items: center;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #dff3fc;
    color: var(--brand-dark);
    font-weight: 900;
}
.submission-note p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.primary-action {
    position: relative;
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 15px;
    background: linear-gradient(135deg, #58b9e8, #3998c9);
    color: #fff;
    font-weight: 820;
    box-shadow: 0 9px 20px rgba(57,152,201,.22);
}
.primary-action:disabled { cursor: wait; opacity: .75; }
.button-spinner { display: none; }
.primary-action.loading .button-label { opacity: .35; }
.primary-action.loading .button-spinner {
    position: absolute;
    left: 50%;
    top: 50%;
    display: block;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255,255,255,.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: buttonSpin .7s linear infinite;
}
@keyframes buttonSpin { to { transform: rotate(360deg); } }

.form-general-error {
    margin: 12px 0 0;
    color: var(--danger);
    text-align: center;
    font-size: 12px;
    font-weight: 650;
}

.success-panel {
    padding: 38px 24px;
    border: 1px solid var(--border);
    border-radius: 26px;
    background: var(--surface);
    box-shadow: var(--shadow);
    text-align: center;
}
.success-panel[hidden] { display: none !important; }
.success-icon {
    display: grid;
    place-items: center;
    width: 66px;
    height: 66px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: #dcf5e8;
    color: #25875b;
    font-size: 34px;
    font-weight: 900;
}
.success-panel h2 { margin: 5px 0 7px; font-size: 27px; }
.success-panel > p:not(.eyebrow) { margin: 0; color: var(--muted); }
.requisition-id-box {
    width: min(360px, 100%);
    margin: 22px auto;
    padding: 14px;
    border-radius: 15px;
    background: var(--surface-soft);
}
.requisition-id-box small,
.requisition-id-box strong { display: block; }
.requisition-id-box small {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .07em;
}
.requisition-id-box strong {
    color: var(--brand-dark);
    font-size: 23px;
    letter-spacing: .08em;
}
.success-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}
.secondary-action,
.primary-link-action {
    min-width: 140px;
    padding: 12px 15px;
    border-radius: 13px;
    font-size: 13px;
    font-weight: 760;
}
.secondary-action {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
}
.primary-link-action {
    background: var(--brand);
    color: #fff;
}
.bottom-nav .priority-nav.current {
    background: #dff3fc !important;
    color: var(--brand-dark) !important;
}

@media (max-width: 700px) {
    .form-panel { padding: 17px; border-radius: 22px; }
    .form-grid.two-col,
    .form-grid.three-col { grid-template-columns: 1fr; }
    .success-actions { flex-direction: column; }
    .secondary-action,
    .primary-link-action { width: 100%; }
}


/* Phase 2.1: upload requisition */
.mode-switch-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0 0 16px;
    padding: 15px 17px;
    border: 1px solid #c9e6f3;
    border-radius: 17px;
    background: #f2fbff;
}
.mode-switch-card strong,
.mode-switch-card small {
    display: block;
}
.mode-switch-card strong {
    color: var(--text);
    font-size: 13px;
}
.mode-switch-card small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}
.mode-switch-card a {
    flex: 0 0 auto;
    padding: 9px 13px;
    border-radius: 11px;
    background: #dff3fc;
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 800;
}

.upload-drop-zone {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 250px;
    padding: 28px 18px;
    margin: 6px 0 4px;
    border: 2px dashed #a9d8ed;
    border-radius: 20px;
    background: linear-gradient(180deg, #f8fdff, #eef9fe);
    text-align: center;
    transition: border-color .15s ease, background .15s ease;
}
.upload-drop-zone:hover {
    border-color: var(--brand);
    background: #eefaff;
}
.upload-drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    opacity: 0;
}
.upload-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin-bottom: 12px;
    border-radius: 18px;
    background: #dff3fc;
    color: var(--brand-dark);
    font-size: 30px;
    font-weight: 900;
}
.upload-drop-zone strong {
    color: var(--text);
    font-size: 16px;
}
.upload-drop-zone p {
    margin: 7px 0 4px;
    color: var(--muted);
    font-size: 12px;
}
.upload-drop-zone > small {
    color: var(--muted);
    font-size: 11px;
}
.selected-file {
    max-width: 100%;
    margin-top: 15px;
    padding: 9px 12px;
    border-radius: 11px;
    background: #fff;
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 750;
    overflow-wrap: anywhere;
    box-shadow: 0 5px 13px rgba(57,152,201,.08);
}
.standalone-error {
    display: block;
    margin: 4px 0 13px;
}
@media (max-width: 600px) {
    .mode-switch-card {
        align-items: stretch;
        flex-direction: column;
    }
    .mode-switch-card a {
        width: 100%;
        text-align: center;
    }
    .upload-drop-zone {
        min-height: 220px;
    }
}


/* Phase 3: Breakage + protected admin dashboard */
.file-input {
    width: 100%;
    padding: 11px;
    border: 1px solid #bfddea;
    border-radius: 13px;
    background: #fff;
}
.radio-panel {
    margin: 4px 0 18px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 15px;
}
.radio-panel legend {
    padding: 0 6px;
    font-size: 13px;
    font-weight: 760;
}
.radio-panel label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 8px 18px 4px 0;
    font-size: 13px;
}
.injury-warning {
    margin: 0 0 18px;
    padding: 13px 15px;
    border: 1px solid #f2c6c6;
    border-radius: 14px;
    background: #fff2f2;
    color: #8b2d2d;
}
.injury-warning strong, .injury-warning p { display: block; margin: 0; }
.injury-warning p { margin-top: 4px; font-size: 12px; line-height: 1.45; }

.admin-lock-card {
    width: min(470px, 100%);
    margin: 30px auto;
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: 25px;
    background: #fff;
    text-align: center;
    box-shadow: var(--shadow);
}
.admin-lock-card[hidden], #admin-dashboard[hidden], .admin-modal[hidden] { display: none !important; }
.lock-symbol {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    margin: 0 auto 15px;
    border-radius: 19px;
    background: #e7f6fd;
    color: var(--brand-dark);
    font-size: 28px;
    font-weight: 900;
}
.admin-lock-card h2 { margin: 0 0 8px; }
.admin-lock-card p { color: var(--muted); line-height: 1.5; }
.admin-lock-card form { display: grid; gap: 11px; margin-top: 20px; }
.admin-lock-card input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #bfddea;
    border-radius: 13px;
}

.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}
.admin-toolbar h2 { margin: 3px 0 0; }
.small-danger-button {
    padding: 9px 12px;
    border: 1px solid #edcccc;
    border-radius: 11px;
    background: #fff5f5;
    color: #ad3e3e;
    font-size: 12px;
    font-weight: 760;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.stats-grid article {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(42,110,150,.06);
}
.stats-grid small, .stats-grid strong { display: block; }
.stats-grid small { color: var(--muted); font-size: 11px; }
.stats-grid strong { margin-top: 6px; color: var(--brand-dark); font-size: 26px; }

.admin-tabs {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    margin-bottom: 13px;
    padding-bottom: 3px;
}
.admin-tab {
    flex: 0 0 auto;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}
.admin-tab.active {
    border-color: #9fd7ee;
    background: #e8f7fd;
    color: var(--brand-dark);
}

.admin-panel {
    display: none;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: #fff;
    box-shadow: var(--shadow);
}
.admin-panel.active { display: block; }
.admin-panel h3 { margin: 0 0 14px; }

.admin-search-row, .stocktake-filters {
    display: flex;
    gap: 9px;
    margin-bottom: 15px;
}
.admin-search-row input, .stocktake-filters select {
    flex: 1 1 auto;
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #bfddea;
    border-radius: 12px;
    background: #fff;
}
.compact-primary, .compact-secondary, .restore-button, .stocktake-entry button,
.admin-item-actions button, .inline-edit-row button {
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 780;
    cursor: pointer;
}
.compact-primary, .stocktake-entry button, .inline-edit-row button {
    border: 1px solid var(--brand);
    background: var(--brand);
    color: #fff;
}
.compact-secondary, .restore-button, .admin-item-actions button {
    border: 1px solid #bcddea;
    background: #f3fbff;
    color: var(--brand-dark);
}
.danger-outline {
    border-color: #edcccc !important;
    background: #fff5f5 !important;
    color: #ad3e3e !important;
}

.admin-result-list { display: grid; gap: 9px; }
.admin-item-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 14px;
    border: 1px solid #dfedf4;
    border-radius: 15px;
    background: #fbfdfe;
}
.admin-item-main { min-width: 0; }
.admin-item-main strong, .admin-item-main small { display: block; }
.admin-item-main strong { font-size: 13px; }
.admin-item-main small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}
.admin-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
}
.admin-item-meta span {
    padding: 3px 7px;
    border-radius: 8px;
    background: #edf7fb;
    color: #557385;
    font-size: 10px;
}
.admin-item-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.empty-state {
    margin: 14px 0;
    padding: 18px;
    border: 1px dashed #cfe3ec;
    border-radius: 13px;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}
.error-text { color: var(--danger) !important; }

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 12px;
}
.admin-form-grid label {
    display: grid;
    gap: 6px;
    color: var(--text);
    font-size: 12px;
    font-weight: 730;
}
.admin-form-grid input, .admin-form-grid select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #bfddea;
    border-radius: 12px;
}
.admin-form-submit { grid-column: 1 / -1; margin-top: 4px; }
.admin-action-message { grid-column: 1 / -1; margin: 0; color: #25875b; font-size: 12px; }

.admin-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.admin-section-header h3 { margin: 0; }
.admin-section-header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11px;
}
.stocktake-progress-card {
    margin: 10px 0 13px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #f2faff;
}
.stocktake-progress-card strong, .stocktake-progress-card small { display: block; }
.stocktake-progress-card small { margin-top: 3px; color: var(--muted); }
.progress-track {
    height: 8px;
    margin-top: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #dceef7;
}
.progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg,#58b9e8,#f0b51d);
    transition: width .25s ease;
}
.stocktake-entry { display: flex; gap: 6px; flex: 0 0 auto; }
.stocktake-entry input {
    width: 78px;
    padding: 8px 9px;
    border: 1px solid #bfddea;
    border-radius: 10px;
}

.category-summary {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 9px;
}
.category-summary div {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    border: 1px solid #dfedf4;
    border-radius: 13px;
    background: #fbfdfe;
}
.category-summary span { color: var(--muted); font-size: 11px; }
.category-summary strong { color: var(--brand-dark); }
.report-heading { margin-top: 24px; }
.report-cause {
    margin: 8px 0 0;
    color: #526a78;
    font-size: 11px;
    line-height: 1.45;
}
.injury-tag { background: #fff0f0 !important; color: #a93e3e !important; }

.admin-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(17,34,45,.38);
}
.admin-modal-card {
    position: relative;
    width: min(620px,100%);
    max-height: 88vh;
    overflow-y: auto;
    padding: 22px;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(17,34,45,.22);
}
.modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: #eff6fa;
    font-size: 23px;
}
.edit-field-list { display: grid; gap: 12px; margin-top: 18px; }
.edit-field-list label {
    display: grid;
    gap: 6px;
    font-size: 11px;
    font-weight: 750;
}
.inline-edit-row { display: flex; gap: 7px; }
.inline-edit-row input, .inline-edit-row select {
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px;
    border: 1px solid #bfddea;
    border-radius: 10px;
}
.admin-toast {
    position: fixed;
    right: 18px;
    bottom: 82px;
    z-index: 120;
    max-width: min(360px,calc(100vw - 36px));
    padding: 11px 14px;
    border-radius: 12px;
    background: #1d6f95;
    color: #fff;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: .18s ease;
}
.admin-toast.show { opacity: 1; transform: translateY(0); }
.admin-toast.error { background: #aa3f3f; }

@media (max-width: 720px) {
    .stats-grid, .category-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .admin-form-grid { grid-template-columns: 1fr; }
    .admin-item-card, .admin-section-header { align-items: stretch; flex-direction: column; }
    .admin-item-actions, .stocktake-entry { width: 100%; }
    .admin-item-actions button, .stocktake-entry input, .stocktake-entry button { flex: 1 1 auto; }
    .stocktake-filters { flex-direction: column; }
}

/* PWA v4 Admin Operations */
.version-chip{position:fixed;left:14px;bottom:77px;z-index:30;padding:4px 8px;border:1px solid #d7e9f3;border-radius:999px;background:rgba(255,255,255,.9);color:#6c8290;font-size:9px;backdrop-filter:blur(8px)}
.v4-stats{grid-template-columns:repeat(6,minmax(0,1fr))}.v4-tabs{scrollbar-width:thin}.filter-grid{display:grid;grid-template-columns:minmax(180px,2fr) repeat(3,minmax(120px,1fr)) auto;gap:8px;margin-bottom:14px}.filter-grid input,.filter-grid select,.tool-grid select,.modal-field select,.modal-field textarea,.template-picker select{width:100%;padding:10px 11px;border:1px solid #bfddea;border-radius:11px;background:#fff;color:var(--text)}.admin-sub-actions{display:flex;gap:8px;margin:0 0 12px}.link-button{display:inline-flex;align-items:center;justify-content:center;text-decoration:none}.timeline-list{display:grid;gap:2px}.timeline-row{display:grid;grid-template-columns:18px 1fr;gap:9px;padding:9px 2px}.timeline-row>span{width:9px;height:9px;margin-top:5px;border-radius:50%;background:#58b9e8;box-shadow:0 0 0 4px #e8f7fd}.timeline-row strong,.timeline-row small{display:block}.timeline-row small{margin-top:2px;color:var(--muted);font-size:10px}.timeline-row p{margin:4px 0 0;color:#526a78;font-size:11px}.segmented{display:flex;padding:3px;border-radius:11px;background:#edf7fb}.segmented button{padding:7px 10px;border:0;border-radius:8px;background:transparent;color:var(--muted);font-size:11px;font-weight:750}.segmented button.active{background:#fff;color:var(--brand-dark);box-shadow:0 2px 8px rgba(42,110,150,.09)}.section-gap{margin-top:24px!important}.span-2{grid-column:1/-1}.admin-form-grid textarea{width:100%;padding:11px;border:1px solid #bfddea;border-radius:12px;resize:vertical}.duplicate-group{display:grid;gap:4px;padding:13px;border:1px solid #dfedf4;border-radius:14px;background:#fbfdfe}.duplicate-group strong{font-size:12px}.duplicate-group small{color:var(--muted);font-size:10px}.export-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}.export-grid a{padding:15px;border:1px solid #cce5f1;border-radius:14px;background:#f5fbfe;color:var(--brand-dark);font-size:12px;font-weight:780;text-align:center}.tool-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.tool-grid article{padding:16px;border:1px solid #dfedf4;border-radius:16px;background:#fbfdfe}.tool-grid h3{margin:0 0 6px}.tool-grid p{margin:0 0 12px;color:var(--muted);font-size:11px;line-height:1.5}.tool-grid small{display:block;margin-top:8px;color:var(--muted)}#qr-preview{display:grid;place-items:center;gap:8px;margin-top:12px}#qr-preview img{width:180px;height:180px;padding:8px;border:1px solid #dbeaf1;border-radius:14px;background:#fff}.health-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.health-item{display:flex;align-items:center;gap:9px;padding:11px;border:1px solid #dcebf2;border-radius:12px;background:#fff}.health-item>span{display:grid;place-items:center;width:24px;height:24px;border-radius:50%;font-weight:900}.health-item.ok>span{background:#dcf5e8;color:#25875b}.health-item.bad>span{background:#fff0f0;color:#a93e3e}.health-item strong,.health-item small{display:block}.health-item strong{font-size:11px}.health-item small{margin-top:2px;color:var(--muted);font-size:9px}.modal-field{display:grid;gap:6px;margin:12px 0;font-size:11px;font-weight:750}.template-picker{align-items:center}.template-picker select{max-width:260px}.feature-icon{font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
@media(max-width:980px){.v4-stats{grid-template-columns:repeat(3,minmax(0,1fr))}.filter-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.filter-grid .compact-primary{grid-column:1/-1}.export-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:650px){.v4-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.filter-grid,.tool-grid,.health-grid,.export-grid{grid-template-columns:1fr}.tool-grid .span-2{grid-column:auto}.template-picker{align-items:stretch}.template-picker select{max-width:none}.version-chip{bottom:74px}.admin-toolbar{align-items:flex-start}}


/* v4.2 Practical Library */
.practical-library-card {
    margin: 18px 0;
    padding: 20px;
    border: 1px solid #cfe8f4;
    border-radius: 20px;
    background: linear-gradient(180deg, #f8fdff 0%, #eef9fe 100%);
    box-shadow: 0 8px 24px rgba(39, 107, 145, .07);
}

.practical-library-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.practical-library-heading h2 {
    margin: 2px 0 6px;
    color: var(--text);
    font-size: 20px;
}

.practical-library-heading p:not(.eyebrow) {
    max-width: 700px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.template-count-badge {
    flex: 0 0 auto;
    padding: 7px 10px;
    border: 1px solid #c8e5f2;
    border-radius: 999px;
    background: #fff;
    color: var(--brand-dark);
    font-size: 10px;
    font-weight: 800;
}

.practical-search-wrap {
    position: relative;
}

.practical-search-wrap > label {
    display: block;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 12px;
    font-weight: 750;
}

.practical-search-wrap > input {
    width: 100%;
    box-sizing: border-box;
    padding: 13px 14px;
    border: 1px solid #acd8eb;
    border-radius: 14px;
    outline: none;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.practical-search-wrap > input:focus {
    border-color: #57b8e7;
    box-shadow: 0 0 0 3px rgba(87, 184, 231, .15);
}

.practical-suggestions {
    position: absolute;
    z-index: 30;
    top: calc(100% + 7px);
    left: 0;
    right: 0;
    overflow: hidden;
    max-height: 370px;
    overflow-y: auto;
    border: 1px solid #c4e2f0;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 16px 35px rgba(41, 91, 121, .16);
}

.practical-suggestion {
    display: grid;
    gap: 3px;
    width: 100%;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid #edf4f7;
    background: #fff;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.practical-suggestion:last-child {
    border-bottom: 0;
}

.practical-suggestion:hover,
.practical-suggestion.active {
    background: #edf8fd;
}

.practical-suggestion strong {
    font-size: 12px;
}

.practical-suggestion small {
    display: block;
}

.practical-suggestion-meta {
    color: var(--brand-dark);
    font-size: 10px;
    font-weight: 700;
}

.practical-suggestion-items {
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.practical-no-results {
    display: grid;
    gap: 4px;
    padding: 14px;
}

.practical-no-results strong {
    font-size: 12px;
}

.practical-no-results small {
    color: var(--muted);
    font-size: 10px;
}

.selected-practical-card,
.technician-note-preview {
    margin-top: 12px;
    border-radius: 14px;
}

.selected-practical-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 13px;
    border: 1px solid #bde4d1;
    background: #f1fbf6;
}

.selected-practical-card[hidden],
.technician-note-preview[hidden] {
    display: none;
}

.selected-practical-card small,
.selected-practical-card strong,
.selected-practical-card span {
    display: block;
}

.selected-practical-card small {
    color: #4b7b66;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.selected-practical-card strong {
    margin-top: 2px;
    font-size: 12px;
}

.selected-practical-card span {
    margin-top: 2px;
    color: #597568;
    font-size: 10px;
}

.selected-practical-card button {
    flex: 0 0 auto;
    padding: 8px 10px;
    border: 1px solid #b6d8c5;
    border-radius: 10px;
    background: #fff;
    color: #2d6f51;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

.technician-note-preview {
    padding: 13px 14px;
    border: 1px solid #efd991;
    background: #fffaf0;
}

.technician-note-preview strong {
    color: #72570d;
    font-size: 11px;
}

.technician-note-preview p {
    margin: 5px 0;
    color: #5e4c1c;
    font-size: 12px;
    line-height: 1.5;
}

.technician-note-preview small {
    color: #8b793f;
    font-size: 9px;
}

.saved-template-details {
    margin-top: 14px;
    border-top: 1px solid #dcecf3;
    padding-top: 12px;
}

.saved-template-details summary {
    color: var(--brand-dark);
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

.saved-template-inner {
    display: grid;
    gap: 7px;
    margin-top: 9px;
}

.saved-template-inner p {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
}

.saved-template-inner select {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid #bfddea;
    border-radius: 11px;
    background: #fff;
    color: var(--text);
}

.field-hint {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 9px;
}

@media (max-width: 650px) {
    .practical-library-card {
        padding: 16px;
    }

    .practical-library-heading {
        display: grid;
    }

    .template-count-badge {
        width: fit-content;
    }

    .selected-practical-card {
        align-items: flex-start;
        flex-direction: column;
    }
}
