/* ============================================================
   Edelweiß Zählererfassung – Stylesheet
   Matches the Grav website design (adcb52 palette)
   ============================================================ */

:root {
    --accent:       #adcb52;
    --accent-dark:  #90a846;
    --accent-deep:  #4d6b00;
    --accent-bg:    #e9f1cf;
    --accent-light: #f7f9f0;
    --body-bg:      #f6f6f6;
    --white:        #ffffff;
    --text:         #222222;
    --text-muted:   #666666;
    --border:       #eee;
    --border-form:  #d0d9b8;
    --danger:       #c0392b;
    --danger-bg:    #fdecea;
    --radius:       10px;
    --radius-sm:    6px;
    --shadow:       0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg:    0 6px 20px rgba(0,0,0,0.12);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: system-ui, sans-serif;
    font-size: 1rem;
    color: var(--text);
    background: var(--body-bg);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1 { font-size: 1.6rem; margin-bottom: 0.5rem; color: var(--text); }
h2 { font-size: 1.2rem; margin-bottom: 0.4rem; }
h3 { font-size: 1rem;   margin-bottom: 0.3rem; }

a { color: var(--accent-deep); text-decoration: none; }
a:hover { color: var(--accent); }

p { margin-bottom: 0.75rem; }

/* --- Container --- */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* --- Header --- */
.site-header {
    background: var(--white);
    border-bottom: 4px solid var(--accent);
}

.header-container {
    display: flex;
    align-items: center;
    padding: 0.85rem 0;
    gap: 1rem;
}

.logo { width: 72px; flex-shrink: 0; }

.site-title h1 { font-size: 1.3rem; color: var(--text); margin: 0; }
.site-title p  { font-size: 0.85rem; color: #555; margin: 0; }

/* Logout/leave is a session action, not a navigation item — lives in the
   header instead of the nav menu so it can never get caught up in the
   menu's wrapping on medium widths. Swaps places with .nav-mobile-only
   once the nav collapses into the hamburger menu (see media query below). */
.header-logout {
    margin-left: auto;
    color: var(--accent-deep);
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.header-logout:hover { text-decoration: underline; }

/* --- Navigation --- */
.main-nav {
    background: var(--accent-bg);
    padding: 0.4rem 0;
}

.main-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
    gap: 0;
}

.main-nav li { margin: 0 0.5rem; }

/* Only shown inside the collapsible mobile menu — see .header-logout below
   for why this exists as a separate, hidden-by-default duplicate. */
.nav-mobile-only { display: none; }

.main-nav a {
    display: inline-block;
    padding: 0.35rem 0.5rem;
    color: #3d3d3d;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: color 0.15s;
}
.main-nav a:hover { color: var(--accent-deep); }

/* Grouped admin menus (Verwaltung / Berichte & Daten) — a <button> instead of
   an <a> since it opens a menu rather than navigating, click-toggled by the
   inline script in layout.php. On mobile this collapses into an always-open
   section instead of a second-level tap target (see the media query below). */
.main-nav li.has-dropdown { position: relative; }
.main-nav button.navlink {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.5rem;
    color: #3d3d3d;
    font-weight: 600;
    font-size: 0.95rem;
    font-family: inherit;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.15s;
}
.main-nav button.navlink:hover { color: var(--accent-deep); }
.main-nav .caret { font-size: 0.65rem; opacity: 0.7; transition: transform 0.15s; }
.main-nav li.is-open .caret { transform: rotate(180deg); }
.main-nav li.is-open > button.navlink { color: var(--accent-deep); }

.main-nav .dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 0.35rem;
    z-index: 20;
}
.main-nav li.is-open .dropdown { display: block; }
.main-nav .dropdown a {
    display: block;
    padding: 0.5rem 0.7rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 4px;
    color: var(--text);
}
.main-nav .dropdown a:hover { background: var(--accent-bg); color: var(--accent-deep); }

.nav-logout {
    color: var(--accent-deep) !important;
    font-weight: 700;
}

.nav-info {
    display: inline-block;
    padding: 0.35rem 0.5rem;
    color: #555;
    font-size: 0.95rem;
}

/* Hamburger */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    flex-shrink: 0;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #2a3a0a;
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
}
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --- Main --- */
main { flex: 1 0 auto; padding: 1.5rem 0 2rem; }

/* --- Footer --- */
.site-footer {
    flex-shrink: 0;
    background: var(--accent);
    color: #2a3a0a;
    text-align: center;
    padding: 0.9rem 0;
    font-size: 0.88rem;
    font-weight: 500;
}

/* --- Alerts --- */
.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.95rem;
    border-left: 4px solid currentColor;
}
.alert-success { background: var(--accent-bg);  color: #2a3a0a; }
.alert-error   { background: var(--danger-bg);  color: var(--danger); }
.alert-info    { background: #e8f4fd;            color: #0d47a1; }

/* --- Toasts (client-side-only feedback, e.g. a button click with no server round-trip) --- */
.toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    left: 1.25rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    pointer-events: none;
}
.toast {
    max-width: 360px;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.92rem;
    color: #fff;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s, transform 0.25s;
}
.toast-visible { opacity: 1; transform: translateY(0); }
.toast-error   { background: var(--danger); }
.toast-success { background: var(--accent-deep); }
.toast-info    { background: #0d47a1; }

@media (max-width: 480px) {
    .toast-container { left: 0.75rem; right: 0.75rem; bottom: 0.75rem; }
    .toast { max-width: none; }
}

/* --- Content box (white card, matches Grav .content-box) --- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.card-center { max-width: 520px; margin-left: auto; margin-right: auto; }
.card-narrow { max-width: 680px; margin-left: auto; margin-right: auto; }
.card-actions { margin-top: 1rem; }

/* --- Buttons --- */
/* Every variant shares one border width (transparent where no border color is
   set) and one explicit line-height. Without this, a bordered variant like
   .btn-secondary rendered 2px taller/wider than a borderless one, and a
   <button> (Deaktivieren/Löschen use <form><button>) rendered at a different
   height than an <a> (Bearbeiten/Meldungen) even with identical padding,
   because form controls get their own UA-stylesheet line-height instead of
   inheriting the page's — two independent causes of the same "buttons in one
   row don't line up" symptom. */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.2rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.2;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
/* Firefox reserves extra inner padding around a <button>'s focus ring by
   default; without this an <a class="btn"> and a <button class="btn"> still
   don't match there even with identical border/line-height above. */
.btn::-moz-focus-inner { border: 0; padding: 0; }

.btn-primary {
    background: var(--accent);
    color: #000;
}
.btn-primary:hover { background: var(--accent-dark); color: #000; box-shadow: 0 2px 6px rgba(0,0,0,0.12); }

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    border-color: #d0d0d0;
}
.btn-secondary:hover { background: #e4e4e4; color: #333; }

.btn-success { background: #adcb52; color: #000; }
.btn-success:hover { background: var(--accent-dark); color: #000; }

.btn-warning { background: #e8a020; color: #000; }
.btn-warning:hover { background: #cc8c16; color: #000; }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #a93226; color: var(--white); }

.btn-link { background: none; color: var(--accent-deep); padding: 0.55rem 0.4rem; }
.btn-link:hover { text-decoration: underline; color: var(--accent-deep); }

.btn-large { padding: 0.75rem 1.75rem; font-size: 1.05rem; }
.btn-sm    { padding: 0.3rem 0.7rem;   font-size: 0.84rem; }

/* --- Forms --- */
.form-group { margin-bottom: 1.25rem; }

label {
    display: block;
    font-weight: 600;
    font-size: 0.92rem;
    color: #444;
    margin-bottom: 0.4rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.6rem 0.85rem;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid var(--border-form);
    border-radius: var(--radius-sm);
    background: #fafafa;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(173,203,82,0.25);
    background: var(--white);
}
.form-control.is-invalid { border-color: var(--danger); }
.form-control-large { font-size: 1.3rem; padding: 0.7rem 0.9rem; }

/* iOS Safari's UA stylesheet sets its own min-width on date & time inputs
   (to keep the day/month/year segments from cramping), which wins over our
   width:100% and pushes the control past its card on narrow phones. Only
   plain "min-width: 0" (not the older -webkit-min-logical-width trick, which
   current Safari no longer honors here) actually overrides it. */
input[type="date"], input[type="time"] {
    width: 100%;
    max-width: 100%;
    min-width: 0 !important;
    box-sizing: border-box;
}

textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.form-row .form-group { flex: 1; min-width: 180px; }

.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.3rem;
    font-weight: 600;
}

.field-hint { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.25rem; margin-bottom: 0; }

/* For a .field-hint sitting loose on the page (not inside a .card/.form-group,
   which already provide their own padding) — lines its text up with the
   padded content of surrounding cards instead of starting flush with the
   page edge. */
.field-hint-page { padding: 0 1.5rem; margin-bottom: 1rem; }
.required { color: var(--danger); }

.checkbox-label, .radio-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    padding: 0.3rem 0;
    font-weight: normal;
    font-size: 0.95rem;
}
.checkbox-label input, .radio-label input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--accent); }
.large-checkbox input { width: 22px; height: 22px; }
.checkbox-group, .radio-group { display: flex; flex-direction: column; gap: 0.2rem; }

.radio-label-block { align-items: flex-start; padding: 0.5rem 0; }
.radio-label-block input { margin-top: 0.15rem; flex-shrink: 0; }
.radio-text { display: flex; flex-direction: column; gap: 0.15rem; }
.radio-title { font-weight: 600; }
.radio-desc { color: var(--text-muted); font-size: 0.82rem; font-weight: normal; }

.filter-bar { margin-bottom: 1rem; }
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}
.filter-form .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}
.audit-data {
    background: var(--bg-muted, #f4f6ef);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    overflow-x: auto;
    margin: 0.25rem 0 0.5rem;
}

/* --- Tables (matches Grav .content-box table) --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
    margin: 0.5rem 0;
}
.data-table th {
    background: var(--accent-light);
    color: #3a4a10;
    font-weight: 700;
    padding: 0.6rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tbody tr:hover td { background: var(--accent-light); }
/* A real gap instead of relying on incidental whitespace between an <a> and
   an inline <form><button> in the template source — that whitespace varies
   with how the PHP happens to be formatted, so the gap was never reliable. */
.data-table .actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.row-status-pending          { background: #fffde7; }
.row-status-needs_admin_reading { background: #e8f4fd; }
.row-status-needs_review     { background: #fff3e0; }
.row-status-rejected         { background: var(--danger-bg); }

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-open              { background: var(--accent-bg);  color: #2a3a0a; }
.badge-calculated        { background: #f0f0f0;           color: #555; margin-left: 0.4rem; }
.status-pending          { background: #fff9c4;            color: #6d4c00; }
.status-needs_admin_reading { background: #d6eaf8;         color: #0d47a1; }
.status-needs_review     { background: #fde8c8;            color: #7a3c00; }
.status-accepted         { background: var(--accent-bg);   color: #2a3a0a; }
.status-corrected        { background: #d4edda;            color: #155724; }
.status-rejected         { background: #fdecea;            color: var(--danger); }
.status-planned          { background: #f0f0f0;            color: #555; }
.status-open             { background: var(--accent-bg);   color: #2a3a0a; }
.status-closed           { background: #fde8c8;            color: #7a3c00; }
.status-completed        { background: #d4edda;            color: #155724; }

/* --- Home page --- */
.page-home { text-align: center; }
.hero { padding: 2.5rem 1rem 1.5rem; }
.hero h1 { font-size: 2rem; color: var(--text); }
.hero-subtitle { font-size: 1.1rem; color: var(--text-muted); margin-top: 0.4rem; }

/* --- Meter cards (submit forms) --- */
.meter-card { border: 1px solid var(--border-form); }
.meter-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.meter-number { color: var(--text-muted); font-size: 0.85rem; }
.meter-icon { font-size: 1.3rem; }
.meter-fields { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.subfields { margin-top: 0.75rem; }

/* --- Supervisor parcel grid --- */
.parcel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}
.parcel-card {
    display: block;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-decoration: none;
    color: var(--text);
    text-align: center;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, transform 0.2s;
}
.parcel-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    color: var(--text);
}
.parcel-number { font-size: 1.4rem; font-weight: bold; color: var(--accent-deep); }
.parcel-meters { margin-top: 0.5rem; display: flex; justify-content: center; gap: 0.4rem; flex-wrap: wrap; }
/* For a table cell (admin parcel list): Strom/Wasser side by side, not
   stacked — without this the two badges have no container of their own and
   touch, relying on nothing but line-height. Kept in a row (not a column) so
   the cell stays single-line height like the rest of the row; a two-line
   cell would force vertical-align: middle on every other cell to center
   against it, leaving the checkbox/number/actions floating disconnected
   from the badges below them. */
.meter-badge-list { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.meter-badge {
    display: inline-block;
    background: var(--accent-bg);
    color: #3a4a10;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 600;
}

/* --- Report list (tenant) --- */
.report-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.report-item {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.55rem 1rem;
    background: #f9f9f9;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
    font-size: 0.93rem;
}
.report-item.status-accepted { background: var(--accent-bg); border-color: var(--accent-dark); }
.report-item.status-rejected { background: var(--danger-bg); border-color: var(--danger); }
.report-item .report-type   { font-weight: 600; }
.report-item .report-status { font-weight: bold; }
.report-item .report-date   { color: var(--text-muted); font-size: 0.83rem; margin-left: auto; }
.report-admin-note {
    flex-basis: 100%;
    font-size: 0.88rem;
    color: var(--text);
    background: rgba(255,255,255,0.6);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.6rem;
}

/* --- Report detail --- */
.report-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
/* min-width: 0 stops a zoomed photo (an explicit px width) from growing this
   column via min-content size propagation through the flex/grid ancestry —
   without it, zooming widens the whole right column instead of just
   scrolling within .photo-viewer. */
.report-detail-col { display: flex; flex-direction: column; min-width: 0; }
.dl-grid { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1rem; }
.dl-grid dt { font-weight: 600; color: var(--text-muted); white-space: nowrap; font-size: 0.9rem; }
.dl-grid dd { word-break: break-word; }

/* Report photo viewer: a fixed-size box, the photo always fully visible and
   centered inside it at first — regardless of its (or, after rotating, its
   new) orientation. Zooming grows the image, not the box: overflow scrolls
   inside instead. A *fixed* height (not max-height) is what makes this
   reliable — a definite size can't be inflated by descendant content the
   way an auto/max-height one can via min-content propagation through the
   surrounding flex/grid ancestry. */
.photo-card { min-height: 0; }
.photo-viewer {
    height: 60vh;
    overflow: auto;
    margin-top: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f4f4f4;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Once zoomed, anchor to the top-left instead of centering — a centered
   flex item that overflows on both sides can leave the "before" half of the
   overflow unreachable by scrolling in some browsers. */
.photo-viewer.is-zoomed { align-items: flex-start; justify-content: flex-start; }
.photo-viewer-img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    flex-shrink: 0;
    cursor: zoom-in;
}
.photo-viewer-img.is-zoomed { cursor: zoom-out; }
.photo-viewer-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.75rem;
}
/* Zoom and rotate are visually separate actions — a thin divider between the
   two groups instead of one undifferentiated row of same-looking buttons. */
.photo-viewer-control-group {
    display: flex;
    gap: 0.4rem;
    padding-right: 1rem;
    border-right: 1px solid var(--border);
}
.photo-viewer-control-group:last-child { border-right: none; padding-right: 0; }
.photo-viewer-newtab-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.action-panel { margin-top: 1.25rem; }
.action-panel h2 { margin-bottom: 1rem; }
.inline-form { display: inline; }

/* --- Page header (admin pages) --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

/* --- Stat grid (admin dashboard) --- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}
.stat-card-warning { border-left: 4px solid #e8a020; background: #fffdf5; }
.stat-card-danger  { border-left: 4px solid var(--danger); background: #fdf5f5; }
.stat-value { font-size: 2.2rem; font-weight: bold; color: var(--accent-deep); }
.stat-label { color: var(--text-muted); margin-top: 0.2rem; font-size: 0.9rem; }
.quick-links { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* --- Progress bars (dashboard submission progress) --- */
.progress-row { margin-bottom: 0.9rem; }
.progress-row:last-child { margin-bottom: 0; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 0.3rem; }
.progress-bar { background: var(--border); border-radius: 999px; height: 10px; overflow: hidden; }
.progress-bar-fill { background: var(--accent-deep); height: 100%; border-radius: 999px; }
.progress-bar-fill-incomplete { background: #e8a020; }
.missing-list { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.4rem; }

/* --- Inline SVG charts (dashboard trends/outliers) --- */
.chart-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 0.75rem 0 1rem;
}
.chart-box { flex: 1; min-width: 240px; }
.chart-title { font-size: 0.88rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.3rem; }
.trend-chart, .outlier-chart { width: 100%; height: auto; display: block; }
.chart-axis-label { font-size: 9px; fill: #777; font-family: inherit; }
.chart-value-label { font-size: 10px; fill: #333; font-family: inherit; }

/* --- Text color utilities --- */
.text-danger  { color: var(--danger); }
.text-warning { color: #b5790a; }
.text-success { color: var(--accent-deep); }

/* --- Section heading (matches Grav .section-heading) --- */
.section-heading {
    margin: 1.5rem 0 0.75rem;
    font-size: 1.2rem;
    color: #1a2a00;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.35rem;
}

/* --- Export page --- */
.export-buttons { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.25rem; }

/* --- Code example --- */
.code-example {
    background: #f5f5f5;
    border: 1px solid #d0d0d0;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    overflow-x: auto;
    margin: 0.5rem 0 1rem;
}

/* --- Inline code / kbd (cron tutorial etc.) --- */
code {
    background: #f0f0f0;
    border-radius: 3px;
    padding: 0.1em 0.4em;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    word-break: break-all;
}
kbd {
    background: #333;
    color: #fff;
    border-radius: 3px;
    padding: 0.1em 0.5em;
    font-size: 0.85em;
    font-family: inherit;
}

/* --- Collapsible how-to (cron setup) --- */
details.cron-help {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    background: var(--accent-light);
}
details.cron-help summary {
    cursor: pointer;
    font-weight: bold;
    color: var(--accent-deep);
}
details.cron-help[open] summary { margin-bottom: 0.75rem; }
details.cron-help h3 { font-size: 1rem; margin: 1rem 0 0.4rem; color: #1a2a00; }
details.cron-help h3:first-of-type { margin-top: 0.5rem; }
.cron-steps { margin: 0 0 0.5rem 1.25rem; padding: 0; }
.cron-steps li { margin-bottom: 0.6rem; line-height: 1.5; }

.migration-log { list-style: none; padding: 0; font-size: 0.9rem; }
.migration-log li { padding: 0.15rem 0; }

/* --- Access code display --- */
code.access-code {
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    font-weight: bold;
    letter-spacing: 2px;
    background: var(--accent-bg);
    color: var(--accent-deep);
    padding: 2px 6px;
    border-radius: 4px;
}

/* --- Input with action button --- */
.input-with-action {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}
.input-with-action .form-control { flex: 1; }
.input-with-action .btn { white-space: nowrap; flex-shrink: 0; }

/* --- Button group --- */
.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* --- Utilities --- */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); font-size: 0.92rem; }
.mt-1 { margin-top: 0.75rem; }
.mt-2 { margin-top: 1.25rem; }
.mb-1 { margin-bottom: 0.75rem; }
.mb-2 { margin-bottom: 1.25rem; }

/* --- Responsive --- */
@media (max-width: 640px) {
    .nav-toggle { display: flex; }
    .header-logout { display: none; }
    .nav-mobile-only { display: block; }

    .main-nav {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    .main-nav.nav-open { max-height: 700px; }
    .main-nav ul { flex-direction: column; align-items: stretch; padding: 0.25rem 1rem; gap: 0; }
    .main-nav li { margin: 0; }
    .main-nav a { display: block; padding: 0.65rem 0.25rem; }

    /* A tap-to-open flyout doesn't work well stacked inside an already-open
       hamburger menu, so on mobile a group becomes a static, always-expanded
       section instead: a plain (non-interactive) label with its links
       indented underneath, right in the normal menu flow. */
    .main-nav li.has-dropdown > button.navlink {
        pointer-events: none;
        color: var(--text-muted);
        font-size: 0.78rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        padding: 0.7rem 0.25rem 0.3rem;
    }
    .main-nav li.has-dropdown > button.navlink .caret { display: none; }
    .main-nav .dropdown {
        display: block;
        position: static;
        box-shadow: none;
        border: none;
        padding: 0;
        background: none;
        min-width: 0;
    }
    .main-nav .dropdown a { padding: 0.6rem 0.25rem 0.6rem 1.1rem; font-size: 0.95rem; font-weight: 600; color: #3d3d3d; }

    .report-detail-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 0; }
    .btn-large { width: 100%; justify-content: center; }
    .export-buttons .btn { width: 100%; }
    .stat-grid { grid-template-columns: 1fr 1fr; }

    .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; font-size: 0.85rem; }
    .data-table th, .data-table td { padding: 0.5rem 0.6rem; }
}
