* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f4f6f9;
    --panel: #ffffff;
    --ink: #1b2530;
    --muted: #6b7a8d;
    --line: #dfe5ec;
    --brand: #1a5fa8;
    --brand-dark: #134a85;
    --good: #1d7a4c;
    --warn: #b26a00;
    --bad: #b3261e;
    --chip: #eef3f9;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    padding: 0 20px 60px;
    max-width: 1240px;
    margin: 0 auto;
}

header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    padding: 18px 0 16px;
    border-bottom: 2px solid var(--line);
    margin-bottom: 22px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 30px; }
h1 { font-size: 21px; color: var(--brand); letter-spacing: .2px; }
.brand p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.modes { display: flex; align-items: center; gap: 8px; }

.mode-btn {
    padding: 8px 15px; border: 1px solid var(--line); background: #fff;
    border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--muted);
}
.mode-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.link {
    background: none; border: none; color: var(--brand); cursor: pointer;
    font-size: 13px; text-decoration: underline;
}

#authBox { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }

.hidden { display: none !important; }

/* ===== Кнопки и поля ===== */
.btn {
    background: var(--brand); color: #fff; border: none; border-radius: 8px;
    padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--brand-dark); }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.ghost:hover { background: var(--chip); }
.btn.big { padding: 14px 26px; font-size: 15px; width: 100%; }
.btn.danger { background: var(--bad); }

input, select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line);
    border-radius: 8px; font-size: 14px; background: #fff; color: var(--ink);
    font-family: inherit;
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; }

label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }

/* ===== Публичный режим ===== */
.calc-box {
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
    padding: 22px; box-shadow: 0 1px 4px rgba(16, 32, 56, .06);
}
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 16px 0; }
.grid3 > div { margin-top: 0; }

.work-note { font-size: 12.5px; color: var(--muted); margin-top: 8px; min-height: 18px; }

.result-box { margin-top: 18px; }
.price-main {
    background: var(--brand); color: #fff; border-radius: 12px; padding: 26px;
    text-align: center; margin-bottom: 14px;
}
.price-main .lbl { font-size: 13px; opacity: .85; }
.price-main .val { font-size: 40px; font-weight: 700; margin: 6px 0; }
.price-main .sub { font-size: 13px; opacity: .85; }

.range-bar { display: flex; gap: 10px; }
.range-card {
    flex: 1; background: var(--panel); border: 1px solid var(--line);
    border-radius: 10px; padding: 14px; text-align: center;
}
.range-card .lbl { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.range-card .val { font-size: 19px; font-weight: 700; margin-top: 5px; color: var(--brand); }

.disclaimer { font-size: 12.5px; color: var(--muted); margin-top: 16px; line-height: 1.6; }

/* ===== Табы ===== */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
    padding: 9px 16px; border: 1px solid var(--line); background: #fff;
    border-radius: 8px 8px 0 0; cursor: pointer; font-size: 13.5px; color: var(--muted);
}
.tab.active { background: var(--panel); color: var(--brand); font-weight: 600; border-bottom-color: var(--panel); }

.tabpane {
    background: var(--panel); border: 1px solid var(--line); border-radius: 0 10px 10px 10px;
    padding: 20px;
}

.client-row, .add-row {
    display: grid; gap: 10px; margin-bottom: 16px;
}
.client-row { grid-template-columns: 1fr 130px 160px; }
.add-row { grid-template-columns: 1fr 100px 140px 200px 130px; }

/* ===== Строки сметы ===== */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--chip); color: var(--brand-dark); font-weight: 600; font-size: 12.5px; }
tbody tr:hover { background: #fafcfe; }
td.num, th.num { text-align: right; white-space: nowrap; }

.line-del {
    background: none; border: none; color: var(--bad); cursor: pointer;
    font-size: 17px; line-height: 1; padding: 2px 6px;
}

.calc-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.calc-actions .big { width: auto; flex: 1; min-width: 200px; }

/* ===== Результат ===== */
.result { margin-top: 22px; }
.totals-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px; margin-bottom: 16px;
}
.total-card { background: var(--chip); border-radius: 9px; padding: 13px; }
.total-card .lbl { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.total-card .val { font-size: 20px; font-weight: 700; margin-top: 4px; }
.total-card.hero { background: var(--brand); }
.total-card.hero .lbl, .total-card.hero .val { color: #fff; }
.total-card.good .val { color: var(--good); }
.total-card.warn .val { color: var(--warn); }

.warn-inline { font-size: 12px; color: var(--warn); margin-top: 4px; }
.norm-gap { font-size: 12px; color: var(--muted); margin-top: 4px; font-style: italic; }
.norm-gap b { color: var(--bad); }

.warn-box {
    background: #fff7e8; border: 1px solid #f0d9a8; border-left: 4px solid var(--warn);
    border-radius: 8px; padding: 14px 16px; font-size: 13px; line-height: 1.6;
    color: #6b4a10; margin-bottom: 18px;
}

.pane-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.pane-tools h3 { font-size: 15px; color: var(--brand-dark); }
.pane-tools input { max-width: 320px; }

.pill {
    display: inline-block; padding: 2px 8px; border-radius: 20px;
    font-size: 11px; font-weight: 600; background: var(--chip); color: var(--brand-dark);
}
.pill.good { background: #e4f4ea; color: var(--good); }
.pill.warn { background: #fdf0dd; color: var(--warn); }
.pill.bad { background: #fbe9e7; color: var(--bad); }

.note-cell { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.45; }

/* ===== Модалка / тост ===== */
.modal { position: fixed; inset: 0; background: rgba(16, 32, 56, .45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-card { background: #fff; border-radius: 12px; padding: 26px; width: 340px; }
.modal-card h2 { font-size: 18px; margin-bottom: 16px; color: var(--brand-dark); }
.modal-card input { margin-bottom: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; margin-bottom: 8px; }

.toast {
    position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
    background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 8px;
    font-size: 13.5px; z-index: 60; box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
}

/* ===== Объявление для посетителя ===== */
.pitch {
    background: linear-gradient(135deg, #1a5fa8, #134a85 60%, #0f3a68);
    border-radius: 14px;
    margin-bottom: 22px;
    overflow: hidden;
}
.pitch-in { padding: 28px 30px; color: #fff; }
.pitch h2 { font-size: 26px; margin-bottom: 8px; letter-spacing: .3px; }
.pitch-lead { font-size: 14.5px; line-height: 1.65; opacity: .93; max-width: 780px; }
.pitch-list {
    margin: 16px 0 20px 18px;
    font-size: 13.5px; line-height: 1.9; opacity: .9;
}
.pitch-list li::marker { color: #8fc3f5; }
.pitch-cta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pitch-price {
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 10px; padding: 10px 18px; text-align: center; white-space: nowrap;
}
.pitch-price .amount { font-size: 28px; font-weight: 700; }
.pitch-price .per { font-size: 13px; opacity: .8; }
.pitch-price.small { display: inline-block; margin: 4px 0 12px; background: var(--chip); border-color: var(--line); color: var(--ink); }
.pitch-price.small .amount { font-size: 24px; color: var(--brand); }
.pitch-cta .big { width: auto; min-width: 220px; }
.pitch-cta .btn.ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .55); }
.pitch-cta .btn.ghost:hover { background: rgba(255, 255, 255, .12); }
.pitch-note { font-size: 12.5px; opacity: .8; margin-top: 14px; line-height: 1.6; }
.pitch.compact .pitch-list, .pitch.compact .pitch-note { display: none; }

.modal-card.wide { width: 520px; }
.modal-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; line-height: 1.55; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.modal-actions .link { margin-right: auto; }

/* ===== Результат закрыт подпиской ===== */
.locked-box {
    background: var(--panel);
    border: 1px solid var(--line);
    border-top: 3px solid var(--warn);
    border-radius: 12px;
    padding: 30px 26px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(16, 32, 56, .06);
}
.locked-icon { font-size: 30px; margin-bottom: 8px; }
.locked-box h3 { font-size: 17px; color: var(--ink); margin-bottom: 8px; }
.locked-box p { font-size: 13.5px; color: var(--muted); line-height: 1.6; max-width: 520px; margin: 0 auto; }
.locked-price {
    background: var(--chip); border-radius: 10px; padding: 10px 22px;
    display: inline-block; margin: 18px 0 16px; white-space: nowrap;
}
.locked-price .amount { font-size: 30px; font-weight: 700; color: var(--brand); }
.locked-price .per { font-size: 13px; color: var(--muted); }
.locked-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.locked-note {
    margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
    font-size: 13px; color: var(--warn);
}
.fb-btn {
    display: inline-block; margin-top: 8px; padding: 8px 16px;
    background: #229ED9; color: #fff; border: none; border-radius: 8px;
    font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.fb-btn:hover { background: #1b87bd; }

.badge {
    display: inline-block; min-width: 19px; padding: 1px 6px; margin-left: 6px;
    background: var(--bad); color: #fff; border-radius: 10px;
    font-size: 11px; font-weight: 700; text-align: center;
}

/* ===== Счётчик посетителей (внизу админки, по центру) ===== */
.visitor-counter {
    max-width: 620px; margin: 22px auto 8px; text-align: center;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 12px; padding: 22px 24px;
}
.vc-num { font-size: 34px; font-weight: 700; color: var(--brand); line-height: 1.1; }
.vc-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px; }
.vc-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 16px; }
.vc-sub b { color: var(--ink); }
.vc-bar { display: flex; align-items: flex-end; gap: 4px; height: 62px; margin-top: 10px; }
.vc-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.vc-stick { background: linear-gradient(180deg, #4a90d9, #1a5fa8); border-radius: 3px 3px 0 0; }
.vc-day { font-size: 9.5px; color: var(--muted); text-align: center; margin-top: 3px; }
.vc-upd { font-size: 11.5px; color: var(--muted); margin-top: 12px; }

/* ===== Админ-панель ===== */
.toolbtns { display: flex; gap: 8px; }
.row-acts { display: flex; gap: 5px; flex-wrap: wrap; }
.mini {
    padding: 4px 9px; font-size: 12px; border-radius: 6px;
    border: 1px solid var(--line); background: #fff; color: var(--brand); cursor: pointer;
}
.mini:hover { background: var(--chip); }
.mini.green { color: var(--good); border-color: #bfe0cd; }
.mini.red { color: var(--bad); border-color: #f0c5c1; }

@media (max-width: 860px) {
    .grid3 { grid-template-columns: 1fr; }
    .client-row, .add-row { grid-template-columns: 1fr; }
    .range-bar { flex-direction: column; }
    .price-main .val { font-size: 32px; }
    .grid2 { grid-template-columns: 1fr; }
    .pitch-in { padding: 22px 18px; }
    .pitch h2 { font-size: 21px; }
    .modal-card.wide { width: auto; }
    .pitch-cta .big { width: 100%; }
}
.mode.blur { opacity: .5; filter: blur(1.5px); pointer-events: none; }

