:root {
    --navy: #1a2744;
    --gold: #c9a84c;
    --bg: #d6dde6;
    --bg-card: #f7f8fb;
    --border: #bfc8d5;
    --text: #182131;
    --muted: #586173;
    --cs-blue: #378ADD;
    --dd-red: #E24B4A;
    --court-green: #1D9E75;
    --joint-purple: #7F77DD;
    --shadow: 0 6px 18px rgba(26, 39, 68, 0.08);
    --app-frame: #e4e8ef;
    --panel-top: #fefefe;
    --panel-bottom: #f3f5f8;
    --toolbar: #e8ebf1;
    --table-header: #dde3ec;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: linear-gradient(180deg, #cbd3de, var(--bg));
    color: var(--text);
    font-family: "Aptos", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.topbar {
    background: linear-gradient(180deg, #233251, #19243a);
    color: #f1f4f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.32);
    min-height: 58px;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.brand-logo {
    height: 34px;
    width: auto;
    display: block;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 8px;
    padding: 0.12rem 0.28rem;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.brand-mark {
    font-size: 1.2rem;
    font-weight: 700;
    color: #f7f9fc;
    line-height: 1.1;
    letter-spacing: 0.01em;
}

.brand-sub {
    color: var(--gold);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1;
}

.topbar-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-links a,
.topbar-link-button {
    color: #f5ead0;
}

.topbar-links a:hover,
.topbar-links a:focus,
.topbar-link-button:hover,
.topbar-link-button:focus {
    color: var(--gold);
}

.topbar-inline-form {
    margin: 0;
}

.topbar-link-button {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.user-chip {
    padding: 0.28rem 0.6rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    font-size: 0.84rem;
}

.page-shell {
    padding: 0.85rem;
    min-height: calc(100vh - 58px);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.36), transparent 180px),
        linear-gradient(180deg, #dfe5ee, #d2d9e3);
}

.panel {
    background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: none;
    padding: 0.9rem 0.95rem;
    position: relative;
}

.panel + .panel,
.panel + .hierarchy-layout,
.hierarchy-layout + .panel,
.tabbar + .tab-panel {
    margin-top: 0.55rem;
}

.panel-header,
.case-list-header,
.case-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.eyebrow {
    margin: 0 0 0.25rem;
    color: var(--gold);
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: 700;
    font-family: Georgia, "Times New Roman", serif;
}

.muted {
    color: var(--muted);
}

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

.flash {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.flash-success {
    background: rgba(29, 158, 117, 0.1);
    border-color: rgba(29, 158, 117, 0.28);
}

.flash-error {
    background: rgba(226, 75, 74, 0.12);
    border-color: rgba(226, 75, 74, 0.28);
}

.btn {
    border: 1px solid #909bae;
    border-radius: 8px;
    padding: 0.58rem 0.92rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.btn-primary {
    background: linear-gradient(180deg, #2d4066, #1a2744);
    color: #f2d785;
    border-color: #172238;
}

.btn-secondary {
    background: linear-gradient(180deg, #fdfefe, #dfe5ee);
    color: var(--navy);
    border-color: #a8b2c0;
}

.btn-danger {
    background: linear-gradient(180deg, #fef7f7, #efd7d7);
    color: #8e1d1d;
    border-color: #c7a1a1;
}

.btn-small {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.62rem 0.72rem;
    border-radius: 8px;
    border: 1px solid #aeb8c7;
    background: linear-gradient(180deg, #ffffff, #f3f5f8);
    color: var(--text);
    box-shadow: inset 0 1px 2px rgba(14, 22, 35, 0.05);
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(201, 168, 76, 0.42);
    border-color: var(--gold);
}

label {
    display: grid;
    gap: 0.45rem;
}

label span {
    font-size: 0.9rem;
    color: var(--muted);
}

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

.one-column {
    grid-template-columns: 1fr;
}

.compact-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    align-items: end;
}

.full-width {
    grid-column: 1 / -1;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(140deg, rgba(26, 39, 68, 0.96), rgba(26, 39, 68, 0.82)), var(--bg);
}

.login-screen {
    position: relative;
    width: min(1120px, calc(100vw - 32px));
    min-height: min(760px, calc(100vh - 32px));
    padding: 2rem;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 28px;
    background:
        radial-gradient(circle at top left, rgba(201, 168, 76, 0.18), transparent 28%),
        radial-gradient(circle at bottom right, rgba(55, 138, 221, 0.16), transparent 30%),
        linear-gradient(160deg, #13203a 0%, #1b2a47 48%, #22365f 100%);
    box-shadow:
        0 30px 80px rgba(7, 12, 25, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.login-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.75), transparent 92%);
    pointer-events: none;
}

.login-corner {
    position: absolute;
    width: 180px;
    height: 180px;
    border: 1px solid rgba(201, 168, 76, 0.32);
    pointer-events: none;
}

.login-corner::before,
.login-corner::after {
    content: "";
    position: absolute;
    background: rgba(201, 168, 76, 0.6);
}

.login-corner::before {
    width: 44px;
    height: 2px;
}

.login-corner::after {
    width: 2px;
    height: 44px;
}

.login-corner-tl {
    top: 20px;
    left: 20px;
    border-right: 0;
    border-bottom: 0;
}

.login-corner-tl::before,
.login-corner-tl::after {
    top: -1px;
    left: -1px;
}

.login-corner-br {
    right: 20px;
    bottom: 20px;
    border-left: 0;
    border-top: 0;
}

.login-corner-br::before,
.login-corner-br::after {
    right: -1px;
    bottom: -1px;
}

.login-deco {
    position: absolute;
    display: grid;
    gap: 0.9rem;
    pointer-events: none;
}

.login-deco span {
    display: block;
    width: 84px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(201, 168, 76, 0.16), rgba(255, 255, 255, 0.05));
}

.login-deco-left {
    left: 48px;
    bottom: 110px;
}

.login-deco-right {
    top: 70px;
    right: 48px;
}

.login-panel {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 251, 0.97));
    border: 1px solid rgba(255, 255, 255, 0.62);
    box-shadow:
        0 22px 54px rgba(10, 18, 35, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.login-panel-head {
    padding: 1.5rem 1.6rem 1.1rem;
    background: linear-gradient(180deg, rgba(34, 54, 95, 0.98), rgba(24, 39, 69, 0.98));
}

.login-logo-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.login-panel-logo {
    width: 68px;
    height: 68px;
    object-fit: contain;
    background: #fff;
    border-radius: 18px;
    padding: 0.45rem;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.login-wordmark {
    display: flex;
    flex-direction: column;
    line-height: 0.95;
    color: #f7f9fd;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.9rem;
    letter-spacing: 0.01em;
}

.login-wordmark .gold {
    color: #f0c86b;
}

.login-strip {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.78rem 1.6rem;
    background: linear-gradient(180deg, #f2e7c6, #e7d7a7);
    color: #4f3e12;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-strip .dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #8d6b1c;
    box-shadow: 0 0 0 4px rgba(141, 107, 28, 0.12);
}

.login-panel-body {
    padding: 1.65rem 1.6rem 1.5rem;
    color: var(--text);
}

.login-kicker {
    margin: 0 0 0.45rem;
    color: #8b6a22;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.login-panel-body h1 {
    margin: 0;
    color: #13203a;
    font-size: clamp(2rem, 4vw, 2.6rem);
    line-height: 1.02;
}

.login-subtitle {
    margin: 0.8rem 0 1.4rem;
    color: #4f5b70;
    font-size: 1rem;
    line-height: 1.6;
}

.login-form {
    display: grid;
    gap: 1rem;
}

.login-form label span {
    color: #314158;
    font-size: 0.88rem;
    font-weight: 700;
}

.login-form input {
    height: 50px;
    padding: 0.78rem 0.9rem;
    border: 1px solid #bcc7d6;
    background: #fff;
    color: #14213b;
    box-shadow: inset 0 1px 2px rgba(14, 22, 35, 0.04);
}

.login-form input::placeholder {
    color: #7a879b;
}

.login-form input:focus {
    outline: 2px solid rgba(201, 168, 76, 0.34);
    border-color: #c9a84c;
    box-shadow: 0 0 0 4px rgba(201, 168, 76, 0.1);
}

.login-submit {
    min-height: 52px;
    margin-top: 0.25rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.login-devline {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 1.25rem;
    color: #5d6980;
    font-size: 0.88rem;
    flex-wrap: wrap;
}

.login-devline i {
    width: 18px;
    height: 1px;
    background: rgba(26, 39, 68, 0.22);
}

.login-devline strong {
    color: #13203a;
}

.login-version {
    position: absolute;
    right: 28px;
    bottom: 24px;
    z-index: 1;
    color: rgba(244, 246, 250, 0.88);
    font-size: 0.82rem;
    letter-spacing: 0.06em;
}

.login-card {
    width: 430px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    padding: 2.4rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.18);
}

.login-card h1 {
    font-size: 2.4rem;
    margin-bottom: 0.3rem;
}

.login-logo {
    width: 320px;
    max-width: 100%;
    display: block;
    margin: 0 auto 1.25rem;
    background: #fff;
    border-radius: 18px;
    padding: 0.55rem 0.7rem;
    border: 1px solid rgba(26, 39, 68, 0.08);
}

.login-subtitle {
    color: var(--muted);
    margin-top: 0;
    margin-bottom: 1.8rem;
}

.login-form {
    display: grid;
    gap: 1rem;
}

@media (max-width: 720px) {
    .login-screen {
        width: 100vw;
        min-height: 100vh;
        border-radius: 0;
        padding: 1rem;
    }

    .login-panel {
        width: 100%;
    }

    .login-panel-head,
    .login-strip,
    .login-panel-body {
        padding-left: 1.1rem;
        padding-right: 1.1rem;
    }

    .login-wordmark {
        font-size: 1.6rem;
    }

    .login-version {
        position: static;
        margin-top: 1rem;
        text-align: center;
    }

    .login-deco,
    .login-corner {
        display: none;
    }
}

.narrow-panel {
    max-width: 640px;
    margin: 0 auto;
}

.meta-pills {
    display: flex;
    gap: 0.65rem;
}

.meta-pill {
    background: rgba(201, 168, 76, 0.14);
    color: var(--navy);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
}

.admin-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 1.5rem;
}

.admin-form-card,
.admin-table-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    background: linear-gradient(180deg, #f8fafc, #edf1f6);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--border);
    padding: 0.9rem 0.75rem;
    vertical-align: top;
}

.data-table thead th {
    background: linear-gradient(180deg, #ecf0f6, var(--table-header));
    text-align: left;
    font-size: 0.84rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #3d4a5f;
}

.data-table tbody tr:nth-child(odd) {
    background: #fbfcfd;
}

.data-table tbody tr:nth-child(even) {
    background: #f3f6fa;
}

.admin-table td form {
    margin: 0;
}

.inline-admin-form {
    display: contents;
}

.admin-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.filter-bar {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
}

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

.case-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    background: linear-gradient(180deg, #fafbfd, #eef2f7);
}

.case-card-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.matter-badge,
.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
}

.matter-badge {
    background: rgba(26, 39, 68, 0.08);
    color: var(--navy);
    margin-top: 0.4rem;
}

.status-active {
    background: rgba(29, 158, 117, 0.15);
    color: #1b755a;
}

.status-stayed {
    background: rgba(201, 168, 76, 0.18);
    color: #7d6120;
}

.status-concluded {
    background: rgba(107, 107, 107, 0.16);
    color: #555;
}

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

.case-meta div {
    background: linear-gradient(180deg, #f8fafc, #edf1f6);
    border-radius: 8px;
    padding: 0.75rem;
    border: 1px solid rgba(26, 39, 68, 0.06);
}

.case-meta dt {
    font-size: 0.8rem;
    color: var(--muted);
}

.case-meta dd {
    margin: 0.25rem 0 0;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(18, 26, 45, 0.58);
    display: grid;
    place-items: center;
    z-index: 50;
}

.modal-card {
    width: 560px;
    background: linear-gradient(180deg, #ffffff, #eef2f7);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 32px 48px rgba(0, 0, 0, 0.22);
    border: 1px solid #b9c3d1;
}

.modal-form label {
    display: grid;
    gap: 0.4rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

.field-value {
    min-height: 2.8rem;
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    border: 1px solid #c8d0db;
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
}

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

.modal-close {
    background: transparent;
    border: 0;
    font-size: 2rem;
    cursor: pointer;
    color: var(--muted);
}

.case-workspace {
    display: grid;
    gap: 0.4rem;
    grid-template-rows: auto auto auto 1fr;
    background: linear-gradient(180deg, #dce3ed, #cfd7e2);
    border: 1px solid #a9b6c6;
    border-radius: 6px;
    padding: 0.35rem;
    box-shadow:
        0 16px 28px rgba(24, 33, 49, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.case-workspace > .panel,
.case-workspace > .tabbar,
.case-workspace > .tab-panel.active {
    margin-top: 0;
    border-radius: 4px;
}

.case-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.case-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    row-gap: 0.6rem;
    padding: 0.7rem 0.85rem;
}

.case-header-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex: 0 0 auto;
    width: 100%;
}

.header-action-buttons {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    flex-wrap: wrap;
}

.case-header-main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex: 1 1 auto;
    min-width: 0;
}

.case-header-main h1 {
    font-size: 1.75rem;
    line-height: 1.05;
    margin: 0;
}

.case-header-main p {
    margin: 0;
    white-space: nowrap;
    color: var(--muted);
}

.back-link {
    white-space: nowrap;
    flex-shrink: 0;
}

.case-summary-panel {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    background: linear-gradient(180deg, #eef2f7, #e5eaf1);
}

.workspace-top {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.9rem;
    align-items: start;
}

.case-meta-form {
    align-content: start;
}

.party-manager {
    border-top: 1px solid #bfc8d5;
    padding-top: 0.95rem;
    display: grid;
    gap: 0.75rem;
}

.party-manager-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.party-form {
    display: grid;
    grid-template-columns: minmax(220px, 1.2fr) minmax(160px, 0.8fr) auto;
    gap: 0.6rem;
    align-items: end;
}

.party-table-wrap {
    max-height: 240px;
    overflow: auto;
    border: 1px solid #c8d0db;
    border-radius: 8px;
    background: linear-gradient(180deg, #fbfcfe, #f0f4f8);
}

.party-table th,
.party-table td {
    padding: 0.6rem 0.65rem;
}

.case-summary-panel label span {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.saved-badge {
    background: rgba(29, 158, 117, 0.14);
    color: #1d7a5f;
    border-radius: 6px;
    padding: 0.28rem 0.55rem;
    font-size: 0.8rem;
    border: 1px solid rgba(29, 158, 117, 0.2);
}

.back-link {
    color: var(--navy);
    font-size: 0.95rem;
}

.export-dropdown {
    position: relative;
}

.export-dropdown summary {
    list-style: none;
}

.export-dropdown[open] .export-menu {
    display: grid;
}

.export-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    min-width: 170px;
    background: linear-gradient(180deg, #ffffff, #eef2f7);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    z-index: 10;
}

.export-menu a {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.export-menu a:last-child {
    border-bottom: 0;
}

.tabbar {
    display: flex;
    gap: 0.18rem;
    border: 1px solid #b4c0cf;
    background: linear-gradient(180deg, #dfe6ef, #d2dae5);
    padding: 0.22rem;
    border-radius: 4px;
    position: sticky;
    top: 0.4rem;
    z-index: 5;
}

.tab-button {
    background: transparent;
    color: var(--navy);
    border: 1px solid transparent;
    border-radius: 3px;
    padding: 0.68rem 0.95rem;
    cursor: pointer;
    font-weight: 600;
}

.tab-button.active {
    background: linear-gradient(180deg, #fbfcfe, #edf2f8);
    border-color: #98a6b7;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    padding: 0.34rem;
    border: 1px solid #b4c0cf;
    background: linear-gradient(180deg, #e8edf4, #dde4ec);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.tab-panel {
    padding-top: 0.1rem;
}

.tab-panel.active > .panel {
    background: linear-gradient(180deg, #fcfdff, #f0f3f7);
    border-color: #bec8d5;
}

.tab-panel.active > .panel + .panel,
.tab-panel.active > .hierarchy-layout,
.tab-panel.active > .panel + .hierarchy-layout {
    margin-top: 0.35rem;
}

.module-strip {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin: -0.9rem -0.95rem 0.85rem;
    padding: 0.52rem 0.95rem;
    border-bottom: 1px solid #ccd4de;
    background: linear-gradient(180deg, #f3f6fa, #e8edf4);
}

.module-strip strong {
    color: var(--navy);
    letter-spacing: 0.02em;
}

.module-strip span {
    color: var(--muted);
    font-size: 0.86rem;
}

.entry-form {
    display: grid;
    gap: 1rem;
}

.entry-toolbar {
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    background: linear-gradient(180deg, #eef2f7, #e5e9f0);
    border: 1px solid #c7cfdb;
}

.entry-toolbar p {
    margin: 0;
}

.entry-grid {
    display: grid;
    grid-template-columns: 140px minmax(300px, 1.6fr) 180px 130px 180px minmax(160px, 0.9fr) minmax(180px, 1fr);
    gap: 0.55rem;
    align-items: end;
}

.entry-event {
    min-width: 0;
}

.table-wrap {
    overflow-x: auto;
}

.drag-col {
    width: 42px;
}

.drag-handle {
    cursor: grab;
    color: var(--muted);
    text-align: center;
}

.spark-row td:first-child {
    border-left: 4px solid transparent;
}

.spark-row.filed-claimant td:first-child,
.swimlane-card.filed-claimant,
.brief-node.depth-1 .brief-node-marker {
    border-left-color: var(--cs-blue);
}

.spark-row.filed-opponent td:first-child,
.spark-row.filed-respondent td:first-child,
.swimlane-card.filed-opponent,
.swimlane-card.filed-respondent,
.brief-node.depth-2 .brief-node-marker {
    border-left-color: var(--dd-red);
}

.spark-row.filed-petitioner td:first-child,
.spark-row.filed-application td:first-child,
.swimlane-card.filed-petitioner,
.swimlane-card.filed-application {
    border-left-color: #3277b9;
}

.spark-row.filed-court td:first-child,
.swimlane-card.filed-court,
.brief-node.depth-3 .brief-node-marker {
    border-left-color: var(--court-green);
}

.spark-row.filed-joint td:first-child,
.spark-row.filed-third-party td:first-child,
.swimlane-card.filed-joint,
.swimlane-card.filed-third-party,
.brief-node.depth-4 .brief-node-marker {
    border-left-color: var(--joint-purple);
}

.spark-row.filed-other td:first-child,
.swimlane-card.filed-other {
    border-left-color: var(--gold);
}

/* Hearing and swimlane card tints for 'Filed By' */
.hearing-card.filed-claimant { background-color: rgba(55,138,221,0.07); }
.hearing-card.filed-opponent,
.hearing-card.filed-respondent { background-color: rgba(226,75,74,0.06); }
.hearing-card.filed-petitioner,
.hearing-card.filed-application { background-color: rgba(50,119,185,0.06); }
.hearing-card.filed-court { background-color: rgba(29,158,117,0.06); }
.hearing-card.filed-joint,
.hearing-card.filed-third-party { background-color: rgba(127,119,221,0.06); }
.hearing-card.filed-other { background-color: rgba(201,168,76,0.06); }

.swimlane-card.filed-claimant { background-color: rgba(55,138,221,0.06); }
.swimlane-card.filed-opponent,
.swimlane-card.filed-respondent { background-color: rgba(226,75,74,0.05); }
.swimlane-card.filed-petitioner,
.swimlane-card.filed-application { background-color: rgba(50,119,185,0.05); }
.swimlane-card.filed-court { background-color: rgba(29,158,117,0.05); }
.swimlane-card.filed-joint,
.swimlane-card.filed-third-party { background-color: rgba(127,119,221,0.05); }
.swimlane-card.filed-other { background-color: rgba(201,168,76,0.04); }

/* Tint the pill label to match the filed-by color for better preview parity */
.hearing-card.filed-claimant .hearing-pill { background: rgba(55,138,221,0.12); color: #08315a; }
.hearing-card.filed-opponent .hearing-pill,
.hearing-card.filed-respondent .hearing-pill { background: rgba(226,75,74,0.12); color: #4a1212; }
.hearing-card.filed-petitioner .hearing-pill,
.hearing-card.filed-application .hearing-pill { background: rgba(50,119,185,0.12); color: #072b45; }
.hearing-card.filed-court .hearing-pill { background: rgba(29,158,117,0.12); color: #073b2b; }
.hearing-card.filed-joint .hearing-pill,
.hearing-card.filed-third-party .hearing-pill { background: rgba(127,119,221,0.12); color: #2b2250; }
.hearing-card.filed-other .hearing-pill { background: rgba(201,168,76,0.12); color: #3d2b00; }

/* Ensure swimlane cards have a visible left border and slightly stronger tint */
.swimlane-card { border-left-width: 6px; }

.separator-row td {
    font-weight: 700;
    text-align: center;
    color: var(--muted);
    background: linear-gradient(180deg, #f0e8d1, #e4dac0);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-button {
    background: linear-gradient(180deg, #ffffff, #e6ebf2);
    border: 1px solid #aeb8c7;
    border-radius: 7px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
}

.table-edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.table-edit-grid .full-width {
    grid-column: 1 / -1;
}

.hierarchy-layout {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 0.45rem;
    align-items: start;
}

.hierarchy-sidebar {
    position: sticky;
    top: 3.8rem;
}

.hierarchy-board-header {
    margin-bottom: 1rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid #d3dae5;
}

.hierarchy-board-header p {
    margin: 0.35rem 0 0;
}

.brief-tree,
.brief-tree ul {
    padding-top: 1.2rem;
    padding-left: 0;
    position: relative;
    display: flex;
    justify-content: center;
    margin: 0;
    list-style: none;
}

.brief-tree li {
    list-style: none;
    position: relative;
    text-align: center;
    padding: 1.2rem 0.5rem 0 0.5rem;
}

.brief-tree li::before,
.brief-tree li::after {
    content: "";
    position: absolute;
    top: 0;
    right: 50%;
    width: 50%;
    height: 1.2rem;
    border-top: 1px solid #d4cfc2;
}

.brief-tree li::after {
    right: auto;
    left: 50%;
    border-left: 1px solid #d4cfc2;
}

.brief-tree li:only-child::before,
.brief-tree li:only-child::after {
    display: none;
}

.brief-tree li:only-child {
    padding-top: 0;
}

.brief-tree li:first-child::before,
.brief-tree li:last-child::after {
    border: 0;
}

.brief-tree li:last-child::before {
    border-right: 1px solid #d4cfc2;
    border-radius: 0 10px 0 0;
}

.brief-tree li:first-child::after {
    border-radius: 10px 0 0 0;
}

.brief-tree ul::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 1.2rem;
    border-left: 1px solid #d4cfc2;
}

.brief-node {
    min-width: 210px;
}

.brief-node-shell {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    text-align: left;
    padding: 0.95rem 1rem;
    background: linear-gradient(180deg, #fff, #fcfaf4);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: none;
}

.brief-node-marker {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: var(--navy);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(26, 39, 68, 0.16);
    margin-top: 0.2rem;
    flex: 0 0 auto;
}

.brief-node.depth-0 .brief-node-marker {
    background: var(--gold);
}

.brief-node.depth-1 .brief-node-marker {
    background: var(--cs-blue);
}

.brief-node.depth-2 .brief-node-marker {
    background: var(--dd-red);
}

.brief-node.depth-3 .brief-node-marker {
    background: var(--court-green);
}

.brief-node.depth-4 .brief-node-marker {
    background: var(--joint-purple);
}

.brief-node-copy strong {
    display: block;
    margin-bottom: 0.25rem;
}

.brief-node-note {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.35;
}

.brief-node-actions {
    display: flex;
    gap: 0.45rem;
    margin-left: auto;
}

.output-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.output-workbench {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 0.45rem;
    min-height: 520px;
}

.output-rail {
    border: 1px solid #c7cfdb;
    background: linear-gradient(180deg, #f8fafc, #edf2f6);
    padding: 0.8rem;
    overflow: auto;
}

.output-stage {
    display: grid;
    gap: 0.55rem;
    min-width: 0;
    border: 1px solid #c7cfdb;
    background: linear-gradient(180deg, #fcfdff, #eef3f8);
    padding: 0.8rem;
}

/* Prevent wide children from forcing the workbench to overflow the page */
.output-workbench,
.output-stage,
.output-view {
    min-width: 0;
}

.output-view {
    overflow: hidden;
}

.output-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.output-filter-chip {
    border: 1px solid #a9b4c4;
    background: linear-gradient(180deg, #ffffff, #e8edf4);
    color: var(--navy);
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
}

.output-filter-chip.active {
    background: linear-gradient(180deg, #2b3f65, #1b2744);
    color: #f2d785;
    border-color: #19243a;
}

.toggle-group {
    display: inline-flex;
    background: linear-gradient(180deg, #eef2f7, #dde4ec);
    border-radius: 4px;
    padding: 0.25rem;
    border: 1px solid #bcc5d3;
}

.toggle-button {
    background: transparent;
    border: 1px solid transparent;
    padding: 0.62rem 0.9rem;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 600;
}

.toggle-button.active {
    background: linear-gradient(180deg, #ffffff, #eef2f7);
    border-color: #aeb8c6;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.output-view {
    display: none;
}

.output-view.active {
    display: block;
}

.swimlane-wrap {
    display: grid;
    gap: 1.5rem;
}

.hearing-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.7rem;
    margin-bottom: 0.8rem;
}

.metric-tile {
    border: 1px solid #c7cfdb;
    border-radius: 4px;
    background: linear-gradient(180deg, #fbfcfe, #eef3f8);
    padding: 0.8rem 0.9rem;
    display: grid;
    gap: 0.25rem;
}

.metric-tile span {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.metric-tile strong {
    font-size: 1.1rem;
    color: var(--navy);
}

.hearing-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.8rem;
}

.hearing-card {
    border: 1px solid #c5ceda;
    border-left: 4px solid var(--gold);
    border-radius: 4px;
    padding: 0.9rem;
    background: linear-gradient(180deg, #ffffff, #eef3f8);
    box-shadow: none;
    display: grid;
    gap: 0.55rem;
}

.hearing-card-top {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    align-items: center;
}

.hearing-card h3 {
    font-size: 1rem;
    font-family: "Aptos", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.35;
}

.hearing-date {
    font-size: 0.9rem;
    color: var(--muted);
}

.hearing-pill {
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: rgba(26, 39, 68, 0.08);
    color: var(--navy);
    font-size: 0.78rem;
    white-space: nowrap;
}

.hearing-card-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.swimlane-board {
    display: grid;
    gap: 0.75rem;
    align-items: stretch;
    overflow-x: auto;
}

.swimlane-corner,
.swimlane-header,
.swimlane-lane-label,
.swimlane-cell {
    min-height: 100%;
}

.swimlane-corner,
.swimlane-header,
.swimlane-lane-label {
    padding: 0.85rem 0.9rem;
    background: linear-gradient(180deg, #eff3f8, #e0e6ef);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.swimlane-corner,
.swimlane-lane-label {
    font-weight: 700;
    color: var(--navy);
}

.swimlane-header {
    display: grid;
    gap: 0.2rem;
}

.swimlane-header small {
    color: var(--muted);
}

.swimlane-cell {
    min-height: 156px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(26, 39, 68, 0.035), rgba(26, 39, 68, 0.012));
    border: 1px dashed rgba(26, 39, 68, 0.08);
    padding: 0.25rem;
}

.swimlane-cell.empty {
    background: transparent;
}

.swimlane-card {
    height: 100%;
    border: 1px solid var(--border);
    border-left: 4px solid var(--gold);
    border-radius: 8px;
    background: #fff;
    padding: 0.9rem;
    display: grid;
    gap: 0.45rem;
    box-shadow: 0 10px 24px rgba(26, 39, 68, 0.06);
}

.swimlane-date {
    color: var(--muted);
    font-size: 0.88rem;
}

.swimlane-meta,
.swimlane-owner {
    color: var(--muted);
    font-size: 0.9rem;
}

.undated-list {
    padding: 1rem 1.1rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #f9f6ec, #f0ead8);
}

.undated-list ul {
    margin: 0.75rem 0 0;
    padding-left: 1.2rem;
}

.event-cell {
    min-width: 360px;
}

.print-table {
    border: 1px solid #c7cfdb;
    background: #fff;
}

.print-table table {
    width: 100%;
    border-collapse: collapse;
}

.print-table th,
.print-table td {
    border: 1px solid var(--border);
    padding: 0.7rem;
}

.print-table .section-divider td {
    background: #f4efe2;
    text-align: center;
    font-weight: 700;
}

.module-strip-compact {
    margin-bottom: 0.8rem;
}

.chart-manager {
    display: grid;
    gap: 0.7rem;
    margin-bottom: 0.9rem;
}

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

.chart-actions-bar {
    display: flex;
    gap: 0.45rem;
}

.hierarchy-view {
    display: none;
}

.hierarchy-view.active {
    display: block;
}

.outline-list {
    display: grid;
    gap: 0.45rem;
}

.outline-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 0.7rem;
    border: 1px solid #ccd4de;
    background: linear-gradient(180deg, #fff, #f4f7fb);
}

.outline-copy {
    display: grid;
    gap: 0.15rem;
}

.outline-copy span {
    color: var(--muted);
    font-size: 0.9rem;
}

.mind-columns {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 1fr);
    gap: 0.8rem;
    overflow-x: auto;
    padding-bottom: 0.2rem;
}

.mind-column {
    display: grid;
    gap: 0.55rem;
    align-content: start;
}

.mind-column header {
    padding: 0.55rem 0.7rem;
    border: 1px solid #cbd3de;
    background: linear-gradient(180deg, #eef2f7, #dde5ee);
    font-weight: 700;
    color: var(--navy);
}

.mind-card {
    display: grid;
    gap: 0.45rem;
    padding: 0.8rem;
    border: 1px solid #c7cfdb;
    border-left: 4px solid var(--gold);
    background: linear-gradient(180deg, #ffffff, #eef3f8);
}

.mind-card span {
    color: var(--muted);
    font-size: 0.9rem;
}

.view-ribbon {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.output-toolbar {
    align-items: flex-start;
}

.output-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: flex-end;
}

.output-workbench.output-hierarchy-hidden {
    grid-template-columns: 1fr;
}

.sequence-rail {
    display: flex;
    flex-wrap: wrap; /* allow multi-row wrapping timeline */
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.3rem 0.15rem;
    max-width: 100%;
    box-sizing: border-box;
    align-items: flex-start;
    -webkit-overflow-scrolling: touch;
}

.sequence-card {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 0.45rem;
    align-items: start;
    border: 1px solid #c7cfdb;
    border-left: 4px solid var(--gold);
    background: linear-gradient(180deg, #fff, #f5f8fb);
    padding: 0.5rem; /* tighter */
    flex: 0 0 auto; /* don't shrink, allow horizontal scrolling */
    min-width: 140px; /* even smaller cards */
    max-width: 300px;
    border-radius: 6px;
}

.sequence-step {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: linear-gradient(180deg, #243454, #172238);
    color: #f2d785;
    font-weight: 700;
    font-size: 0.92rem;
}

/* Drag cursor and active state */
.sequence-card,
.sequence-card .sequence-step {
    cursor: grab;
}
.sequence-card:active,
.sequence-card:active .sequence-step {
    cursor: grabbing;
}

/* Stronger drag handle appearance for ledger rows */
.drag-handle {
    cursor: grab;
    color: var(--muted);
    text-align: center;
    width: 44px;
    padding: 0.25rem 0.4rem;
    user-select: none;
}
.drag-handle:hover {
    background: rgba(26,39,68,0.03);
    border-radius: 6px;
}
.drag-handle:active { cursor: grabbing; }

/* Filed-by row background tints for better readability */
.sequence-card.filed-claimant { background-color: rgba(55,138,221,0.07); }
.sequence-card.filed-opponent,
.sequence-card.filed-respondent { background-color: rgba(226,75,74,0.06); }
.sequence-card.filed-petitioner,
.sequence-card.filed-application { background-color: rgba(50,119,185,0.06); }
.sequence-card.filed-court { background-color: rgba(29,158,117,0.06); }
.sequence-card.filed-joint,
.sequence-card.filed-third-party { background-color: rgba(127,119,221,0.06); }
.sequence-card.filed-other { background-color: rgba(201,168,76,0.06); }

/* Also tint ledger rows similarly so colors are consistent */
.spark-row.filed-claimant td { background-color: rgba(55,138,221,0.06); }
.spark-row.filed-opponent td,
.spark-row.filed-respondent td { background-color: rgba(226,75,74,0.05); }
.spark-row.filed-petitioner td,
.spark-row.filed-application td { background-color: rgba(50,119,185,0.05); }
.spark-row.filed-court td { background-color: rgba(29,158,117,0.05); }
.spark-row.filed-joint td,
.spark-row.filed-third-party td { background-color: rgba(127,119,221,0.05); }
.spark-row.filed-other td { background-color: rgba(201,168,76,0.04); }

.sequence-copy {
    display: grid;
    gap: 0.3rem;
}

/* Vertical timeline (spark view) */
.vertical-timeline {
    position: relative;
    padding: 1rem 2rem;
}
.vertical-timeline .vt-spine {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #2a2a3e;
    transform: translateX(-50%);
}
.vertical-timeline .vt-item-wrap { width: 50%; padding: 0.5rem 1rem; }
.vertical-timeline .vt-item-wrap.left { float: left; text-align: right; }
.vertical-timeline .vt-item-wrap.right { float: right; text-align: left; }
.vertical-timeline .vt-item { display: inline-block; max-width: 320px; border: 1px solid var(--border); background: #fff; padding: 0.6rem; border-radius: 6px; }
.vt-date { font-weight:700; margin-bottom:0.25rem }
.vt-annexure { font-size:0.85rem; color:var(--muted); margin-bottom:0.25rem }

/* Card wall */
.card-wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }
.card { border:1px solid #c7cfdb; padding:0.6rem; border-radius:6px; background:linear-gradient(180deg,#fff,#f7f9fc); }
.card-date { font-weight:700; font-size:0.95rem }
.card-annexure { font-size:0.85rem; color:var(--muted) }

/* Swimlane SVG */
.swimlane-wrap { overflow-x: auto; padding: 0.5rem 0; }
.swimlane-svg { width: 1200px; height: 220px; }
.swim-block { cursor: pointer; }

.sequence-copy h3 {
    font-size: 1rem;
    font-family: "Aptos", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.35;
}

.sequence-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.7rem;
}

.calendar-card {
    border: 1px solid #c7cfdb;
    background: linear-gradient(180deg, #fff, #eef3f8);
    padding: 0.8rem;
    display: grid;
    gap: 0.6rem;
}

.calendar-card header {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    align-items: baseline;
}

.calendar-card header span {
    color: var(--muted);
    font-size: 0.85rem;
}

.calendar-card ul,
.digest-card ul {
    margin: 0;
    padding-left: 1rem;
}

.calendar-card li,
.digest-card li {
    display: grid;
    gap: 0.12rem;
    margin-bottom: 0.45rem;
}

.annexure-groups,
.party-stream,
.digest-grid {
    display: grid;
    gap: 0.7rem;
}

.annexure-card,
.digest-card,
.party-stream-section {
    border: 1px solid #c7cfdb;
    background: linear-gradient(180deg, #ffffff, #eef3f8);
    padding: 0.85rem;
}

.annexure-card header,
.party-stream-section header {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    align-items: baseline;
    margin-bottom: 0.55rem;
}

.annexure-card header span,
.party-stream-section header span {
    color: var(--muted);
    font-size: 0.85rem;
}

.annexure-body {
    display: grid;
    gap: 0.55rem;
}

.annexure-body article,
.party-stream-item {
    padding: 0.65rem 0.7rem;
    border: 1px solid #d3dbe5;
    background: rgba(255, 255, 255, 0.72);
}

.annexure-body article p,
.party-stream-item p,
.digest-card p {
    margin: 0.2rem 0 0;
}

.annexure-body article small {
    color: var(--muted);
}

.party-roster {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.7rem;
    margin-bottom: 0.7rem;
}

.party-card {
    display: grid;
    gap: 0.15rem;
    border: 1px solid #c7cfdb;
    background: linear-gradient(180deg, #fff, #eef3f8);
    padding: 0.75rem 0.8rem;
}

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

.digest-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.typeahead-panel {
    position: absolute;
    z-index: 999;
    display: grid;
    gap: 0;
    border: 1px solid #aeb8c7;
    background: #fff;
    box-shadow: 0 18px 28px rgba(24, 33, 49, 0.16);
    max-height: 240px;
    overflow: auto;
}

.typeahead-item {
    border: 0;
    border-bottom: 1px solid #e3e8ef;
    background: #fff;
    padding: 0.58rem 0.7rem;
    text-align: left;
    cursor: pointer;
    color: var(--text);
}

.typeahead-item:last-child {
    border-bottom: 0;
}

.typeahead-item.active,
.typeahead-item:hover {
    background: linear-gradient(180deg, #253555, #1a2744);
    color: #f2d785;
}

/* Filed-by event palette */
.spark-row.filed-claimant td,
.spark-row.filed-petitioner td,
.spark-row.filed-application td,
.hearing-card.filed-claimant,
.hearing-card.filed-petitioner,
.hearing-card.filed-application,
.sequence-card.filed-claimant,
.sequence-card.filed-petitioner,
.sequence-card.filed-application,
.card.filed-claimant,
.card.filed-petitioner,
.card.filed-application,
.vertical-timeline .vt-item.filed-claimant,
.vertical-timeline .vt-item.filed-petitioner,
.vertical-timeline .vt-item.filed-application {
    background-color: rgba(31, 143, 95, 0.10);
}

.spark-row.filed-opponent td,
.spark-row.filed-respondent td,
.hearing-card.filed-opponent,
.hearing-card.filed-respondent,
.sequence-card.filed-opponent,
.sequence-card.filed-respondent,
.card.filed-opponent,
.card.filed-respondent,
.vertical-timeline .vt-item.filed-opponent,
.vertical-timeline .vt-item.filed-respondent {
    background-color: rgba(216, 76, 76, 0.10);
}

.spark-row.filed-court td,
.hearing-card.filed-court,
.sequence-card.filed-court,
.card.filed-court,
.vertical-timeline .vt-item.filed-court {
    background-color: rgba(212, 166, 42, 0.14);
}

.spark-row.filed-joint td,
.spark-row.filed-third-party td,
.hearing-card.filed-joint,
.hearing-card.filed-third-party,
.sequence-card.filed-joint,
.sequence-card.filed-third-party,
.card.filed-joint,
.card.filed-third-party,
.vertical-timeline .vt-item.filed-joint,
.vertical-timeline .vt-item.filed-third-party {
    background-color: rgba(122, 106, 214, 0.10);
}

.spark-row.filed-other td,
.hearing-card.filed-other,
.sequence-card.filed-other,
.card.filed-other,
.vertical-timeline .vt-item.filed-other {
    background-color: rgba(123, 135, 152, 0.10);
}

.spark-row.filed-claimant td:first-child,
.spark-row.filed-petitioner td:first-child,
.spark-row.filed-application td:first-child,
.hearing-card.filed-claimant,
.hearing-card.filed-petitioner,
.hearing-card.filed-application,
.sequence-card.filed-claimant,
.sequence-card.filed-petitioner,
.sequence-card.filed-application,
.card.filed-claimant,
.card.filed-petitioner,
.card.filed-application,
.vertical-timeline .vt-item.filed-claimant,
.vertical-timeline .vt-item.filed-petitioner,
.vertical-timeline .vt-item.filed-application {
    border-left-color: #1f8f5f;
}

.spark-row.filed-opponent td:first-child,
.spark-row.filed-respondent td:first-child,
.hearing-card.filed-opponent,
.hearing-card.filed-respondent,
.sequence-card.filed-opponent,
.sequence-card.filed-respondent,
.card.filed-opponent,
.card.filed-respondent,
.vertical-timeline .vt-item.filed-opponent,
.vertical-timeline .vt-item.filed-respondent {
    border-left-color: #d84c4c;
}

.spark-row.filed-court td:first-child,
.hearing-card.filed-court,
.sequence-card.filed-court,
.card.filed-court,
.vertical-timeline .vt-item.filed-court {
    border-left-color: #d4a62a;
}

.spark-row.filed-joint td:first-child,
.spark-row.filed-third-party td:first-child,
.hearing-card.filed-joint,
.hearing-card.filed-third-party,
.sequence-card.filed-joint,
.sequence-card.filed-third-party,
.card.filed-joint,
.card.filed-third-party,
.vertical-timeline .vt-item.filed-joint,
.vertical-timeline .vt-item.filed-third-party {
    border-left-color: #7a6ad6;
}

.spark-row.filed-other td:first-child,
.hearing-card.filed-other,
.sequence-card.filed-other,
.card.filed-other,
.vertical-timeline .vt-item.filed-other {
    border-left-color: #7b8798;
}

.hearing-card.filed-claimant .hearing-pill,
.hearing-card.filed-petitioner .hearing-pill,
.hearing-card.filed-application .hearing-pill {
    background: rgba(31, 143, 95, 0.16);
    color: #0f5a3a;
}

.hearing-card.filed-opponent .hearing-pill,
.hearing-card.filed-respondent .hearing-pill {
    background: rgba(216, 76, 76, 0.16);
    color: #7a1f1f;
}

.hearing-card.filed-court .hearing-pill {
    background: rgba(212, 166, 42, 0.18);
    color: #6b4f06;
}

.hearing-card.filed-joint .hearing-pill,
.hearing-card.filed-third-party .hearing-pill {
    background: rgba(122, 106, 214, 0.16);
    color: #3c2e8b;
}

.hearing-card.filed-other .hearing-pill {
    background: rgba(123, 135, 152, 0.16);
    color: #384455;
}

.vertical-timeline::after {
    content: "";
    display: block;
    clear: both;
}

.vertical-timeline .vt-item {
    border-left: 4px solid #7b8798;
}

.card-wall {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
    border-left: 4px solid #7b8798;
    display: grid;
    gap: 0.35rem;
}

.card h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
}

.card-meta {
    color: var(--muted);
    font-size: 0.9rem;
}

.gantt-placeholder {
    border: 1px dashed #b8c3d1;
    background: linear-gradient(180deg, #fbfcfd, #eef3f8);
    padding: 1rem 1.1rem;
    border-radius: 8px;
}

.gantt-placeholder p {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

/* Smart Scan modal */
.modal-card.large {
    width: min(980px, calc(100vw - 48px));
    max-height: calc(100vh - 56px);
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr;
}

.modal-body {
    display: grid;
    gap: 1rem;
    overflow: auto;
    padding-right: 0.1rem;
}

.modal-body > p {
    margin: 0;
    color: #465267;
    line-height: 1.55;
}

.calendar-entry,
.annexure-body article,
.party-card,
.party-stream-item {
    border-left: 4px solid #7b8798;
}

.calendar-entry {
    list-style: none;
    padding: 0.65rem 0.7rem;
    margin: 0 0 0.45rem;
    border: 1px solid #d3dbe5;
    background: rgba(255, 255, 255, 0.72);
}

.calendar-entry small {
    color: var(--muted);
    font-size: 0.82rem;
}

.print-table tbody tr.filed-claimant td,
.print-table tbody tr.filed-petitioner td,
.print-table tbody tr.filed-application td,
.calendar-entry.filed-claimant,
.calendar-entry.filed-petitioner,
.calendar-entry.filed-application,
.annexure-body article.filed-claimant,
.annexure-body article.filed-petitioner,
.annexure-body article.filed-application,
.party-card.filed-claimant,
.party-card.filed-petitioner,
.party-card.filed-application,
.party-stream-item.filed-claimant,
.party-stream-item.filed-petitioner,
.party-stream-item.filed-application {
    background-color: rgba(31, 143, 95, 0.10);
}

.print-table tbody tr.filed-opponent td,
.print-table tbody tr.filed-respondent td,
.calendar-entry.filed-opponent,
.calendar-entry.filed-respondent,
.annexure-body article.filed-opponent,
.annexure-body article.filed-respondent,
.party-card.filed-opponent,
.party-card.filed-respondent,
.party-stream-item.filed-opponent,
.party-stream-item.filed-respondent {
    background-color: rgba(216, 76, 76, 0.10);
}

.print-table tbody tr.filed-court td,
.calendar-entry.filed-court,
.annexure-body article.filed-court,
.party-card.filed-court,
.party-stream-item.filed-court {
    background-color: rgba(212, 166, 42, 0.14);
}

.print-table tbody tr.filed-joint td,
.print-table tbody tr.filed-third-party td,
.calendar-entry.filed-joint,
.calendar-entry.filed-third-party,
.annexure-body article.filed-joint,
.annexure-body article.filed-third-party,
.party-card.filed-joint,
.party-card.filed-third-party,
.party-stream-item.filed-joint,
.party-stream-item.filed-third-party {
    background-color: rgba(122, 106, 214, 0.10);
}

.print-table tbody tr.filed-other td,
.calendar-entry.filed-other,
.annexure-body article.filed-other,
.party-card.filed-other,
.party-stream-item.filed-other {
    background-color: rgba(123, 135, 152, 0.10);
}

.calendar-entry.filed-claimant,
.calendar-entry.filed-petitioner,
.calendar-entry.filed-application,
.annexure-body article.filed-claimant,
.annexure-body article.filed-petitioner,
.annexure-body article.filed-application,
.party-card.filed-claimant,
.party-card.filed-petitioner,
.party-card.filed-application,
.party-stream-item.filed-claimant,
.party-stream-item.filed-petitioner,
.party-stream-item.filed-application {
    border-left-color: #1f8f5f;
}

.calendar-entry.filed-opponent,
.calendar-entry.filed-respondent,
.annexure-body article.filed-opponent,
.annexure-body article.filed-respondent,
.party-card.filed-opponent,
.party-card.filed-respondent,
.party-stream-item.filed-opponent,
.party-stream-item.filed-respondent {
    border-left-color: #d84c4c;
}

.calendar-entry.filed-court,
.annexure-body article.filed-court,
.party-card.filed-court,
.party-stream-item.filed-court {
    border-left-color: #d4a62a;
}

.calendar-entry.filed-joint,
.calendar-entry.filed-third-party,
.annexure-body article.filed-joint,
.annexure-body article.filed-third-party,
.party-card.filed-joint,
.party-card.filed-third-party,
.party-stream-item.filed-joint,
.party-stream-item.filed-third-party {
    border-left-color: #7a6ad6;
}

.calendar-entry.filed-other,
.annexure-body article.filed-other,
.party-card.filed-other,
.party-stream-item.filed-other {
    border-left-color: #7b8798;
}

.file-drop {
    border: 2px dashed #b3bfd0;
    border-radius: 12px;
    background: linear-gradient(180deg, #fbfcfe, #edf2f7);
    padding: 1.25rem;
    text-align: center;
    color: #24344f;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease;
}

.file-drop small {
    display: block;
    margin-top: 0.45rem;
    color: var(--muted);
    font-weight: 400;
}

.file-drop.drag-over {
    border-color: #1f8f5f;
    background: rgba(31, 143, 95, 0.08);
    transform: translateY(-1px);
}

#smart-scan-results {
    display: grid;
    gap: 0.8rem;
}

.scan-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

#smart-scan-table {
    width: 100%;
}

#smart-scan-table tbody input {
    min-width: 0;
}

.confidence {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.conf-high {
    background: rgba(31, 143, 95, 0.14);
    color: #0f5a3a;
}

.conf-med {
    background: rgba(212, 166, 42, 0.16);
    color: #6b4f06;
}

.conf-low {
    background: rgba(216, 76, 76, 0.14);
    color: #7a1f1f;
}
