:root {
    --bg: #f6f3ee;
    --panel: #fffdf9;
    --text: #241f1b;
    --muted: #766d63;
    --line: #e5ded4;
    --accent: #24201c;
    --accent-soft: #ede6da;
    --success: #136f3a;
    --danger: #a33a2f;
    --warning: #9b6a17;
    --shadow: 0 18px 50px rgba(34, 28, 22, .08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, #fff8ec 0, var(--bg) 40%, #eee7dd 100%);
    color: var(--text);
    min-height: 100vh;
}
a { color: inherit; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 32px;
    background: rgba(246, 243, 238, .88);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand a { font-size: 22px; font-weight: 800; text-decoration: none; letter-spacing: -.03em; }
.brand span { color: var(--muted); font-size: 14px; }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a, .text-link { color: var(--text); text-decoration: none; border-bottom: 1px solid transparent; }
.nav a:hover, .text-link:hover { border-color: currentColor; }
.container { width: min(1180px, calc(100% - 32px)); margin: 32px auto 64px; }
.footer { display: flex; justify-content: space-between; width: min(1180px, calc(100% - 32px)); margin: 48px auto 24px; color: var(--muted); font-size: 13px; }
.page-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 24px; }
h1, h2, h3 { margin: 0; line-height: 1.12; letter-spacing: -.035em; }
h1 { font-size: clamp(34px, 5vw, 62px); }
h2 { font-size: 26px; margin-bottom: 18px; }
h3 { font-size: 20px; }
p { line-height: 1.55; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.panel, .auth-card {
    background: rgba(255, 253, 249, .92);
    border: 1px solid var(--line);
    border-radius: 28px;
    padding: 26px;
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}
.panel.highlight { background: linear-gradient(135deg, #fffdf9, #efe6d7); }
.narrow { max-width: 720px; margin-left: auto; margin-right: auto; }
.auth-card { max-width: 980px; margin: 8vh auto; display: grid; grid-template-columns: 1fr 420px; gap: 42px; align-items: center; }
.form label { display: grid; gap: 8px; font-weight: 650; font-size: 14px; }
.stack { display: grid; gap: 16px; }
input, textarea, select {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 14px;
    padding: 13px 14px;
    font: inherit;
    color: var(--text);
}
textarea { resize: vertical; }
.checkbox { display: flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 10px !important; }
.checkbox input { width: auto; }
.button, button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 999px;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
    font: inherit;
    font-weight: 750;
    transition: transform .15s ease, box-shadow .15s ease;
}
.button:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(34, 28, 22, .12); }
.button.primary { background: var(--accent); color: white; }
.button.small { padding: 8px 12px; font-size: 14px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; }
.link-button { border: 0; background: none; color: var(--text); padding: 0; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.flash { padding: 14px 16px; border-radius: 16px; margin-bottom: 18px; border: 1px solid; }
.flash-success { background: #eef8f1; color: var(--success); border-color: #b9dfc3; }
.flash-error { background: #fff0ed; color: var(--danger); border-color: #edc4bd; }
.demo-box { background: var(--accent-soft); border-radius: 18px; padding: 14px; color: var(--muted); font-size: 14px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: var(--shadow); display: grid; gap: 4px; }
.stat strong { font-size: 34px; }
.stat span { color: var(--muted); }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 20px; display: grid; gap: 12px; }
.project-card { min-height: 220px; }
.badge, .status { display: inline-flex; align-items: center; width: max-content; border-radius: 999px; padding: 6px 10px; background: var(--accent-soft); color: var(--text); font-size: 13px; font-weight: 700; }
.badge.large { padding: 10px 14px; font-size: 15px; }
.badge.success, .status-paid, .status-CONFIRMED { background: #e8f6ec; color: var(--success); }
.status-unpaid, .status-fail, .status-REJECTED, .status-AUTH_FAIL { background: #fff0ed; color: var(--danger); }
.status-payment_pending, .status-created, .status-NEW { background: #fff8e6; color: var(--warning); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.file-card { border: 1px solid var(--line); border-radius: 22px; padding: 14px; background: #fff; display: grid; gap: 10px; }
.file-card img { width: 100%; height: 150px; object-fit: cover; border-radius: 16px; display: block; }
.file-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--muted); font-weight: 800; }
.row-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.order-list { display: grid; gap: 14px; }
.order-card { display: flex; justify-content: space-between; gap: 18px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 18px; }
.order-pay { display: grid; gap: 12px; justify-items: end; }
.price { font-size: 28px; letter-spacing: -.03em; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.photo { position: relative; overflow: hidden; border-radius: 22px; min-height: 190px; background: #ddd; display: block; color: #fff; text-decoration: none; }
.photo img { width: 100%; height: 240px; object-fit: cover; display: block; filter: saturate(.95); transition: transform .2s ease; }
.photo:hover img { transform: scale(1.03); }
.photo span { position: absolute; left: 12px; right: 12px; bottom: 12px; background: rgba(0,0,0,.42); backdrop-filter: blur(10px); padding: 10px 12px; border-radius: 14px; }
.doc-list { display: grid; gap: 12px; }
.doc-row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.summary-box { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 20px 0; }
.summary-box div { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: grid; gap: 4px; }
.summary-box span { color: var(--muted); font-size: 13px; }
@media (max-width: 820px) {
    .topbar, .page-head, .order-card { flex-direction: column; align-items: stretch; }
    .nav { flex-wrap: wrap; }
    .auth-card, .two-columns, .stats-grid, .summary-box { grid-template-columns: 1fr; }
    h1 { font-size: 38px; }
    .order-pay { justify-items: start; }
}

/* v1.1 refinements */
.brand a { font-size: 20px; }
.footer { border-top: 1px solid var(--line); padding-top: 18px; }
.feature-list { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.feature-list span { border: 1px solid var(--line); background: rgba(255,255,255,.55); border-radius: 999px; padding: 8px 12px; color: var(--muted); font-weight: 650; }
.stats-grid.five { grid-template-columns: repeat(5, 1fr); }
.stats-grid.three { grid-template-columns: repeat(3, 1fr); }
.mode-panel { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.input-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.notice { border: 1px solid var(--line); background: var(--accent-soft); color: var(--muted); border-radius: 16px; padding: 14px 16px; line-height: 1.5; }
.small-text { font-size: 13px; }
code { background: #f1ebe2; border: 1px solid var(--line); border-radius: 8px; padding: 2px 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.payment-card h1 { font-size: clamp(38px, 5vw, 58px); }
.status-success { background: #e8f6ec !important; color: var(--success) !important; }
.status-waiting { background: #fff8e6 !important; color: var(--warning) !important; }
.status-danger { background: #fff0ed !important; color: var(--danger) !important; }
.status-muted { background: #eee8df !important; color: var(--muted) !important; }
.status-neutral { background: var(--accent-soft) !important; color: var(--text) !important; }
.badge.success { background: #e8f6ec; color: var(--success); }
.table-wrap table code { white-space: nowrap; }
@media (max-width: 980px) {
    .stats-grid.five, .stats-grid.three { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
    .stats-grid.five, .stats-grid.three { grid-template-columns: 1fr; }
    .input-row { grid-template-columns: 1fr; }
    .mode-panel { flex-direction: column; align-items: flex-start; }
}
