:root {
    --ink: #10231c;
    --ink-soft: #2e413a;
    --forest: #173f31;
    --forest-deep: #0b2b22;
    --moss: #a8d18d;
    --lime: #d9f99d;
    --paper: #f3f0e8;
    --paper-light: #fbfaf6;
    --line: #d9d7cf;
    --muted: #69746f;
    --danger: #a33a2b;
    --radius: 18px;
    --shadow: 0 24px 70px rgb(16 35 28 / 10%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper);
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--paper);
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-size: 17px;
    line-height: 1.6;
    text-rendering: optimizeLegibility;
}

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

a {
    color: inherit;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--lime);
    color: var(--ink);
    font-weight: 700;
    transform: translateY(-160%);
    transition: transform 160ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

:focus-visible {
    outline: 3px solid #5f8f35;
    outline-offset: 3px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
}

.brand > span:last-child {
    display: grid;
    line-height: 1.1;
}

.brand strong {
    font-size: 17px;
    letter-spacing: -0.02em;
}

.brand small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand-light {
    color: var(--paper-light);
}

.brand-light small {
    color: rgb(255 255 255 / 58%);
}

.brand-mark {
    display: grid;
    width: 34px;
    height: 38px;
    grid-template-columns: repeat(3, 1fr);
    align-items: end;
    gap: 3px;
}

.brand-mark i {
    display: block;
    border-radius: 3px 3px 1px 1px;
    background: currentColor;
}

.brand-mark i:nth-child(1) {
    height: 55%;
}

.brand-mark i:nth-child(2) {
    height: 100%;
}

.brand-mark i:nth-child(3) {
    height: 75%;
    background: var(--moss);
}

.kicker {
    margin: 0 0 12px;
    color: #537063;
    font-size: 13px;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1,
h2 {
    font-weight: 650;
    letter-spacing: -0.045em;
    line-height: 1.08;
}

h1 {
    max-width: 850px;
    margin-bottom: 24px;
    font-size: clamp(2.6rem, 7vw, 5.8rem);
}

h2 {
    margin-bottom: 16px;
    font-size: clamp(1.65rem, 3vw, 2.35rem);
}

.button {
    min-height: 48px;
    border: 0;
    border-radius: 999px;
    padding: 11px 22px;
    cursor: pointer;
    font-weight: 720;
    text-decoration: none;
    transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.button:not(:disabled):hover {
    transform: translateY(-1px);
}

.button-primary {
    background: var(--ink);
    color: white;
}

.button-primary:not(:disabled):hover {
    background: var(--forest);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.button-quiet {
    min-height: 40px;
    padding: 8px 16px;
    background: transparent;
    color: var(--ink);
}

.text-link,
.back-link {
    color: var(--forest);
    font-weight: 700;
    text-underline-offset: 4px;
}

.back-link {
    display: inline-flex;
    margin-bottom: 40px;
    font-size: 15px;
    text-decoration: none;
}

.back-link:hover,
.text-link:hover {
    text-decoration: underline;
}

.login-shell {
    background: var(--forest-deep);
}

.login-layout {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr);
}

.login-intro {
    display: flex;
    min-height: 100vh;
    padding: clamp(32px, 6vw, 88px);
    flex-direction: column;
    justify-content: space-between;
    color: var(--paper-light);
    background:
        linear-gradient(135deg, rgb(217 249 157 / 8%), transparent 46%),
        var(--forest-deep);
}

.login-thesis {
    max-width: 830px;
    padding: 80px 0;
}

.login-thesis .kicker {
    color: var(--moss);
}

.login-thesis p:last-child {
    max-width: 660px;
    margin-bottom: 0;
    color: rgb(255 255 255 / 70%);
    font-size: clamp(1.05rem, 2vw, 1.3rem);
}

.source-rail {
    display: grid;
    max-width: 850px;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    border-top: 1px solid rgb(255 255 255 / 20%);
}

.source-rail span {
    display: grid;
    padding: 18px 20px 0 0;
    color: rgb(255 255 255 / 72%);
    font-size: 14px;
}

.source-rail b {
    margin-bottom: 4px;
    color: var(--moss);
    font-size: 12px;
    letter-spacing: 0.12em;
}

.login-panel {
    display: grid;
    min-height: 100vh;
    padding: clamp(28px, 5vw, 80px);
    place-items: center;
    background: var(--paper-light);
}

.login-form {
    display: grid;
    width: min(100%, 460px);
    gap: 24px;
}

.login-form h2 {
    margin-bottom: 10px;
    font-size: clamp(2.2rem, 5vw, 3.6rem);
}

.form-intro,
.form-note {
    color: var(--muted);
}

.form-note {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
}

.form-error,
.flash {
    border-left: 4px solid var(--danger);
    padding: 13px 16px;
    background: #fff0ec;
    color: #6f2218;
}

.flash {
    width: min(100% - 40px, 1380px);
    margin: 24px auto 0;
    border-radius: 8px;
}

.flash-success {
    border-left-color: #4c8d54;
    background: #eaf3e9;
    color: #244d2a;
}

.field {
    display: grid;
    gap: 8px;
}

.field label {
    font-size: 15px;
    font-weight: 720;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid #c7cbc6;
    border-radius: 10px;
    padding: 12px 15px;
    background: white;
    color: var(--ink);
    font-size: 17px;
}

.field input,
.field select {
    min-height: 54px;
}

.field textarea {
    min-height: 112px;
    resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
    border-color: #87938d;
}

.optional {
    color: var(--muted);
    font-weight: 500;
}

.site-header {
    display: flex;
    width: min(100% - 40px, 1380px);
    min-height: 86px;
    margin: 0 auto;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-nav > a {
    padding: 10px 14px;
    font-size: 15px;
    font-weight: 680;
    text-decoration: none;
}

.page-shell {
    width: min(100% - 40px, 1380px);
    margin: 0 auto;
    padding: clamp(64px, 9vw, 128px) 0;
}

.page-shell-narrow {
    width: min(100% - 40px, 980px);
}

.page-heading {
    margin-bottom: 56px;
}

.page-heading h1,
.customer-hero h1 {
    max-width: 960px;
    font-size: clamp(3rem, 7vw, 6rem);
}

.form-card {
    display: grid;
    gap: 28px;
    border-radius: var(--radius);
    padding: clamp(28px, 5vw, 56px);
    background: var(--paper-light);
    box-shadow: var(--shadow);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.dashboard-hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 64px;
}

.dashboard-hero h1 {
    max-width: 900px;
    font-size: clamp(3rem, 7vw, 6.8rem);
}

.lead {
    max-width: 760px;
    margin-bottom: 0;
    color: var(--ink-soft);
    font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.protection-badge {
    display: flex;
    min-width: 275px;
    align-items: center;
    gap: 13px;
    border: 1px solid #bed2c2;
    border-radius: 14px;
    padding: 16px;
    background: #eaf3e9;
}

.protection-badge div {
    display: grid;
}

.protection-badge small {
    color: #557062;
}

.status-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #4c8d54;
    box-shadow: 0 0 0 5px rgb(76 141 84 / 13%);
}

.dashboard-grid {
    display: grid;
    margin-top: clamp(64px, 9vw, 120px);
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
    gap: 24px;
}

.primary-panel,
.guardrail-panel {
    border-radius: var(--radius);
    padding: clamp(28px, 4vw, 56px);
}

.primary-panel {
    background: var(--paper-light);
    box-shadow: var(--shadow);
}

.primary-panel > p {
    max-width: 680px;
    color: var(--ink-soft);
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    gap: 32px;
}

.step-number,
.count-badge {
    color: #b8c0bb;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.count-badge {
    display: grid;
    min-width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 999px;
    background: #e5ebe5;
    color: var(--forest);
    font-size: 14px;
}

.empty-state {
    margin: 24px 0 30px;
    border-left: 3px solid var(--moss);
    padding: 6px 0 6px 20px;
}

.empty-state p {
    margin: 5px 0 0;
    color: var(--muted);
}

.organization-list {
    display: grid;
    margin: 12px 0 32px;
    border-top: 1px solid var(--line);
}

.organization-list a {
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
}

.organization-list a:hover strong {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.organization-list a > span:first-child {
    display: grid;
}

.organization-list small {
    color: var(--muted);
}

.guardrail-panel {
    background: var(--forest);
    color: white;
}

.guardrail-panel .kicker {
    color: var(--moss);
}

.guardrail-list {
    display: grid;
    margin: 30px 0 0;
    padding: 0;
    gap: 24px;
    list-style: none;
}

.guardrail-list li {
    display: grid;
    grid-template-columns: 26px 1fr;
    gap: 12px;
}

.guardrail-list li > span {
    color: var(--moss);
    font-size: 22px;
    line-height: 1;
}

.guardrail-list div {
    display: grid;
}

.guardrail-list small {
    margin-top: 3px;
    color: rgb(255 255 255 / 62%);
}

.customer-hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 64px;
}

.customer-layout {
    display: grid;
    margin-top: clamp(56px, 8vw, 104px);
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
    align-items: start;
    gap: 24px;
}

.content-panel,
.upload-panel,
.bot-summary {
    border-radius: var(--radius);
    padding: clamp(28px, 4vw, 48px);
}

.content-panel {
    min-width: 0;
    background: var(--paper-light);
    box-shadow: var(--shadow);
}

.upload-panel {
    background: var(--forest);
    color: white;
}

.upload-panel .kicker {
    color: var(--moss);
}

.upload-panel .form-note {
    color: rgb(255 255 255 / 65%);
}

.upload-form {
    display: grid;
    gap: 22px;
}

.upload-form .field label {
    color: rgb(255 255 255 / 80%);
}

.upload-form .field select {
    border-color: rgb(255 255 255 / 20%);
    background: white;
}

.upload-form .button-primary {
    background: var(--lime);
    color: var(--ink);
}

.upload-form .button-primary:hover {
    background: var(--moss);
}

.file-field {
    position: relative;
    display: grid;
    min-height: 150px;
    border: 1px dashed rgb(255 255 255 / 35%);
    border-radius: 12px;
    place-items: center;
    text-align: center;
}

.file-field label {
    display: grid;
    padding: 24px;
    pointer-events: none;
}

.file-field span {
    margin-top: 5px;
    color: rgb(255 255 255 / 60%);
    font-size: 13px;
}

.file-field input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    opacity: 0;
}

.file-field:focus-within {
    outline: 3px solid var(--moss);
    outline-offset: 3px;
}

.document-list {
    display: grid;
    margin-top: 20px;
}

.document-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    border-top: 1px solid var(--line);
    padding: 20px 0;
}

.file-mark {
    display: grid;
    width: 48px;
    height: 56px;
    place-items: center;
    border-radius: 7px 7px 12px 7px;
    background: #e8eee7;
    color: var(--forest);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.08em;
}

.document-main {
    display: grid;
    min-width: 0;
}

.document-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-main small {
    margin-top: 3px;
    color: var(--muted);
}

.status {
    border-radius: 999px;
    padding: 5px 10px;
    background: #ecece8;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 760;
}

.status-published {
    background: #e2f1df;
    color: #28542f;
}

.status-ready {
    background: #fff2d8;
    color: #74521d;
}

.status-failed {
    background: #fff0ec;
    color: var(--danger);
}

.document-action {
    grid-column: 2 / -1;
    margin-top: -6px;
}

.button-small {
    min-height: 38px;
    padding: 7px 14px;
    background: transparent;
    color: var(--forest);
    box-shadow: inset 0 0 0 1px #8ca397;
    font-size: 13px;
}

.button-small:hover {
    background: #e8eee7;
}

.document-error {
    grid-column: 2 / -1;
    margin: -8px 0 0;
    color: var(--danger);
    font-size: 14px;
}

.bot-summary {
    display: grid;
    margin-top: 24px;
    grid-template-columns: minmax(240px, 0.45fr) minmax(0, 1fr);
    gap: 40px;
    background: var(--forest-deep);
    color: white;
}

.bot-summary .kicker {
    color: var(--moss);
}

.bot-summary h2 {
    margin-bottom: 0;
}

.bot-summary-copy > p:last-child {
    max-width: 520px;
    margin: 18px 0 0;
    color: rgb(255 255 255 / 66%);
}

.boundary-statement {
    border-left: 1px solid rgb(255 255 255 / 20%);
    padding-left: 40px;
}

.chat-tester {
    margin-top: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: clamp(28px, 4vw, 48px);
    background: #ebe8df;
}

.chat-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 24px;
}

.source-only-label {
    border: 1px solid #acc3ae;
    border-radius: 999px;
    padding: 7px 12px;
    background: #e3efe0;
    color: #315f39;
    font-size: 12px;
    font-weight: 780;
}

.chat-form {
    display: grid;
    max-width: 820px;
    margin-top: 24px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 16px;
}

.chat-form .field {
    min-width: 0;
}

.chat-form .button {
    min-height: 54px;
    margin-bottom: 0;
}

.chat-answer {
    max-width: 920px;
    margin-top: 32px;
    border-left: 4px solid #4c8d54;
    border-radius: 0 12px 12px 0;
    padding: 24px;
    background: var(--paper-light);
}

.chat-answer-refused {
    border-left-color: #b68342;
}

.answer-label {
    margin-bottom: 8px;
    color: #4b6e56;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.chat-answer-refused .answer-label {
    color: #8a5a22;
}

.answer-text {
    margin-bottom: 0;
    white-space: normal;
}

.source-list {
    margin-top: 20px;
    border-top: 1px solid var(--line);
    padding-top: 16px;
    font-size: 14px;
}

.source-list ul {
    margin: 8px 0 0;
    padding-left: 20px;
    color: var(--muted);
}

.boundary-statement p {
    max-width: 690px;
    margin: 7px 0 0;
    color: rgb(255 255 255 / 68%);
}

@media (max-width: 900px) {
    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-intro,
    .login-panel {
        min-height: auto;
    }

    .source-rail {
        grid-template-columns: 1fr;
    }

    .source-rail span {
        grid-template-columns: 42px 1fr;
        border-top: 1px solid rgb(255 255 255 / 12%);
    }

    .login-panel {
        padding-top: 72px;
        padding-bottom: 72px;
    }

    .dashboard-hero {
        align-items: start;
        flex-direction: column;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .customer-hero {
        align-items: start;
        flex-direction: column;
    }

    .customer-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    body {
        font-size: 16px;
    }

    .login-intro {
        padding: 28px 22px 42px;
    }

    .login-thesis {
        padding: 72px 0;
    }

    .login-panel {
        padding: 56px 22px;
    }

    .site-header {
        width: min(100% - 28px, 1380px);
    }

    .site-nav > a {
        display: none;
    }

    .page-shell {
        width: min(100% - 28px, 1380px);
    }

    .primary-panel,
    .guardrail-panel {
        padding: 26px 22px;
    }

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

    .form-actions .text-link {
        text-align: center;
    }

    .document-row {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .file-mark {
        width: 42px;
        height: 50px;
    }

    .status {
        grid-column: 2;
        justify-self: start;
    }

    .bot-summary {
        grid-template-columns: 1fr;
    }

    .boundary-statement {
        border-top: 1px solid rgb(255 255 255 / 20%);
        border-left: 0;
        padding-top: 24px;
        padding-left: 0;
    }

    .chat-heading {
        flex-direction: column;
    }

    .chat-form {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
