:root {
    --ink: #17211b;
    --muted: #66736b;
    --line: #dce3de;
    --surface: #ffffff;
    --page: #f4f7f5;
    --green: #176b43;
    --green-dark: #0e4d2f;
    --green-soft: #e7f3ec;
    --amber: #c86722;
    --amber-soft: #fff1e7;
    --danger: #a83232;
    --danger-soft: #fff0f0;
    --shadow: 0 8px 26px rgba(24, 48, 34, 0.08);
}

* { box-sizing: border-box; }

html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--page); }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }

.topbar {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 10px max(20px, calc((100vw - 1180px) / 2));
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand > span:last-child { display: grid; }
.brand strong { font-size: 16px; }
.brand small { color: var(--muted); font-size: 12px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; background: var(--green); color: white; font-weight: 800; border-radius: 6px; }
.brand-mark.large { width: 50px; height: 50px; font-size: 18px; flex: 0 0 auto; }

.nav-actions { display: flex; align-items: center; gap: 8px; }
.nav-actions > a:not(.button) { padding: 9px 10px; text-decoration: none; color: var(--muted); font-weight: 650; }
.nav-actions form { margin: 0; }

.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 40px 0 72px; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #eef6f1 0 55%, #fff4ea 55%); }
.auth-panel { width: min(100%, 470px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 32px; }
.auth-heading { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 28px; }
.auth-heading h1 { margin: 2px 0 8px; font-size: 25px; }
.auth-heading p:last-child { margin: 0; color: var(--muted); line-height: 1.5; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin: 3px 0 7px; font-size: clamp(28px, 4vw, 38px); letter-spacing: 0; }
.page-heading p:last-child { margin: 0; color: var(--muted); }
.eyebrow { margin: 0; color: var(--amber); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.muted { color: var(--muted); line-height: 1.6; }

.button { min-height: 42px; border: 1px solid transparent; border-radius: 6px; padding: 9px 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 750; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--green); color: #fff; }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { background: var(--green-soft); color: var(--green-dark); border-color: #b8d9c7; }
.button-quiet { background: transparent; color: var(--muted); border-color: var(--line); }
.button-full { width: 100%; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--danger); font-size: 22px; cursor: pointer; }

.stack-form { display: grid; gap: 18px; }
.honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
label, .field-group { display: grid; gap: 7px; font-size: 14px; font-weight: 700; color: #34423a; }
label strong { color: var(--danger); }
input, select, textarea { width: 100%; min-height: 44px; border: 1px solid #cbd5ce; border-radius: 6px; background: #fff; color: var(--ink); padding: 10px 12px; outline: none; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 107, 67, .12); }

.alert { margin: 0 0 24px; padding: 13px 16px; border-radius: 6px; font-weight: 650; }
.alert-success { color: var(--green-dark); background: var(--green-soft); border: 1px solid #b7dbc7; }
.alert-error { color: var(--danger); background: var(--danger-soft); border: 1px solid #efc5c5; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.metric span, .metric small { display: block; color: var(--muted); }
.metric strong { display: block; margin: 5px 0; font-size: 33px; line-height: 1; }
.metric small { font-size: 12px; }

.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 22px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.panel h2 { margin: 3px 0 0; font-size: 19px; }
.recent-panel { margin-top: 18px; }

.download-list { display: grid; gap: 10px; margin-top: 17px; }
.download-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; }
.download-item:hover { border-color: var(--green); background: #fbfdfc; }
.download-item span { display: grid; gap: 3px; }
.download-item small { color: var(--muted); }
.download-item b { color: var(--green); font-size: 12px; }

.ranking { margin: 0; padding: 0 0 0 26px; }
.ranking.plain { list-style: none; padding-left: 0; }
.ranking li { padding: 10px 0; border-bottom: 1px solid #edf1ee; }
.ranking li:last-child { border-bottom: 0; }
.ranking li::marker { color: var(--amber); font-weight: 800; }
.ranking li { display: list-item; }
.ranking li span { padding-right: 10px; }
.ranking li strong { float: right; color: var(--muted); font-size: 12px; }
.empty-state { color: var(--muted); padding: 20px 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { color: var(--muted); font-size: 12px; text-align: left; text-transform: uppercase; }
th, td { padding: 12px 10px; border-bottom: 1px solid #edf1ee; white-space: nowrap; }
code { background: #eef2ef; border-radius: 4px; padding: 2px 5px; font-size: 12px; }

.progress-wrap { width: min(260px, 35vw); display: grid; gap: 7px; }
.progress-wrap span { color: var(--muted); font-size: 12px; font-weight: 700; text-align: right; }
progress { width: 100%; height: 8px; border: 0; border-radius: 10px; overflow: hidden; background: #dde5df; }
progress::-webkit-progress-bar { background: #dde5df; }
progress::-webkit-progress-value { background: var(--green); }
progress::-moz-progress-bar { background: var(--green); }

.form-section { margin: 0 0 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 24px; }
.form-section legend { padding: 0 10px 0 0; font-size: 18px; font-weight: 800; }
.form-section legend span { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 8px; border-radius: 50%; background: var(--green-soft); color: var(--green-dark); font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.span-2 { grid-column: 1 / -1; }
.field-label { font-size: 14px; font-weight: 700; }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.choice { display: flex; align-items: center; gap: 8px; min-height: 44px; border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; font-weight: 600; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.choice input { width: 17px; min-height: 17px; margin: 0; accent-color: var(--green); }
.section-note { margin: 0 0 18px; color: var(--muted); }
.product-list { display: grid; gap: 14px; margin-bottom: 14px; }
.product-row { border: 1px solid #cfd9d2; border-left: 4px solid var(--amber); border-radius: 6px; padding: 18px; background: #fcfdfc; }
.product-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 8px; }
.confirmation-panel { width: min(100%, 640px); margin: 70px auto; padding: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.confirmation-panel h1 { margin: 5px 0 10px; font-size: 30px; }
.confirmation-panel > p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.confirmation-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

[hidden] { display: none !important; }

@media (max-width: 760px) {
    .topbar { align-items: flex-start; padding: 10px 16px; }
    .brand small, .nav-actions > a:not(.button) { display: none; }
    .nav-actions { gap: 5px; }
    .nav-actions .button { padding-inline: 10px; font-size: 13px; }
    .page-shell { width: min(100% - 28px, 1180px); padding-top: 26px; }
    .page-heading { align-items: stretch; flex-direction: column; }
    .page-heading > .button { align-self: flex-start; }
    .progress-wrap { width: 100%; }
    .progress-wrap span { text-align: left; }
    .metrics, .dashboard-grid, .form-grid, .product-grid { grid-template-columns: 1fr; }
    .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .metric { padding: 15px; }
    .metric strong { font-size: 26px; }
    .metric small { display: none; }
    .span-2 { grid-column: auto; }
    .choice-grid { grid-template-columns: 1fr 1fr; }
    .form-section { padding: 20px 16px; }
    .auth-panel { padding: 24px; }
}

@media (max-width: 480px) {
    .brand > span:last-child { display: none; }
    .nav-actions .button-quiet { padding-inline: 8px; }
    .metrics { grid-template-columns: 1fr; }
    .metric { display: grid; grid-template-columns: 1fr auto; align-items: center; }
    .metric strong { grid-row: 1 / 3; grid-column: 2; }
    .choice-grid { grid-template-columns: 1fr; }
    .form-actions { align-items: stretch; flex-direction: column-reverse; }
    .form-actions .button { width: 100%; }
}
