/* === Reset === */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Manrope', -apple-system, sans-serif;
    background: #f5f5f0;
    color: #1a1a1a;
    font-size: 14px;
    line-height: 1.45;
    min-height: 100vh;
}

/* === Palette ===
   Тёплый кремовый фон, графитовый текст, янтарь-акцент.
   Чтобы не выглядело как стандартный бутстрап-AI-slop. */
:root {
    --bg: #f5f5f0;
    --paper: #ffffff;
    --ink: #1a1a1a;
    --ink-2: #4a4a4a;
    --ink-3: #8a8a85;
    --line: #e6e6df;
    --line-2: #d8d8d0;
    --accent: #c2410c;       /* жжёный оранж */
    --accent-soft: #fef3e8;
    --green: #15803d;
    --green-soft: #dcfce7;
    --red: #b91c1c;
    --red-soft: #fee2e2;
    --blue: #1d4ed8;
    --blue-soft: #dbeafe;
    --gray-btn: #2d2d2a;
}

/* === Layout === */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 248px;
    background: #18181b;
    color: #e7e7e0;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    z-index: 10;
}
.main {
    margin-left: 248px;
    padding: 28px 36px 60px;
    min-height: 100vh;
}
@media (max-width: 880px) {
    .sidebar { position: static; width: 100%; height: auto; padding: 14px; }
    .main { margin-left: 0; padding: 18px; }
}

/* === Brand === */
.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 4px 6px 22px;
    border-bottom: 1px solid #2a2a2e;
    margin-bottom: 16px;
}
.brand-mark {
    width: 40px; height: 40px;
    background: var(--accent);
    border-radius: 10px;
    display: grid; place-items: center;
    font-size: 20px;
}
.brand-title { font-weight: 800; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub   { font-size: 11px; color: #8a8a85; text-transform: uppercase; letter-spacing: 0.08em; }

/* === Nav === */
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    color: #c7c7c0;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 13.5px;
    transition: background .12s, color .12s;
}
.nav-item:hover { background: #232327; color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-icon { font-size: 14px; opacity: .8; width: 16px; text-align: center; }

/* === User card === */
.sidebar-foot { border-top: 1px solid #2a2a2e; padding-top: 14px; margin-top: 14px; }
.user-card { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: grid; place-items: center; font-weight: 700;
}
.user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-role { font-size: 11px; color: #8a8a85; }
.logout {
    display: block; text-align: center;
    padding: 8px;
    color: #c7c7c0; text-decoration: none;
    font-size: 12px;
    border: 1px solid #2a2a2e;
    border-radius: 6px;
}
.logout:hover { color: #fff; border-color: #444; }

/* === Page header === */
.page-head {
    display: flex; justify-content: space-between; align-items: flex-end;
    gap: 16px; margin-bottom: 24px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 16px;
}
.page-title {
    font-size: 28px; font-weight: 800; letter-spacing: -0.02em;
    margin: 0;
}
.page-sub { color: var(--ink-3); font-size: 13px; margin-top: 4px; }

/* === Cards === */
.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}
.card-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-3);
    margin: 0 0 14px;
}

/* === Grid === */
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* === Forms === */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.field input, .field select, .field textarea {
    padding: 9px 11px;
    border: 1px solid var(--line-2);
    border-radius: 7px;
    background: #fff;
    font-family: inherit;
    font-size: 14px;
    color: var(--ink);
    transition: border .12s, box-shadow .12s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 70px; }
.field .hint { font-size: 11px; color: var(--ink-3); }

/* === Buttons === */
.btn {
    display: inline-flex; gap: 6px; align-items: center;
    padding: 9px 16px;
    background: var(--gray-btn); color: #fff;
    border: none; border-radius: 7px;
    cursor: pointer;
    font-family: inherit; font-size: 13.5px; font-weight: 600;
    text-decoration: none;
    transition: background .12s;
}
.btn:hover { background: #111; }
.btn-accent { background: var(--accent); }
.btn-accent:hover { background: #9a3409; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #991b1b; }

/* === Tables === */
.table { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: top; }
.table th { background: #fafaf5; font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafaf5; }
.table .num { font-family: 'JetBrains Mono', monospace; font-size: 13px; }

/* === Badges === */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-draft   { background: var(--blue-soft); color: var(--blue); }
.badge-gen     { background: var(--accent-soft); color: var(--accent); }
.badge-done    { background: var(--green-soft); color: var(--green); }
.badge-muted   { background: var(--bg); color: var(--ink-3); }

/* === Stats === */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
@media (max-width: 760px) { .stats { grid-template-columns: 1fr 1fr; } }
.stat {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px 20px;
}
.stat-label { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; }
.stat-foot { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* === Flash === */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; font-weight: 500; }
.flash-success { background: var(--green-soft); color: var(--green); }
.flash-error   { background: var(--red-soft); color: var(--red); }
.flash-info    { background: var(--blue-soft); color: var(--blue); }

/* === Trip form === */
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.section-num {
    width: 26px; height: 26px;
    background: var(--ink); color: #fff;
    border-radius: 6px;
    display: grid; place-items: center;
    font-weight: 800; font-size: 13px;
}
.section-title { font-weight: 700; font-size: 15px; }

.party-row {
    display: grid;
    grid-template-columns: 1fr 200px 40px;
    gap: 8px;
    align-items: end;
    margin-bottom: 8px;
}
.party-row .field { margin: 0; }

.pair-table { width: 100%; }
.pair-table td { padding: 6px 4px; }
.pair-table select, .pair-table input {
    padding: 7px 9px;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    width: 100%;
    font-family: inherit;
    font-size: 13px;
}

.amount-summary {
    background: var(--bg);
    border: 1px dashed var(--line-2);
    border-radius: 7px;
    padding: 10px 14px;
    margin-top: 8px;
    font-size: 13px;
    display: flex; justify-content: space-between;
}
.amount-summary.ok { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.amount-summary.bad { background: var(--red-soft); border-color: var(--red); color: var(--red); }

/* === Login === */
.login-page {
    min-height: 100vh;
    display: grid; place-items: center;
    background:
        radial-gradient(circle at 20% 30%, #fff5e6 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, #f0ebe0 0%, transparent 50%),
        var(--bg);
}
.login-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 36px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.04);
}
.login-title { font-size: 22px; font-weight: 800; margin: 0 0 6px; letter-spacing: -0.02em; }
.login-sub { color: var(--ink-3); margin-bottom: 26px; font-size: 13px; }

/* === Misc === */
.row-actions { display: flex; gap: 6px; }
.muted { color: var(--ink-3); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
