/* Head-office compliance reports — desktop-first */

:root {
    /* Aisle Eye palette — greens from img/aisle_eye.png (see header_background.css) */
    --brand: #3f9c22;
    --brand-dark: #226310;
    --brand-light: #edf7e3;
    --text: #1a1a1a;
    --text-sub: #666;
    --bg: #f5f5f4;
    --card: #fff;
    --green: #0a7a3d;
    --amber: #b26a00;
    --red: #b3261e;
    --grey: #9a9a98;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* Layout on top of #header from img/header_background.css (Blakemore gradient) */
header#header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    padding: 0 24px 0 12px;
}

.header-logo { height: 48px; width: auto; border-radius: 11px; }
header h1 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.header-sub { font-weight: 400; color: rgba(255, 255, 255, 0.85); font-size: 0.9rem; margin-left: 6px; }

/* Small screens: the logo is nearly full-width, so let the title wrap
   underneath it instead of being pushed off the right edge */
@media (max-width: 600px) {
    header#header {
        height: auto;
        min-height: 70px;
        padding-bottom: 10px;
    }
    .header-logo { height: 38px; }

    /* Wide data tables scroll within themselves, not the whole page */
    table.data { display: block; overflow-x: auto; }
}
header nav { margin-left: auto; }
header nav a { color: #fff; font-size: 0.85rem; text-decoration: none; opacity: 0.9; }
header nav a:hover { opacity: 1; text-decoration: underline; }

main { max-width: 1100px; margin: 0 auto; padding: 20px 24px 60px; }

h2 { font-size: 1.15rem; }
h3 { font-size: 0.95rem; color: var(--text-sub); }

#back-link {
    display: inline-block;
    margin: 4px 0 12px;
    color: var(--brand);
    text-decoration: none;
    font-size: 0.9rem;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    font-size: 0.9rem;
}

table.data th {
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-sub);
    background: #fafaf9;
    padding: 10px 12px;
    border-bottom: 2px solid #eee;
}

table.data td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0ee;
    vertical-align: top;
}

table.data small { color: var(--text-sub); }
tr.tappable { cursor: pointer; }
tr.tappable:hover { background: var(--brand-light); }

.badge {
    display: inline-block;
    min-width: 52px;
    text-align: center;
    padding: 3px 8px;
    border-radius: 12px;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
}

.badge.green { background: var(--green); }
.badge.amber { background: var(--amber); }
.badge.red   { background: var(--red); }
.badge.grey  { background: var(--grey); }

.panel-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.panel {
    flex: 1 1 320px;
    background: var(--card);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.big-score { margin: 6px 0 12px; }
.big-score .badge { font-size: 1.5rem; padding: 8px 18px; border-radius: 20px; }

.panel dl {
    display: grid;
    grid-template-columns: auto auto;
    gap: 4px 16px;
    font-size: 0.88rem;
    margin: 0;
}

.panel dt { color: var(--text-sub); }
.panel dd { margin: 0; text-align: right; font-weight: 600; }

.cat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.cat-name {
    flex: 0 0 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cat-bar {
    flex: 1;
    height: 10px;
    background: #e8e8e6;
    border-radius: 5px;
    overflow: hidden;
}

.cat-fill { display: block; height: 100%; }
.cat-fill.green { background: var(--green); }
.cat-fill.amber { background: var(--amber); }
.cat-fill.red   { background: var(--red); }

.cat-pct { flex: 0 0 48px; text-align: right; font-weight: 600; }

/* --- Section drill-down overlay --- */

#section-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

#section-overlay[hidden] { display: none; }

#section-panel {
    background: var(--card);
    border-radius: var(--radius);
    max-width: 860px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    padding: 18px 22px 22px;
    position: relative;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

#section-panel h3 { color: var(--text); font-size: 1.05rem; margin: 0 36px 2px 0; }

.pane-sub { margin: 0 0 10px; font-size: 0.8rem; color: var(--text-sub); }

#section-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: var(--bg);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
}

.tab-bar {
    display: flex;
    gap: 6px;
    border-bottom: 2px solid #e5e5e3;
    margin-bottom: 14px;
}

.tab {
    background: none;
    border: none;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-sub);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.summary-box {
    background: var(--brand-light);
    border-left: 3px solid var(--brand);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.88rem;
    line-height: 1.45;
    margin: 0 0 12px;
}

table.findings-detail { font-size: 0.85rem; }
table.findings-detail .note-cell { color: var(--text-sub); max-width: 340px; }
tr.row-issue td { background: #fdf6f5; }
tr.row-ok td small, tr.row-ok td { color: var(--text-sub); }
tr.row-ok td:first-child { color: var(--text); }

.pane-footer { font-size: 0.82rem; color: var(--text-sub); }
.pane-footer a { color: var(--brand); }

.review-photo {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 12px;
}

.planogram-frame {
    width: 100%;
    height: 62vh;
    border: 1px solid #e5e5e3;
    border-radius: 8px;
}

/* --- Dashboard & periods --- */

#dashboard-panel { margin-bottom: 20px; flex: none; }

.period-chart { width: 100%; max-width: 680px; height: auto; }
.period-chart .bar.green { fill: var(--green); }
.period-chart .bar.amber { fill: var(--amber); }
.period-chart .bar.red   { fill: var(--red); }
.period-chart .bar.grey  { fill: var(--grey); }
.period-chart .bar-value { text-anchor: middle; font-size: 11px; font-weight: 600; fill: var(--text); }
.period-chart .bar-label { text-anchor: middle; font-size: 10px; fill: var(--text-sub); }

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.period-select {
    font-size: 0.85rem;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    gap: 8px;
}

.period-select select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--card);
}

.sold-through { color: var(--text-sub); }

/* Find -> Fix (D19) */
.as-found { font-size: 0.8rem; color: var(--text-sub); margin-left: 10px; font-weight: 400; }
.ho-task-list { list-style: none; margin: 8px 0; padding: 0; }
.ho-task-list li { padding: 8px 4px; border-bottom: 1px solid #f0f0f0; }
.ho-task-list li small { color: var(--text-sub); margin-left: 6px; }
.ho-task-done { color: var(--text-sub); }

.photo-item { margin: 0 0 16px; }
.photo-item .photo-delete {
    display: block;
    margin-top: 6px;
    padding: 5px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: var(--card);
    color: var(--red);
    font-size: 0.8rem;
    cursor: pointer;
}
.photo-item .photo-delete:hover { background: #fdecee; border-color: var(--red); }
.photo-item .photo-delete:disabled { opacity: 0.6; cursor: default; }

/* Period dropdown inside the audit detail header */
.audit-period select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--card);
}

.brand-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 24px 16px;
    font-size: 0.75rem;
    color: var(--text-sub);
}

.brand-footer .brand-name {
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--brand);
}
