:root {
    --bg: #f4f6f9;
    --panel: #ffffff;
    --ink: #1f2937;
    --muted: #6b7280;
    --accent: #1f6feb;
    --danger: #b42318;
    --warn: #b7791f;
    --ok: #166534;
    --border: #d7dee8;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

.help-shell { max-width: 1180px; }
.help-topline { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; }
.help-search { background:#eef2f7; border:1px solid var(--border); border-radius:14px; padding:16px; margin-bottom:20px; }
.help-search-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; }
.help-search-row .btn { white-space:nowrap; }
.help-categories { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; }
.help-category-card { margin:0; }
.help-category-card h2 { margin-top:0; }
.help-category-card > a { display:block; color:var(--ink); text-decoration:none; padding:12px 0; border-top:1px solid var(--border); }
.help-category-card > a:first-of-type { border-top:0; }
.help-category-card > a:hover strong, .help-result:hover strong { color:var(--accent); }
.help-category-card a span, .help-result span { display:block; color:var(--muted); font-size:14px; margin-top:4px; line-height:1.45; }
.help-results { display:grid; gap:12px; }
.help-result { display:block; color:var(--ink); text-decoration:none; margin:0; }
.help-result .help-category { color:var(--accent); font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; margin:0 0 5px; }
.help-article { max-width:900px; font-size:16px; line-height:1.65; }
.help-article h2 { margin-top:28px; padding-top:4px; }
.help-article h3 { margin-top:22px; }
.help-article li { margin:7px 0; }
.help-article code { background:#eef2f7; padding:2px 5px; border-radius:4px; }
.help-article-meta { color:var(--muted); font-size:13px; border-bottom:1px solid var(--border); padding-bottom:12px; margin-bottom:18px; }
.help-note { border-left:4px solid var(--accent); background:#eff6ff; padding:12px 14px; margin:16px 0; border-radius:0 8px 8px 0; }
.help-related { display:flex; flex-wrap:wrap; gap:10px; }
.help-related a { display:inline-block; background:#eef2ff; color:#3730a3; padding:8px 11px; border-radius:8px; text-decoration:none; }

.context-help { display:flex; align-items:center; justify-content:space-between; gap:16px; margin:0 0 18px; padding:12px 14px; border:1px solid #bfdbfe; border-left:4px solid var(--accent); border-radius:10px; background:#eff6ff; color:#1e3a5f; font-size:14px; }
.context-help a { flex:0 0 auto; font-weight:700; color:#174ea6; }
.field-help-link { display:inline-flex; align-items:center; justify-content:center; width:20px; height:20px; margin-left:7px; border:1px solid #93c5fd; border-radius:50%; background:#eff6ff; color:#174ea6; font-size:12px; font-weight:700; line-height:1; text-decoration:none; vertical-align:middle; }
.field-help-link:hover, .field-help-link:focus { background:#dbeafe; outline:2px solid rgba(31,111,235,.25); outline-offset:1px; }
.help-recovery-link { display:block; margin-top:8px; font-weight:700; color:inherit; }
.empty-help-link { display:inline-block; margin-left:5px; font-weight:700; }
.help-article :target { scroll-margin-top:16px; background:#fff7d6; border-radius:5px; padding-left:5px; }

@media (max-width: 760px) {
    .help-categories { grid-template-columns:1fr; }
    .help-topline { display:block; }
    .help-search-row { grid-template-columns:1fr; }
    .context-help { display:block; }
    .context-help a { display:inline-block; margin-top:7px; }
}

.topbar {
    height: 64px;
    background: #0f172a;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.brand {
    font-size: 22px;
    font-weight: 700;
}

.brand span {
    display: block;
    font-size: 16px;
    font-weight: 400;
    color: #cbd5e1;
    margin-top: 2px;
}

.user-pill {
    font-size: 15px;
    background: #1e293b;
    padding: 9px 12px;
    border-radius: 999px;
}

.layout {
    display: flex;
    min-height: calc(100vh - 64px);
}

.sidebar {
    width: 250px;
    background: #111827;
    padding: 18px 12px;
    flex-shrink: 0;
}

.sidebar a,
.sidebar summary {
    display: block;
    color: #d1d5db;
    text-decoration: none;
    padding: 11px 14px;
    border-radius: 8px;
    margin-bottom: 4px;
    cursor: pointer;
}

.sidebar a:hover,
.sidebar summary:hover {
    background: #1f2937;
    color: white;
}

.sidebar .sub {
    margin-left: 12px;
    font-size: 13px;
    padding: 8px 14px;
    background: #172033;
}

.content {
    flex: 1;
    padding: 26px;
}

h1 {
    margin-top: 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
    margin-bottom: 18px;
}

.metric {
    font-size: 32px;
    font-weight: 700;
    margin-top: 8px;
}

.small {
    color: var(--muted);
    font-size: 13px;
}

.btn {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 9px 13px;
    border-radius: 8px;
    border: 0;
    text-decoration: none;
    cursor: pointer;
}

.btn.secondary {
    background: #475569;
}

.btn.light {
    background: #e5e7eb;
    color: #111827;
}

.btn.danger {
    background: var(--danger);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.table th,
.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.table th {
    background: #eef2f7;
    font-size: 15px;
    color: #374151;
}

.badge {
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
    display: inline-block;
}

.badge.High {
    background: #fee2e2;
    color: var(--danger);
}

.badge.Medium {
    background: #fef3c7;
    color: var(--warn);
}

.badge.Low {
    background: #dcfce7;
    color: var(--ok);
}

.badge.status {
    background: #eef2ff;
    color: #3730a3;
}

.form-row {
    margin-bottom: 14px;
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
}

input[type="checkbox"] {
    width: auto;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.three-col {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 12px;
}

.four-col {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 18px;
    margin-bottom: 12px;
}

.transaction-info-grid > div {
    min-width: 0;
    overflow-wrap: anywhere;
}

.progress {
    height: 9px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.progress div {
    height: 9px;
    background: var(--accent);
}

.timeline {
    border-left: 3px solid var(--border);
    margin-left: 10px;
    padding-left: 18px;
}

.timeline-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 14px;
    position: relative;
}

.timeline-item:before {
    content: "";
    position: absolute;
    left: -28px;
    top: 18px;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
}

.calendar-week,
.calendar-month {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 7px;
}

.day-name {
    text-align: center;
    font-weight: 700;
    color: #374151;
    padding: 7px;
}

.day {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    min-height: 112px;
    padding: 8px;
}

.month-day {
    min-height: 96px;
}

.day strong {
    display: block;
    margin-bottom: 5px;
}

.event {
    font-size: 12px;
    padding: 5px;
    border-radius: 7px;
    background: #e0f2fe;
    margin-bottom: 5px;
}

.event.office {
    background: #fef3c7;
}

.notice {
    background: #ecfdf5;
    border: 1px solid #86efac;
    color: #14532d;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #7f1d1d;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.login {
    max-width: 462px;
    margin: 60px auto;
}

@media (max-width: 1100px) {
    .four-col {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .grid,
    .two-col,
    .three-col,
    .four-col {
        grid-template-columns: 1fr;
    }

    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }
}


/* v1.0.18 transaction info responsive override */
.transaction-info-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(155px, 1fr)) !important;
    gap: 12px 16px !important;
    align-items: start;
}
.transaction-info-grid > div {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: normal;
}
@media (max-width: 900px) {
    .transaction-info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}
@media (max-width: 650px) {
    .transaction-info-grid {
        grid-template-columns: 1fr !important;
    }
}

.badge.Critical {
    background: #7f1d1d;
    color: #ffffff;
}

.risk-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.risk-summary-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    background: #fff;
}

.risk-summary-card .metric {
    font-size: 28px;
}

@media (max-width: 900px) {
    .risk-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .risk-summary-grid {
        grid-template-columns: 1fr;
    }
}

/* v1.40 agent repository display preference */
.preference-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin: 4px 0 8px;
}
.preference-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.preference-slider {
    position: relative;
    width: 46px;
    height: 26px;
    flex: 0 0 46px;
    border-radius: 999px;
    background: #94a3b8;
    transition: background .18s ease;
}
.preference-slider::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.28);
    content: "";
    transition: transform .18s ease;
}
.preference-switch input:checked + .preference-slider { background: var(--accent); }
.preference-switch input:checked + .preference-slider::after { transform: translateX(20px); }
.preference-switch input:focus-visible + .preference-slider {
    outline: 3px solid rgba(37,99,235,.35);
    outline-offset: 2px;
}


/* v1.0.21 consolidated transaction/reminder layout */
.badge.Critical,
.badge.High,
.badge.Medium,
.badge.Low {
    min-width: 68px;
    text-align: center;
    font-size: 12px;
    line-height: 1.2;
    padding: 5px 9px;
}
.transactions-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.table.compact th,
.table.compact td {
    padding: 10px 12px;
}
.inner-card {
    box-shadow: none;
    border-style: dashed;
}


/* v1.0.25 task status lifecycle */
.btn.tiny {
    padding: 3px 7px;
    font-size: 11px;
    line-height: 1.2;
}
.small-action {
    margin-top: 6px;
}
.badge.status {
    min-width: 68px;
    text-align: center;
}


/* v1.30.2 admin/security polish */
.impersonation-banner {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 14px;
    color: #ffffff;
    font-weight: 700;
    white-space: nowrap;
}
.impersonation-banner a {
    color: #ffffff;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 999px;
}
.impersonation-banner a:hover {
    background: rgba(255, 255, 255, 0.14);
}
.impersonation-banner .exit-icon {
    color: #ef4444;
    margin-right: 4px;
}
@media (max-width: 900px) {
    .impersonation-banner {
        position: static;
        transform: none;
        font-size: 12px;
        gap: 8px;
    }
}

/* v1.30.5 Transaction Intelligence / PDF Intake Analysis */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 12px 0 16px;
}
.stats-grid > div,
.stats-grid > section {
    border: 1px solid #d9e2ef;
    border-radius: 8px;
    padding: 10px 12px;
    background: #f8fafc;
}
.stats-grid strong {
    color: #1e3a5f;
}

/* v1.35.3 mobile login polish: keep password input visible on narrow phones. */
.password-input-wrap{display:flex;gap:0.5rem;align-items:center;width:100%}
.password-input-wrap input{flex:1 1 auto;min-width:0}
.password-input-wrap .btn.small{flex:0 0 auto;width:auto;min-width:76px;margin-bottom:0;white-space:nowrap}
.btn.small{padding:0.35rem 0.6rem;font-size:0.85rem}

/* v1.32.4 Contract Intake Review */
.intake-review-hero {
    border-left: 6px solid #64748b;
}
.intake-review-hero.excellent {
    border-left-color: #16a34a;
}
.intake-review-hero.review_recommended {
    border-left-color: #f59e0b;
}
.intake-review-hero.needs_information {
    border-left-color: #dc2626;
}
.review-list {
    display: grid;
    gap: 12px;
}
.review-item {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid #d9e2ef;
    border-radius: 10px;
    padding: 12px 14px;
    background: #ffffff;
}
.review-item p {
    margin: 4px 0 0;
}
.review-message {
    font-weight: 700;
    white-space: nowrap;
    color: #92400e;
}
.review-item.missing_required .review-message {
    color: #991b1b;
}
.good-line {
    font-weight: 700;
    color: #166534;
}
.review-ack-card {
    border-left: 6px solid #1e3a5f;
}
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}
.checkbox-row input {
    width: 18px;
    height: 18px;
}
@media (max-width: 720px) {
    .review-item {
        display: block;
    }
    .review-message {
        margin-top: 8px;
        white-space: normal;
    }
}

/* v1.32.6 Learning feedback */
.simple-list {
    margin: 0.75rem 0 0 1.25rem;
    padding: 0;
}
.simple-list li {
    margin-bottom: 0.75rem;
}
.review-ack-card textarea,
.card textarea,
.card input[type="text"],
.card select {
    width: 100%;
    max-width: 100%;
}


/* v1.32.7 responsive UI cleanup */
html {
    -webkit-text-size-adjust: 100%;
}

body {
    line-height: 1.45;
}

.nav-toggle {
    display: none;
    background: #1e293b;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    font-size: 22px;
    line-height: 1;
    padding: 8px 10px;
    cursor: pointer;
}

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

.alert {
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    background: #ffffff;
}

.alert.success {
    background: #ecfdf5;
    border-color: #86efac;
    color: #14532d;
}

.alert.danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #7f1d1d;
}

.good-line {
    color: var(--ok);
    font-weight: 700;
}

.content > .card,
.content > form.card {
    max-width: 1180px;
}

button,
.btn,
input,
select,
textarea {
    max-width: 100%;
}

button.btn {
    font: inherit;
}

.card h2,
.card h3 {
    margin-top: 0;
}

.review-list {
    display: grid;
    gap: 10px;
}

.review-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #ffffff;
}

.review-item p {
    margin: 4px 0 0;
}

.review-message {
    color: var(--warn);
    font-weight: 700;
    white-space: nowrap;
}

.checkbox-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.checkbox-row input {
    margin-top: 3px;
    flex: 0 0 auto;
}

.simple-list {
    padding-left: 20px;
}

.content table,
.table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
}

.content table th,
.content table td,
.table th,
.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.content table th,
.table th {
    background: #eef2f7;
    color: #374151;
}

@media (max-width: 1020px) {
    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .content {
        padding: 20px;
    }

    .brand {
        font-size: 20px;
    }

    .brand span {
        font-size: 13px;
    }
}

@media (max-width: 760px) {
    .topbar {
        height: auto;
        min-height: 60px;
        padding: 10px 14px;
        gap: 10px;
        position: sticky;
        top: 0;
        z-index: 20;
        flex-wrap: wrap;
    }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .brand {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 18px;
    }

    .brand span {
        display: none;
    }

    .user-pill {
        flex: 1 1 100%;
        border-radius: 12px;
        font-size: 13px;
        padding: 8px 10px;
    }

    .layout {
        min-height: auto;
    }

    .sidebar {
        display: none;
        padding: 10px;
        border-bottom: 1px solid #253044;
    }

    .sidebar.is-open {
        display: block;
    }

    .sidebar a,
    .sidebar summary {
        padding: 12px 13px;
        margin-bottom: 6px;
    }

    .content {
        padding: 16px 12px 24px;
        width: 100%;
    }

    h1 {
        font-size: 24px;
        line-height: 1.2;
    }

    h2 {
        font-size: 20px;
    }

    .card {
        border-radius: 12px;
        padding: 14px;
        margin-bottom: 14px;
    }

    .actions,
    .transactions-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn,
    button.btn {
        width: 100%;
        text-align: center;
        justify-content: center;
        margin-bottom: 6px;
    }

    .review-item {
        grid-template-columns: 1fr;
    }

    .review-message {
        white-space: normal;
    }

    .calendar-week,
    .calendar-month {
        display: block;
    }

    .day-name {
        display: none;
    }

    .day,
    .month-day {
        min-height: 0;
        margin-bottom: 8px;
    }
}

@media (max-width: 620px) {
    .content table,
    .table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .content table td,
    .content table th,
    .table td,
    .table th {
        white-space: normal;
        min-width: 120px;
    }

    .metric {
        font-size: 26px;
    }

    .login {
        margin: 24px 12px;
    }
}


/* v1.32.8 document management */
.document-stats {
    width: 100%;
    max-width: 1180px;
    margin: 0 0 1rem 0;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
}
.document-stats .stat-card {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: .65rem;
    text-align: center;
    min-height: 44px;
    padding: 10px 12px;
}
.document-stats .stat-card span,
.document-stats .stat-card strong {
    display: inline-block;
    white-space: nowrap;
}
.document-stats .stat-card strong {
    margin-left: .25rem;
}
.document-toolbar .filter-grid { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 1rem; align-items: end; }
.document-list { display: grid; gap: 0.9rem; }
.document-card { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem; border: 1px solid #dde3ea; border-radius: 14px; background: #fff; }
.document-card h3 { margin: 0 0 .25rem 0; font-size: 1rem; }
.document-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.document-meta span { border: 1px solid #d6dee8; border-radius: 999px; padding: .2rem .55rem; font-size: .82rem; background: #f7f9fb; }
.document-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; justify-content: flex-end; min-width: 260px; }
.document-group { margin-bottom: 1rem; }
.document-group summary { cursor: pointer; padding: .5rem 0; }
.narrow-card { max-width: 760px; }
@media (max-width: 900px) {
    .document-stats { grid-template-columns: 1fr; }
    .document-stats .stat-card { justify-content: center; }
    .document-toolbar .filter-grid { grid-template-columns: 1fr; }
    .document-card { flex-direction: column; }
    .document-actions { justify-content: flex-start; min-width: 0; }
}

/* v1.32.9 Billing foundation */
.billing-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.stat-card span {
    display: block;
    color: #526173;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}
.stat-card strong {
    display: block;
    font-size: 1.15rem;
}
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    border: 1px solid #d4dde8;
    background: #f8fafc;
    color: #172033;
    font-size: 0.88rem;
    font-weight: 600;
}
.badge-success {
    border-color: #bbf7d0;
    background: #ecfdf3;
    color: #166534;
}
.badge-warning {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}
.badge-muted {
    border-color: #e5e7eb;
    background: #f3f4f6;
    color: #4b5563;
}
.billing-action-grid {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(140px, 1fr)) auto;
    gap: 1rem;
    align-items: end;
}
.billing-action-grid .form-row {
    margin-bottom: 0;
}
.billing-action-grid .form-row-button {
    align-self: end;
}
@media (max-width: 900px) {
    .billing-action-grid {
        grid-template-columns: 1fr;
    }
    .billing-action-grid .btn {
        width: 100%;
    }
}


/* v1.33.1 System Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}
.settings-section {
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    padding: 1rem;
    background: #fff;
}
.settings-section h2 {
    margin-top: 0;
    font-size: 1.05rem;
}
.setting-row input[type="text"],
.setting-row input[type="password"],
.setting-row select {
    width: 100%;
}
.inline-check {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-weight: 500;
    margin-top: .35rem;
}
.small { font-size: .86rem; }
@media (max-width: 900px) {
    .settings-grid { grid-template-columns: 1fr; }
    .system-settings-form .form-actions .btn { width: 100%; margin-bottom: .5rem; }
}


/* v1.33.1 System Settings hotfix visibility */
.system-settings-form { display: block; }
.system-settings-form .settings-grid { margin-bottom: 1rem; }
.settings-section .form-row { margin-bottom: 1rem; }

/* v1.33.3 OpenAI Parser Diagnostics */
.compact-stats {
    margin: 1rem 0;
}
.compact-stats .stat-card {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}
.compact-stats .stat-card span {
    font-size: 1.05rem;
}

@media (max-width: 620px) {
    .password-input-wrap .btn.small,
    .login .password-input-wrap .btn.small {
        width: auto;
        min-width: 76px;
        margin-bottom: 0;
    }
}


/* v1.35.3 AI Intake Review cleanup actions */
.cleanup-actions { display: flex; flex-direction: column; gap: 6px; min-width: 160px; }
.cleanup-actions form { margin: 0; }
.cleanup-actions .btn.tiny { width: 100%; text-align: center; }
@media (max-width: 620px) {
    .cleanup-actions .btn.tiny { width: 100%; }
}

/* v1.36.0 seven-day rolling compliance calendars */
.rolling-calendar-card {
    margin-top: 0;
}

.rolling-calendar-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.rolling-calendar-heading h2,
.rolling-calendar-heading p {
    margin-top: 0;
}

.rolling-calendar-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.rolling-legend {
    border-left: 5px solid transparent;
    border-radius: 6px;
    padding: 5px 8px;
    white-space: nowrap;
}

.rolling-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.rolling-day {
    min-width: 0;
    min-height: 150px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.rolling-day.is-today {
    border: 2px solid var(--accent);
}

.rolling-day-header {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px;
    background: #eef2f7;
    border-bottom: 1px solid var(--border);
}

.rolling-day-header strong {
    margin: 0;
}

.rolling-count {
    margin-left: auto;
    min-width: 23px;
    height: 23px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #1f2937;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.rolling-day-events {
    padding: 7px;
}

.rolling-event {
    border-left: 5px solid #94a3b8;
    border-radius: 7px;
    background: #fff;
    margin-bottom: 7px;
    padding: 7px;
    overflow-wrap: anywhere;
}

.rolling-event a {
    display: block;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
}

.rolling-event span {
    display: block;
    margin-top: 3px;
    color: #4b5563;
    font-size: 11px;
    line-height: 1.25;
}

.rolling-event-today {
    border-left-color: #b91c1c;
    background: #fef2f2;
}

.rolling-event-soon {
    border-left-color: #d97706;
    background: #fffbeb;
}

.rolling-event-upcoming {
    border-left-color: #ca8a04;
    background: #fefce8;
}

.rolling-event-later {
    border-left-color: #2563eb;
    background: #eff6ff;
}

.rolling-empty {
    display: block;
    padding: 10px 4px;
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
}

.rolling-calendar-empty-message {
    margin-bottom: 0;
}

@media (max-width: 1100px) {
    .rolling-calendar {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .rolling-calendar-heading {
        display: block;
    }

    .rolling-calendar-legend {
        justify-content: flex-start;
        margin-top: 8px;
    }

    .rolling-calendar {
        display: block;
    }

    .rolling-day {
        min-height: 0;
        margin-bottom: 8px;
    }
}


/* v1.36.1 sortable compliance tables */
.sortable-column {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    user-select: none;
    white-space: nowrap;
}

.sortable-column::after {
    display: inline-block;
    min-width: 1em;
    margin-left: 5px;
    color: #64748b;
    content: "↕";
    text-decoration: none;
}

.sortable-column.sort-asc::after {
    content: "▲";
}

.sortable-column.sort-desc::after {
    content: "▼";
}

.sortable-column:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.metric-link{display:block;color:inherit;text-decoration:none}.metric-link:hover{transform:translateY(-1px);box-shadow:0 4px 14px rgba(0,0,0,.12)}.document-compliance-cards{margin-top:16px}

.aos-intake-callout { border-width: 2px; }
.aos-intake-callout h2 { margin-top: 0; }

/* v1.39.1D.1 document navigation and dashboard layout */
.document-tree { display: grid; gap: 10px; }
.document-group { border: 1px solid #d9e2ef; border-radius: 10px; background: #fff; overflow: hidden; }
.document-group > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; padding: 13px 15px; background: #f8fafc; color: #1e3a5f; }
.document-group > summary:hover { background: #eef4fa; }
.document-group-children { display: grid; gap: 9px; padding: 10px 12px 12px; }
.transaction-document-group { margin: 0; }
.transaction-document-group > summary { background: #fff; padding-left: 18px; }
.document-summary-count { color: #64748b; font-size: .84rem; font-weight: 500; white-space: nowrap; }
.transaction-document-group .document-list { padding: 10px 12px 12px; border-top: 1px solid #e5eaf0; }

.dashboard-calendar-activity { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(270px, .85fr); gap: 16px; align-items: stretch; margin-bottom: 16px; }
.dashboard-calendar-column, .dashboard-calendar-column .rolling-calendar-card { min-width: 0; height: 100%; margin: 0; }
.dashboard-stat-section { margin-bottom: 16px; }
.dashboard-stat-section h2 { margin-top: 0; margin-bottom: 12px; }
.transaction-activity-card { margin: 0; }
.dashboard-compact-metrics { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); gap: 9px; }
.forms-compliance-card .dashboard-compact-metrics { grid-template-columns: repeat(5, minmax(120px, 1fr)); }
.dashboard-mini-stat { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid #d9e2ef; border-radius: 9px; padding: 10px 12px; background: #f8fafc; color: inherit; text-decoration: none; min-height: 48px; }
.dashboard-mini-stat span { font-size: .85rem; color: #475569; line-height: 1.2; }
.dashboard-mini-stat strong { color: #1e3a5f; font-size: 1.35rem; white-space: nowrap; }
a.dashboard-mini-stat:hover { background: #eef4fa; transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0,0,0,.08); }

@media (max-width: 1100px) {
    .dashboard-calendar-activity { grid-template-columns: 1fr; }
    .transaction-activity-card .dashboard-compact-metrics { grid-template-columns: repeat(5, minmax(120px, 1fr)); }
}
@media (max-width: 850px) {
    .forms-compliance-card .dashboard-compact-metrics,
    .transaction-activity-card .dashboard-compact-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .forms-compliance-card .dashboard-compact-metrics,
    .transaction-activity-card .dashboard-compact-metrics { grid-template-columns: 1fr; }
    .document-group > summary { align-items: flex-start; flex-direction: column; }
    .document-summary-count { white-space: normal; }
}
