:root {
    color-scheme: light;
    --ink: #1c2a25;
    --muted: #66736d;
    --paper: #ffffff;
    --canvas: #f2f5f1;
    --line: #d9e1db;
    --green: #205c48;
    --green-dark: #164534;
    --green-soft: #eaf5f0;
    --clay: #b55e3d;
    --navy: #102d50;
    --navy-2: #173f69;
}

body {
    color: var(--ink);
    background: var(--canvas);
    font-family: "Segoe UI", Tahoma, sans-serif;
}

.login-page {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: clamp(16px, 4vw, 32px);
    overflow: hidden;
    background: #eef2f6;
}

.login-backdrop {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 12% 18%, rgba(39, 133, 107, .14), transparent 42%),
        radial-gradient(circle at 88% 82%, rgba(16, 45, 80, .12), transparent 45%),
        linear-gradient(165deg, #eef2f6 0%, #f7f9fb 45%, #e8f0ec 100%);
    pointer-events: none;
}

.login-shell {
    position: relative;
    z-index: 1;
    width: min(100%, 960px);
    min-height: min(88vh, 620px);
    display: grid;
    grid-template-columns: minmax(280px, 1.05fr) minmax(0, 1fr);
    border: 1px solid #e3e9ef;
    border-radius: 16px;
    background: var(--paper);
    box-shadow: 0 22px 60px rgba(16, 45, 80, .11);
    overflow: hidden;
}

.login-aside {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(28px, 5vw, 44px);
    color: #fff;
    background:
        linear-gradient(155deg, rgba(16, 45, 80, .94) 0%, rgba(23, 63, 105, .92) 52%, rgba(32, 92, 72, .88) 100%),
        linear-gradient(155deg, var(--navy) 0%, var(--navy-2) 100%);
}

.login-aside-inner {
    max-width: 340px;
}

.login-brand-lockup {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.login-brand-lockup strong {
    display: block;
    font-size: 18px;
    letter-spacing: .2px;
}

.login-brand-lockup small {
    display: block;
    margin-top: 3px;
    color: rgba(255, 255, 255, .72);
    font-size: 12px;
}

.login-brand-logo {
    width: 96px;
    height: 96px;
    flex-shrink: 0;
    object-fit: contain;
    border-radius: 50%;
    background: rgba(255, 255, 255, .96);
    padding: 5px;
    box-shadow: 0 6px 22px rgba(0, 0, 0, .14);
}

.login-aside-lead {
    margin: 0 0 24px;
    color: rgba(255, 255, 255, .88);
    font-size: 15px;
    line-height: 1.55;
}

.login-features {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.login-features li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: rgba(255, 255, 255, .86);
    font-size: 13px;
    line-height: 1.45;
}

.login-feature-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 9px;
    background: rgba(255, 255, 255, .1);
    font-size: 14px;
}

.login-aside-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin: 28px 0 0;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, .14);
    color: rgba(255, 255, 255, .62);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .4px;
    text-transform: uppercase;
}

.login-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(28px, 6vw, 52px);
}

.login-panel-header {
    margin-bottom: 26px;
}

.login-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 10px;
    color: var(--green);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.login-eyebrow::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
}

.login-panel h1,
.dashboard-heading h1 {
    margin: 0;
    color: var(--navy);
    font-size: clamp(26px, 4vw, 32px);
    font-weight: 750;
    letter-spacing: -.4px;
}

.login-intro {
    margin: 10px 0 0;
    max-width: 420px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.login-alert {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 20px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
}

.login-alert strong {
    font-size: 13px;
}

.institution-mark,
.brand-symbol {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    color: white;
    background: var(--green);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0;
}

.eyebrow {
    margin: 22px 0 8px;
    color: var(--green);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.form-label {
    color: var(--ink);
    font-size: 13px;
    font-weight: 650;
}

.form-control {
    min-height: 46px;
    border-color: var(--line);
    border-radius: 3px;
}

.form-control:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(32, 92, 72, .12);
}

.login-input.form-control {
    min-height: 46px;
    border-color: #dce5ec;
    border-radius: 10px;
    font-size: 14px;
}

.login-input.form-control:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(32, 92, 72, .12);
}

.login-password-wrap {
    position: relative;
}

.login-password-wrap .login-input {
    padding-right: 88px;
}

.login-password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    padding: 6px 10px;
    border: 0;
    border-radius: 7px;
    background: #f0f4f8;
    color: #52677c;
    font-size: 11px;
    font-weight: 700;
}

.login-password-toggle:hover {
    background: #e8f5ef;
    color: var(--green);
}

.input-group .btn {
    border-radius: 0 10px 10px 0;
}

.btn-enter {
    min-height: 46px;
    color: white;
    background: var(--navy);
    border: 0;
    border-radius: 10px;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(16, 45, 80, .18);
}

.btn-enter:hover,
.btn-enter:focus-visible {
    color: white;
    background: var(--navy-2);
}

.login-submit {
    margin-top: 4px;
}

.login-footnote {
    margin: 22px 0 0;
    max-width: 420px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.app-page {
    min-height: 100vh;
    background: #f4f6f3;
}

.topbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px clamp(20px, 5vw, 72px);
    background: white;
    border-bottom: 1px solid var(--line);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
}

.brand-symbol {
    width: 42px;
    height: 42px;
    font-size: 12px;
}

.brand-lockup strong,
.brand-lockup small {
    display: block;
}

.brand-lockup strong {
    font-size: 14px;
}

.brand-lockup small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.dashboard-shell {
    width: min(100% - 40px, 1100px);
    margin: 44px auto;
}

.documents-shell {
    max-width: 1240px;
}

.page-title-row,
.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.page-title-row {
    margin-bottom: 26px;
}

.page-title-row .eyebrow {
    margin-top: 0;
}

.page-title-row h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 650;
    letter-spacing: 0;
}

.document-search--primary {
    margin-bottom: 20px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
}

.document-create,
.document-search,
.document-results,
.archive-browser {
    margin-top: 22px;
    padding: 24px;
    background: white;
    border: 1px solid var(--line);
}

.archive-year-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.archive-year-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-right: 4px;
}

.archive-year-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--navy);
    font-size: 12px;
    font-weight: 600;
    background: #f8fafb;
}

.archive-year-chip:hover {
    border-color: #b9d9cc;
    background: #f3faf7;
    color: var(--green);
}

.archive-year-chip.is-active {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--navy);
}

.archive-folder-hint {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.archive-path {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 8px;
    background: #f4f7fa;
    font-size: 11px;
    word-break: break-word;
}

.archive-folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.archive-folder-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 110px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafb;
    color: var(--navy);
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.archive-folder-card:hover {
    border-color: var(--green);
    background: var(--green-soft);
}

.archive-folder-icon {
    font-size: 28px;
    line-height: 1;
}

.archive-folder-card small {
    color: var(--muted);
}

.archive-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    font-size: 13px;
}

.archive-breadcrumb a {
    color: var(--green);
    font-weight: 600;
    text-decoration: none;
}

.doc-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.doc-move-details {
    position: relative;
}

.doc-move-details summary {
    list-style: none;
    cursor: pointer;
}

.doc-move-details summary::-webkit-details-marker {
    display: none;
}

.doc-move-panel {
    position: absolute;
    right: 0;
    z-index: 5;
    width: min(420px, 92vw);
    margin-top: 6px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.doc-move-form .form-label {
    margin-bottom: 4px;
}

.section-heading {
    margin-bottom: 22px;
}

.section-heading h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 650;
}

.section-heading p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.document-results .table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

.document-results thead th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

.document-results tbody td {
    padding-top: 15px;
    padding-bottom: 15px;
    font-size: 14px;
}

.document-results td strong,
.document-results td small {
    display: block;
}

.document-results td small {
    max-width: 370px;
    margin-top: 4px;
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reference-cell {
    color: var(--green);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.status-label {
    display: inline-block;
    padding: 4px 7px;
    color: #34483d;
    background: #edf2ee;
    font-size: 12px;
    white-space: nowrap;
}

.empty-row {
    padding: 36px 12px !important;
    color: var(--muted);
    text-align: center;
}

.document-link {
    color: var(--ink);
    font-weight: 650;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
}

.document-link:hover,
.document-link:focus-visible {
    color: var(--green);
    text-decoration-color: currentColor;
}

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0 22px;
    margin: 24px 0 0;
    padding: 22px 24px;
    background: white;
    border: 1px solid var(--line);
}

.metadata-grid div {
    min-width: 0;
    padding: 12px 0;
    border-bottom: 1px solid #edf0ed;
}

.metadata-grid dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.metadata-grid dd {
    margin: 5px 0 0;
    overflow-wrap: anywhere;
    font-size: 14px;
}

.metadata-grid .metadata-wide {
    grid-column: 1 / -1;
}

.dashboard-heading .eyebrow {
    margin-top: 0;
}

.setup-notice {
    display: flex;
    gap: 20px;
    margin-top: 34px;
    padding: 26px 28px;
    background: white;
    border: 1px solid var(--line);
    border-left: 4px solid var(--clay);
}

.notice-mark {
    color: var(--clay);
    font-size: 14px;
    font-weight: 700;
}

.setup-notice h2 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 650;
}

.setup-notice p {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin-top: 32px;
    background: var(--line);
    border: 1px solid var(--line);
}

.metric {
    min-height: 105px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 17px 18px;
    background: white;
}

.metric span {
    color: var(--muted);
    font-size: 13px;
}

.metric strong {
    color: var(--green-dark);
    font-size: 26px;
    font-variant-numeric: tabular-nums;
}

.dashboard-lower {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(240px, .8fr);
    gap: 22px;
    margin-top: 22px;
}

.dashboard-section {
    min-width: 0;
    padding: 22px;
    background: white;
    border: 1px solid var(--line);
}

.dashboard-section .section-heading {
    margin-bottom: 14px;
}

.ocr-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #edf0ed;
    color: var(--muted);
    font-size: 14px;
}

.ocr-row:last-child {
    border-bottom: 0;
}

.ocr-row strong {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 700px) {
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-lower {
        grid-template-columns: 1fr;
    }

    .metadata-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 14px 16px;
    }

    .metadata-grid .metadata-wide {
        grid-column: 1 / -1;
    }

    .login-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .login-aside {
        order: -1;
        padding: 24px 22px;
    }

    .login-aside-lead {
        margin-bottom: 16px;
        font-size: 14px;
    }

    .login-features {
        gap: 10px;
    }

    .login-aside-meta {
        margin-top: 18px;
        padding-top: 14px;
    }

    .login-panel {
        padding: 28px 22px 32px;
    }

    .topbar {
        align-items: flex-start;
        padding: 12px 16px;
    }

    .brand-lockup small {
        max-width: 190px;
    }

    .dashboard-shell {
        width: calc(100% - 32px);
        margin: 32px auto;
    }

    .document-create,
    .document-search,
    .document-results {
        padding: 18px 14px;
    }

    .page-title-row {
        align-items: flex-start;
    }
}

.user-edit {
    min-width: 180px;
    text-align: left;
}

.user-edit summary {
    color: var(--green);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.user-edit-form {
    position: relative;
    z-index: 2;
    width: min(100%, 360px);
    min-width: 280px;
    margin-top: 10px;
    padding: 14px;
    background: white;
    border: 1px solid var(--line);
    box-shadow: 0 8px 24px rgba(28, 42, 37, .12);
}

.section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 22px;
}

.section-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: #52677c;
    font-size: 12px;
    font-weight: 650;
}

.section-nav-icon {
    font-size: 13px;
    line-height: 1;
    opacity: 0.85;
}

.section-nav-badge {
    min-width: 18px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #fff3e6;
    color: #b45309;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
}

.section-nav a.is-active .section-nav-badge {
    background: #fff;
    color: var(--green-dark);
}

.section-nav a:hover {
    border-color: #b9d9cc;
    background: #f6fbf8;
    color: var(--green);
}

.section-nav a.is-active {
    border-color: #b9d9cc;
    background: #eaf5f0;
    color: var(--green-dark);
}

.form-link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 8px;
}

.form-link-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 96px;
    padding: 18px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: inherit;
    transition: border-color .15s, box-shadow .15s;
}

.form-link-card:hover {
    border-color: #b9d9cc;
    box-shadow: 0 6px 18px rgba(28, 42, 37, .06);
    color: inherit;
}

.form-link-card strong {
    color: var(--ink);
    font-size: 14px;
}

.form-link-card span {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.chat-shell {
    max-width: 1280px;
}

.chat-app {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    min-height: calc(100vh - 180px);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 8px 28px rgba(25, 48, 73, .05);
}

.chat-sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: #f8fafb;
}

.chat-sidebar-head {
    padding: 18px 16px 12px;
    border-bottom: 1px solid var(--line);
}

.chat-sidebar-head h1 {
    margin: 0;
    font-size: 20px;
    color: var(--navy);
}

.chat-sidebar-head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.chat-sidebar-actions {
    padding: 12px;
    display: grid;
    gap: 10px;
    border-bottom: 1px solid var(--line);
}

.chat-thread-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

.chat-thread-link {
    display: block;
    padding: 12px 14px;
    border-bottom: 1px solid #eef1f4;
    color: inherit;
}

.chat-thread-link:hover,
.chat-thread-link.is-active {
    background: #eef6f2;
}

.chat-thread-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: baseline;
}

.chat-thread-top strong {
    font-size: 12px;
    color: var(--navy);
}

.chat-thread-top small {
    color: var(--muted);
    font-size: 10px;
    white-space: nowrap;
}

.chat-thread-preview {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

.chat-unread-badge {
    min-width: 18px;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--green);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
}

.chat-thread-empty {
    padding: 20px 14px;
    color: var(--muted);
    font-size: 12px;
}

.chat-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #e9edf0 url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h60v60H0z' fill='%23e9edf0'/%3E%3Cpath d='M30 0v60M0 30h60' stroke='%23dfe5ea' stroke-width='1'/%3E%3C/svg%3E");
}

.chat-panel-head {
    padding: 14px 18px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.chat-panel-head h2 {
    margin: 0;
    font-size: 16px;
    color: var(--navy);
}

.chat-panel-head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.chat-panel-empty {
    flex: 1;
    display: grid;
    place-content: center;
    text-align: center;
    gap: 8px;
    padding: 24px;
    color: var(--muted);
}

.chat-empty-icon {
    font-size: 42px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-bubble-row {
    display: flex;
    justify-content: flex-start;
}

.chat-bubble-row.is-mine {
    justify-content: flex-end;
}

.chat-bubble {
    max-width: min(78%, 520px);
    padding: 8px 11px 6px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}

.chat-bubble-row.is-mine .chat-bubble {
    background: #dcf8c6;
    border-bottom-right-radius: 4px;
}

.chat-bubble-row:not(.is-mine) .chat-bubble {
    border-bottom-left-radius: 4px;
}

.chat-bubble p {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-bubble time {
    display: block;
    margin-top: 4px;
    text-align: right;
    color: #667788;
    font-size: 10px;
}

.chat-bubble-author {
    display: block;
    margin-bottom: 3px;
    color: var(--green);
    font-size: 10px;
    font-weight: 700;
}

.chat-compose {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: #f0f2f5;
    border-top: 1px solid var(--line);
}

.chat-compose-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.chat-attach-btn {
    margin: 0;
    cursor: pointer;
}

.chat-file-name {
    font-size: 12px;
    color: var(--muted);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-compose-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
}

.chat-compose-row textarea {
    resize: none;
    min-height: 42px;
    max-height: 120px;
    border-radius: 22px;
    padding: 10px 14px;
}

.chat-compose-row .btn-enter {
    border-radius: 999px;
    min-width: 88px;
}

.chat-request-card {
    background: rgba(255, 255, 255, 0.65);
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 4px;
}

.chat-bubble-row.is-mine .chat-request-card {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.45);
}

.chat-request-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
    color: var(--green);
}

.chat-bubble-row.is-mine .chat-request-label {
    color: #e8ffe8;
}

.chat-attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    word-break: break-word;
}

.chat-bubble-image-link {
    display: block;
    max-width: min(280px, 100%);
}

.chat-bubble-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.chat-bubble-caption {
    margin-top: 6px;
}

.chat-reply-btn {
    margin-top: 8px;
    width: 100%;
}

.chat-reply-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    background: #fff;
    border-left: 3px solid var(--green);
    border-radius: 8px;
    font-size: 13px;
}

.chat-reply-bar-text strong {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--green);
}

.chat-reply-cancel {
    border: 0;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
}

.chat-reply-quote {
    margin: 0 0 6px;
    padding: 6px 8px;
    border-left: 3px solid var(--green);
    background: rgba(0, 0, 0, 0.04);
    border-radius: 4px;
    font-size: 12px;
    color: var(--muted);
}

.chat-bubble-row.is-mine .chat-reply-quote {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: rgba(255, 255, 255, 0.85);
    color: rgba(255, 255, 255, 0.92);
}

.chat-reply-quote cite {
    display: block;
    font-style: normal;
    font-weight: 700;
    font-size: 11px;
    margin-bottom: 2px;
}

.doc-preview-panel {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: #fafafa;
}

.doc-preview-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.doc-preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.doc-preview-frame {
    width: 100%;
    min-height: 420px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.doc-preview-image {
    display: block;
    max-width: 100%;
    max-height: 420px;
    margin: 0 auto;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
}

.doc-preview-notice {
    margin: 0;
    padding: 12px;
    border-radius: 8px;
    background: #fff8e6;
    border: 1px solid #f0dfa8;
    color: #5c4a12;
}

.chat-file-preview {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    background: #fff;
}

.chat-file-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

.chat-file-preview-clear {
    border: 0;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
}

.chat-file-preview-frame {
    width: 100%;
    min-height: 280px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.chat-file-preview-image {
    display: block;
    max-width: 100%;
    max-height: 280px;
    margin: 0 auto;
    border-radius: 8px;
}

.chat-file-preview-note {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

@media (max-width: 900px) {
    .chat-app {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .chat-sidebar {
        max-height: 42vh;
    }
}

/* —— Protocolo e tramitação —— */
.workflow-shell {
    max-width: 1240px;
}

.workflow-shell .document-create,
.workflow-shell .document-results {
    border-radius: 12px;
    box-shadow: 0 1px 0 rgba(28, 42, 37, .04);
}

.workflow-hero {
    margin-bottom: 22px;
    padding: 22px 24px 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(165deg, #f8fbf9 0%, #fff 55%);
}

.workflow-hero-head {
    margin-bottom: 18px;
}

.workflow-hero-head h1 {
    margin: 0 0 8px;
}

.workflow-lead {
    max-width: 52ch;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.section-nav--workflow {
    margin-bottom: 0;
}

.workflow-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.workflow-stat {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.workflow-stat--highlight {
    border-color: #f0d4a8;
    background: #fffaf3;
}

.workflow-stat-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--green-soft);
    color: var(--green-dark);
    font-size: 16px;
}

.workflow-stat--highlight .workflow-stat-icon {
    background: #ffedd5;
    color: #c2410c;
}

.workflow-stat-label {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.workflow-stat-value {
    margin: 4px 0 0;
    color: var(--ink);
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
}

.workflow-actions {
    margin-bottom: 22px;
    padding: 22px 24px 24px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.workflow-actions-head {
    margin-bottom: 16px;
}

.workflow-actions-head h2 {
    margin: 0;
    font-size: 18px;
}

.workflow-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.workflow-action-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 88px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafb;
    color: inherit;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.workflow-action-card:hover {
    border-color: #b9d9cc;
    background: #f3faf7;
    box-shadow: 0 8px 22px rgba(28, 42, 37, .06);
    color: inherit;
}

.workflow-action-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 11px;
    background: #fff;
    border: 1px solid #e8eef2;
    font-size: 18px;
}

.workflow-action-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.workflow-action-copy strong {
    color: var(--ink);
    font-size: 14px;
}

.workflow-action-copy span {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.workflow-action-chevron {
    color: #9aa6b4;
    font-size: 22px;
    line-height: 1;
}

.workflow-action-badge {
    min-width: 26px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #ffedd5;
    color: #c2410c;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.workflow-pending-panel {
    border-radius: 12px;
}

.workflow-pending-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.workflow-pending-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 12px 14px;
    border: 1px solid #eef1f4;
    border-radius: 10px;
    background: #f8fafb;
}

.workflow-pending-item strong {
    display: block;
    font-size: 13px;
}

.workflow-pending-item > div:first-child span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.workflow-pending-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    color: var(--muted);
    font-size: 11px;
}

.workflow-status {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
    white-space: nowrap;
}

.workflow-status--warn {
    background: #fff7ed;
    color: #c2410c;
}

.workflow-status--info {
    background: #eff6ff;
    color: #1d4ed8;
}

.workflow-status--ok {
    background: #ecfdf5;
    color: #047857;
}

.workflow-status--muted {
    background: #f1f5f9;
    color: #64748b;
}

.workflow-status--neutral {
    background: #f4f7fa;
    color: #52677c;
}

.roles-reference-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

.roles-reference-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.roles-reference-card--wide {
    grid-column: 1 / -1;
}

.roles-reference-card {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafb;
}

.roles-reference-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.roles-reference-head h3 {
    margin: 0 0 4px;
    font-size: 15px;
}

.roles-reference-code {
    font-size: 11px;
    color: var(--muted);
}

.roles-reference-count {
    flex-shrink: 0;
    padding: 3px 8px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    font-size: 10px;
    font-weight: 650;
    color: var(--muted);
}

.roles-reference-desc {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.roles-permission-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.roles-permission-list li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #eef1f4;
    font-size: 12px;
    line-height: 1.4;
}

.roles-permission-code {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 10px;
    color: var(--green-dark);
}

.roles-permission-groups {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.roles-permission-group {
    margin: 0;
    padding: 12px;
    border: 1px solid #eef1f4;
    border-radius: 10px;
    background: #fff;
}

.roles-permission-group legend {
    padding: 0 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.roles-permission-checks {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.roles-permission-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.4;
}

.roles-permission-check input {
    margin-top: 3px;
    flex-shrink: 0;
}

.roles-permission-check-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.roles-permission-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

/* —— Sessões activas (admin) —— */
.sessions-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid #dcebe4;
    border-radius: 12px;
    background: #f6fbf8;
}

.sessions-live-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #eaf5f0;
    color: var(--green);
    font-size: 18px;
    line-height: 1;
    box-shadow: 0 0 0 3px rgba(39, 133, 107, 0.12);
    animation: session-live-pulse 2s ease-in-out infinite;
}

.sessions-live-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    color: var(--muted);
}

.sessions-live-copy strong {
    font-size: 22px;
    line-height: 1.1;
    color: var(--navy);
    font-variant-numeric: tabular-nums;
}

.session-user-cell {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.session-online-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 50%;
    background: #27856b;
    box-shadow: 0 0 0 3px rgba(39, 133, 107, 0.2);
    animation: session-live-pulse 2s ease-in-out infinite;
}

.session-duration-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #edf6f1;
    color: #205c48;
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

.session-duration-badge i {
    font-style: normal;
    font-size: 13px;
    opacity: 0.85;
}

.nav-count--live {
    background: #eaf5f0;
    color: #205c48;
}

@keyframes session-live-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.72;
    }
}

#activity-log {
    scroll-margin-top: 88px;
}

/* —— Painel (dashboard) —— */
.dashboard-home {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.dashboard-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 20px;
    padding: 14px 18px !important;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(165deg, #f8fbf9 0%, #fff 58%);
    box-shadow: 0 1px 0 rgba(28, 42, 37, .04);
}

.dashboard-hero-main {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.dashboard-hero-title {
    margin: 0;
    color: var(--navy);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.4px;
    line-height: 1.25;
}

.dashboard-hero-meta {
    margin: 4px 0 0;
    max-width: 100%;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-hero-lead {
    max-width: 52ch;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.dashboard-role-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.dashboard-role-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #dcebe4;
    background: #fff;
    color: #365a4f;
    font-size: 10px;
    font-weight: 650;
}

.dashboard-hero-aside {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.dashboard-hero-badge {
    padding: 4px 10px;
    border-radius: 999px;
    background: #fff3e6;
    color: #b45309;
    font-size: 10px;
    font-weight: 700;
}

.dashboard-quick {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.dashboard-quick-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 72px;
    padding: 14px 16px;
    border: 1px solid #e8edf2;
    border-radius: 12px;
    background: #fff;
    color: inherit;
    box-shadow: 0 5px 20px rgba(25, 48, 73, .035);
    transition: border-color .15s, box-shadow .15s;
}

.dashboard-quick-card:hover {
    border-color: #b9d9cc;
    box-shadow: 0 8px 22px rgba(28, 42, 37, .06);
    color: inherit;
}

.dashboard-quick-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--green-soft);
    color: var(--green-dark);
    font-size: 16px;
}

.dashboard-quick-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.dashboard-quick-copy strong {
    font-size: 12px;
    color: var(--navy);
}

.dashboard-quick-copy small {
    color: var(--muted);
    font-size: 10px;
}

.dashboard-quick-arrow {
    color: #9aa6b4;
    font-size: 20px;
}

.dashboard-home .stat-card--link {
    display: block;
    color: inherit;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}

.dashboard-home .stat-card--link:hover {
    border-color: #b9d9cc;
    box-shadow: 0 10px 28px rgba(28, 42, 37, .08);
    color: inherit;
    transform: translateY(-1px);
}

.dashboard-home .stat-card--alert {
    border-color: #f0d4a8;
    background: linear-gradient(180deg, #fffaf3 0%, #fff 100%);
}

.dashboard-bar-list {
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dashboard-bar-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 10px;
    color: #718092;
}

.dashboard-bar-head strong {
    color: var(--navy);
    font-size: 10px;
}

.dashboard-bar-track {
    height: 8px;
    border-radius: 999px;
    background: #eef1f4;
    overflow: hidden;
}

.dashboard-bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #27856b, #3aa88a);
}

.dashboard-bar-fill.ocr-pending {
    background: linear-gradient(90deg, #d6a64e, #e8bc6a);
}

.dashboard-bar-fill.ocr-processing {
    background: linear-gradient(90deg, #477dbd, #6a9ad4);
}

.dashboard-bar-fill.ocr-completed {
    background: linear-gradient(90deg, #27856b, #3aa88a);
}

.dashboard-bar-fill.ocr-failed {
    background: linear-gradient(90deg, #c45049, #e07a74);
}

@media (max-width: 760px) {
    .dashboard-hero-aside {
        align-items: flex-start;
        width: 100%;
    }

    .dashboard-quick {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .workflow-hero {
        padding: 18px 16px 6px;
    }

    .workflow-actions {
        padding: 18px 16px;
    }

    .workflow-stat-value {
        font-size: 22px;
    }
}

.help-hero {
    padding: 24px 28px;
    margin-bottom: 20px;
}

.help-hero h1 {
    font-size: clamp(1.35rem, 2.5vw, 1.75rem);
    max-width: 42rem;
}

.help-lead {
    color: var(--muted);
    max-width: 46rem;
    margin-bottom: 0;
}

.help-module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.help-module-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    text-decoration: none;
    color: inherit;
    min-height: 100%;
}

a.help-module-card:hover {
    border-color: #b8cfc4;
    box-shadow: 0 8px 24px rgba(16, 45, 80, .06);
}

.help-module-ref {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--green);
}

.help-module-card p {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
    flex: 1;
}

.help-module-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--green);
}

.help-module-muted {
    font-size: 12px;
    color: var(--muted);
}

.help-security ul {
    margin: 0 0 16px;
    padding-left: 1.2rem;
}

.help-security li {
    margin-bottom: 6px;
}

.ocr-excerpt {
    max-height: 280px;
    overflow: auto;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8faf9;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.ocr-meta {
    margin-top: 0;
}

.archive-folder-create {
    margin: 12px 0 16px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
}

.archive-folder-create-summary {
    display: inline-block;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.archive-folder-create-summary::-webkit-details-marker {
    display: none;
}

.archive-folder-create[open] .archive-folder-create-summary {
    margin-bottom: 12px;
}

.archive-subfolder-heading {
    font-size: 15px;
    font-weight: 700;
    margin: 8px 0 10px;
    color: var(--ink);
}

.archive-folder-card--nested {
    position: relative;
    border-left: 3px solid var(--green);
}

.archive-folder-open-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--green);
}

.archive-browser--years {
    margin-top: 8px;
    opacity: 0.95;
}

.archive-folder-form,
.archive-folder-edit {
    margin: 12px 0 16px;
    padding: 14px 16px;
}

.archive-folder-edit summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--green);
}