:root {
    --bg: #f4efe6;
    --surface: #fffaf2;
    --surface-strong: #ffffff;
    --ink: #1f2a2a;
    --muted: #556161;
    --line: #d9d2c4;
    --brand: #0f766e;
    --brand-strong: #0b5c56;
    --accent: #dd6b20;
    --danger: #b83232;
    --radius: 14px;
    --shadow: 0 12px 30px rgba(16, 24, 24, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    background:
        radial-gradient(1200px 420px at 5% -10%, rgba(15, 118, 110, 0.15), transparent 70%),
        radial-gradient(900px 380px at 95% 10%, rgba(221, 107, 32, 0.14), transparent 70%),
        var(--bg);
}

.site-shell {
    width: min(1024px, 94vw);
    margin: 0 auto;
    padding: 28px 0 44px;
}

.site-header {
    background: linear-gradient(135deg, #102f2d 0%, #0f4f4a 60%, #0c3e3a 100%);
    color: #f9f8f4;
    border-radius: calc(var(--radius) + 6px);
    box-shadow: var(--shadow);
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.brand h1 {
    margin: 0;
    font-size: 1.25rem;
    letter-spacing: 0.02em;
}

.brand p {
    margin: 4px 0 0;
    opacity: 0.9;
    font-size: 0.92rem;
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.main-nav a {
    color: #f9f8f4;
    text-decoration: none;
    border: 1px solid rgba(249, 248, 244, 0.35);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 0.9rem;
    transition: transform 120ms ease, background-color 120ms ease;
}

.main-nav a:hover {
    background: rgba(249, 248, 244, 0.13);
    transform: translateY(-1px);
}

.page-card {
    margin-top: 18px;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    animation: lift-in 250ms ease;
}

.page-title {
    margin: 0;
    font-size: clamp(1.2rem, 2vw, 1.7rem);
}

.page-subtitle {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.4;
}

.form-stack {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.processing-status {
    margin: 2px 0 0;
    border: 1px solid #c8e5e3;
    background: #eef9f8;
    color: #0b5c56;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.94rem;
}

.progress-shell {
    margin-top: -2px;
}

.progress-shell-large {
    margin-top: 16px;
}

.progress-shell-large .progress-track {
    height: 14px;
}

.progress-track {
    width: 100%;
    height: 10px;
    background: #d5ebe8;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #bedfd9;
}

.progress-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #0f766e 0%, #0ea5a4 45%, #14b8a6 100%);
    border-radius: 999px;
    transition: width 280ms ease;
}

.progress-label {
    margin: 8px 0 0;
    color: #24514d;
    font-size: 0.9rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="file"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    background: var(--surface);
}

input:focus {
    outline: 2px solid rgba(15, 118, 110, 0.3);
    border-color: var(--brand);
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 14px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 120ms ease, background-color 120ms ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #f9f8f4;
}

.btn-primary:hover {
    background: var(--brand-strong);
}

.btn.is-loading {
    position: relative;
    opacity: 0.95;
}

.btn.is-loading::after {
    content: "";
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border-radius: 999px;
    border: 2px solid rgba(249, 248, 244, 0.5);
    border-top-color: #f9f8f4;
    animation: spin 800ms linear infinite;
}

.btn-ghost {
    border-color: var(--line);
    color: var(--ink);
    background: var(--surface-strong);
}

.alert {
    margin-top: 14px;
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid;
}

.alert-error {
    background: #fff1f1;
    color: var(--danger);
    border-color: #f3b8b8;
}

.meta {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.95rem;
}

.signature-mark {
    margin: 18px 0 0;
    text-align: right;
    color: #5b6b69;
    font-size: 0.86rem;
    letter-spacing: 0.22em;
    font-weight: 700;
    user-select: none;
}

.signature-mark .fa-brands {
    margin-left: 6px;
    font-size: 0.95em;
}

.preview-grid {
    display: grid;
    gap: 14px;
    margin-top: 12px;
}

.preview-section {
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface);
}

.preview-section h3 {
    margin: 0;
    padding: 10px 12px;
    font-size: 1rem;
    border-bottom: 1px solid var(--line);
    background: #f4f8f8;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table th,
.table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.table th {
    color: var(--muted);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    width: 34%;
}

@keyframes lift-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 740px) {
    .site-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-card {
        padding: 16px;
    }
}
