:root {
    --bg: #f3eee4;
    --surface: rgba(255, 253, 249, 0.95);
    --surface-strong: #ffffff;
    --surface-soft: rgba(255, 255, 255, 0.72);
    --text: #1e1c18;
    --muted: #6e675d;
    --line: #ddd0c0;
    --brand: #176b5a;
    --brand-dark: #114a3f;
    --success: #e7f7ee;
    --success-text: #1a6941;
    --error: #fdeceb;
    --error-text: #a0382d;
    --warning: #fdf1d7;
    --warning-text: #8a5d0e;
    --neutral: #ece7df;
    --neutral-text: #5e584f;
    --shadow: 0 24px 60px rgba(46, 35, 20, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(23, 107, 90, 0.12), transparent 28%),
        linear-gradient(180deg, #fbf7f1 0%, var(--bg) 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(14px);
    background: rgba(251, 247, 241, 0.86);
    border-bottom: 1px solid rgba(221, 208, 192, 0.9);
}

.topbar-inner {
    width: min(1220px, calc(100% - 32px));
    margin: 0 auto;
    padding: 16px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: block;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-copy strong {
    font-size: 16px;
}

.brand-copy small {
    color: var(--muted);
}

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

.nav-link {
    padding: 10px 14px;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(23, 107, 90, 0.1);
    color: var(--brand-dark);
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar-user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.topbar-user strong {
    font-size: 14px;
}

.topbar-user small {
    color: var(--muted);
}

.topbar-links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.container {
    width: min(1220px, calc(100% - 32px));
    margin: 0 auto;
    padding: 36px 0 60px;
}

.container.narrow {
    width: min(860px, calc(100% - 32px));
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(520px, 100%);
    padding: 32px;
    border-radius: 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.auth-brand {
    margin-bottom: 28px;
}

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 26px;
}

.hero.compact {
    align-items: flex-end;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.eyebrow {
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 12px;
    font-weight: 700;
    color: var(--brand);
}

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

h1 {
    margin-bottom: 10px;
    font-size: clamp(32px, 5vw, 48px);
    line-height: 1.05;
}

h2 {
    margin-bottom: 12px;
    font-size: 24px;
}

h3 {
    font-size: 18px;
}

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

.lead {
    max-width: 760px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-grid {
    grid-template-columns: minmax(320px, 1.1fr) minmax(280px, 0.9fr);
}

.card,
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    padding: 20px;
}

.stat-label {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-value {
    margin: 0;
    font-size: 30px;
    font-weight: 800;
}

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

.button,
button,
input,
textarea,
select,
label,
dt,
dd,
li,
th,
td {
    font-size: 15px;
    line-height: 1.55;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 20px;
    border: none;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.button:hover {
    background: var(--brand-dark);
    transform: translateY(-1px);
}

.button.secondary {
    background: transparent;
    color: var(--brand);
    border: 1px solid var(--line);
}

.button.danger {
    background: #b54639;
    color: #fff;
}

.button.danger:hover {
    background: #923629;
}

.button:disabled,
button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    transform: none;
}

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

.status {
    margin-bottom: 8px;
    font-weight: 700;
}

.status.good {
    color: var(--success-text);
}

.status.warn {
    color: var(--warning-text);
}

.alert {
    border-radius: 18px;
    padding: 14px 18px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert.success {
    background: var(--success);
    color: var(--success-text);
    border-color: #b8e6ca;
}

.alert.error {
    background: var(--error);
    color: var(--error-text);
    border-color: #efbcb6;
}

.field {
    margin-bottom: 18px;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    background: var(--surface-strong);
    color: var(--text);
    outline: none;
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(23, 107, 90, 0.12);
}

textarea {
    resize: vertical;
}

.hint,
.error-text {
    margin: 8px 0 0;
    font-size: 14px;
}

.error-text {
    color: var(--error-text);
}

.actions {
    padding-top: 10px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

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

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

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(221, 208, 192, 0.7);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.5);
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.danger-text {
    color: #b54639;
}

.details,
.detail-grid {
    display: grid;
    gap: 12px;
    margin: 0;
}

.detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.details div,
.detail-grid div {
    padding: 10px 0;
    border-bottom: 1px solid rgba(221, 208, 192, 0.7);
}

.details div:last-child,
.detail-grid div:last-child {
    border-bottom: none;
}

dt {
    font-weight: 700;
}

dd {
    margin: 4px 0 0;
    color: var(--muted);
    word-break: break-word;
}

.soft-panel,
.template-preview,
.stack-item,
.result-item {
    padding: 18px;
    border: 1px solid rgba(221, 208, 192, 0.82);
    border-radius: 18px;
    background: var(--surface-soft);
}

.template-header,
.result-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.template-copy {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

.template-component p {
    margin: 8px 0 0;
}

.inline-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.badge-good {
    background: #dff5e6;
    color: var(--success-text);
}

.badge-bad {
    background: #fde5e3;
    color: var(--error-text);
}

.badge-warn {
    background: var(--warning);
    color: var(--warning-text);
}

.badge-neutral {
    background: var(--neutral);
    color: var(--neutral-text);
}

.stack-list,
.result-list {
    display: grid;
    gap: 14px;
}

.stack-item h3,
.result-item h3 {
    margin: 0;
}

.checklist {
    margin: 0;
    padding-left: 20px;
}

.compact-list {
    margin-top: 8px;
}

.checkbox-list {
    display: grid;
    gap: 12px;
    max-height: 420px;
    overflow: auto;
    padding-right: 6px;
}

.checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(221, 208, 192, 0.7);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.66);
}

.checkbox-item input {
    width: auto;
    margin-top: 4px;
    padding: 0;
    box-shadow: none;
}

.status-line {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.progress-stack {
    display: grid;
    gap: 8px;
    min-width: 180px;
}

.progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.progress-meta strong {
    font-size: 14px;
}

.progress-meta span {
    color: var(--muted);
    font-size: 13px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(221, 208, 192, 0.95);
    overflow: hidden;
}

.progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2a9b7f 0%, var(--brand) 100%);
}

@media (max-width: 900px) {
    .topbar-inner,
    .hero,
    .hero.compact,
    .section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav {
        justify-content: flex-start;
    }

    .topbar-meta,
    .topbar-user {
        align-items: flex-start;
        justify-content: flex-start;
    }

    .form-grid,
    .field-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .container,
    .container.narrow,
    .topbar-inner {
        width: min(100% - 20px, 1220px);
    }

    .card,
    .stat-card {
        border-radius: 20px;
        padding: 18px;
    }

    .button,
    .button.secondary {
        width: 100%;
    }

    .hero-actions,
    .actions,
    .inline-form {
        width: 100%;
    }
}
