:root {
    --bg: #f5efe5;
    --bg-accent: #f0d7b6;
    --card: rgba(255, 251, 246, 0.86);
    --card-strong: #fff9f1;
    --ink: #1f1c1a;
    --muted: #615650;
    --line: rgba(84, 67, 53, 0.14);
    --primary: #0f766e;
    --primary-strong: #0a5d56;
    --danger: #ba3a2d;
    --warn: #b67d20;
    --shadow: 0 24px 70px rgba(55, 39, 18, 0.14);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), transparent 35%),
        radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.12), transparent 28%),
        linear-gradient(135deg, var(--bg), #f8f4ed 42%, var(--bg-accent));
}

body {
    padding: 28px;
}

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

button {
    cursor: pointer;
}

code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.page-shell {
    max-width: 1180px;
    margin: 0 auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 24px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 32px;
    background: rgba(255, 251, 246, 0.74);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}

.topbar > div:first-child {
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand-mark {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: #f8fffd;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    box-shadow: 0 18px 36px rgba(15, 118, 110, 0.25);
}

.brand-copy h1,
.panel__header h2,
.auth-card h2,
.diagnostic-item h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-copy p,
.diagnostic-item p,
.auth-card__intro p,
.selection-box p,
.dropzone p,
.upload-context,
.result-card__meta,
.empty-state {
    color: var(--muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-pill {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(15, 118, 110, 0.08);
}

.user-pill__label,
.eyebrow,
.panel__badge,
.selection-box__label {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
    color: var(--muted);
}

main {
    margin-top: 28px;
}

.screen {
    display: none;
}

.screen--active,
.screen:not(.is-hidden) {
    display: block;
}

.panel,
.auth-card {
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: var(--radius-lg);
    background: var(--card);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.panel {
    padding: 24px;
}

.panel + .panel {
    margin-top: 24px;
}

.panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.panel__badge {
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.1);
    white-space: nowrap;
}

.auth-card {
    max-width: 560px;
    margin: 60px auto 0;
    padding: 30px;
}

.auth-card__intro {
    margin-bottom: 20px;
}

.auth-form,
.upload-form {
    display: grid;
    gap: 18px;
}

.auth-form label,
.upload-form label {
    display: grid;
    gap: 8px;
}

input[type="text"],
input[type="password"],
select,
textarea,
.copy-field__input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--ink);
}

textarea.copy-field__input {
    min-height: 76px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
.dropzone:focus {
    outline: 3px solid rgba(20, 184, 166, 0.18);
    border-color: rgba(15, 118, 110, 0.42);
}

.primary-button,
.ghost-button,
.copy-field__button,
.cancel-button {
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 600;
    transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.primary-button {
    background: linear-gradient(135deg, var(--primary), #14b8a6);
    color: #f7fffd;
    box-shadow: 0 16px 28px rgba(15, 118, 110, 0.22);
}

.ghost-button,
.copy-field__button,
.cancel-button {
    background: rgba(15, 118, 110, 0.08);
    color: var(--primary-strong);
}

.primary-button:hover,
.ghost-button:hover,
.copy-field__button:hover,
.cancel-button:hover {
    transform: translateY(-1px);
}

.ghost-button[disabled],
.primary-button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.dropzone {
    position: relative;
    display: grid;
    place-items: center;
    gap: 12px;
    min-height: 270px;
    padding: 32px;
    border: 2px dashed rgba(15, 118, 110, 0.35);
    border-radius: 26px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(241, 253, 251, 0.84)),
        radial-gradient(circle at top right, rgba(20, 184, 166, 0.15), transparent 30%);
    text-align: center;
}

.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.dropzone__copy {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.dropzone--active {
    border-color: rgba(15, 118, 110, 0.9);
    background:
        linear-gradient(145deg, rgba(237, 255, 252, 0.95), rgba(255, 255, 255, 0.9)),
        radial-gradient(circle at top right, rgba(20, 184, 166, 0.22), transparent 34%);
}

.dropzone--disabled {
    opacity: 0.55;
    pointer-events: none;
}

.upload-form__grid {
    display: grid;
    grid-template-columns: minmax(260px, 340px) 1fr;
    gap: 18px;
}

.selection-box {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card-strong);
}

.selection-box strong {
    display: block;
    margin-top: 8px;
    font-size: 1.05rem;
}

.form-actions,
.action-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.66);
}

.checkbox-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--primary);
}

.checkbox-row span {
    display: grid;
    gap: 4px;
}

.checkbox-row small {
    color: var(--muted);
}

.diagnostics-list,
.upload-list {
    display: grid;
    gap: 14px;
}

.diagnostic-item,
.upload-item,
.result-card,
.error-card {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
}

.diagnostic-item {
    grid-template-columns: 84px 1fr;
    align-items: start;
}

.diagnostic-item__status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 14px;
    font-weight: 700;
}

.diagnostic-item--ok .diagnostic-item__status {
    background: rgba(15, 118, 110, 0.12);
    color: var(--primary-strong);
}

.diagnostic-item--warn .diagnostic-item__status {
    background: rgba(182, 125, 32, 0.14);
    color: var(--warn);
}

.upload-item__top,
.result-card__top {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
}

.upload-item__meta,
.result-card__meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.progress {
    width: 100%;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.09);
}

.progress__bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #34d399);
    transition: width 0.16s ease;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.1);
    color: var(--primary-strong);
    font-weight: 600;
}

.status-chip--error {
    background: rgba(186, 58, 45, 0.12);
    color: var(--danger);
}

.status-chip--cancelled {
    background: rgba(97, 86, 80, 0.12);
    color: var(--muted);
}

.status-chip--warning {
    background: rgba(182, 125, 32, 0.12);
    color: var(--warn);
}

.copy-fields {
    display: grid;
    gap: 12px;
}

.copy-field {
    display: grid;
    gap: 6px;
}

.copy-field__row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: stretch;
}

.copy-field__button {
    min-width: 52px;
    display: inline-grid;
    place-items: center;
}

.copy-field__button svg {
    width: 19px;
    height: 19px;
}

.result-card {
    grid-template-columns: 120px 1fr;
    gap: 18px;
}

.result-card__preview {
    display: grid;
    place-items: center;
    min-height: 120px;
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.88)),
        rgba(255, 255, 255, 0.8);
    overflow: hidden;
}

.result-card__preview img {
    max-width: 100%;
    max-height: 120px;
    display: block;
}

.file-icon {
    width: 76px;
    height: 92px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #fff;
    background: linear-gradient(160deg, #374151, #111827);
}

.file-icon--pdf { background: linear-gradient(160deg, #b91c1c, #7f1d1d); }
.file-icon--doc { background: linear-gradient(160deg, #2563eb, #1d4ed8); }
.file-icon--sheet { background: linear-gradient(160deg, #15803d, #166534); }
.file-icon--archive { background: linear-gradient(160deg, #7c3aed, #5b21b6); }
.file-icon--video { background: linear-gradient(160deg, #ea580c, #c2410c); }
.file-icon--text { background: linear-gradient(160deg, #475569, #334155); }

.alert {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid transparent;
    white-space: pre-line;
}

.alert--error {
    background: rgba(186, 58, 45, 0.1);
    border-color: rgba(186, 58, 45, 0.18);
    color: #7f1d1d;
}

.alert--success {
    background: rgba(15, 118, 110, 0.1);
    border-color: rgba(15, 118, 110, 0.18);
    color: var(--primary-strong);
}

.upload-context {
    margin-bottom: 18px;
}

.is-hidden {
    display: none !important;
}

@media (max-width: 840px) {
    body {
        padding: 18px;
    }

    .topbar,
    .panel__header,
    .upload-form__grid,
    .result-card,
    .diagnostic-item {
        grid-template-columns: 1fr;
        display: grid;
    }

    .topbar {
        justify-content: stretch;
    }

    .topbar > div:first-child,
    .upload-item__top,
    .result-card__top {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-actions {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
    }

    .copy-field__row {
        grid-template-columns: 1fr;
    }

    .copy-field__button {
        width: 100%;
    }
}
