@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--soft);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--line);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.preloader-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--brand-dark);
    margin: 0;
}

:root {
    --ink: #172033;
    --muted: #667085;
    --line: #dfe5ee;
    --paper: #ffffff;
    --soft: #f5f7fb;
    --brand: #146c73;
    --brand-dark: #0b4b50;
    --gold: #c58b2b;
    --danger: #b42318;
    --warn: #b54708;
    --ok: #027a48;
    --shadow: 0 18px 55px rgba(23, 32, 51, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--ink);
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(135deg, rgba(20, 108, 115, 0.1), transparent 34%),
        linear-gradient(225deg, rgba(197, 139, 43, 0.12), transparent 28%),
        var(--soft);
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    color: var(--brand-dark);
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem clamp(1rem, 3vw, 2.5rem);
    border-bottom: 1px solid rgba(223, 229, 238, 0.9);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--ink);
    font-size: 1.08rem;
    font-weight: 800;
}

.brand i {
    color: var(--brand);
}

.app-header nav {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.app-header nav a:not(.button) {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    font-weight: 700;
}

.role-chip,
.db-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 34px;
    padding: 0.35rem 0.7rem;
    border: 1px solid rgba(20, 108, 115, 0.18);
    border-radius: 999px;
    color: var(--brand-dark);
    background: rgba(20, 108, 115, 0.08);
    font-size: 0.82rem;
    font-weight: 800;
}

.db-chip {
    color: var(--warn);
    background: #fff7ed;
    border-color: #fed7aa;
}

.db-chip.live {
    color: var(--ok);
    background: #ecfdf3;
    border-color: #abefc6;
}

.page {
    width: 100%;
    margin: 0 auto;
    padding: 2rem 31px 4rem;
}

.button,
button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 42px;
    padding: 0.72rem 1.05rem;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    box-shadow: 0 10px 24px rgba(20, 108, 115, 0.24);
    font-weight: 800;
}

.button:hover {
    color: #fff;
    transform: translateY(-1px);
}

.button.small {
    min-height: 36px;
    padding: 0.55rem 0.8rem;
}

.button.secondary {
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: none;
}

.page-title,
.case-hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 1.4rem;
    padding: clamp(1.25rem, 4vw, 2.4rem);
    border-radius: 8px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(11, 75, 80, 0.96), rgba(20, 108, 115, 0.9)),
        radial-gradient(circle at top right, rgba(197, 139, 43, 0.45), transparent 36%);
    box-shadow: var(--shadow);
}

.page-title h1,
.case-hero h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.6rem);
    font-weight: 800;
}

.case-hero p {
    margin: 0.5rem 0 0;
    color: rgba(255, 255, 255, 0.78);
}

.eyebrow {
    margin: 0 0 0.5rem;
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.panel {
    margin-bottom: 1rem;
    padding: clamp(1rem, 2vw, 1.35rem);
    border: 1px solid rgba(223, 229, 238, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 35px rgba(23, 32, 51, 0.07);
    overflow: visible;
    min-width: 0;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-head h2,
.empty h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
}

.panel-head span {
    color: var(--muted);
    font-weight: 700;
}

.case-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.case-card {
    display: block;
    min-height: 230px;
    padding: 1.1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: linear-gradient(180deg, #fff, #f8fbfc);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.case-card:hover {
    color: var(--ink);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.case-card h3 {
    margin: 0.7rem 0 0.35rem;
    font-size: 1.35rem;
    font-weight: 800;
}

.case-card p,
.muted-text {
    color: var(--muted);
}

.pill,
.status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
}

.pill {
    color: var(--brand-dark);
    background: rgba(20, 108, 115, 0.1);
}

.status.danger {
    color: var(--danger);
    background: #fee4e2;
}

.status.warn {
    color: var(--warn);
    background: #fef0c7;
}

.status.ok {
    color: var(--ok);
    background: #dcfae6;
}

dl {
    margin: 0;
}

.case-card dl,
.detail-list {
    display: grid;
    gap: 0.75rem;
}

.case-card dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 1rem;
}

dt {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

dd {
    margin: 0.15rem 0 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.empty {
    padding: 2rem;
    text-align: center;
}

.hero-stats,
.metrics-row,
.split {
    display: grid;
    gap: 1rem;
}

.hero-stats {
    grid-template-columns: repeat(3, minmax(95px, 1fr));
}

.hero-stats div,
.metric {
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
}

/* Clickable hero stat button */
.hero-stat-btn {
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.hero-stat-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.hero-stat-btn:active {
    transform: translateY(0);
}

.hero-stat-btn span,
.hero-stats span,
.metric strong {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
}

.hero-stat-btn small,
.hero-stats small,
.metric span,
.metric small {
    color: rgba(255, 255, 255, 0.76);
    font-weight: 700;
}

.metrics-row {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    margin-bottom: 1rem;
}

.metric {
    color: var(--ink);
    background: #fff;
    border-color: var(--line);
}

.metric small,
.metric span {
    color: var(--muted);
}

.metric.muted {
    grid-column: 1 / -1;
}

.split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    display: block;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

@media (max-width: 800px) {
    table {
        min-width: 480px;
    }
}

th {
    color: var(--muted);
    background: #f8fafc;
    font-size: 0.78rem;
    text-transform: uppercase;
}

th,
td {
    padding: 0.8rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

td {
    color: #344054;
    font-size: 0.92rem;
}

.matrix-table {
    min-width: 1120px;
}

.matrix-table th,
.matrix-table td {
    width: 16.66%;
}

.matrix-table td:first-child {
    min-width: 190px;
}

.matrix-table td strong,
.matrix-table td small {
    display: block;
}

.matrix-table td small {
    margin-top: 0.25rem;
    color: var(--muted);
    font-weight: 700;
}

.matrix-table hr {
    margin: 0.55rem 0;
    border-color: var(--line);
    opacity: 1;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.form-grid.compact {
    margin-top: 1rem;
}

label {
    display: grid;
    gap: 0.4rem;
    color: #344054;
    font-size: 0.86rem;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: #fff;
    font: inherit;
    font-weight: 500;
}

textarea {
    min-height: 96px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 0.2rem rgba(20, 108, 115, 0.14);
    outline: none;
}

.wide,
.form-actions,
.nested-form {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    justify-content: end;
    gap: 0.75rem;
}

details.panel summary {
    cursor: pointer;
    color: var(--ink);
    font-weight: 800;
}

.nested-form {
    margin-top: 1.3rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--line);
}

.master-entry-intro {
    margin-bottom: 1rem;
}

.master-entry-intro h3 {
    margin: 0.25rem 0 0.5rem;
}

.master-entry-section {
    margin-bottom: 1.25rem;
}

.master-entry-section .panel-head h3 {
    margin: 0;
    font-size: 1.05rem;
}

.master-entry-history {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--line);
}

.form-grid.compact label select {
    margin-bottom: 0.45rem;
}

.form-grid.compact label input[type="text"],
.form-grid.compact label input:not([type="file"]):not([type="date"]):not([type="number"]):not([type="hidden"]) {
    margin-top: 0.35rem;
}

.master-entry-history h4 {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    color: var(--muted);
}

.auth-panel {
    margin-inline: auto;
}

.role-guide {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.role-guide article,
.review-card {
    padding: 0.9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.role-guide strong,
.role-guide span,
.review-card strong,
.review-card small {
    display: block;
}

.role-guide span,
.review-card small {
    margin-top: 0.25rem;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.review-stack {
    display: grid;
    gap: 0.8rem;
    margin-top: 1rem;
}

.inline-actions {
    display: inline-flex;
    margin: 0.7rem 0.45rem 0 0;
}

.vault-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.8rem;
}

.vault-folder {
    display: grid;
    gap: 0.35rem;
    min-height: 118px;
    padding: 0.9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.vault-folder strong,
.vault-folder small,
.vault-folder a {
    overflow-wrap: anywhere;
}

.vault-folder small {
    color: var(--muted);
    font-weight: 800;
}

.date-display-input {
    padding-right: 2.35rem;
    background:
        linear-gradient(90deg, transparent calc(100% - 2.4rem), #f8fafc calc(100% - 2.4rem)),
        #fff;
}

.date-popover {
    position: absolute;
    z-index: 1000;
    width: 304px;
    padding: 0.85rem;
    border: 1px solid rgba(20, 108, 115, 0.2);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 22px 60px rgba(23, 32, 51, 0.22);
}

.date-popover-head,
.date-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.date-popover-head strong {
    font-size: 0.96rem;
}

.date-title {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.date-popover button {
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font-weight: 800;
}

.date-popover-head button,
.date-tools button {
    min-width: 42px;
    padding: 0.25rem 0.55rem;
    border-color: var(--line);
    background: #f8fafc;
}

.date-title button {
    min-width: auto;
    padding: 0.25rem 0.5rem;
    border-color: rgba(20, 108, 115, 0.18);
    color: var(--brand-dark);
    background: rgba(20, 108, 115, 0.08);
}

.date-choice-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
    margin-top: 0.8rem;
}

.date-choice-grid.year-grid {
    grid-template-columns: repeat(4, 1fr);
}

.date-choice-grid button {
    min-height: 44px;
    border-color: var(--line);
    background: #f8fafc;
}

.date-choice-grid button:hover,
.date-choice-grid button.selected {
    color: #fff;
    border-color: var(--brand);
    background: var(--brand);
}

.date-week,
.date-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.28rem;
}

.date-week {
    margin: 0.75rem 0 0.35rem;
}

.date-week span {
    color: var(--muted);
    text-align: center;
    font-size: 0.72rem;
    font-weight: 800;
}

.date-grid button {
    aspect-ratio: 1;
}

.date-grid button:hover,
.date-grid button.today {
    border-color: rgba(20, 108, 115, 0.35);
    background: rgba(20, 108, 115, 0.08);
}

.date-grid button.selected {
    color: #fff;
    border-color: var(--brand);
    background: var(--brand);
}

.date-blank {
    min-height: 34px;
}

.date-tools {
    margin-top: 0.75rem;
}

.review-card p {
    margin: 0.65rem 0 0;
}

.warning-note,
.question-note {
    margin-top: 0.65rem;
    padding: 0.7rem;
    border-radius: 8px;
    font-weight: 700;
}

.warning-note {
    color: var(--warn);
    background: #fef0c7;
}

.question-note {
    color: var(--brand-dark);
    background: rgba(20, 108, 115, 0.1);
}

.flash-stack {
    display: grid;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.flash {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    font-weight: 700;
}

.flash.success {
    color: var(--ok);
    background: #ecfdf3;
    border-color: #abefc6;
}

.flash.error {
    color: var(--danger);
    background: #fef3f2;
    border-color: #fecdca;
}

/* ── Index page layout ── */
.index-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ══════════════════════════════════════════════════════
   SHARED COMPONENTS
   ══════════════════════════════════════════════════════ */

/* Sidebar toggle button */
.mobile-sidebar-toggle {
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.7rem 1.1rem;
    border: none;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(20, 108, 115, 0.25);
}

/* Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* Close button inside drawer */
.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 14px;
    right: 14px;
    background: transparent;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    color: var(--ink);
    cursor: pointer;
}

/* ── Dashboard tabs sidebar (case detail) ── */
.dashboard-tabs-wrapper:not(.dashboard-layout) {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.dashboard-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.dashboard-tabs-sidebar {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 260px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.dashboard-tabs-sidebar::-webkit-scrollbar {
    width: 6px;
}

.dashboard-tabs-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.dashboard-tabs-sidebar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

.dashboard-tabs-content {
    flex-grow: 1;
    min-width: 0;
}

.tab-button {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem 0.5rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-button:hover {
    background: rgba(20, 108, 115, 0.05);
    color: var(--brand);
    transform: translateX(3px);
}

.tab-button.active {
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(20, 108, 115, 0.2);
}

.tab-pane {
    display: none;
}

.tab-pane:not(#tab-overview) {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.tab-pane h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--ink);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ══════════════════════════════════════════════════════
   CREATIVE DASHBOARD (index.html)
   ══════════════════════════════════════════════════════ */

.dash-hero {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding: clamp(1.1rem, 3vw, 2rem);
    border-radius: 12px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(11, 75, 80, 0.97), rgba(20, 108, 115, 0.92)),
        radial-gradient(circle at top right, rgba(197, 139, 43, 0.55), transparent 40%);
    box-shadow: var(--shadow);
}

.dash-hero-left {
    flex: 1;
    min-width: 180px;
}

.dash-hero-left h1 {
    margin: 0.25rem 0 0.4rem;
    font-size: clamp(1.5rem, 4vw, 2.6rem);
    font-weight: 800;
}

.dash-hero-sub {
    margin: 0;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.88rem;
    font-weight: 600;
}

.dash-hero-stats {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.dash-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 82px;
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    text-align: center;
}

.dash-stat span {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1;
}

.dash-stat small {
    margin-top: 0.25rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.72);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dash-stat.dash-stat-warn {
    background: rgba(181, 71, 8, 0.28);
    border-color: rgba(254, 240, 199, 0.3);
}

/* Clickable stat card */
.dash-stat-btn {
    cursor: pointer;
    font-family: inherit;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.dash-stat-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.dash-stat-btn:active {
    transform: translateY(0);
}

.dash-stat-btn.dash-stat-warn {
    background: rgba(181, 71, 8, 0.28);
    border-color: rgba(254, 240, 199, 0.3);
}

.dash-hero-btn {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: none;
}

.dash-hero-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.dash-layout {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.dash-sidebar {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 270px;
    min-width: 270px;
    padding: 1.25rem;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 4px 20px rgba(23, 32, 51, 0.06);
}

.dash-sidebar::-webkit-scrollbar {
    width: 5px;
}

.dash-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.dash-sidebar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

.dash-sidebar-label {
    margin: 0 0 0.35rem;
    padding: 0 0.2rem;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.dash-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.65rem 0.7rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: all 0.18s ease;
}

.dash-nav-btn:hover {
    background: var(--soft);
    border-color: var(--line);
}

.dash-nav-btn.active {
    background: rgba(20, 108, 115, 0.07);
    border-color: rgba(20, 108, 115, 0.2);
}

.dash-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    color: #fff;
    font-size: 0.95rem;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14);
}

.dash-nav-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.dash-nav-text strong {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-nav-text small {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    margin-top: 0.06rem;
}

.dash-nav-btn.active .dash-nav-text strong {
    color: var(--brand-dark);
}

.dash-nav-badge {
    flex-shrink: 0;
    min-width: 22px;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    text-align: center;
    background: rgba(20, 108, 115, 0.1);
    color: var(--brand-dark);
}

.dash-nav-badge.warn {
    background: #fef0c7;
    color: var(--warn);
}

.dash-nav-badge.gold {
    background: rgba(197, 139, 43, 0.12);
    color: var(--gold);
}

.dash-quick-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
    transition: all 0.15s ease;
}

.dash-quick-link:hover {
    background: var(--soft);
    color: var(--brand);
}

.dash-quick-link i {
    font-size: 0.95rem;
    color: var(--brand);
}

.dash-content {
    flex: 1;
    min-width: 0;
    overflow: visible;
}

.dash-pane {
    display: none;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: clamp(1rem, 2vw, 1.75rem);
    box-shadow: 0 4px 20px rgba(23, 32, 51, 0.05);
    animation: dashFadeIn 0.25s ease;
    min-width: 0;
    overflow: visible;
}

.dash-pane.active {
    display: block;
}

@keyframes dashFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dash-pane-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

.dash-pane-header h2 {
    margin: 0 0 0.2rem;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--ink);
}

.dash-pane-header p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 600;
}

.dash-count-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.8rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
    background: rgba(20, 108, 115, 0.1);
    color: var(--brand-dark);
    white-space: nowrap;
}

.dash-count-chip.warn {
    background: #fef0c7;
    color: var(--warn);
}

.dash-count-chip.gold {
    background: rgba(197, 139, 43, 0.12);
    color: var(--gold);
}

.dash-count-chip.purple {
    background: rgba(105, 65, 198, 0.1);
    color: #6941c6;
}

.dash-case-link {
    color: var(--ink);
    font-weight: 800;
}

.dash-case-link:hover {
    color: var(--brand);
}

.date-chip {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 6px;
    background: rgba(20, 108, 115, 0.08);
    color: var(--brand-dark);
    font-size: 0.83rem;
}

.date-chip.warn {
    background: #fef0c7;
    color: var(--warn);
}

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 22px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--ink);
    font-size: 0.76rem;
    font-weight: 800;
    border: 1px solid var(--line);
}

.row-num {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.empty-cell {
    text-align: center;
    padding: 2rem !important;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.9rem;
}

/* Schedule case link */
.schedule-case-link {
    font-weight: 800;
    color: var(--ink);
}

.schedule-case-link:hover {
    color: var(--brand);
}

/* Tab badges */
.tab-badge {
    margin-left: auto;
    min-width: 22px;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(20, 108, 115, 0.12);
    color: var(--brand-dark);
    font-size: 0.74rem;
    font-weight: 800;
    text-align: center;
}

.tab-button.active .tab-badge {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.tab-badge.warn {
    background: #fef0c7;
    color: var(--warn);
}

/* ── Cases list table ── */
.cases-list-table {
    min-width: 1280px;
}

.cases-list-table thead th {
    white-space: nowrap;
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    padding: 0.7rem 0.85rem;
}

.cases-list-table tbody tr {
    transition: background 0.15s ease;
}

.cases-list-table tbody tr:nth-child(even) {
    background: #f9fbfc;
}

.cases-list-table tbody tr:hover {
    background: rgba(20, 108, 115, 0.06);
    box-shadow: inset 3px 0 0 var(--brand);
}

.cases-list-table td {
    padding: 0.7rem 0.85rem;
    white-space: nowrap;
    vertical-align: middle;
}

.cases-list-table td:nth-last-child(-n+2),
.cases-list-table th:nth-last-child(-n+2) {
    text-align: center;
}

.button.small {
    min-height: 34px;
    padding: 0.42rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 6px;
    gap: 0.35rem;
    white-space: nowrap;
}

.button.small.secondary {
    color: var(--brand-dark);
    border-color: rgba(20, 108, 115, 0.3);
    background: rgba(20, 108, 115, 0.07);
    box-shadow: none;
}

.button.small.secondary:hover {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
}

.button.small:not(.secondary):hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(20, 108, 115, 0.28);
}

th,
td {
    padding: 0.5rem 0.55rem;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* ══════════════════════════════════════════════════════
   MOBILE RESPONSIVE ≤ 768px
   ══════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    .page {
        width: 100%;
        max-width: 100%;
        padding: 0.75rem 0.75rem 3rem;
        overflow-x: hidden;
    }

    /* Header */
    .app-header {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        padding: 0.7rem 0.9rem;
    }

    .app-header nav {
        flex-wrap: wrap;
        gap: 0.35rem 0.55rem;
    }

    .app-header nav a:not(.button) {
        font-size: 0.8rem;
    }

    .role-chip {
        font-size: 0.74rem;
        padding: 0.25rem 0.55rem;
    }

    /* Hero */
    .dash-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.85rem;
        padding: 1rem;
        border-radius: 8px;
        box-sizing: border-box;
        width: 100%;
    }

    .dash-hero-stats {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.45rem;
    }

    .dash-stat {
        min-width: unset;
        padding: 0.55rem 0.4rem;
    }

    .dash-stat span {
        font-size: 1.3rem;
    }

    .dash-stat small {
        font-size: 0.6rem;
    }

    .dash-hero-btn {
        width: 100%;
        justify-content: center;
    }

    .dash-hero-left h1 {
        font-size: 1.5rem;
    }

    /* Toggle visible */
    .mobile-sidebar-toggle {
        display: inline-flex;
    }

    /* Sidebar — drawer */
    .dash-layout {
        flex-direction: column;
        gap: 0;
    }

    .dash-sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        min-width: unset;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        z-index: 200;
        padding-top: 3.5rem;
        transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.14);
    }

    .dash-sidebar.open {
        left: 0;
    }

    /* Case detail sidebar */
    .dashboard-tabs-wrapper:not(.dashboard-layout),
    .dashboard-layout {
        flex-direction: column;
    }

    .dashboard-tabs-sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        min-width: unset;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        z-index: 200;
        padding-top: 3.5rem;
        transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.14);
    }

    .dashboard-tabs-sidebar.open {
        left: 0;
    }

    .sidebar-close-btn {
        display: block;
    }

    .dashboard-tabs-content {
        width: 100%;
    }

    .tab-pane:not(#tab-overview) {
        padding: 1rem;
        border-radius: 8px;
    }

    /* Pane */
    .dash-pane {
        padding: 0.9rem;
        border-radius: 8px;
    }

    .dash-pane-header {
        flex-direction: column;
        gap: 0.4rem;
    }

    /* Tables */
    th,
    td {
        padding: 0.5rem 0.55rem;
        font-size: 0.8rem;
    }

    /* Forms */
    .form-grid {
        grid-template-columns: 1fr;
    }

    .split {
        grid-template-columns: 1fr;
    }

    .hero-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .role-guide {
        grid-template-columns: 1fr;
    }

    /* Page title */
    .page-title,
    .case-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem;
    }

    .page-title h1,
    .case-hero h1 {
        font-size: 1.55rem;
    }

    /* Panel */
    .panel {
        padding: 0.85rem;
    }

    /* Force table scroll to work inside all containers */
    .table-wrap {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        display: block !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    .dash-pane,
    .panel,
    .dash-content,
    .dashboard-tabs-content,
    .tab-pane {
        overflow: visible !important;
        max-width: 100%;
    }

    /* Prevent body/html overflow clipping tables */
    body {
        overflow-x: hidden;
    }
}

/* ==========================================================================
   PREMIUM THEME & SIDEBAR LAYOUT
   ========================================================================== */

/* Typography */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --font-outfit: 'Outfit', sans-serif;
    --sidebar-width: 280px;
    --sidebar-bg: linear-gradient(180deg, hsl(222, 47%, 11%) 0%, hsl(222, 47%, 7%) 100%);
    --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
    --sidebar-active-bg: linear-gradient(90deg, rgba(20, 108, 115, 0.25) 0%, rgba(20, 108, 115, 0.08) 100%);
    --sidebar-text: hsl(215, 20%, 80%);
    --sidebar-text-muted: hsl(215, 12%, 55%);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --brand-hsl: 185, 70%, 26%;
    --brand: hsl(var(--brand-hsl));
    --brand-dark: hsl(185, 80%, 15%);
    --brand-light: hsl(185, 60%, 45%);
    --brand-soft: hsl(185, 40%, 96%);
    --gold: hsl(38, 65%, 47%);
    --danger: hsl(4, 76%, 45%);
    --warn: hsl(28, 90%, 37%);
    --ok: hsl(156, 96%, 24%);
    --shadow: 0 12px 30px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);
    --border-radius-lg: 12px;
    --border-radius-md: 8px;
}

body {
    font-family: var(--font-outfit), 'Inter', sans-serif;
    background: radial-gradient(circle at 100% 0%, hsla(185, 70%, 26%, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 0% 100%, hsla(38, 65%, 47%, 0.08) 0%, transparent 40%),
                var(--soft);
}

/* ══════════════════════════════════════════════════════
   HEADER — horizontal nav (replaces global sidebar)
   ══════════════════════════════════════════════════════ */

.app-header {
    position: sticky;
    top: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 clamp(1rem, 2vw, 2rem);
    height: 56px;
    border-bottom: 1px solid rgba(223,229,238,0.9);
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(16px);
    flex-wrap: nowrap;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 800;
    white-space: nowrap;
    flex-shrink: 0;
}

.brand i { color: var(--brand); }

/* Horizontal nav links */
.app-nav {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    margin-left: 0.75rem;
    flex: 1;
}

.app-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
    text-decoration: none;
}

.app-nav-link:hover,
.app-nav-link.active {
    background: rgba(20,108,115,0.08);
    color: var(--brand-dark);
}

/* Right side of header */
.app-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-shrink: 0;
}

/* Mobile hamburger — hidden on desktop */
.app-nav-hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font-size: 1.25rem;
    cursor: pointer;
    flex-shrink: 0;
}

/* Mobile nav drawer */
.app-nav-drawer {
    position: fixed;
    top: 0; left: -280px;
    width: 260px;
    height: 100vh;
    background: #0f2027;
    z-index: 300;
    display: flex;
    flex-direction: column;
    padding: 3.5rem 1rem 1.5rem;
    gap: 0.25rem;
    transition: left 0.28s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
}

.app-nav-drawer.open { left: 0; }

.app-nav-drawer-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.app-nav-drawer-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.app-nav-drawer-close {
    position: absolute;
    top: 14px; right: 14px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
}

.app-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 299;
}
.app-nav-overlay.active { display: block; }

/* Warrant banner */
.warrant-red-banner {
    background: linear-gradient(90deg, #991b1b 0%, #dc2626 100%);
    color: #fff;
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    animation: flashRed 2.5s infinite;
}

@keyframes flashRed {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

@media (max-width: 900px) {
    .app-nav { display: none; }
    .app-nav-hamburger { display: inline-flex; }
    .app-header-right .button { display: none; }
}

@media (max-width: 600px) {
    .app-header { padding: 0 0.75rem; }
    .brand { font-size: 0.9rem; }
}

/* ── Global horizontal nav strip (below app-header) ── */
.global-hnav {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 clamp(1rem, 2vw, 2rem);
    background: #14323e;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.global-hnav::-webkit-scrollbar { display: none; }

.global-hnav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1rem;
    color: rgba(255,255,255,0.65);
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    text-decoration: none;
}

.global-hnav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
}

.global-hnav-link.active {
    color: #fff;
    border-bottom-color: var(--brand);
    background: rgb(20 108 115 / 42%);
}

.global-hnav-link i {
    font-size: 0.9rem;
    opacity: 0.8;
}

@media (max-width: 768px) {
    .global-hnav { padding: 0 0.5rem; }
    .global-hnav-link { padding: 0.55rem 0.7rem; font-size: 0.78rem; }
}

.warrant-amber-banner {
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 1rem;
    border-radius: var(--border-radius-md);
    margin-bottom: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.05);
}

/* Default Bail Blinking Row */
.default-bail-row {
    animation: blinkGreen 2s infinite;
}

@keyframes blinkGreen {
    0%, 100% { background-color: rgba(22, 163, 74, 0.06); }
    50% { background-color: rgba(22, 163, 74, 0.18); }
}

.status-default-bail {
    background-color: #dcfce7;
    border: 1px solid #bbf7d0;
    color: #166534;
    font-weight: 800;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Glassmorphism Modals */
.modal-glass {
    backdrop-filter: blur(8px);
    background-color: rgba(23, 32, 51, 0.4);
}

.modal-glass .modal-content {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border-radius: var(--border-radius-lg);
}

.modal-glass .modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.modal-glass .modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* Segment Toggles */
.segment-toggles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    background: var(--soft);
    padding: 0.35rem;
    border-radius: var(--border-radius-md);
    margin-bottom: 1.5rem;
    border: 1px solid var(--line);
}

.segment-btn {
    border: none;
    background: transparent;
    padding: 0.65rem 0.5rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.segment-btn.active {
    background: #fff;
    color: var(--brand-dark);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.segment-btn i {
    margin-right: 0.35rem;
}

/* Litigant Add Grid */
.litigant-row-container {
    border: 1px solid var(--line);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    background: #fff;
}

.litigant-input-row {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 0.5rem;
}

/* Step tracker */
.step-tracker {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.step-tracker::before {
    content: '';
    position: absolute;
    top: 15px; left: 0; right: 0;
    height: 3px;
    background: var(--line);
    z-index: 1;
}

.step-node {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.88rem;
    z-index: 2;
    color: var(--muted);
    transition: all 0.3s;
}

.step-node.active {
    border-color: var(--brand);
    color: var(--brand);
    box-shadow: 0 0 0 4px rgba(20, 108, 115, 0.15);
}

.step-node.completed {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--ink);
    display: none;
}

@media (max-width: 1024px) {
    .sidebar-toggle-btn {
        display: block;
    }
}

/* ==========================================================================
   NEW PAGE COMPONENTS — Cause List, Case Registry, Ledger, Library, KYC
   ========================================================================== */

/* Page Title Header */
.page-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.page-title h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
    line-height: 1.2;
}
.page-title .eyebrow {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff7ed;
    margin: 0 0 0.35rem;
}
.page-title-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Warrant Alert Banner */
.warrant-banner {
    background: hsl(4, 76%, 45%);
    color: #fff;
    border-radius: var(--border-radius-md);
    padding: 0.75rem 1.25rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    animation: warrant-pulse 2.4s ease-in-out infinite;
}
@keyframes warrant-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(185,28,28,0.5); }
    50%       { box-shadow: 0 0 0 8px rgba(185,28,28,0); }
}
.warrant-tag {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    padding: 0.2rem 0.55rem;
    font-size: 0.82rem;
}

/* Badge / Stage Pills */
.badge-stage {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    text-transform: capitalize;
    letter-spacing: 0.02em;
}
.badge-stage.not-started     { background: hsl(215,15%,90%); color: hsl(215,15%,40%); }
.badge-stage.started         { background: hsl(38,90%,92%);  color: hsl(38,90%,30%); }
.badge-stage.evidence        { background: hsl(270,60%,93%); color: hsl(270,60%,35%); }
.badge-stage.arguments       { background: hsl(185,60%,90%); color: hsl(185,60%,25%); }
.badge-stage.disposed        { background: hsl(156,60%,90%); color: hsl(156,60%,25%); }
.badge-stage.criminal        { background: hsl(4,76%,92%);   color: hsl(4,76%,35%); }
.badge-stage.complaint       { background: hsl(38,90%,92%);  color: hsl(38,90%,30%); }
.badge-stage.civil-case      { background: hsl(215,60%,92%); color: hsl(215,60%,30%); }
.badge-stage.other-petition  { background: hsl(270,60%,92%); color: hsl(270,60%,35%); }
.badge-stage.admin           { background: hsl(185,60%,90%); color: hsl(185,60%,25%); }
.badge-stage.danger          { background: hsl(4,76%,92%);   color: hsl(4,76%,35%); }
.badge-stage.warning         { background: hsl(38,90%,92%);  color: hsl(38,90%,30%); }

/* Row Highlights */
tr.row-danger td { background: hsla(4,76%,45%,0.07); }
tr.row-warning td { background: hsla(38,90%,45%,0.08); }

/* Colored text utilities */
.green { color: hsl(156,60%,30%); font-weight: 600; }
.red   { color: hsl(4,76%,40%);   font-weight: 600; }
.orange{ color: hsl(38,90%,35%);  font-weight: 600; }

/* Count chip colour variants */
.dash-count-chip.blue   { background: hsl(215,60%,92%); color: hsl(215,60%,30%); }
.dash-count-chip.red    { background: hsl(4,76%,92%);   color: hsl(4,76%,35%); }
.dash-count-chip.purple { background: hsl(270,50%,92%); color: hsl(270,50%,35%); }
.dash-count-chip.green  { background: hsl(156,60%,90%); color: hsl(156,60%,25%); }
.dash-count-chip.orange { background: hsl(38,90%,92%);  color: hsl(38,90%,30%); }

/* Link Pill */
.link-pill {
    font-weight: 700;
    color: var(--brand);
    text-decoration: none;
    padding: 0.1rem 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s;
}
.link-pill:hover { border-bottom-color: var(--brand); }

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3.5rem 2rem;
    color: var(--muted);
    text-align: center;
}
.empty-state p { font-size: 1.05rem; margin: 0; }

/* Margin utility */
.mt-4 { margin-top: 1.5rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }

/* ---- Citation Library ---- */
.citations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}
.citation-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.citation-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.1);
}
.citation-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.citation-category-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--brand-soft);
    color: var(--brand);
    border-radius: 20px;
    padding: 0.2rem 0.65rem;
}
.citation-court {
    font-size: 0.78rem;
    color: var(--muted);
    font-style: italic;
}
.citation-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
    line-height: 1.35;
}
.citation-no {
    font-size: 0.82rem;
    color: var(--brand);
    font-weight: 600;
}
.citation-summary {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.55;
    margin: 0;
    flex: 1;
}
.citation-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.35rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.citation-date {
    font-size: 0.78rem;
    color: var(--muted);
}

/* ---- Ledger Page ---- */
.ledger-header-card {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
}
.ledger-header-card h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--ink);
    margin: 0 0 0.25rem;
}
.ledger-header-card p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.ledger-stat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
.ledger-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
    min-width: 110px;
}
.ledger-stat .stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--muted);
}
.ledger-stat .stat-val {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--ink);
}
.ledger-stat .stat-val.green { color: hsl(156,60%,30%); }
.ledger-stat .stat-val.red   { color: hsl(4,76%,40%); }
.ledger-stat .stat-val.orange{ color: hsl(38,90%,35%); }

/* ---- KYC Directory ---- */
.kyc-expand-row td {
    background: hsl(215,25%,97%);
    padding: 0;
}
.kyc-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
}
.kyc-section h4 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--brand);
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.kyc-section dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.3rem 0.75rem;
    font-size: 0.83rem;
    margin: 0;
}
.kyc-section dt {
    color: var(--muted);
    font-weight: 600;
    white-space: nowrap;
}
.kyc-section dd {
    color: var(--ink);
    margin: 0;
    word-break: break-all;
}

/* ══════════════════════════════════════════════════════
   INLINE MODAL SYSTEM (.modal-overlay / .modal-box)
   Used by: registerUserModal, addCitationModal, addLedgerModal
   ══════════════════════════════════════════════════════ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 600;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
    overflow-y: auto;
}

.modal-overlay.open {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(23, 32, 51, 0.22);
    animation: modalSlideIn 0.22s ease;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-box .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(135deg, rgba(11,75,80,0.97), rgba(20,108,115,0.92));
    border-radius: 14px 14px 0 0;
}

.modal-box .modal-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    color: #fff;
    font-size: 1.3rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: background 0.15s ease;
}

.modal-close-btn:hover {
    background: rgba(255,255,255,0.28);
}

.modal-box form,
.modal-box > div:not(.modal-header) {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

/* Modal wide variant */
.modal-box.wide {
    max-width: 860px;
    width: 95vw;
}

/* ══════════════════════════════════════════════════════
   STAT MODALS (Accused / Witness popup)
   ══════════════════════════════════════════════════════ */

.stat-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 500;
    backdrop-filter: blur(3px);
}

.stat-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    z-index: 501;
    width: min(720px, calc(100vw - 2rem));
    max-height: 80vh;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(23, 32, 51, 0.22);
    overflow: hidden;
    flex-direction: column;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0;
}

.stat-modal.open {
    display: flex;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.stat-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(135deg, rgba(11, 75, 80, 0.97), rgba(20, 108, 115, 0.92));
    color: #fff;
}

.stat-modal-head h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-modal-close {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: #fff;
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: background 0.15s ease;
}

.stat-modal-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.stat-modal-body {
    overflow-y: auto;
    overflow-x: auto;
    padding: 1.25rem;
    flex: 1;
}

.stat-modal-body table {
    min-width: 500px;
}

@media (max-width: 600px) {
    .stat-modal {
        width: calc(100vw - 1rem);
        max-height: 85vh;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        border-radius: 14px 14px 0 0;
    }
    .stat-modal.open {
        transform: none;
    }
}
