/* Mango intra-tool Dashboard — shared styling.
   Palette shared by the Dashboard and, via the shared header, every tool. */
:root{
  --green:#8BC400; --green-dark:#6b9900; --dark:#53565A; --nearwhite:#F5F5F3;
  --border:#E2E2DF; --border-strong:#CCCCCC; --white:#FFFFFF; --danger:#B23A2E;
  --muted:#8a8d8f; --ok:#2f7d32; --ok-bg:#eaf5e1;
  /* "Needs looking at, but nothing is broken" — a stale backup, a warning from a
     run that otherwise succeeded. Distinct from --danger, which means failed. */
  --warn:#8a6100; --warn-bg:#fdf3d8; --warn-border:#e8d9a8;
}
*{box-sizing:border-box;}
body{margin:0;font-family:'Red Hat Display',Arial,sans-serif;background:var(--nearwhite);color:var(--dark);}

/* ---- Centred card (login / change password) ---- */
.center{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px;}
.box{background:var(--white);border:1px solid var(--border);border-radius:12px;padding:32px 30px;width:100%;max-width:380px;box-shadow:0 6px 24px rgba(0,0,0,.06);}
/* Sign-in / change-password card brand: the Mango logo, with the wordmark as a
   fallback if the image is missing (see docs/CONNECTING_A_TOOL.md → the logo file).
   The app chrome uses the shared header instead — css/mango-header.css. */
.brand{display:flex;align-items:center;gap:8px;margin-bottom:4px;}
.brand .brand-logo{height:34px;width:auto;display:block;}
.brand .word{font-weight:700;font-size:24px;color:var(--green-dark);}
.brand .rest{font-weight:400;font-size:15px;color:var(--dark);}
p.sub{font-size:13px;color:var(--muted);margin:0 0 22px;}
label{display:block;font-size:12px;font-weight:500;margin:14px 0 4px;}
input,select{width:100%;font-family:inherit;font-size:14px;padding:9px 11px;border:1px solid var(--border-strong);border-radius:6px;background:var(--white);}
/* A select that sits in a table row rather than a form: sized to its content. */
select.inline{width:auto;font-size:13px;padding:5px 8px;}
select:disabled,input:disabled{background:var(--nearwhite);color:var(--muted);cursor:default;}
button{margin-top:20px;width:100%;background:var(--green);border:none;color:#fff;font-family:inherit;font-weight:700;font-size:15px;padding:11px;border-radius:6px;cursor:pointer;}
button:hover{background:var(--green-dark);}
button:disabled{opacity:.6;cursor:default;}
button.ghost{background:transparent;color:var(--green-dark);border:1px solid var(--border-strong);}
button.ghost:hover{background:var(--nearwhite);}
button.small{width:auto;margin:0;padding:6px 12px;font-size:13px;font-weight:500;}
button.danger{background:var(--danger);}
button.danger:hover{background:#8f2d24;}
.msg{margin-top:16px;font-size:13px;padding:10px 12px;border-radius:6px;background:#fbeae7;color:var(--danger);display:none;}
.msg.ok{background:var(--ok-bg);color:var(--ok);}
.msg.show{display:block;}

/* ---- App chrome ----
   The page header is the SHARED header: css/mango-header.css + js/mango-header.js,
   identical in the Dashboard and in every tool. Don't add a bespoke header here.

   The page WIDTH is shared too: the tokens come from css/mango-page.css, which
   every tool links as well, so content is the same width everywhere on the
   platform. Read the tokens — never hard-code the number here. The fallbacks
   only matter if that stylesheet fails to load. */
main{
  width:100%;
  max-width:var(--mango-page-max,1600px);
  margin:28px auto;
  padding:0 var(--mango-page-gutter,24px);
}
/* For a page whose table has more columns than a form page needs — the audit log. */
main.wide{max-width:var(--mango-page-max-wide,1900px);}
h1{font-size:22px;margin:0 0 4px;}
h2{font-size:16px;margin:28px 0 10px;}
h3{font-size:13px;margin:22px 0 8px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);}
.hint{font-size:13px;color:var(--muted);}

/* Tool tiles (portal) */
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:14px;margin-top:14px;}
.tile{display:block;background:var(--white);border:1px solid var(--border);border-radius:10px;padding:18px;text-decoration:none;color:var(--dark);}
.tile:hover{border-color:var(--green);box-shadow:0 4px 14px rgba(0,0,0,.05);}
.tile .name{font-weight:700;color:var(--green-dark);}
.tile .desc{font-size:13px;color:var(--muted);margin-top:4px;}

/* Table (admin) */
.card{background:var(--white);border:1px solid var(--border);border-radius:10px;padding:18px;margin-top:14px;}

/* A card that folds away. `<details>` rather than a script, because the CSP
   forbids inline handlers and this needs no state beyond the browser's own.
   Reference material and long procedures start closed, so they cannot push the
   thing a reader came for off the screen. */
details.card > summary{
  cursor:pointer;font-size:16px;font-weight:700;color:var(--dark);
  display:flex;align-items:center;gap:9px;list-style:none;
}
details.card > summary::-webkit-details-marker{display:none;}
details.card > summary::before{
  content:'';flex:none;
  border-left:6px solid var(--muted);border-top:5px solid transparent;border-bottom:5px solid transparent;
  transition:transform .15s ease;
}
details.card[open] > summary::before{transform:rotate(90deg) translateX(1px);}
details.card > summary:hover{color:var(--green-dark);}
details.card > summary:hover::before{border-left-color:var(--green-dark);}
details.card > summary:focus-visible{outline:2px solid var(--green);outline-offset:3px;border-radius:4px;}
/* The first child after the summary carries the gap, so a closed card is tight. */
details.card[open] > summary{margin-bottom:14px;}
details.card table{margin-bottom:4px;}
details.card h3:first-of-type{margin-top:6px;}
table{width:100%;border-collapse:collapse;font-size:14px;}
th,td{text-align:left;padding:9px 10px;border-bottom:1px solid var(--border);}
th{font-size:12px;text-transform:uppercase;letter-spacing:.03em;color:var(--muted);}
td .row-actions{display:flex;gap:8px;flex-wrap:wrap;}
.pill{display:inline-block;font-size:12px;padding:2px 8px;border-radius:10px;background:var(--nearwhite);border:1px solid var(--border);}
.pill.admin{background:#eef7d9;border-color:#d3e6a3;color:var(--green-dark);}
/* Super admin: the strongest role, so the strongest pill. */
.pill.super{background:var(--green-dark);border-color:var(--green-dark);color:#fff;font-weight:500;}
.pill.off{background:#f4eceb;border-color:#e3cfcc;color:var(--danger);}
/* Health, not role: a state that is fine / needs looking at / is wrong. Used by
   the Backups screen, where the same column carries all three. */
.pill.good{background:var(--ok-bg);border-color:#cfe6b8;color:var(--ok);}
.pill.warn{background:var(--warn-bg);border-color:var(--warn-border);color:var(--warn);}
.pill.bad{background:#f4eceb;border-color:#e3cfcc;color:var(--danger);}

/* A banner above a page's content: what a reader must know before reading the
   rest. Three severities, and the colour is the whole message, so the left bar
   is thick enough to register without reading. */
.banner{margin-top:14px;padding:12px 16px;border-radius:8px;background:var(--white);
        border:1px solid var(--border);border-left:4px solid var(--border-strong);font-size:13px;}
.banner strong{display:block;color:var(--dark);font-size:14px;margin-bottom:3px;}
.banner.good{border-left-color:var(--green);background:var(--ok-bg);}
.banner.warn{border-left-color:#e0a800;background:var(--warn-bg);}
.banner.bad{border-left-color:var(--danger);background:#fbeae7;}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
.temp-box{margin-top:14px;padding:14px;border-radius:8px;background:var(--ok-bg);border:1px solid #cfe6b8;}
.temp-box code{font-size:18px;font-weight:700;letter-spacing:.04em;color:var(--dark);}
.temp-box .cap{font-size:12px;color:var(--ok);margin-bottom:6px;}
@media(max-width:640px){.grid2{grid-template-columns:1fr;}}

/* The platform's standard audit filter row: search takes the space on the left,
   the date range and buttons sit to the right. Bottom-aligned so the buttons are
   level with the inputs. Every tool's audit screen uses this shape — the classes
   are here rather than in a shared file because a tool's own styles.css owns its
   page furniture; the shape is specified in docs/AUDIT_LOG.md. */
.filters{display:flex;align-items:flex-end;gap:12px 16px;flex-wrap:wrap;}
.filters label{margin-top:0;}
.filters-search{flex:1 1 280px;min-width:200px;}
.filters-dates{display:flex;align-items:flex-end;gap:10px;margin-left:auto;flex-wrap:wrap;}
.filters-date input{width:165px;}

/* ANY card holding a table scrolls the table rather than letting it overflow.
   This used to arrive only as a side effect of .table-card, which exists for the
   pagination bar — so the users table, which has no pagination, had no scroll
   container at all. On a phone its later columns (Role, Status, Actions) were
   not merely cramped, they were unreachable: nothing scrolled to them. Keep the
   two concerns separate so a table never depends on being paginated to be
   usable. .mango-table-scroll is the shared name every tool can use. */
.card.table-card,
.card.table-scroll,
.mango-table-scroll{overflow-x:auto;}

/* A table that the shared pagination bar joins onto: square off the bottom
   corners so the two read as one block (the bar sets .mp-attached to match). */
.card.table-card{border-bottom-left-radius:0;border-bottom-right-radius:0;}

/* The expandable "Details" row under an audit entry. */
.detail-cell{background:var(--nearwhite);}
.detail-cell pre{margin:0;overflow:auto;font-size:12px;line-height:1.5;background:var(--white);border:1px solid var(--border);border-radius:6px;padding:10px;}

/* A read-only notice inside a form area — e.g. "this user has full access". */
.notice{margin-top:14px;padding:12px 14px;border-radius:8px;background:var(--ok-bg);border:1px solid #cfe6b8;color:var(--ok);font-size:13px;}
.notice strong{color:var(--green-dark);}
