:root {
    --deep-blue: #075A84;
    --mustard: #F7C548;
    --slate: #8CA9C3;
    --white: #FFFFFF;
    --charcoal: #1C1C1C;
    --ink: #1f2933;
    --muted: #667085;
    --line: #d7e0e8;
    --panel: #FFFFFF;
    --bg: #F3F7FA;
    --danger: #B42318;
    --warn: #B54708;
    --good: #027A48;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Open Sans", Arial, Helvetica, sans-serif;
    font-size: 15px;
}

a {
    color: var(--deep-blue);
    font-weight: 700;
    text-decoration: none;
}

h1, h2, h3 {
    color: var(--charcoal);
    font-family: "Poppins", "Open Sans", Arial, sans-serif;
    letter-spacing: 0;
    margin-top: 0;
}

h1 {
    font-size: 30px;
    line-height: 1.15;
}

h2 {
    font-size: 22px;
}

h3 {
    font-size: 17px;
}

.topbar {
    align-items: center;
    background: var(--deep-blue);
    border-bottom: 4px solid var(--mustard);
    display: flex;
    justify-content: space-between;
    padding: 10px 22px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    align-items: center;
    color: var(--white);
    display: inline-flex;
    font-family: "Montserrat", "Open Sans", Arial, sans-serif;
    font-size: 18px;
    font-weight: 800;
    gap: 10px;
    text-transform: uppercase;
    white-space: nowrap;
}

.brand img {
    background: var(--charcoal);
    border: 2px solid rgba(255,255,255,0.85);
    border-radius: 50%;
    height: 44px;
    object-fit: cover;
    width: 44px;
}

nav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

nav a {
    border-radius: 6px;
    color: var(--white);
    padding: 8px 10px;
}

nav a:hover {
    background: rgba(255,255,255,0.14);
}

.notification-link {
    align-items: center;
    display: inline-flex;
    justify-content: center;
    min-height: 40px;
    min-width: 40px;
    position: relative;
}

.bell-icon {
    font-size: 18px;
    line-height: 1;
}

.notification-badge {
    align-items: center;
    background: #D92D20;
    border: 2px solid var(--deep-blue);
    border-radius: 999px;
    color: var(--white);
    display: flex;
    font-size: 10px;
    font-weight: 800;
    height: 20px;
    justify-content: center;
    min-width: 20px;
    padding: 0 4px;
    position: absolute;
    right: 0;
    top: 0;
}

.shell {
    margin: 0 auto;
    max-width: 1220px;
    padding: 24px;
}

.panel, .hero-panel, .metric-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(7, 90, 132, 0.06);
}

.panel {
    margin-bottom: 18px;
    padding: 18px;
}

.inner-panel {
    background: #F8FBFD;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 12px 0;
    padding: 14px;
}

.hero-panel {
    align-items: center;
    border-left: 6px solid var(--mustard);
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 22px;
}

.eyebrow {
    color: var(--deep-blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0 0 8px;
    text-transform: uppercase;
}

.hero-copy {
    color: var(--muted);
    margin: 0;
}

.grid, .metric-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.metric-grid {
    margin-bottom: 18px;
}

.metric-card, .stat {
    padding: 16px;
}

.metric-card {
    border-top: 4px solid var(--deep-blue);
}

.metric-card span, .stat span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.metric-card strong, .stat strong {
    color: var(--charcoal);
    display: block;
    font-family: "Montserrat", "Open Sans", Arial, sans-serif;
    font-size: 30px;
    line-height: 1.1;
    margin-top: 6px;
}

.metric-card small {
    color: var(--muted);
    display: block;
    margin-top: 6px;
}

.metric-danger { border-top-color: var(--danger); }
.metric-warning { border-top-color: var(--mustard); }
.metric-success { border-top-color: var(--good); }

.section-heading {
    align-items: end;
    display: flex;
    justify-content: space-between;
    margin: 22px 0 12px;
}

.section-heading h2,
.section-heading p {
    margin-bottom: 0;
}

.stat {
    border-left: 4px solid var(--mustard);
}

.brand-strip {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.brand-strip div {
    background: #F8FBFD;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.brand-strip span, .brand-strip small {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 700;
}

.brand-strip strong {
    color: var(--deep-blue);
    display: block;
    font-family: "Montserrat", "Open Sans", Arial, sans-serif;
    font-size: 24px;
    margin: 4px 0;
}

label {
    color: #344054;
    display: block;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 6px;
}

input, select, textarea, button {
    font: inherit;
}

input, select, textarea {
    background: var(--white);
    border: 1px solid #C8D4DF;
    border-radius: 6px;
    min-height: 44px;
    padding: 10px 11px;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--deep-blue);
    box-shadow: 0 0 0 3px rgba(7, 90, 132, 0.14);
    outline: none;
}

textarea {
    min-height: 84px;
    resize: vertical;
}

button, .button {
    background: var(--mustard);
    border: 0;
    border-radius: 6px;
    color: var(--charcoal);
    cursor: pointer;
    display: inline-block;
    font-weight: 800;
    min-height: 44px;
    padding: 11px 16px;
}

button:hover, .button:hover {
    filter: brightness(0.98);
}

.button.secondary {
    background: var(--deep-blue);
    color: var(--white);
}

button.danger, .button.danger {
    background: var(--danger);
    color: var(--white);
}

.flash {
    border-radius: 6px;
    font-weight: 700;
    margin-bottom: 16px;
    padding: 12px;
}

.flash.error {
    background: #FEF3F2;
    color: var(--danger);
}

.flash.info, .flash.success {
    background: #ECFDF3;
    color: var(--good);
}

.login-panel {
    max-width: 430px;
    margin: 46px auto;
}

.login-brand {
    align-items: center;
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.login-brand img {
    background: var(--charcoal);
    border-radius: 50%;
    height: 58px;
    object-fit: cover;
    width: 58px;
}

.login-brand span {
    color: var(--deep-blue);
    display: block;
    font-family: "Montserrat", "Open Sans", Arial, sans-serif;
    font-size: 18px;
    font-weight: 800;
}

.login-brand small {
    color: var(--muted);
    display: block;
    font-weight: 700;
    margin-top: 3px;
}

.category-panel {
    padding: 0;
}

.category-panel summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    list-style: none;
    padding: 16px 18px;
}

.category-panel summary::-webkit-details-marker {
    display: none;
}

.category-panel summary span {
    color: var(--deep-blue);
    font-family: "Poppins", "Open Sans", Arial, sans-serif;
    font-size: 18px;
    font-weight: 700;
}

.category-panel summary small {
    color: var(--muted);
    font-weight: 800;
}

.category-body {
    border-top: 1px solid var(--line);
    padding: 8px 12px 14px;
}

.audit-line {
    border: 1px solid transparent;
    border-radius: 8px;
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(240px, 1.2fr) minmax(190px, 0.7fr) minmax(240px, 1fr) minmax(190px, 0.8fr);
    padding: 14px 10px;
}

.action-assignment {
    background: #F0F6FA;
    border-left: 4px solid var(--mustard);
    border-radius: 6px;
    grid-column: 1 / -1;
    padding: 14px;
}

.action-assignment[hidden] {
    display: none !important;
}

.action-assignment-heading {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 10px;
}

.action-assignment-heading strong {
    color: var(--deep-blue);
    font-family: "Poppins", "Open Sans", Arial, sans-serif;
}

.action-assignment-heading small {
    color: var(--muted);
    font-weight: 700;
}

.action-assignment-grid,
.followup-controls {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(220px, 1fr) minmax(170px, 0.55fr) minmax(240px, 1fr);
}

.action-assignment-grid p,
.followup-controls p,
.filter-bar p {
    margin: 0;
}

.audit-line:hover {
    background: #F8FBFD;
}

.audit-line.needs-attention {
    background: #FFF7ED;
    border-color: #F97316;
}

.standard-title {
    color: var(--charcoal);
    font-weight: 800;
}

.standard-meta {
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
}

.abc {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(4, 1fr);
}

.abc label {
    align-items: center;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    display: flex;
    font-size: 16px;
    justify-content: center;
    margin: 0;
    min-height: 48px;
}

.abc label:has(input:checked) {
    border-color: var(--deep-blue);
    box-shadow: inset 0 0 0 2px var(--deep-blue);
}

.grade-a:has(input:checked) {
    background: #ECFDF3;
}

.grade-b:has(input:checked) {
    background: #FFFAEB;
}

.grade-c:has(input:checked) {
    background: #FEF3F2;
}

.grade-na:has(input:checked) {
    background: #EEF2F6;
}

.abc input {
    height: auto;
    margin: 0 6px 0 0;
    min-height: 0;
    width: auto;
}

.badge {
    border-radius: 999px;
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 8px;
}

.badge.pass { background: #ECFDF3; color: var(--good); }
.badge.middle { background: #FFFAEB; color: var(--warn); }
.badge.fail { background: #FEF3F2; color: var(--danger); }
.badge.na { background: #EEF2F6; color: #475467; }

table {
    border-collapse: collapse;
    width: 100%;
}

th, td {
    border-bottom: 1px solid var(--line);
    padding: 11px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    background: #F0F6FA;
    color: #344054;
    font-size: 12px;
    letter-spacing: 0;
    text-transform: uppercase;
}

.photos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.photos img {
    border: 1px solid var(--line);
    border-radius: 6px;
    height: 90px;
    object-fit: cover;
    width: 120px;
}

.photo-upload-status {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-top: 7px;
    min-height: 18px;
}

.photo-upload-status.is-uploading {
    color: var(--deep-blue);
}

.photo-upload-status.is-saved {
    color: var(--good);
}

.photo-upload-status.is-error {
    color: var(--danger);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.actions-cell {
    min-width: 120px;
}

.table-scroll {
    overflow-x: auto;
    width: 100%;
}

.action-table td:nth-child(2) {
    min-width: 300px;
    white-space: normal;
}

.action-table small,
td small {
    color: var(--muted);
}

.overdue-row {
    background: #FFF4F2;
}

.overdue-date {
    color: var(--danger);
    font-weight: 800;
}

.filter-bar {
    align-items: end;
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(240px, 420px) auto;
}

.followup-list {
    display: grid;
    gap: 16px;
}

.followup-item {
    margin-bottom: 0;
}

.followup-item.is-overdue {
    border-left: 5px solid var(--danger);
}

.followup-heading {
    align-items: flex-start;
    display: flex;
    gap: 20px;
    justify-content: space-between;
}

.followup-heading h2 {
    font-size: 19px;
    line-height: 1.35;
    margin-bottom: 8px;
}

.deadline-block {
    background: #F8FBFD;
    border: 1px solid var(--line);
    border-radius: 6px;
    flex: 0 0 150px;
    padding: 10px 12px;
}

.deadline-block span,
.deadline-block strong {
    display: block;
}

.deadline-block span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.action-facts {
    display: grid;
    gap: 10px 18px;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    margin: 14px 0;
}

.action-facts div {
    border-left: 3px solid var(--slate);
    padding-left: 10px;
}

.action-facts dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.action-facts dd {
    margin: 3px 0 0;
}

.followup-form {
    border-top: 1px solid var(--line);
    margin-top: 14px;
    padding-top: 14px;
}

.result-choice {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
}

.result-choice label {
    align-items: center;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    margin: 0;
    min-height: 48px;
    padding: 8px;
}

.result-choice input {
    margin-right: 7px;
    min-height: 0;
    width: auto;
}

.empty-state {
    padding: 34px;
    text-align: center;
}

.action-detail-grid {
    display: grid;
    gap: 28px;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.7fr);
}

.action-facts-large {
    display: block;
    margin: 0;
}

.action-facts-large div {
    margin-bottom: 14px;
}

.timeline {
    margin-left: 8px;
}

.timeline-entry {
    display: grid;
    gap: 14px;
    grid-template-columns: 16px 1fr;
    padding-bottom: 22px;
    position: relative;
}

.timeline-entry::before {
    background: var(--line);
    content: "";
    height: 100%;
    left: 7px;
    position: absolute;
    top: 10px;
    width: 2px;
}

.timeline-entry:last-child::before {
    display: none;
}

.timeline-marker {
    background: var(--mustard);
    border: 3px solid var(--white);
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--deep-blue);
    height: 16px;
    position: relative;
    width: 16px;
    z-index: 1;
}

.timeline-entry h3 {
    margin-bottom: 2px;
}

.form-panel {
    margin-left: auto;
    margin-right: auto;
    max-width: 900px;
}

.inline-form {
    display: inline;
    margin-left: 10px;
}

.link-button {
    background: transparent;
    color: var(--deep-blue);
    font-weight: 800;
    min-height: 0;
    padding: 0;
}

.link-button:hover {
    text-decoration: underline;
}

.admin-action-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.checkbox-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.checkbox-grid label {
    align-items: center;
    background: #F8FBFD;
    border: 1px solid var(--line);
    border-radius: 6px;
    display: flex;
    gap: 8px;
    margin: 0;
    min-height: 44px;
    padding: 9px 10px;
}

.checkbox-grid input {
    min-height: 0;
    width: auto;
}

.store-role-field {
    margin: 16px 0;
}

.note {
    background: #F0F6FA;
    border-left: 4px solid var(--slate);
    border-radius: 6px;
    color: #344054;
    font-weight: 700;
    padding: 10px 12px;
}

.muted-row {
    opacity: 0.68;
}

.sticky-actions {
    align-items: center;
    bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: 0 -10px 24px rgba(7, 90, 132, 0.12);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    position: sticky;
    z-index: 15;
}

.autosave-status {
    align-items: center;
    color: var(--muted);
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    gap: 8px;
    min-height: 28px;
}

.autosave-dot {
    background: var(--slate);
    border-radius: 50%;
    display: inline-block;
    height: 10px;
    width: 10px;
}

.autosave-status.is-saving {
    color: var(--deep-blue);
}

.autosave-status.is-saving .autosave-dot {
    animation: autosave-pulse 1s ease-in-out infinite;
    background: var(--deep-blue);
}

.autosave-status.is-saved {
    color: var(--good);
}

.autosave-status.is-saved .autosave-dot {
    background: var(--good);
}

.autosave-status.is-pending {
    color: var(--warn);
}

.autosave-status.is-pending .autosave-dot {
    background: var(--mustard);
}

.autosave-status.is-error {
    color: var(--danger);
}

.autosave-status.is-error .autosave-dot {
    background: var(--danger);
}

@keyframes autosave-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 4px 0;
}

@media (max-width: 900px) {
    .hero-panel {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }

    .audit-line {
        grid-template-columns: 1fr;
    }

    .action-assignment-grid,
    .followup-controls,
    .action-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    body {
        font-size: 14px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        padding: 10px 14px;
    }

    nav {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    nav a {
        background: rgba(255,255,255,0.12);
        overflow-wrap: anywhere;
        text-align: center;
    }

    .notification-link {
        width: 100%;
    }

    .shell {
        padding: 14px;
    }

    .panel, .hero-panel {
        padding: 14px;
    }

    .category-panel {
        padding: 0;
    }

    .category-panel summary {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
        padding: 14px;
    }

    .abc label {
        min-height: 54px;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .sticky-actions .actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .sticky-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .section-heading,
    .followup-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .deadline-block {
        flex-basis: auto;
        width: 100%;
    }

    .filter-bar {
        grid-template-columns: 1fr;
    }
}

@media print {
    .topbar, .no-print, button {
        display: none !important;
    }

    body {
        background: #ffffff;
    }

    .shell {
        max-width: none;
        padding: 0;
    }

    .panel, .hero-panel, .metric-card {
        box-shadow: none;
        break-inside: avoid;
    }

    details {
        display: block;
    }
}
