/* ============================================================================
   management.css — the only stylesheet this app adds on top of the canonical
   site.css it shares with DemoAppCore.

   Keep it small on purpose: everything the management screens are made of
   (layout, side menu, tables, filter bar, pager, dialogs, forms) is already in
   site.css, and the product's visual identity — Tokef — is theme.css, loaded
   last. What is here is structure particular to these screens.
   ========================================================================== */

/* Two tables have no "add" button, because a row of theirs is not something this app creates:
   a FORM is born in the editor (phase 5 of the plan), and a report row is a filled form that
   arrived from the client site. The legacy hid the same button on the same two screens. The two
   instance tables (log, attachments) create nothing either. */
#FormsTable > .addButton, #ReportTable > .addButton,
#LogTable > .addButton, #AttachmentsTable > .addButton { display: none; }

/* The build number, at the foot of the menu — the legacy master page showed it too. */
#menu .menuVersion {
    display: block;
    padding: 0.4rem 1.2rem 0;
    color: var(--glass-ink-soft);
    font-size: 0.8rem;
    direction: ltr;
    text-align: start;
    opacity: 0.7;
}

/* ------------------------------------------------- the single-instance report -- */

.reportHead {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.reportHead h1 { margin: 0; }

/* Disclosure sections without a line of javascript: the checkbox is hidden, its
   label is the header, and the panel right after it shows only when it is checked.
   (The legacy report page used the same trick — worth keeping.) */
.sections > input[type=checkbox] { display: none; }

.sections > label {
    display: block;
    margin-top: 0.6rem;
    padding: 0.55rem 2.4rem 0.55rem 1rem;
    background: var(--glass-2, rgba(255, 255, 255, 0.06));
    border: 0.08rem solid var(--glass-line);
    border-radius: var(--radius-s);
    cursor: pointer;
    font-weight: 600;
    position: relative;
}

.sections > label::after {
    content: '+';
    position: absolute;
    inset-inline-end: 0.9rem;
}

.sections > input[type=checkbox]:checked + label::after { content: '−'; }
.sections > input[type=checkbox]:not(:checked) + label + div { display: none; }
.sections > input[type=checkbox]:checked + label + div { padding: 0.8rem 0.2rem; }

/* label + value pairs, four to a row on a wide screen and one on a phone */
.detailGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 0.6rem 1rem;
}

.detailGrid label { font-weight: 600; display: block; }
.detailGrid label > span { display: block; font-weight: 400; overflow-wrap: anywhere; }

.rowButtons { display: flex; gap: 0.6rem; align-items: center; margin-top: 1rem; flex-wrap: wrap; }

/* the raw JSON / data blocks — always left-to-right, they are machine text */
.sections textarea {
    width: 100%;
    min-height: 22rem;
    direction: ltr;
    font-family: Consolas, monospace;
}

/* an attachment preview opens in the standard record panel */
#formDiv > img { width: 100%; height: auto; }
#formDiv > iframe { width: 100%; height: 70vh; border: 0; }

/* ------------------------------------------------------- the files screen -- */

.filesOps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.opBox {
    background: var(--glass-2, rgba(255, 255, 255, 0.06));
    border: 0.08rem solid var(--glass-line);
    border-radius: var(--radius-s);
    padding: 1rem;
}

.opBox h2 { font-size: 1.1rem; margin: 0 0 0.7rem; }
.opBox label { display: block; margin-top: 0.6rem; font-size: 0.9rem; }
.opBox select, .opBox input[type=file] { width: 100%; margin-top: 0.25rem; }
.opBox .checkRow label { display: inline; margin: 0; }
.opBox > a.btnGhost { display: inline-flex; margin-top: 0.3rem; }

/* --------------------------------------------------------- the dashboard -- */

/* Five states, one colour each. Validated as a categorical palette on this surface
   (lightness band, chroma, CVD separation, contrast): the green/red pair sits in the
   6-8 ΔE band for deuteranopia, which is legal ONLY because identity is never carried
   by colour alone here — every segment is repeated as a named row in the table under
   it, and the segments are separated by a real gap. --idle is a neutral by intent (a
   link nobody will ever fill again), not a sixth category. */
:root {
    --st-done: #1f7a4d;
    --st-open: #2340c8;
    --st-warn: #d18700;
    --st-fail: #c1121f;
    --st-idle: #94a3b8;
}

.dashFilter {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    background: var(--paper, #fff);
    border: 0.08rem solid var(--line, #e3e8f2);
    border-radius: var(--radius-s);
    padding: 0.8rem 1rem;
    margin-bottom: 1.2rem;
}

.dashFilter label { font-size: 0.9rem; color: var(--ink-soft, #5a6480); }
.dashFilter input[type=date] { margin-inline-end: 0.6rem; }

/* the headline numbers */
.dashTiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.dashTile {
    background: var(--paper, #fff);
    border: 0.08rem solid var(--line, #e3e8f2);
    border-inline-start: 0.3rem solid var(--st-idle);
    border-radius: var(--radius-s);
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.dashTile.all { border-inline-start-color: var(--ink, #101a33); }
.dashTile.done { border-inline-start-color: var(--st-done); }
.dashTile.open { border-inline-start-color: var(--st-open); }
.dashTile.fail { border-inline-start-color: var(--st-fail); }

/* figures line up as a column of numbers, like every other table in this skin */
.tileValue { font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tileCaption { color: var(--ink-soft, #5a6480); font-size: 0.9rem; }
.tileNote { color: var(--ink-soft, #5a6480); font-size: 0.85rem; }

/* one card per form */
.dashForms {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr));
    gap: 1rem;
}

.dashCard {
    background: var(--paper, #fff);
    border: 0.08rem solid var(--line, #e3e8f2);
    border-radius: var(--radius-s);
    padding: 1rem;
}

.dashCard header { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 0.7rem; }
.dashCard h2 { font-size: 1.05rem; margin: 0; overflow-wrap: anywhere; }
.dashCard .dashTotal { margin-inline-start: auto; color: var(--ink-soft, #5a6480); font-size: 0.9rem; white-space: nowrap; }

/* The bar. flex-grow carries the proportion, so the gaps between segments come out of
   the track and never push the last segment past its end. */
.dashBar {
    display: flex;
    gap: 0.125rem;
    height: 0.7rem;
    border-radius: 0.25rem;
    overflow: hidden;
    background: var(--paper-soft, #f2f5fa);
    margin-bottom: 0.7rem;
}

.dashBar .seg { flex-basis: 0; min-width: 0.15rem; background: var(--st-idle); }
.dashBar .seg.done { background: var(--st-done); }
.dashBar .seg.open { background: var(--st-open); }
.dashBar .seg.warn { background: var(--st-warn); }
.dashBar .seg.fail { background: var(--st-fail); }

.dashTable { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.dashTable td { padding: 0.3rem 0.2rem; border-top: 0.08rem solid var(--line, #e3e8f2); }
.dashTable tr:first-child td { border-top: 0; }
.dashTable tr { cursor: pointer; }
.dashTable tr:hover { background: var(--accent-soft, #eaeeff); }
.dashTable .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }

.dashTable .dot {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    margin-inline-end: 0.4rem;
    background: var(--st-idle);
}

.dashTable .dot.done { background: var(--st-done); }
.dashTable .dot.open { background: var(--st-open); }
.dashTable .dot.warn { background: var(--st-warn); }
.dashTable .dot.fail { background: var(--st-fail); }

.dashEmpty { color: var(--ink-soft, #5a6480); }

/* ------------------------------------------------------- the SSO screens -- */

/* The domain account name on the refusal screen — the operator quotes it to an
   administrator, so it must be readable and selectable, never decorative. */
.ssoAccount {
    font-family: Consolas, monospace;
    background: var(--glass-2, rgba(255, 255, 255, 0.06));
    border: 0.08rem solid var(--glass-line);
    border-radius: var(--radius-s);
    padding: 0.5rem 0.8rem;
    user-select: all;
    overflow-wrap: anywhere;
}

/* the domain-login link sits under the password button and reads as its alternative */
#ssoLink { display: inline-flex; margin-top: 0.4rem; }

/* the "can this be deleted" note at the head of the form panel */
.formNote { color: var(--ink-soft, #555); margin: 0 0 0.8rem; }
