/* Base font, extracted from repeats.html, shared by the Assets and Repeats pages. */
body {
    font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* Mobile / touch devices only: larger base text. Desktop keeps 15px. */
@media (hover: none) and (pointer: coarse) {
    body {
        font-size: 25px;
    }
}

/* Tabs style — a row of tabs (Plot / Tasks / Log / Invoice, etc.) where the
   active tab is highlighted and appears joined to the panel below it. Each
   tab stays a <form>+submit-button so tab switching keeps working via a
   normal page navigation; this only styles the row and the buttons. */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 10px 0;
    border-bottom: 2px solid #d5dcde;
}
.tabs form {
    display: inline;
    margin: 0;
}
.tab-btn {
    font: inherit;
    padding: 8px 22px;
    margin-bottom: -2px;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: transparent;
    color: #5d6b70;
    cursor: pointer;
}
.tab-btn:hover {
    background: #f7f9f9;
}
.tab-btn.active {
    background: #fff;
    color: #1f5f6b;
    font-weight: 700;
    border-color: #d5dcde;
    border-bottom: 2px solid #fff;
}

/* Sub-tabs — a second, smaller row of tabs shown under a main tab that has
   children (e.g. Yearly > Plot / Log / Estimate / Top 10). Uses the same
   .tabs / .tab-btn markup, with a lighter, indented look so it reads as a
   child of the active main tab. */
.tabs.sub-tabs {
    margin: -8px 0 12px;
    padding: 6px 0 0 14px;
    gap: 2px;
    background: #f7f9f9;
    border-bottom: 1px solid #d5dcde;
}
.sub-tabs .tab-btn {
    padding: 5px 16px;
    font-size: 0.93em;
    margin-bottom: -1px;
}
.sub-tabs .tab-btn.active {
    border-bottom: 1px solid #fff;
}

/* Cell shading — one colour scheme for status cells on every page.
   Use on a <td>:  overdue (red)  |  hold / upcoming (amber)  |  blue (Scheduled, ExtRef)  |
   remind (bright yellow: not yet due, but the RemindDate has been reached).
   Text is always black and not bold, whatever the shade. */
:root {
    --overdue: #f22d2d;
    --hold: #f2b705;
    --blue: #9ccbff;
    --remind: #ffff00;
}
@media (prefers-color-scheme: dark) {
    :root {
        --overdue: #ff3b3b;
        --hold: #a67c00;
        --blue: #1f5fa8;
        --remind: #ffff00;
    }
}
td.overdue,
td.hold,
td.upcoming,
td.blue,
td.remind {
    color: #000;
    font-weight: 400;
}
td.overdue  { background: var(--overdue); }
td.hold,
td.upcoming { background: var(--hold); }
td.blue     { background: var(--blue); }
td.remind   { background: var(--remind); }

/* Balance / highlight fills (used by Assets and any other page).
   bg-red follows the same red as the overdue cells above. */
.bg-red             { background-color: var(--overdue); color: #000; }
.bg-yellow          { background-color: #ffffcc; }
.bg-lime            { background-color: #ccffcc; }
.bg-rose            { background-color: #ffe6e6; }
.bg-lightgrn        { background-color: #e6ffe6; }
.bg-grey            { background-color: #f0f0f0; }
.bg-cornflowerblue  { background-color: #6495ed; color: #fff; }
.bg-orange          { background-color: #ffa500; }

/* Balance cells sit on light fills, so force black text even inside a row
   (e.g. a Total row) that sets white text for its other cells. */
td.bg-red, td.bg-yellow, td.bg-lime { color: #000; }

/* Grouping rows in the task tables (Repeats, Assets > Tasks, summary table).
   Pages that define --accent / --paper / --bg (Repeats) get their dark mode;
   other pages fall back to the light values. */
tr.holder td { background: var(--accent, #1f5f6b); color: var(--paper, #fff); font-weight: 700; }
tr.asset td,
tr.type td   { background: var(--bg, #f0f0f0); font-weight: 700; }

/* Invoice table cells */
tr.amount-positive-row td { background: #d4edda; }
td.missing-date-cell      { background: #fff3cd; }

/* Summary total row: fill comes from bg-cornflowerblue on the <tr> (same blue as the
   Assets Total row); count cells keep their red / yellow value shading. Bold text. */
tr.total td { font-weight: 700; }

/* Toast: short feedback message shown at the top of the page (e.g. after an Approve).
   Markup: <div id="toast" class="toast" role="status" aria-live="polite"></div>
   Add the class "show" to display it, remove it to fade it out. */
.toast {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translate(-50%, -20px);
    max-width: min(92vw, 640px);
    padding: 10px 18px;
    border-radius: 8px;
    background: #1e7e34;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s, transform .3s;
    z-index: 99999;                 /* above the page menu / any sticky header */
}
.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}
