:root {
    --navy: #102a43;
    --blue: #1f6feb;
    --blue-dark: #1659bc;
    --background: #f5f7fb;
    --card: #ffffff;
    --border: #d9e2ec;
    --text: #243b53;
    --muted: #627d98;
    --green: #1f8f5f;
    --orange: #c05621;
    --red: #c53030;
    --shadow: 0 10px 25px rgba(16, 42, 67, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--background);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
}

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    background: var(--navy);
    color: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.topbar-inner {
    width: min(1500px, calc(100% - 40px));
    min-height: 66px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 8px;
    background: var(--blue);
    font-size: 12px;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar nav > a:not(.button) {
    color: #d9e2ec;
}

.page-container {
    width: min(1500px, calc(100% - 40px));
    margin: 32px auto 60px;
}

.page-heading,
.case-header,
.documents-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.case-header {
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
}

.case-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    color: var(--navy);
    font-size: 28px;
}

h2 {
    margin-bottom: 4px;
    color: var(--navy);
    font-size: 19px;
}

h3 {
    margin-bottom: 4px;
    color: var(--navy);
    font-size: 16px;
}

.eyebrow {
    margin-bottom: 6px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.muted,
.small-text {
    color: var(--muted);
}

.small-text {
    display: block;
    margin-top: 4px;
    font-size: 12px;
}

.back-link {
    display: inline-block;
    margin-bottom: 16px;
    font-weight: 600;
}

.card {
    margin-bottom: 20px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.card-heading,
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.table-card {
    padding: 0;
    overflow: hidden;
}

.table-card .card-heading {
    padding: 22px 22px 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    padding: 18px;
    border: 1px solid var(--border);
    border-left: 5px solid var(--blue);
    border-radius: 10px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-weight: 600;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    color: var(--navy);
    font-size: 30px;
}

.stat-total {
    border-left-color: #1f6feb;
    background: linear-gradient(135deg, #ffffff 0%, #edf5ff 100%);
}

.stat-open {
    border-left-color: #2563eb;
    background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
}

.stat-on-hold {
    border-left-color: #d97706;
    background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
}

.stat-follow-up {
    border-left-color: #ea580c;
    background: linear-gradient(135deg, #ffffff 0%, #fff7ed 100%);
}

.stat-departed {
    border-left-color: #7c3aed;
    background: linear-gradient(135deg, #ffffff 0%, #f5f3ff 100%);
}

.stat-arrived {
    border-left-color: #0891b2;
    background: linear-gradient(135deg, #ffffff 0%, #ecfeff 100%);
}

.stat-ready {
    border-left-color: #c2410c;
    background: linear-gradient(135deg, #ffffff 0%, #fff7ed 100%);
}

.stat-archived {
    border-left-color: #64748b;
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
}

.stat-closed {
    border-left-color: #059669;
    background: linear-gradient(135deg, #ffffff 0%, #ecfdf5 100%);
}

.stat-cancelled {
    border-left-color: #dc2626;
    background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
}

.search-form {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 180px 220px auto auto;
    gap: 10px;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid #bcccdc;
    border-radius: 7px;
    color: var(--text);
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    outline: 3px solid rgba(31, 111, 235, 0.13);
}

textarea {
    resize: vertical;
}

label {
    display: grid;
    gap: 7px;
    color: var(--navy);
    font-size: 13px;
    font-weight: 700;
}

.required {
    color: var(--red);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.span-2 {
    grid-column: span 2;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.button:hover {
    text-decoration: none;
}

.button-primary {
    border-color: var(--blue);
    color: #fff;
    background: var(--blue);
}

.button-primary:hover {
    border-color: var(--blue-dark);
    background: var(--blue-dark);
}

.button-secondary {
    border-color: #bcccdc;
    color: var(--navy);
    background: #fff;
}

.button-secondary:hover {
    background: #f0f4f8;
}

.button-danger {
    border-color: var(--red);
    color: #fff;
    background: var(--red);
}

.button-large {
    min-height: 44px;
    padding: 10px 16px;
}

.button-small {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 12px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 18px;
    border-top: 1px solid #e5edf5;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    background: #f8fafc;
    font-size: 12px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

tbody tr:hover {
    background: #f8fbff;
}

.clickable-row {
    cursor: pointer;
}

.reference-link {
    font-weight: 800;
}

.empty-cell {
    padding: 40px;
    color: var(--muted);
    text-align: center;
}

.status {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.status-open {
    color: #174ea6;
    background: #e8f0fe;
}

.status-ready-to-close {
    color: #9c4221;
    background: #fff3cd;
}

.status-departed {
    color: #6b21a8;
    background: #f3e8ff;
}

.status-arrived {
    color: #075985;
    background: #e0f2fe;
}

.status-closed {
    color: #166534;
    background: #dcfce7;
}

.two-column-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 22px;
    align-items: start;
}

.side-column {
    position: sticky;
    top: 20px;
}

.document-section {
    scroll-margin-top: 20px;
}

.upload-form {
    padding: 14px;
    border: 1px dashed #9fb3c8;
    border-radius: 9px;
    background: #f8fbff;
}

.file-input {
    display: none;
}

.drop-zone {
    display: flex;
    min-height: 102px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    border: 2px dashed #9fb3c8;
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    text-align: center;
    transition: 0.15s ease;
}

.drop-zone strong {
    color: var(--navy);
}

.drop-zone:hover,
.drop-zone.drag-active {
    border-color: var(--blue);
    background: #eaf3ff;
}

.drop-zone-icon {
    color: var(--blue);
    font-size: 25px;
    font-weight: 800;
}

.selected-files {
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
}

.selected-files span {
    color: #829ab1;
}

.upload-button {
    margin-top: 12px;
}

.document-list {
    margin-top: 14px;
}

.document-row {
    display: grid;
    grid-template-columns: 38px minmax(220px, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 13px 4px;
    border-bottom: 1px solid #e5edf5;
}

.document-row:last-child {
    border-bottom: 0;
}

.document-icon {
    width: 38px;
    font-size: 22px;
    text-align: center;
}

.document-info {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.document-filename {
    display: block;
    overflow: hidden;
    color: var(--navy);
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-filename:hover {
    color: var(--blue);
    text-decoration: underline;
}

.document-meta {
    color: var(--muted);
    font-size: 12px;
}

.document-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
}

.document-actions form {
    margin: 0;
}

.document-actions select {
    width: 178px;
    padding: 7px;
    font-size: 12px;
}

.empty-documents {
    margin: 14px 0 0;
    color: var(--muted);
    font-style: italic;
}

.summary-list {
    margin: 0;
}

.summary-list div {
    padding: 10px 0;
    border-bottom: 1px solid #e5edf5;
}

.summary-list div:last-child {
    border-bottom: 0;
}

.summary-list dt {
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 12px;
}

.summary-list dd {
    margin: 0;
    font-weight: 700;
}

.activity-list {
    display: grid;
    gap: 12px;
}

.activity-item {
    padding-bottom: 11px;
    border-bottom: 1px solid #e5edf5;
}

.activity-item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.activity-item strong,
.activity-item span,
.activity-item time {
    display: block;
}

.activity-item span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.activity-item time {
    margin-top: 5px;
    color: #829ab1;
    font-size: 11px;
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.flash {
    padding: 12px 15px;
    border-radius: 8px;
    font-weight: 600;
}

.flash-success {
    border: 1px solid #86efac;
    color: #166534;
    background: #f0fdf4;
}

.flash-error {
    border: 1px solid #fca5a5;
    color: #991b1b;
    background: #fef2f2;
}

.preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.preview-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.preview-card {
    min-height: 720px;
    padding: 12px;
}

.pdf-preview,
.text-preview {
    width: 100%;
    height: 760px;
    border: 0;
    border-radius: 8px;
    background: #f8fafc;
}

.image-preview-wrap {
    display: grid;
    min-height: 680px;
    place-items: center;
    overflow: auto;
    padding: 20px;
    border-radius: 8px;
    background: #f8fafc;
}

.image-preview {
    max-width: 100%;
    max-height: 760px;
    object-fit: contain;
}

.preview-not-supported {
    display: grid;
    min-height: 500px;
    place-items: center;
    align-content: center;
    gap: 12px;
    text-align: center;
}

.preview-file-icon {
    font-size: 52px;
}

@media (max-width: 1050px) {
    .two-column-layout {
        grid-template-columns: 1fr;
    }

    .side-column {
        position: static;
    }

    .search-form {
        grid-template-columns: minmax(220px, 1fr) 180px 220px auto;
    }

    .search-form .button-secondary {
        grid-column: 4;
    }
}

@media (max-width: 980px) {
    .document-row {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .document-actions {
        grid-column: 2;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 760px) {
    .topbar-inner,
    .page-container {
        width: min(100% - 24px, 1500px);
    }

    .topbar-inner,
    .page-heading,
    .case-header,
    .preview-header {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar nav {
        justify-content: space-between;
    }

    .stat-grid,
    .form-grid,
    .search-form {
        grid-template-columns: 1fr;
    }

    .search-form .button-secondary {
        grid-column: auto;
    }

    .span-2 {
        grid-column: span 1;
    }

    .pdf-preview,
    .text-preview {
        height: 600px;
    }
}

@media (max-width: 600px) {
    .document-row {
        grid-template-columns: 1fr;
    }

    .document-icon {
        display: none;
    }

    .document-actions {
        grid-column: auto;
        align-items: stretch;
        flex-direction: column;
    }

    .document-actions select {
        width: 100%;
    }

    .preview-card {
        min-height: 540px;
        padding: 8px;
    }

    .image-preview-wrap {
        min-height: 500px;
        padding: 10px;
    }
}.generate-notes-form {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.generate-notes-form .button {
    width: 100%;
}.notes-field {
    gap: 8px;
}

.notes-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.notes-label-row .button {
    flex: 0 0 auto;
}

.notes-field textarea {
    min-height: 290px;
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.55;
    white-space: pre-wrap;
}

@media (max-width: 1200px) {
    .stat-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 420px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .notes-label-row {
        align-items: stretch;
        flex-direction: column;
    }

    .notes-label-row .button {
        width: 100%;
    }
}.status-on-hold {
    color: #92400e;
    background: #fef3c7;
}

.status-follow-up {
    color: #9a3412;
    background: #ffedd5;
}

.status-departed {
    color: #6b21a8;
    background: #f3e8ff;
}

.status-arrived {
    color: #075985;
    background: #e0f2fe;
}

.status-archived {
    color: #374151;
    background: #e5e7eb;
}

.status-cancelled {
    color: #991b1b;
    background: #fee2e2;
}
.document-workspace {
    overflow: hidden;
}

.document-workspace-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #d9e2ec;
}

.document-folder-selector {
    display: grid;
    gap: 0.45rem;
    min-width: min(100%, 360px);
}

.document-folder-selector label {
    font-weight: 700;
    color: #243b53;
}

.document-folder-selector select {
    width: 100%;
}

.document-workspace-count {
    color: #627d98;
    white-space: nowrap;
}

.document-workspace-count strong {
    color: #102a43;
}

.document-folder-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 1.25rem;
}

.document-folder-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
    padding: 0.45rem 0.7rem;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    color: #334e68;
    background: #ffffff;
    text-decoration: none;
    font-size: 0.86rem;
    transition: 0.15s ease;
}

.document-folder-chip:hover {
    border-color: #2f80ed;
    color: #1f6feb;
    background: #eff6ff;
}

.document-folder-chip.active {
    border-color: #1f6feb;
    color: #ffffff;
    background: #1f6feb;
}

.document-folder-chip strong {
    display: inline-grid;
    min-width: 1.45rem;
    height: 1.45rem;
    place-items: center;
    padding: 0 0.25rem;
    border-radius: 999px;
    color: inherit;
    background: rgba(15, 42, 67, 0.1);
    font-size: 0.75rem;
}

.document-folder-chip.active strong {
    background: rgba(255, 255, 255, 0.22);
}

.selected-document-section {
    padding-top: 0.25rem;
}

.upload-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-top: 0.85rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 720px) {
    .document-workspace-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .document-workspace-count {
        white-space: normal;
    }

    .document-folder-chip {
        width: 100%;
        justify-content: space-between;
        border-radius: 0.5rem;
    }
}

.danger-zone {
    margin-top: 2rem;
    padding: 1rem;
    border: 1px solid #dc2626;
    border-radius: 8px;
    background: #fff1f2;
}

.danger-button {
    margin-top: 0.75rem;
    background: #b91c1c;
    color: #ffffff;
}

.danger-button:hover {
    background: #991b1b;
}
.note-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.note-original {
    margin: 0 20px 20px;
    padding: 16px;
    border: 1px solid #dbe3ee;
    border-left: 4px solid #64748b;
    border-radius: 8px;
    background: #f8fafc;
}

.note-original p {
    margin: 0 0 8px;
}

.note-original p:last-child {
    margin-bottom: 0;
}

.company-identity {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    min-width: 0;

    color: inherit;
    text-decoration: none;
}

.company-logo {
    display: block;
    width: auto;
    height: 42px;
    max-width: 200px;
    object-fit: contain;
}

.company-identity-text {
    display: flex;
    flex-direction: column;
    gap: 3px;

    padding-left: 16px;
    border-left: 1px solid currentColor;
}

.company-location {
    font-size: 0.88rem;
    font-weight: 700;
}

.company-application {
    font-size: 0.76rem;
    opacity: 0.8;
}

.company-identity:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 4px;
}

@media (max-width: 600px) {
    .company-identity {
        gap: 10px;
    }

    .company-logo {
        height: 32px;
        max-width: 140px;
    }

    .company-identity-text {
        padding-left: 10px;
    }
}

.audit-entry {
    padding: 16px 0;
    border-bottom: 1px solid #e2e8f0;
}

.audit-entry:last-child {
    border-bottom: 0;
}

.audit-entry-title {
    margin: 0 0 12px;
    color: #172b4d;
    font-size: 0.9rem;
    font-weight: 700;
}

.audit-entry-fields {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 8px 14px;
    margin: 0;
    font-size: 0.84rem;
}

.audit-entry-fields dt {
    color: #64748b;
    font-weight: 600;
}

.audit-entry-fields dd {
    margin: 0;
    color: #334155;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.audit-change-arrow {
    display: inline-block;
    margin: 0 6px;
    color: #64748b;
}

.audit-entry-details {
    margin: 0 0 8px;
    color: #334155;
    font-size: 0.84rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.audit-entry-recorded {
    margin: 0;
    color: #64748b;
    font-size: 0.78rem;
}

@media (max-width: 600px) {
    .audit-entry-fields {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .audit-entry-fields dd {
        margin-bottom: 8px;
    }
}
/* Login form sizing */
.login-form {
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
    margin: 24px auto;
}

.login-form input[type="email"],
.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    box-sizing: border-box;
}
