/* SmartChef Group: same family as the SmartChef app (navy, teal, Manrope, Space Grotesk) */

:root {
    --navy: #0a2342;
    --navy-2: #0e3a5c;
    --teal: #2ca58d;
    --sage: #84bc9c;
    --amber: #f2a65a;
    --rust: #c75146;
    --ink: #1f2a37;
    --muted: #6b7a8a;
    --line: #e3e8ee;
    --bg: #f5f7fa;
    --card: #ffffff;
    --good-bg: #e3f4ef; --good-fg: #1d6f5f;
    --watch-bg: #fdf0e0; --watch-fg: #8a5212;
    --bad-bg: #fbe6e3; --bad-fg: #8f3128;
    --neutral-bg: #eaeef3; --neutral-fg: #4f5d6b;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(10, 35, 66, 0.06);
    --font: "Manrope", "Segoe UI", -apple-system, sans-serif;
    --display: "Space Grotesk", "Segoe UI", sans-serif;
}

html { font-size: 15px; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); min-height: 100vh; }
h1, h2, h3, h4, .display-num { font-family: var(--display); color: var(--navy); }
a { color: var(--navy-2); }
.btn-primary { background: var(--navy); border-color: var(--navy); }
.btn-primary:hover, .btn-primary:focus { background: var(--navy-2); border-color: var(--navy-2); }
.btn-outline-primary { color: var(--navy); border-color: var(--navy); }
.btn-outline-primary:hover { background: var(--navy); border-color: var(--navy); }
.text-light-muted { color: rgba(255,255,255,0.7); }
.card { border: none; border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 600; }
.form-control:focus, .form-select:focus { border-color: var(--teal); box-shadow: 0 0 0 0.2rem rgba(44,165,141,0.2); }
.table { --bs-table-hover-bg: #f3f6f9; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Auth screens ---------- */
.full-screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; overflow: auto; }
.auth-bg { background:
    radial-gradient(circle at top left, rgba(46,181,229,0.18), transparent 55%),
    radial-gradient(circle at 20% 80%, rgba(255,112,67,0.14), transparent 50%),
    linear-gradient(120deg, #f9fbfd 0%, #eef3f8 50%, #f7f9fc 100%); }
.auth-bg .spinner-border.text-light { color: var(--navy) !important; }
.auth-bg .text-light-muted { color: var(--muted); }
.auth-wrap { display: flex; gap: 2rem; align-items: stretch; width: 100%; max-width: 920px; }
.auth-panel { flex: 1; background: linear-gradient(160deg, var(--navy), var(--navy-2)); color: white; border-radius: 24px; padding: 2.5rem; box-shadow: 0 18px 40px rgba(10,42,67,0.25); display: flex; flex-direction: column; justify-content: center; }
.auth-panel h2 { color: white; font-size: 2rem; margin: 1rem 0 0.75rem; }
.auth-panel p { color: rgba(255,255,255,0.8); }
.auth-panel-logo { height: 48px; width: auto; align-self: flex-start; background: white; border-radius: 10px; padding: 4px; }
.auth-points { list-style: none; padding: 0; margin: 1rem 0 0; }
.auth-points li { display: flex; gap: 0.6rem; align-items: flex-start; margin-bottom: 0.6rem; color: rgba(255,255,255,0.9); }
.auth-points i { color: var(--sage); font-size: 1.1rem; }
.auth-card { flex: 0 0 400px; max-width: 100%; background: white; padding: 2.5rem; border-radius: 24px; box-shadow: 0 10px 40px rgba(10,35,66,0.12); }
.auth-card h3, .auth-card h4 { margin-bottom: 0.25rem; }
.auth-logo { height: 48px; margin-bottom: 0.75rem; }
@media (max-width: 767px) { .auth-card { flex: 1; padding: 1.75rem; } }

/* ---------- Top bar ---------- */
.topbar { background: linear-gradient(90deg, var(--navy), var(--navy-2)); color: white; position: sticky; top: 0; z-index: 1020; box-shadow: 0 2px 10px rgba(0,0,0,0.15); }
.topbar-inner { display: flex; align-items: center; gap: 1rem; padding: 0.55rem 1.25rem; max-width: 1500px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: white; min-width: 0; }
.brand img { height: 34px; width: 34px; background: white; border-radius: 8px; padding: 3px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
.brand-name em { font-style: normal; color: var(--sage); }
.brand-org { font-size: 0.75rem; color: rgba(255,255,255,0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.mainnav { display: flex; gap: 0.25rem; margin-left: 1rem; }
.mainnav-link { display: flex; align-items: center; gap: 0.4rem; color: rgba(255,255,255,0.8); text-decoration: none; padding: 0.5rem 0.8rem; border-radius: 8px; font-weight: 500; position: relative; }
.mainnav-link:hover { background: rgba(255,255,255,0.1); color: white; }
.mainnav-link.active { background: rgba(255,255,255,0.16); color: white; }
.nav-badge { background: var(--rust); color: white; font-size: 0.7rem; font-weight: 700; border-radius: 999px; padding: 0.05rem 0.45rem; margin-left: 0.2rem; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.nav-toggle { background: none; border: none; color: white; font-size: 1.5rem; margin-left: auto; }
@media (max-width: 991px) {
    .topbar-inner { flex-wrap: wrap; }
    .mainnav { display: none; width: 100%; flex-direction: column; margin: 0.25rem 0 0; order: 3; }
    .mainnav.open { display: flex; }
    .topbar-right { margin-left: 0; order: 2; }
    .brand-org { max-width: 140px; }
}

/* Period picker */
.period { position: relative; }
.period-btn { display: flex; align-items: center; gap: 0.45rem; background: rgba(255,255,255,0.12); color: white; border: 1px solid rgba(255,255,255,0.25); border-radius: 8px; padding: 0.4rem 0.75rem; font-weight: 500; font-size: 0.9rem; }
.period-btn:hover { background: rgba(255,255,255,0.2); }
.period-menu { position: absolute; right: 0; top: calc(100% + 6px); background: white; color: var(--ink); border-radius: 10px; box-shadow: 0 10px 30px rgba(10,35,66,0.2); min-width: 240px; padding: 0.4rem; z-index: 1030; }
.period-menu > button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 0.45rem 0.75rem; border-radius: 6px; }
.period-menu > button:hover { background: var(--bg); }
.period-menu > button.active { background: var(--good-bg); color: var(--good-fg); font-weight: 600; }
.period-custom { border-top: 1px solid var(--line); margin-top: 0.4rem; padding: 0.6rem 0.5rem 0.2rem; display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; font-size: 0.85rem; }
.period-custom input { font-size: 0.85rem; border: 1px solid var(--line); border-radius: 6px; padding: 0.25rem 0.4rem; }

/* User menu */
.usermenu { position: relative; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--teal); color: white; border: none; font-weight: 700; font-family: var(--display); }
.usermenu-menu { position: absolute; right: 0; top: calc(100% + 6px); background: white; color: var(--ink); border-radius: 10px; box-shadow: 0 10px 30px rgba(10,35,66,0.2); min-width: 240px; padding: 0.4rem; z-index: 1030; }
.usermenu-head { padding: 0.5rem 0.75rem 0.6rem; border-bottom: 1px solid var(--line); margin-bottom: 0.3rem; }
.usermenu-item { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.45rem 0.75rem; border-radius: 6px; text-align: left; background: none; border: none; color: var(--ink); }
.usermenu-item:empty { display: none; }
.usermenu-btn:hover { background: var(--bg); }
.usermenu-item .form-check-input { margin-left: 0; margin-right: 0.5rem; }

/* ---------- Page ---------- */
.page { max-width: 1500px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.6rem; margin: 0; }
.page-head .sub { color: var(--muted); margin: 0.15rem 0 0; }
.section-title { font-family: var(--display); font-size: 1.05rem; color: var(--navy); margin: 1.5rem 0 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.section-title .count { font-family: var(--font); font-size: 0.8rem; background: var(--neutral-bg); color: var(--neutral-fg); border-radius: 999px; padding: 0.1rem 0.55rem; }

/* Status pills: three colours, three meanings, everywhere */
.pill { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; font-weight: 700; border-radius: 999px; padding: 0.15rem 0.6rem; letter-spacing: 0.02em; white-space: nowrap; }
.pill-good { background: var(--good-bg); color: var(--good-fg); }
.pill-watch { background: var(--watch-bg); color: var(--watch-fg); }
.pill-bad { background: var(--bad-bg); color: var(--bad-fg); }
.pill-neutral { background: var(--neutral-bg); color: var(--neutral-fg); }
.pill i { font-size: 0.7rem; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }
.tile { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.15rem; border-left: 4px solid var(--line); }
.tile.good { border-left-color: var(--teal); } .tile.watch { border-left-color: var(--amber); } .tile.bad { border-left-color: var(--rust); }
.tile-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }
.tile-num { font-family: var(--display); font-size: 2rem; font-weight: 600; color: var(--navy); line-height: 1.1; margin: 0.2rem 0; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 0.85rem; color: var(--muted); }
.tile a { text-decoration: none; }

/* Findings lists */
.findings { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.findings li { background: var(--card); border-radius: 10px; box-shadow: var(--shadow); padding: 0.6rem 0.9rem; display: flex; gap: 0.75rem; align-items: flex-start; border-left: 4px solid var(--line); }
.findings li.red { border-left-color: var(--rust); } .findings li.amber { border-left-color: var(--amber); } .findings li.green { border-left-color: var(--teal); }
.findings .f-site { font-weight: 700; color: var(--navy); white-space: nowrap; min-width: 10rem; }
.findings .f-text { flex: 1; }
.findings a { color: inherit; text-decoration: none; display: flex; gap: 0.75rem; flex: 1; align-items: flex-start; }
.findings a:hover .f-text { text-decoration: underline; }
.findings .f-go { color: var(--navy-2); }
@media (max-width: 575px) { .findings a, .findings li { flex-direction: column; gap: 0.2rem; } .findings .f-site { min-width: 0; } }

/* Site cards */
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.site-card { display: block; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.15rem; text-decoration: none; color: var(--ink); transition: transform 0.12s, box-shadow 0.12s; border-top: 4px solid var(--line); }
.site-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(10,35,66,0.12); color: var(--ink); }
.site-card.good { border-top-color: var(--teal); } .site-card.watch { border-top-color: var(--amber); } .site-card.bad { border-top-color: var(--rust); }
.site-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.6rem; }
.site-card-name { font-family: var(--display); font-weight: 600; font-size: 1.05rem; color: var(--navy); }
.site-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; text-align: center; }
.site-num { font-family: var(--display); font-size: 1.4rem; font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; }
.site-num.bad { color: var(--rust); } .site-num.good { color: var(--teal); }
.site-num-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.site-card-foot { margin-top: 0.7rem; font-size: 0.82rem; color: var(--muted); display: flex; justify-content: space-between; }
.site-card-foot .bad { color: var(--rust); font-weight: 600; }

/* Tabs */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: 0.55rem 0.9rem; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--navy); }
.tabs a.active { color: var(--navy); border-bottom-color: var(--teal); }

/* Hint icon with tooltip */
.hint { color: var(--muted); font-size: 0.85rem; margin-left: 0.3rem; cursor: help; }

/* ---------- Compare table ---------- */
.cmp-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; max-height: calc(100vh - 220px); }
.cmp-table { margin: 0; width: auto; min-width: 100%; border-collapse: separate; border-spacing: 0; }
.cmp-table th, .cmp-table td { border-bottom: 1px solid var(--line); padding: 0.55rem 0.9rem; vertical-align: middle; }
.cmp-table thead th { position: sticky; top: 0; background: #fbfcfd; z-index: 3; }
.cmp-table thead th:first-child, .cmp-table tbody td:first-child { position: sticky; left: 0; background: var(--card); z-index: 2; }
.cmp-table thead th:first-child { z-index: 4; }
.cmp-table .cmp-label-col { min-width: 17rem; }
.cmp-table .cmp-site-col { width: 14rem; min-width: 14rem; text-align: left; }
.cmp-site-head { display: flex; flex-direction: column; gap: 0.2rem; }
.cmp-site-head a { font-family: var(--display); font-weight: 600; color: var(--navy); text-decoration: none; }
.cmp-site-head a:hover { text-decoration: underline; }
.cmp-table td.cmp-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cmp-cell .cmp-val { display: inline-block; min-width: 3.2rem; text-align: right; }
.cmp-cell .cmp-exp { display: inline-block; min-width: 3.6rem; text-align: left; color: var(--muted); padding-left: 0.3rem; }
.cmp-cell .cmp-slot { display: inline-block; min-width: 3.4rem; text-align: left; }
.cmp-rate { display: inline-block; min-width: 3.2rem; text-align: center; font-size: 0.76rem; font-weight: 700; padding: 0.12rem 0.4rem; border-radius: 0.35rem; }
.cmp-rate-good { background: var(--good-bg); color: var(--good-fg); }
.cmp-rate-warn { background: var(--watch-bg); color: var(--watch-fg); }
.cmp-rate-bad { background: var(--bad-bg); color: var(--bad-fg); }
.cmp-rate-neutral { background: var(--neutral-bg); color: var(--neutral-fg); }
.cmp-bad { color: var(--rust); font-weight: 700; }
.cmp-bad-text { color: var(--rust); }
.cmp-link { color: inherit; text-decoration: none; border-radius: 0.3rem; padding: 0.1rem 0.25rem; margin-left: -0.25rem; }
.cmp-link:hover { background: var(--bg); color: inherit; }
.cmp-link .cmp-arrow { font-size: 0.7rem; color: var(--navy-2); margin-left: 0.2rem; }
.cmp-link .cmp-val { color: var(--navy-2); text-decoration: underline; text-decoration-color: rgba(14,58,92,0.3); text-underline-offset: 2px; }
.cmp-link .cmp-val.text-muted { color: var(--navy-2) !important; }
.cmp-section td { background: #eef2f6 !important; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); cursor: pointer; user-select: none; }
.cmp-section td i { margin-right: 0.4rem; transition: transform 0.15s; }
.cmp-section.collapsed td i { transform: rotate(-90deg); }
.cmp-table tr.hidden { display: none; }
.cmp-table tbody tr:not(.cmp-section) td:first-child { padding-left: 1.4rem; }
.cmp-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 0.35rem; vertical-align: middle; }
.cmp-dot.best { background: var(--teal); } .cmp-dot.worst { background: var(--rust); }
.heat { text-align: right; font-variant-numeric: tabular-nums; }
.heat-0 { background: #fff; color: var(--muted); } .heat-1 { background: #eaf6f2; } .heat-2 { background: #cfeadf; } .heat-3 { background: #a9dbc8; } .heat-4 { background: #7fc9b0; color: #0b3b31; }
.heat-bad-1 { background: #fdeceb; } .heat-bad-2 { background: #f8d2cf; } .heat-bad-3 { background: #f1aaa4; } .heat-bad-4 { background: #e47d74; color: white; }

/* ---------- Site page ---------- */
.site-head { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.25rem; display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.site-head h1 { font-size: 1.5rem; margin: 0; }
.site-head .nums { display: flex; gap: 1.5rem; margin-left: auto; }
.day-group { margin-bottom: 1rem; }
.day-head { font-family: var(--display); font-weight: 600; color: var(--navy); padding: 0.35rem 0; border-bottom: 2px solid var(--line); margin-bottom: 0.4rem; display: flex; justify-content: space-between; }
.rec-row { display: grid; grid-template-columns: 5rem 11rem 1fr 9rem 6rem; gap: 0.75rem; align-items: start; background: var(--card); border-radius: 10px; box-shadow: var(--shadow); padding: 0.6rem 0.9rem; margin-bottom: 0.35rem; cursor: pointer; }
.rec-row:hover { background: #fbfcfd; }
.rec-row .rec-issues { margin: 0.25rem 0 0; padding-left: 1rem; color: var(--rust); font-size: 0.88rem; }
@media (max-width: 767px) { .rec-row { grid-template-columns: 1fr 1fr; } .rec-row .rec-text { grid-column: 1 / -1; } }

/* Record view (modal) */
.rv-k { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 0.1rem; }
.rv-v { font-size: 0.95rem; }
.rv-table { font-size: 0.9rem; }
.rv-table td, .rv-table th { vertical-align: middle; }
.rv-bad-row td { background: #fff3f3; }
.rv-signoff { display: flex; align-items: center; gap: 1.5rem; padding: 0.75rem 1rem; background: var(--bg); border-radius: 0.5rem; margin-bottom: 0.75rem; }
.rv-signoff img, .rv-sig img { max-height: 56px; max-width: 220px; background: white; border: 1px solid var(--line); border-radius: 0.3rem; padding: 2px 6px; }
.rv-sig { display: inline-block; margin: 0 1rem 0.75rem 0; }

/* Setup cards */
.setup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 1rem; }
@media (max-width: 575px) { .setup-grid { grid-template-columns: 1fr; } }

/* Empty state */
.empty { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem; text-align: center; color: var(--muted); }
.empty i { font-size: 2rem; color: var(--sage); display: block; margin-bottom: 0.5rem; }

/* Site filter chips */
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: -0.25rem 0 1rem; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--navy); border-radius: 999px; padding: 0.3rem 0.85rem; font-size: 0.85rem; font-weight: 600; }
.chip:hover { border-color: var(--teal); }
.chip.active { background: var(--navy); border-color: var(--navy); color: white; }

/* Issues list (every failed check): stacked rows, fine on phones */
.issue-list { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.75rem; }
.issue-row { background: var(--bg); border-radius: 10px; padding: 0.55rem 0.85rem; border-left: 4px solid var(--rust); cursor: pointer; }
.issue-row:hover { background: #eef2f6; }
.issue-row.issue-static { border-left-color: var(--line); cursor: default; }
.issue-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 0.75rem; align-items: center; font-size: 0.85rem; margin-bottom: 0.15rem; }
.issue-text { color: var(--rust); }
.issue-static .issue-text { color: var(--ink); }
