:root {
    --ink: #132033;
    --muted: #64748b;
    --line: #d7dde7;
    --panel: #ffffff;
    --soft: #f5f7fb;
    --navy: #10324a;
    --teal: #0f766e;
    --blue: #0b6fc7;
    --gold: #b7791f;
    --coral: #c2410c;
    --success: #0f7a48;
    --warning: #a16207;
    --danger: #b42318;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--soft);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}

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

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
}

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

label {
    display: grid;
    gap: 7px;
    color: var(--ink);
}

label span,
.compact-form span,
.filters span {
    color: #44546a;
    font-size: 12px;
    font-weight: 700;
}

.field-note {
    color: var(--muted);
    display: block;
    font-size: 12px;
    line-height: 1.45;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 10px 12px;
    outline: none;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0 15px;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    text-decoration: none;
}

.btn.primary {
    background: var(--teal);
    color: #fff;
}

.btn.primary:hover {
    background: #0b625d;
}

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

.btn.secondary:hover {
    border-color: #a8b3c4;
}

.text-button {
    border: 0;
    background: transparent;
    color: var(--coral);
    cursor: pointer;
    font-weight: 700;
    padding: 0;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    background: #0f2438;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 22px;
}

.brand {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 12px;
    align-items: center;
    color: #fff;
}

.brand img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
}

.brand strong,
.mini-profile strong {
    display: block;
}

.brand small,
.mini-profile small {
    display: block;
    color: #b8c5d5;
    margin-top: 3px;
}

.nav {
    display: grid;
    gap: 6px;
    margin-top: 34px;
}

.nav a,
.ghost-link {
    color: #e7eef8;
    border-radius: 8px;
    padding: 11px 12px;
}

.nav a:hover,
.ghost-link:hover {
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

.ghost-link.dark {
    color: var(--ink);
    background: #f1f5f9;
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 14px;
}

.mini-profile,
.person {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dff7f3;
    color: #075e58;
    font-weight: 800;
    flex: 0 0 auto;
}

.avatar.small {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

.app-shell {
    margin-left: 260px;
    padding: 26px;
}

.topbar {
    min-height: 86px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.topbar p,
.panel-head p,
.eyebrow {
    margin: 0 0 5px;
    color: var(--teal);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.topbar h1,
.panel-head h2 {
    margin: 0;
}

.top-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.flash {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-weight: 700;
}

.flash-success {
    background: #dcfce7;
    color: #166534;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
}

.flash-warning {
    background: #fef3c7;
    color: #92400e;
}

.grid {
    display: grid;
    gap: 16px;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 16px;
}

.stat,
.panel {
    background: var(--panel);
    border: 1px solid #e4e9f1;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.stat {
    padding: 18px;
}

.stat span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat strong {
    font-size: 22px;
}

.panel {
    padding: 20px;
}

.panel.wide,
.settings-panel {
    max-width: 1080px;
}

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

.work-area {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.two-columns {
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.detail-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.detail-list div {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 12px;
    border-bottom: 1px solid #eef2f7;
    padding-bottom: 10px;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 700;
}

.detail-list dd {
    margin: 0;
}

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

.hint {
    margin: 10px 0 0;
    font-size: 12px;
}

.compact-form,
.report-form {
    display: grid;
    gap: 14px;
}

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

.filters {
    display: flex;
    align-items: end;
    gap: 12px;
    margin-bottom: 16px;
}

.filters label {
    min-width: 190px;
}

.report-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    align-items: end;
}

.filter-actions {
    display: flex;
    gap: 10px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-row input {
    width: auto;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.task-report-table {
    direction: ltr;
    min-width: 1080px;
}

.task-report-table th,
.task-report-table td {
    text-align: left;
}

.task-report-table th:first-child,
.task-report-table td:first-child {
    width: 74px;
}

.task-report-table th:nth-child(2),
.task-report-table td:nth-child(2) {
    width: 170px;
}

.task-report-table th:nth-child(3),
.task-report-table td:nth-child(3) {
    width: 190px;
}

.task-report-table th:nth-child(5),
.task-report-table td:nth-child(5) {
    width: 150px;
}

.task-report-table th:nth-child(6),
.task-report-table td:nth-child(6) {
    width: 190px;
}

.task-report-table th:last-child,
.task-report-table td:last-child {
    width: 120px;
}

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

th,
td {
    border-bottom: 1px solid #edf1f6;
    padding: 11px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    color: #405169;
    font-size: 12px;
    text-transform: uppercase;
}

.actions {
    text-align: right;
}

.empty {
    color: var(--muted);
    text-align: center;
    padding: 24px;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    background: #eef2f7;
    color: #334155;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 800;
}

.pill.ok {
    background: #dcfce7;
    color: var(--success);
}

.pill.warn {
    background: #fef3c7;
    color: var(--warning);
}

.tasks-head,
.task-row-head,
.form-actions,
.report-toolbar,
.add-task-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tasks-head h3 {
    margin: 0;
}

.task-list {
    display: grid;
    gap: 14px;
}

.task-entry-table {
    direction: ltr;
    min-width: 900px;
}

.task-entry-table th,
.task-entry-table td {
    text-align: left;
    vertical-align: middle;
}

.task-entry-table th:first-child,
.task-entry-table td:first-child {
    width: 76px;
}

.task-entry-table th:nth-child(2),
.task-entry-table td:nth-child(2) {
    width: 230px;
}

.task-entry-table th:nth-child(4),
.task-entry-table td:nth-child(4) {
    width: 160px;
}

.task-entry-table th:last-child,
.task-entry-table td:last-child {
    width: 90px;
}

.task-entry-table textarea {
    min-height: 54px;
}

.add-task-bar {
    justify-content: center;
    border: 1px dashed #b8c5d5;
    border-radius: 8px;
    background: #f8fafc;
    padding: 14px;
}

.task-row {
    border: 1px solid #e1e7f0;
    border-radius: 8px;
    padding: 15px;
    display: grid;
    gap: 12px;
}

.task-row legend {
    font-weight: 800;
}

.subtle-form {
    margin-top: 14px;
    border-top: 1px solid #edf1f6;
    padding-top: 14px;
}

.login-page {
    background:
        linear-gradient(90deg, rgba(15, 36, 56, 0.82), rgba(15, 36, 56, 0.34) 48%, rgba(238, 243, 247, 0.94) 78%),
        url("../images/login-background.png") center center / cover no-repeat fixed;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
}

.login-visual {
    position: relative;
    overflow: hidden;
    padding: 46px;
    color: #fff;
    background: linear-gradient(135deg, rgba(15, 50, 74, 0.72), rgba(15, 118, 110, 0.48) 58%, rgba(15, 50, 74, 0.2));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
}

.logo-row {
    display: flex;
    gap: 12px;
}

.logo-row img,
.form-head img {
    width: 58px;
    height: 58px;
    background: #fff;
    border-radius: 8px;
    object-fit: contain;
    padding: 4px;
}

.login-visual h1 {
    max-width: 620px;
    margin: 0;
    font-size: 46px;
    line-height: 1.04;
}

.login-copy {
    max-width: 540px;
    color: #dbeafe;
    font-size: 16px;
    line-height: 1.7;
}

.login-copy.compact {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.65;
}

.report-preview {
    width: min(100%, 520px);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 8px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.12);
    display: grid;
    gap: 8px;
}

.report-preview span,
.report-preview small {
    color: #e0f2fe;
}

.report-preview strong {
    font-size: 20px;
}

.report-preview small {
    line-height: 1.55;
}

.login-panel {
    display: grid;
    place-items: center;
    padding: 40px 28px;
    background: rgba(238, 243, 247, 0.74);
    backdrop-filter: blur(2px);
}

.auth-form {
    width: min(100%, 420px);
    background: #fff;
    border: 1px solid #e3e9f2;
    border-radius: 8px;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.12);
    padding: 28px;
    display: grid;
    gap: 16px;
}

.form-head {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 4px;
}

.form-head p {
    margin: 0 0 3px;
    color: var(--teal);
    font-weight: 800;
}

.form-head h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.15;
}

.login-card-copy {
    color: #526176;
    line-height: 1.6;
    margin: 0;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, 0.62);
    padding: 22px;
}

.modal-card {
    width: min(100%, 460px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.22);
    padding: 24px;
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.modal-head p {
    color: var(--teal);
    font-size: 12px;
    font-weight: 800;
    margin: 0 0 5px;
    text-transform: uppercase;
}

.modal-head h2 {
    margin: 0;
}

.report-paper {
    max-width: 1040px;
}

.report-toolbar {
    margin-bottom: 14px;
    justify-content: flex-end;
}

.workflow-panel {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
}

.workflow-panel h2 {
    margin: 0;
}

.workflow-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.paper {
    background: #fff;
    border: 1px solid #ccd5e1;
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.paper-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    color: #006fc9;
}

.paper-head h2 {
    margin: 0;
    font-size: 18px;
}

.paper-logos {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.paper-logos img {
    width: 58px;
    height: 46px;
    object-fit: contain;
}

.meta-table,
.summary-table {
    margin-top: 16px;
    border: 1px solid #b9c3d0;
}

.meta-table th,
.summary-table th {
    width: 150px;
    background: #f1f5f9;
    color: #0f172a;
    text-transform: uppercase;
    font-size: 11px;
}

.meta-table td,
.meta-table th,
.summary-table td,
.summary-table th {
    border: 1px solid #b9c3d0;
}

.paper h3 {
    margin: 22px 0 10px;
    font-size: 13px;
}

.description-box {
    border: 1px solid #b9c3d0;
    background: #f8fafc;
}

.description-box h4 {
    margin: 0;
    padding: 8px 10px;
    background: #dce3ec;
    border-bottom: 1px solid #b9c3d0;
    font-size: 12px;
}

.description-box ol {
    margin: 18px 22px 22px;
}

.description-box li {
    margin-bottom: 10px;
}

.description-box p {
    margin: 6px 0;
    line-height: 1.55;
}

@media (max-width: 980px) {
    .sidebar {
        position: static;
        width: auto;
        min-height: auto;
    }

    .app-shell {
        margin-left: 0;
        padding: 18px;
    }

    .stats-grid,
    .two-columns,
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-visual {
        min-height: 430px;
    }
}

@media (max-width: 640px) {
    .topbar,
    .panel-head,
    .tasks-head,
    .task-row-head,
    .form-actions,
    .paper-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .inline-fields,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .filters {
        align-items: stretch;
        flex-direction: column;
    }

    .filters label {
        min-width: 0;
    }

    .report-filters {
        grid-template-columns: 1fr;
    }

    .filter-actions,
    .workflow-panel,
    .workflow-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .login-visual {
        padding: 30px;
    }

    .login-visual h1 {
        font-size: 34px;
    }

    .auth-form {
        padding: 22px;
    }
}
