/* QCM Healthcare — dashboard design system */

:root {
    --leo-bg: #f4f7fb;
    --leo-surface: #ffffff;
    --leo-surface-2: #f7f9fc;
    --leo-border: #e3e8ef;
    --leo-border-strong: #cfd6e0;
    --leo-text: #14264a;
    --leo-text-muted: #54607a;
    --leo-text-subtle: #8993a6;
    --leo-primary: #1e3a6f;
    --leo-primary-hover: #162c55;
    --leo-primary-soft: #e8eef7;
    --leo-accent: #2b8fbd;
    --leo-accent-soft: #e3f1f8;
    --leo-green: #7fb747;
    --leo-green-hover: #6ea23b;
    --leo-green-soft: #eef6e3;
    --leo-success: #4f8a2e;
    --leo-success-soft: #eef6e3;
    --leo-warning: #b45309;
    --leo-warning-soft: #fef3c7;
    --leo-danger: #b91c1c;
    --leo-danger-soft: #fee2e2;
    --leo-purple: #6d28d9;
    --leo-purple-soft: #ede9fe;
    --leo-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
    --leo-shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.06);
    --leo-radius: 10px;
    --leo-radius-sm: 6px;

    --pico-font-family: "Inter", "GDS Transport", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --pico-font-size: 15px;
    --pico-line-height: 1.5;
    --pico-background-color: var(--leo-bg);
    --pico-color: var(--leo-text);
    --pico-muted-color: var(--leo-text-muted);
    --pico-muted-border-color: var(--leo-border);
    --pico-card-background-color: var(--leo-surface);
    --pico-card-sectioning-background-color: var(--leo-surface-2);
    --pico-primary: var(--leo-primary);
    --pico-primary-hover: var(--leo-primary-hover);
    --pico-primary-focus: rgba(30, 58, 111, 0.18);
    --pico-primary-inverse: #ffffff;
    --pico-border-radius: var(--leo-radius-sm);
    --pico-form-element-spacing-vertical: 0.55rem;
    --pico-form-element-spacing-horizontal: 0.85rem;
}

@import url("https://rsms.me/inter/inter.css");

html, body {
    background: var(--leo-bg);
    color: var(--leo-text);
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    -webkit-font-smoothing: antialiased;
}

/* ===== Layout shell ===== */
.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.app-sidebar {
    background: linear-gradient(180deg, #14264a 0%, #1e3a6f 100%);
    color: #cfd8e6;
    padding: 1.25rem 0.75rem;
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.app-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 0.5rem;
}
.app-brand-logo {
    width: auto;
    height: 52px;
    max-width: 100%;
    display: block;
    background: #ffffff;
    border-radius: 8px;
    padding: 6px 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.app-brand-mark {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #2b8fbd, #1e3a6f);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 2px 6px rgba(30, 58, 111, 0.35);
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 0.5rem;
}
.app-nav a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 0.55rem 0.85rem;
    border-radius: var(--leo-radius-sm);
    font-size: 0.92rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: background 0.12s ease, color 0.12s ease;
}
.app-nav a:hover {
    background: rgba(255,255,255,0.06);
    color: #ffffff;
}
.app-nav a.active {
    background: rgba(127, 183, 71, 0.18);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #7fb747;
}
.app-nav a .icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
    opacity: 0.85;
}

.app-sidebar-footer {
    margin-top: auto;
    padding: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.82rem;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.app-sidebar-footer a {
    color: #94a3b8;
    text-decoration: none;
}
.app-sidebar-footer a:hover { color: #ffffff; }

.app-main {
    padding: 1.75rem 2rem 3rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.app-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--leo-border);
}
.app-topbar h1 {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 650;
    letter-spacing: -0.015em;
}
.app-topbar .subtitle {
    color: var(--leo-text-muted);
    font-size: 0.92rem;
    margin-top: 0.2rem;
}

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-sidebar {
        position: static; height: auto;
        flex-direction: row; flex-wrap: wrap;
        padding: 0.75rem 1rem;
    }
    .app-nav { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
    .app-nav a { padding: 0.4rem 0.7rem; font-size: 0.85rem; }
    .app-brand { padding: 0.25rem 0.5rem 0.25rem 0; margin-right: auto; }
    .app-sidebar-footer { display: none; }
    .app-main { padding: 1.25rem; }
}

/* ===== Cards / articles ===== */
article {
    background: var(--leo-surface);
    border: 1px solid var(--leo-border);
    border-radius: var(--leo-radius);
    box-shadow: var(--leo-shadow-sm);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}
article > header {
    margin: -1.25rem -1.5rem 1.25rem;
    padding: 1rem 1.5rem;
    background: var(--leo-surface-2);
    border-bottom: 1px solid var(--leo-border);
    border-radius: var(--leo-radius) var(--leo-radius) 0 0;
    font-weight: 600;
}

h2, h3, h4 { letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; font-weight: 650; margin-top: 0; }
h3 { font-size: 1.1rem; font-weight: 600; margin-top: 1.5rem; }
h4 { font-size: 0.98rem; font-weight: 600; margin-top: 0; }

/* ===== Stats / KPI tiles ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat {
    background: var(--leo-surface);
    border: 1px solid var(--leo-border);
    border-radius: var(--leo-radius);
    padding: 1rem 1.15rem;
    box-shadow: var(--leo-shadow-sm);
}
.stat-label {
    color: var(--leo-text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.stat-value {
    font-size: 1.6rem;
    font-weight: 650;
    margin-top: 0.35rem;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.stat-delta {
    font-size: 0.82rem;
    margin-top: 0.2rem;
    color: var(--leo-text-muted);
}

/* ===== Tables ===== */
table {
    background: var(--leo-surface);
    border: 1px solid var(--leo-border);
    border-radius: var(--leo-radius);
    overflow: hidden;
    box-shadow: var(--leo-shadow-sm);
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}
table thead th {
    background: var(--leo-surface-2);
    color: var(--leo-text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--leo-border);
    text-align: left;
}
table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--leo-border);
    font-size: 0.93rem;
    vertical-align: middle;
}
table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover { background: var(--leo-surface-2); }
table input[type="text"],
table input[type="number"] {
    margin-bottom: 0;
    background: var(--leo-surface);
    border: 1px solid var(--leo-border-strong);
    border-radius: var(--leo-radius-sm);
}
table input[type="text"]:focus,
table input[type="number"]:focus {
    border-color: var(--leo-primary);
    box-shadow: 0 0 0 3px var(--pico-primary-focus);
}

/* ===== Buttons ===== */
button, [role="button"], a[role="button"] {
    font-weight: 550;
    border-radius: var(--leo-radius-sm);
    padding: 0.55rem 1rem;
    font-size: 0.92rem;
    letter-spacing: -0.005em;
    transition: transform 0.05s ease, box-shadow 0.12s ease;
}
button:not(.outline):not(.secondary):not(.contrast) {
    background: var(--leo-primary);
    border-color: var(--leo-primary);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(30, 58, 111, 0.28);
}
button:not(.outline):not(.secondary):not(.contrast):hover {
    background: var(--leo-primary-hover);
    border-color: var(--leo-primary-hover);
}
button.outline {
    background: var(--leo-surface);
    border-color: var(--leo-border-strong);
    color: var(--leo-text);
}
button.outline:hover {
    background: var(--leo-surface-2);
    border-color: var(--leo-primary);
    color: var(--leo-primary);
}
button:active { transform: translateY(1px); }

/* ===== Forms ===== */
input, select, textarea {
    background: var(--leo-surface) !important;
    border: 1px solid var(--leo-border-strong);
    border-radius: var(--leo-radius-sm);
    font-size: 0.93rem;
}
label {
    font-size: 0.88rem;
    font-weight: 550;
    color: var(--leo-text);
}

/* ===== Status pills ===== */
.pill, [class^="badge-"], [class*=" badge-"] {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.5;
    border: 1px solid transparent;
}
.pill::before, [class^="badge-"]::before, [class*=" badge-"]::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.85;
}
.badge-pending,
.badge-generating {
    background: var(--leo-warning-soft);
    color: var(--leo-warning);
    border-color: rgba(180, 83, 9, 0.2);
}
.badge-completed {
    background: var(--leo-success-soft);
    color: var(--leo-success);
    border-color: rgba(15, 118, 110, 0.2);
}
.badge-failed {
    background: var(--leo-danger-soft);
    color: var(--leo-danger);
    border-color: rgba(185, 28, 28, 0.2);
}
.badge-submitted {
    background: var(--leo-purple-soft);
    color: var(--leo-purple);
    border-color: rgba(109, 40, 217, 0.2);
}

/* ===== Payrun detail tweaks ===== */
.group-header {
    cursor: pointer;
    background: var(--leo-surface);
    font-weight: 600;
}
.group-header:hover { background: var(--leo-primary-soft); }
.group-toggle {
    display: inline-block;
    width: 1em;
    transition: transform 0.18s ease;
    color: var(--leo-text-subtle);
    font-size: 0.75em;
}
.group-toggle.open { transform: rotate(90deg); }
.detail-row td {
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    font-size: 0.88rem;
    background: var(--leo-surface-2);
}
.detail-row.weekend td { background: #fff7ed; }

/* Weekday/Weekend pills in tables shouldn't look like status pills */
.badge.badge-weekday,
.badge.badge-weekend {
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    border: 1px solid transparent;
}
.badge.badge-weekday::before,
.badge.badge-weekend::before { display: none; }
.badge.badge-weekday { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.badge.badge-weekend { background: #ffedd5; color: #9a3412; border-color: #fed7aa; }

/* ===== Progress card / log ===== */
progress {
    height: 8px;
    border-radius: 999px;
    background: var(--leo-border);
}
progress::-webkit-progress-bar { background: var(--leo-border); border-radius: 999px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, #2b8fbd, #1e3a6f); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--leo-primary); }

#progress-log {
    background: #14264a;
    color: #d1d9e6;
    padding: 0.85rem 1rem;
    border-radius: var(--leo-radius-sm);
    margin-top: 0.75rem;
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.82rem;
}
#progress-log div {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
#progress-log div:last-child { border-bottom: none; }

/* ===== Dialog ===== */
dialog article {
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
    border-radius: var(--leo-radius);
}

/* ===== Misc ===== */
.payroll-status { color: var(--leo-success); font-weight: 500; }
small { color: var(--leo-text-muted); }
code {
    background: var(--leo-surface-2);
    border: 1px solid var(--leo-border);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}
.autocomplete-list {
    background: var(--leo-surface);
    border: 1px solid var(--leo-border-strong);
    border-radius: var(--leo-radius-sm);
    box-shadow: var(--leo-shadow);
}
.autocomplete-item:hover, .autocomplete-item.active {
    background: var(--leo-primary-soft);
    color: var(--leo-primary);
}

/* Empty/loading state */
table tbody td[colspan] {
    color: var(--leo-text-muted);
    font-style: italic;
    text-align: center;
    padding: 2rem 1rem;
}
