/* ─────────────────────────────────────────────────────────────────────────────
   ASSURA · DESIGN SYSTEM (v2 · TGLOR brand)
   ─────────────────────────────────────────────────────────────────────────────
   Aesthetic: clean modern SaaS, TGLOR brand colours, sidebar navigation.
   Reference: Linear, Notion, modern enterprise dashboards.
   No editorial flourishes — geometric, technological, confident.
   Hierarchy through type weight and the lime-green brand accent.
   ───────────────────────────────────────────────────────────────────────────── */

/* ─── 1. Type — DM Sans + JetBrains Mono ──────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300..800&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ─── 2. Tokens — TGLOR palette sampled from the brand mark ───────────────── */
:root {
    /* Brand greens, sampled from the supplied logo. */
    --tglor:           #88B838;     /* primary brand green   (sampled) */
    --tglor-bright:    #B0C820;     /* logo highlight green  (sampled) */
    --tglor-dark:      #6A9020;     /* darker hover state    (derived) */
    --tglor-darker:    #4F6E16;     /* deepest, for high-contrast text on green */
    --tglor-tint:      #F3F8E8;     /* pale wash for selected rows / hover */
    --tglor-tint-2:    #E8F1D6;     /* slightly stronger tint */

    /* Neutrals — TGLOR's gray (#686860) anchors the warm-gray family. */
    --ink:             #18201A;     /* primary text */
    --ink-soft:        #3D453E;     /* secondary text */
    --ash:             #686860;     /* tertiary text — sampled logo gray */
    --ash-soft:        #9A9A93;     /* placeholder / disabled */

    /* Surfaces */
    --surface:         #FFFFFF;
    --canvas:          #FAFBF7;     /* page background — barely-warm off-white */
    --canvas-soft:     #F4F6EE;     /* hover background */

    /* Borders — quiet, low contrast, never harsh */
    --line:            #E6E8E0;
    --line-soft:       #F0F2EA;
    --line-strong:     #D4D8C8;

    /* Status — measured, not fluorescent */
    --status-low:      var(--ash);
    --status-medium:   #C2701A;     /* amber, slightly desaturated */
    --status-high:     #C2410C;     /* terracotta */
    --status-critical: #B11C1C;     /* deep red */
    --status-ok:       var(--tglor-dark);
    --status-info:     #1F5F8B;

    /* Type stacks */
    --sans:  'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;

    /* Geometry — modern radii, soft shadows */
    --r-sm:      6px;
    --r-md:      10px;
    --r-lg:      14px;
    --shadow-sm: 0 1px 2px rgba(24, 32, 26, 0.04), 0 1px 1px rgba(24, 32, 26, 0.03);
    --shadow:    0 1px 3px rgba(24, 32, 26, 0.06), 0 4px 12px rgba(24, 32, 26, 0.04);
    --shadow-lg: 0 4px 8px rgba(24, 32, 26, 0.06), 0 12px 32px rgba(24, 32, 26, 0.06);

    /* Layout */
    --sidebar-w: 248px;
    --topbar-h:  64px;
}

/* ─── 3. Reset & base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.55;
    font-feature-settings: 'kern', 'ss01';
}

img, svg { display: block; max-width: 100%; }

a {
    color: var(--tglor-dark);
    text-decoration: none;
    transition: color 120ms ease;
}
a:hover { color: var(--tglor-darker); }

hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

::selection { background: var(--tglor-bright); color: var(--ink); }

/* ─── 4. Type scale ───────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-family: var(--sans);
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
    line-height: 1.25;
}
h1 { font-size: 1.625rem;  font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem;   font-weight: 600; }
h3 { font-size: 1rem;      font-weight: 600; }
h4 { font-size: 0.875rem;  font-weight: 600; }

p { margin: 0 0 1em; }

.eyebrow {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ash);
}
.eyebrow--green { color: var(--tglor-dark); }

.mono   { font-family: var(--mono); font-feature-settings: 'kern'; }
.tnum   { font-feature-settings: 'tnum', 'lnum'; }

/* ─── 5. Application shell — sidebar + main ───────────────────────────────── */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { display: none; }
}

/* ─── 6. Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar__brand {
    padding: 20px 20px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--ink);
}
.sidebar__brand:hover { color: var(--ink); }
.sidebar__brand img,
.sidebar__brand svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}
.sidebar__brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
    min-width: 0;
}
.sidebar__brand-text strong {
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: -0.01em;
    color: var(--ink);
}
.sidebar__brand-text small {
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ash);
    margin-top: 4px;
}

.sidebar__section {
    padding: 16px 12px 4px;
}
.sidebar__section-label {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ash-soft);
    padding: 0 10px 8px;
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.sidebar__nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    color: var(--ink-soft);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 120ms ease, color 120ms ease;
    position: relative;
}
.sidebar__nav a:hover {
    background: var(--canvas-soft);
    color: var(--ink);
}
.sidebar__nav a.is-active {
    background: var(--tglor-tint);
    color: var(--tglor-darker);
    font-weight: 600;
}
.sidebar__nav a.is-active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--tglor);
    border-radius: 0 2px 2px 0;
}
.sidebar__nav-icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
    color: currentColor;
    opacity: 0.85;
}
.sidebar__nav a.is-active .sidebar__nav-icon { color: var(--tglor-dark); opacity: 1; }
.sidebar__nav-count {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--ash);
    background: var(--canvas-soft);
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 500;
}
.sidebar__nav a.is-active .sidebar__nav-count {
    background: var(--surface);
    color: var(--tglor-darker);
}

.sidebar__user {
    margin-top: auto;
    border-top: 1px solid var(--line);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar__avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--tglor);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}
.sidebar__user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
    flex: 1;
}
.sidebar__user-meta strong {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar__user-meta span {
    font-size: 0.6875rem;
    color: var(--ash);
    margin-top: 2px;
}
.sidebar__user button {
    background: transparent;
    border: 0;
    padding: 6px;
    border-radius: var(--r-sm);
    color: var(--ash);
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}
.sidebar__user button:hover { background: var(--canvas-soft); color: var(--status-high); }

/* ─── 7. Main content ──────────────────────────────────────────────────────── */
.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    height: var(--topbar-h);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 5;
}
.topbar__crumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--ash);
}
.topbar__crumbs a { color: var(--ash); }
.topbar__crumbs a:hover { color: var(--ink); }
.topbar__crumbs strong { color: var(--ink); font-weight: 500; }
.topbar__crumbs span.sep { color: var(--ash-soft); }

.topbar__search {
    flex: 1;
    max-width: 420px;
    position: relative;
}
.topbar__search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: var(--canvas);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    font-size: 0.875rem;
    font-family: var(--sans);
    color: var(--ink);
    transition: border-color 120ms ease, background 120ms ease;
}
.topbar__search input:focus {
    outline: none;
    border-color: var(--tglor);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--tglor-tint);
}
.topbar__search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    color: var(--ash);
    pointer-events: none;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.content {
    padding: 32px;
    flex: 1;
    max-width: 1480px;
    width: 100%;
}
@media (max-width: 720px) { .content { padding: 20px; } }

/* ─── 8. Page heading block ──────────────────────────────────────────────── */
.pagehead {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}
.pagehead__title {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pagehead__title h1 { font-size: 1.5rem; font-weight: 600; }
.pagehead__title p {
    color: var(--ash);
    font-size: 0.875rem;
    margin: 0;
    max-width: 60ch;
}
.pagehead__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ─── 9. Cards ────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card__head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card__head h2,
.card__head h3 {
    font-size: 0.9375rem;
    font-weight: 600;
}
.card__head .eyebrow { color: var(--ash); }
.card__body  { padding: 18px; }
.card__foot {
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    background: var(--canvas);
}

/* ─── 10. Stat cards ──────────────────────────────────────────────────────── */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: border-color 160ms ease, transform 160ms ease;
}
.stat-card:hover { border-color: var(--line-strong); }
.stat-card__label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ash);
    margin-bottom: 12px;
}
.stat-card__icon {
    width: 32px; height: 32px;
    border-radius: var(--r-md);
    background: var(--tglor-tint);
    color: var(--tglor-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-card__icon svg { width: 16px; height: 16px; }
.stat-card--alt .stat-card__icon { background: #FFEDD5; color: var(--status-medium); }
.stat-card--warn .stat-card__icon { background: #FEE2E2; color: var(--status-critical); }
.stat-card--info .stat-card__icon { background: #DBEAFE; color: var(--status-info); }
.stat-card__num {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--ink);
    font-feature-settings: 'tnum', 'lnum';
    letter-spacing: -0.02em;
    margin: 4px 0 8px;
}
.stat-card__delta {
    font-size: 0.75rem;
    color: var(--ash);
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1.4;
}
.stat-card__delta--up   { color: var(--status-critical); }
.stat-card__delta--down { color: var(--tglor-dark); }
.stat-card__delta-arrow {
    font-family: var(--mono);
    font-weight: 600;
    font-size: 0.8125rem;
}

/* ─── 11. Tables ──────────────────────────────────────────────────────────── */
.listing {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
}
.listing thead th {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ash);
    text-align: left;
    padding: 10px 16px;
    background: var(--canvas);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    position: sticky;
    top: 0;
}
.listing tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 0.875rem;
    color: var(--ink-soft);
    vertical-align: middle;
}
.listing tbody tr {
    transition: background 100ms ease;
}
.listing tbody tr:hover { background: var(--canvas); }
.listing tbody tr:last-child td { border-bottom: 0; }

.listing td.id    { font-family: var(--mono); font-size: 0.8125rem; color: var(--ash); white-space: nowrap; }
.listing td.id a  { color: var(--tglor-dark); font-weight: 500; }
.listing td.id a:hover { color: var(--tglor-darker); text-decoration: underline; }
.listing td.title { font-weight: 500; color: var(--ink); }
.listing td.title a { color: var(--ink); }
.listing td.title a:hover { color: var(--tglor-dark); }
.listing td.title small { display: block; color: var(--ash); font-size: 0.75rem; margin-top: 2px; font-weight: 400; }
.listing td.meta  { color: var(--ash); font-size: 0.8125rem; }
.listing td.num   { text-align: right; font-family: var(--mono); }
.listing td.right { text-align: right; }

/* When a listing is inside a card body it looks better edge-to-edge. */
.card .listing thead th { background: transparent; border-bottom: 1px solid var(--line); }
.card .listing thead th:first-child { padding-left: 18px; }
.card .listing thead th:last-child  { padding-right: 18px; }
.card .listing tbody td:first-child { padding-left: 18px; }
.card .listing tbody td:last-child  { padding-right: 18px; }

/* ─── 12. Status pills (subtle, not garish) ──────────────────────────────── */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    background: var(--canvas-soft);
    color: var(--ash);
    white-space: nowrap;
}
.status::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
    opacity: 0.8;
}
.status--low      { background: #F1F2EC;  color: var(--ash); }
.status--medium   { background: #FFF3E5;  color: var(--status-medium); }
.status--high     { background: #FFE8DD;  color: var(--status-high); }
.status--critical { background: #FBE2E2;  color: var(--status-critical); font-weight: 700; }
.status--ok       { background: var(--tglor-tint);  color: var(--tglor-darker); }
.status--info     { background: #E1ECF5;  color: var(--status-info); }
.status--critical::before { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse {
    0%, 100% { transform: scale(1);   opacity: 0.85; }
    50%      { transform: scale(1.4); opacity: 0.5;  }
}

/* ─── 13. Buttons ─────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    background: transparent;
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
    white-space: nowrap;
}
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--tglor-tint);
}
.btn--primary {
    background: var(--tglor);
    color: white;
    box-shadow: var(--shadow-sm);
}
.btn--primary:hover { background: var(--tglor-dark); color: white; }
.btn--primary:active { background: var(--tglor-darker); }

.btn--ghost {
    color: var(--ink);
    border-color: var(--line);
    background: var(--surface);
}
.btn--ghost:hover { background: var(--canvas); border-color: var(--line-strong); color: var(--ink); }

.btn--text {
    color: var(--tglor-dark);
    padding: 4px 6px;
}
.btn--text:hover { color: var(--tglor-darker); background: var(--tglor-tint); }

.btn--danger {
    background: var(--status-critical);
    color: white;
    box-shadow: var(--shadow-sm);
}
.btn--danger:hover { background: #8E1010; color: white; }

.btn--sm { padding: 5px 10px; font-size: 0.8125rem; }
.btn--icon {
    padding: 7px;
    width: 32px; height: 32px;
    color: var(--ash);
    border-color: var(--line);
    background: var(--surface);
}
.btn--icon:hover { color: var(--ink); background: var(--canvas); }
.btn--icon svg { width: 16px; height: 16px; }

/* ─── 14. Forms ───────────────────────────────────────────────────────────── */
.form-section {
    margin-bottom: 24px;
}
.form-section__head {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
.form-section__head h3 { font-size: 1rem; font-weight: 600; }
.form-section__head p  { font-size: 0.8125rem; color: var(--ash); margin: 4px 0 0; }

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}
.field--row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.field--row .field { margin-bottom: 0; }

.field label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ink-soft);
    line-height: 1.4;
}
.field label .req { color: var(--status-critical); margin-left: 2px; }
.field__hint  { font-size: 0.75rem; color: var(--ash); line-height: 1.45; margin-top: 2px; }
.field__error { font-size: 0.75rem; color: var(--status-critical); line-height: 1.4; margin-top: 4px; display: flex; gap: 4px; align-items: flex-start; }

input[type="text"], input[type="email"], input[type="password"],
input[type="datetime-local"], input[type="date"], input[type="number"],
input[type="search"], input[type="tel"], input[type="url"],
textarea, select {
    width: 100%;
    appearance: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 9px 12px;
    font-family: var(--sans);
    font-size: 0.875rem;
    color: var(--ink);
    line-height: 1.4;
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--tglor);
    box-shadow: 0 0 0 3px var(--tglor-tint);
}
input::placeholder, textarea::placeholder {
    color: var(--ash-soft);
}
textarea { min-height: 96px; resize: vertical; }

select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none'%3e%3cpath d='M1 1l5 5 5-5' stroke='%23686860' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 8px;
    padding-right: 36px;
    cursor: pointer;
}
input.input-error, textarea.input-error, select.input-error {
    border-color: var(--status-critical);
    box-shadow: 0 0 0 3px #FBE2E2;
}

input[type="checkbox"], input[type="radio"] {
    width: 16px; height: 16px;
    accent-color: var(--tglor);
    cursor: pointer;
}
.field-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
}
.field-check label {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--ink);
    line-height: 1.5;
    cursor: pointer;
    margin-top: -2px;
}

/* ─── 15. Filter bar ─────────────────────────────────────────────────────── */
.filterbar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 12px;
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr) auto;
    gap: 8px;
    align-items: end;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.filterbar .field { margin-bottom: 0; }
.filterbar .field label { display: none; }
@media (max-width: 720px) {
    .filterbar { grid-template-columns: 1fr; }
}

/* ─── 16. Definition list / record view ──────────────────────────────────── */
.dl {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 0;
}
.dl > div {
    display: contents;
}
.dl dt, .dl dd {
    padding: 12px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 0.875rem;
}
.dl dt {
    font-weight: 500;
    color: var(--ash);
    font-size: 0.8125rem;
}
.dl dd {
    margin: 0;
    color: var(--ink);
    line-height: 1.5;
}
.dl dd .mono { font-size: 0.8125rem; color: var(--ink-soft); }
.dl > div:last-of-type dt,
.dl > div:last-of-type dd { border-bottom: 0; }
@media (max-width: 720px) {
    .dl { grid-template-columns: 1fr; }
    .dl dt { padding-bottom: 4px; border-bottom: 0; }
    .dl dd { padding-top: 0; }
}

/* ─── 17. Two-column page layout ─────────────────────────────────────────── */
.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 20px;
    align-items: start;
}
.split--narrow {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
}
@media (max-width: 1100px) {
    .split, .split--narrow { grid-template-columns: 1fr; }
}

/* ─── 18. Action items (sidebar lists in cards) ─────────────────────────── */
.action-list { display: flex; flex-direction: column; }
.action-item {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line-soft);
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none;
    color: inherit;
    transition: background 120ms ease;
}
.action-item:hover { background: var(--canvas); }
.action-item:last-child { border-bottom: 0; }
.action-item__title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink);
    line-height: 1.4;
}
.action-item__meta {
    font-size: 0.75rem;
    color: var(--ash);
    display: flex;
    align-items: center;
    gap: 6px;
}
.action-item__meta .dot { color: var(--ash-soft); }

/* ─── 19. Callouts / banners ──────────────────────────────────────────────── */
.callout {
    border: 1px solid var(--line);
    border-left: 3px solid var(--ash);
    border-radius: var(--r-md);
    padding: 12px 14px;
    background: var(--canvas);
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--ink-soft);
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.callout strong {
    display: block;
    color: var(--ink);
    font-weight: 600;
    font-size: 0.8125rem;
    margin-bottom: 2px;
}
.callout--warn  { border-left-color: var(--status-medium);   background: #FFF8F0; }
.callout--error { border-left-color: var(--status-critical); background: #FEF2F2; }
.callout--ok    { border-left-color: var(--tglor);           background: var(--tglor-tint); }
.callout--info  { border-left-color: var(--status-info);     background: #EFF6FB; }
.callout__icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
    color: currentColor;
    margin-top: 1px;
}

/* ─── 20. Numbered section list (root causes) ───────────────────────────── */
.numbered-list { list-style: none; padding: 0; margin: 0; counter-reset: nl; }
.numbered-list li {
    border-top: 1px solid var(--line-soft);
    padding: 14px 0 14px 48px;
    position: relative;
    counter-increment: nl;
}
.numbered-list li::before {
    content: counter(nl, decimal-leading-zero);
    position: absolute;
    left: 0; top: 14px;
    font-family: var(--mono);
    font-size: 0.875rem;
    color: var(--tglor-dark);
    font-weight: 600;
}
.numbered-list li:first-child { border-top: 0; padding-top: 0; }
.numbered-list li:first-child::before { top: 0; }

/* ─── 21. Pagination ────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0 0;
    margin-top: 16px;
    border-top: 1px solid var(--line);
}
.pagination__info {
    font-size: 0.8125rem;
    color: var(--ash);
}

/* ─── 22. Login layout ──────────────────────────────────────────────────── */
.login {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 5fr 7fr;
    background: var(--canvas);
}
@media (max-width: 900px) { .login { grid-template-columns: 1fr; } }

.login__brand-pane {
    background: linear-gradient(135deg, var(--tglor-bright) 0%, var(--tglor) 50%, var(--tglor-dark) 100%);
    color: white;
    padding: 56px 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.login__brand-pane::before {
    content: '';
    position: absolute;
    top: -40%; right: -30%;
    width: 130%; height: 130%;
    background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 60%);
    pointer-events: none;
}
@media (max-width: 900px) { .login__brand-pane { padding: 40px 28px; min-height: 280px; } }

.login__brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: white;
    position: relative;
    z-index: 1;
}
.login__brand img,
.login__brand svg { width: 42px; height: 42px; }
.login__brand strong {
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}
.login__brand small {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-top: 6px;
    opacity: 0.85;
    display: block;
}

.login__pitch {
    position: relative;
    z-index: 1;
    margin-top: 80px;
}
.login__pitch h1 {
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.025em;
    max-width: 14ch;
    margin-bottom: 16px;
}
.login__pitch p {
    color: rgba(255,255,255,0.92);
    font-size: 1rem;
    line-height: 1.55;
    max-width: 38ch;
    font-weight: 400;
}

.login__foot {
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.8);
    line-height: 1.7;
    position: relative;
    z-index: 1;
}
.login__foot strong { color: white; font-weight: 600; }

.login__form-pane {
    background: var(--surface);
    padding: 56px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
@media (max-width: 900px) { .login__form-pane { padding: 40px 28px; } }
.login__form-inner {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
}
.login__form-inner h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}
.login__form-inner p.lead {
    color: var(--ash);
    font-size: 0.875rem;
    margin-bottom: 28px;
}
.login__legal {
    margin-top: 28px;
    font-size: 0.75rem;
    color: var(--ash);
    line-height: 1.55;
}

/* ─── 23. AI co-pilot accent ─────────────────────────────────────────────── */
.ai-card {
    background: linear-gradient(135deg, var(--tglor-tint) 0%, var(--surface) 60%);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 16px 18px;
}
.ai-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.ai-card__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--tglor);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.ai-card__badge svg { width: 12px; height: 12px; }
.ai-card__quote {
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--ink);
    margin: 0 0 8px;
}
.ai-card__meta {
    font-size: 0.6875rem;
    color: var(--ash);
    line-height: 1.5;
}

/* ─── 24. Margin commentary (form helper sidebar) ───────────────────────── */
.margin-note {
    border-left: 2px solid var(--tglor);
    padding: 4px 0 4px 14px;
    margin-bottom: 20px;
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--ink-soft);
}
.margin-note strong { color: var(--ink); display: block; margin-bottom: 2px; }
.margin-note + .margin-note { margin-top: 0; }

/* ─── 25. Utilities ──────────────────────────────────────────────────────── */
.flex          { display: flex; }
.flex-between  { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.gap-1 { gap: 4px;  } .gap-2 { gap: 8px;  } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-0  { margin-top: 0; }
.mt-1  { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mt-4  { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-0  { margin-bottom: 0; }
.mb-2  { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-ash    { color: var(--ash); }
.text-soft   { color: var(--ink-soft); }
.text-green  { color: var(--tglor-dark); }
.text-warn   { color: var(--status-medium); }
.text-error  { color: var(--status-critical); }
.right       { text-align: right; }
.text-sm     { font-size: 0.8125rem; }
.text-xs     { font-size: 0.75rem; }
.uppercase   { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.6875rem; font-weight: 600; }

/* ─── 26. Print ──────────────────────────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .btn, .pagination { display: none !important; }
    body { background: white; }
    .main { display: block; }
    .content { padding: 0; max-width: none; }
    .card { box-shadow: none; border: 1px solid var(--line); break-inside: avoid; }
}

/* ─── 27. Page entry — single coordinated rise ──────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
    .pagehead, .stats, .card, .filterbar {
        animation: rise 360ms cubic-bezier(0.2, 0.6, 0.2, 1) backwards;
    }
    .pagehead   { animation-delay: 0ms;   }
    .stats      { animation-delay: 40ms;  }
    .filterbar  { animation-delay: 60ms;  }
    .card       { animation-delay: 80ms;  }
    .card + .card  { animation-delay: 120ms; }
    @keyframes rise {
        from { opacity: 0; transform: translateY(6px); }
        to   { opacity: 1; transform: translateY(0); }
    }
}

/* ════════════════════════════════════════════════════════════════════
   PART 4a ADDITIONS — confirm-dialog, callout--ok variant
   ════════════════════════════════════════════════════════════════════ */

dialog.confirm-dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  max-width: 480px;
  width: calc(100% - 48px);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(15, 26, 23, 0.18);
  font-family: var(--font-sans);
}

dialog.confirm-dialog::backdrop {
  background: rgba(15, 26, 23, 0.42);
  backdrop-filter: blur(2px);
}

dialog.confirm-dialog > * {
  padding-left: 24px;
  padding-right: 24px;
}

dialog.confirm-dialog > h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  padding-top: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

dialog.confirm-dialog > p {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 18px 0;
}

dialog.confirm-dialog .confirm-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 14px;
  padding-bottom: 18px;
  border-top: 1px solid var(--line);
  background: var(--mist);
  margin-top: 6px;
}

dialog.confirm-dialog .confirm-dialog__actions form { margin: 0; }

/* success / OK callout — green variant */
.callout--ok {
  background: #F4F9EE;
  border-color: #BFD8A6;
  color: #2A4A12;
}
.callout--ok .callout__icon {
  color: var(--green, #4A7B1F);
}

/* ════════════════════════════════════════════════════════════════════
   v2 GRID + STAT TILES — these classes were referenced by ~61 module
   views (Contractors, ThirdPartyRisk, Training, ContinuousImprovement,
   Incidents, CAPA, …) but never defined, so summary tiles rendered as
   plain full-width boxes. Defined here against the v2 token set.
   ════════════════════════════════════════════════════════════════════ */
.grid        { display: grid; }
.grid--2     { gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3     { gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4     { gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1024px) {
    .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

/* Stat tile (usually `.card.stat`) — compact label + value */
.stat {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stat__label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ash);
}
.stat__value {
    font-family: var(--sans);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.stat__hint { font-size: 0.75rem; color: var(--ash); }

/* Optional state accents if a tile adds .stat--ok / --warn / --bad */
.stat--ok  .stat__value { color: var(--status-ok); }
.stat--warn .stat__value { color: var(--status-medium); }
.stat--bad .stat__value { color: var(--status-critical); }

/* ════════════════════════════════════════════════════════════════════
   FILTER BAR CONSISTENCY
   13 module pages (Contractors, Training, Third-party risk, Continuous
   improvement, Inspections, Policies, …) shipped a plain *ghost* "Filter"
   button, while Incidents/Audits/Documents use a green one. These filter
   forms all carry the same distinctive inline style, so we can green their
   submit button here — no per-view markup change, no rebuild required.
   (Combined with the attribute-less <input> fix in assura-legacy-forms.css,
   the search box is visible again and the whole row lines up straight.)
   ════════════════════════════════════════════════════════════════════ */
form[style*="align-items:flex-end"] button[type="submit"].btn {
    background: var(--tglor);
    border-color: var(--tglor);
    color: #ffffff;
}
form[style*="align-items:flex-end"] button[type="submit"].btn:hover {
    background: var(--tglor-dark);
    border-color: var(--tglor-dark);
    color: #ffffff;
}

/* ── Detail/definition lists (.defs) — professional two-column label/value rows ──
   Views use <dl class="defs"><div><dt>Label</dt><dd>Value</dd></div>…</dl>.
   Previously unstyled (dt/dd stacked). This renders them as aligned rows. */
.defs {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0;
}
.defs > div { display: contents; }
.defs dt, .defs dd {
    padding: 11px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 0.875rem;
    align-self: start;
}
.defs dt {
    font-weight: 500;
    color: var(--ash);
    font-size: 0.8125rem;
    padding-right: 16px;
}
.defs dd {
    margin: 0;
    color: var(--ink);
    line-height: 1.5;
}
.defs dd .mono { font-size: 0.8125rem; color: var(--ink-soft); }
.defs > div:last-of-type dt,
.defs > div:last-of-type dd { border-bottom: 0; }
@media (max-width: 720px) {
    .defs { grid-template-columns: 1fr; }
    .defs dt { padding-bottom: 2px; border-bottom: 0; }
    .defs dd { padding-top: 0; padding-bottom: 11px; }
}

/* ── .kv detail lists (Compliance, Permits, Audits) — flat <dl><dt><dd> ──
   These pages use class="kv" (no wrapping div per pair). Render as two columns. */
.kv {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 0;
    align-items: start;
}
.kv dt {
    font-weight: 500;
    color: var(--ash);
    font-size: 0.8125rem;
    padding: 11px 16px 11px 0;
    border-bottom: 1px solid var(--line-soft);
}
.kv dd {
    margin: 0;
    color: var(--ink);
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 11px 0;
    border-bottom: 1px solid var(--line-soft);
}
@media (max-width: 720px) {
    .kv { grid-template-columns: 1fr; }
    .kv dt { padding-bottom: 2px; border-bottom: 0; }
    .kv dd { padding-top: 0; }
}

/* ═══════════════════════════════════════════════════════════════════
   ASSURA brand theme layer — richer, branded look (green/teal)
   Palette: ink #0E2A33 · green #0F8A63 · green-dark #0B6B4F · mint #E7F5EF
   ═══════════════════════════════════════════════════════════════════ */

/* Branded data table (matches the report PDF) — use class="data-table" */
.data-table{
    width:100%; border-collapse:separate; border-spacing:0; font-size:13.5px;
    background:#fff; border:1px solid #e3ece8; border-radius:14px; overflow:hidden;
    box-shadow:0 1px 3px rgba(14,42,51,.06);
}
.data-table thead th{
    background:#0B6B4F; color:#fff; text-align:left; padding:12px 16px;
    font-size:11.5px; font-weight:600; letter-spacing:.03em; text-transform:uppercase;
}
.data-table tbody td{ padding:11px 16px; border-top:1px solid #eef3f1; color:#1b2a30; }
.data-table tbody tr:first-child td{ border-top:0; }
.data-table tbody tr:nth-child(even){ background:#f6faf8; }
.data-table tbody tr:hover{ background:#eaf5ef; }
.data-table .t-strong{ font-weight:600; color:#0E2A33; }

/* Page headers — more presence */
.pagehead__title h1{ color:#0E2A33; font-weight:800; letter-spacing:-.01em; }
.pagehead__title p{ color:#5b6b70; }

/* Cards — softer, with lift */
.card{ border:1px solid #e6ece9 !important; border-radius:16px !important;
       box-shadow:0 1px 2px rgba(14,42,51,.05), 0 6px 18px -10px rgba(14,42,51,.10) !important; }
.card__head{ border-bottom:1px solid #eef3f1 !important; }
.card__head h3{ color:#0B6B4F; font-weight:700; }

/* Primary buttons — brand green */
.btn--primary{ background:#0F8A63 !important; border-color:#0F8A63 !important; color:#fff !important; }
.btn--primary:hover{ background:#0B6B4F !important; border-color:#0B6B4F !important; }
.btn--ghost{ border-color:#cfe0d8 !important; color:#2b3f45 !important; }
.btn--ghost:hover{ background:#eef6f2 !important; }

/* Status badges — branded */
.status{ border-radius:999px; font-weight:600; font-size:11.5px; padding:3px 10px; }
.status--ok{ background:#e4f6ec !important; color:#0B6B4F !important; }
.status--info{ background:#e2f3f2 !important; color:#0e7490 !important; }
.status--high{ background:#fde7e4 !important; color:#b42318 !important; }
.status--low{ background:#eef1f0 !important; color:#5b6b70 !important; }

/* Mint callout accent for "next step" boxes already using .callout--ok stays green */
.callout--ok{ border-color:#bfe3d4 !important; }

/* Stat tiles / big numbers pick up brand ink if present */
.v3-kpi-value, .rp-stat__v{ color:#0E2A33; }

/* ── Catchy display font: Space Grotesk for headings, Inter for body ── */
h1, h2, h3,
.pagehead__title h1, .card__head h3,
.data-table thead th, .v3-card-title, .sb-brand-title,
.rb-run, .rb-exp {
    font-family: 'Space Grotesk', 'Sora', system-ui, sans-serif !important;
    letter-spacing: -0.005em;
}
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; }

/* ── Module list tables (.listing) — brand them app-wide (green header, zebra) ── */
.listing{ width:100%; border-collapse:separate; border-spacing:0; font-size:13.5px; }
.listing thead th{
    background:#0B6B4F !important; color:#fff !important; text-align:left; padding:12px 16px !important;
    font-size:11.5px !important; font-weight:600 !important; letter-spacing:.03em; text-transform:uppercase;
    border:0 !important;
}
.listing thead th:first-child{ border-top-left-radius:12px; }
.listing thead th:last-child{ border-top-right-radius:12px; }
.listing tbody td{ padding:12px 16px !important; border-top:1px solid #eef3f1 !important; color:#1b2a30; }
.listing tbody tr:nth-child(even){ background:#f6faf8; }
.listing tbody tr:hover{ background:#eaf5ef; }

/* Stat tiles — bigger, branded numbers */
.stat__value{ font-family:'Space Grotesk',sans-serif !important; font-size:32px !important; font-weight:700 !important; color:#0E2A33 !important; }
.stat__label{ font-size:11px !important; text-transform:uppercase; letter-spacing:.04em; color:#8a9aa3 !important; font-weight:600 !important; }
.card.stat{ padding:18px 20px; }

/* Eyebrow (section kicker) — brand green */
.eyebrow, .eyebrow--green{ color:#0F8A63 !important; font-weight:700; letter-spacing:.06em; font-size:11px; text-transform:uppercase; }
