/* ===== Фирменный стиль HRS =====
   Палитра и шрифт сняты с hrs.ru:
   navy #063e6d / #043361 / #032754, акцент #119bcf, фон #f2f2f2, шрифт Fira Sans. */
:root {
    --navy:        #063e6d;
    --navy-dark:   #043361;
    --navy-deep:   #032754;
    --accent:      #119bcf;
    --accent-dark: #0e83b0;
    --bg:          #f2f2f2;
    --card:        #ffffff;
    --border:      #e1e1e1;
    --border-soft: #ebebeb;
    --text:        #16222e;
    --muted:       #6b7682;
    --ok:          #1f8a4c;
    --err:         #c0392b;
    --radius:      10px;
    --shadow:      0 1px 3px rgba(6,62,109,.06), 0 6px 24px rgba(6,62,109,.05);
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
    margin: 0;
    font-family: 'Fira Sans', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}
.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }

/* ===== Шапка ===== */
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    background: linear-gradient(90deg, var(--navy-deep), var(--navy));
    color: #fff;
    padding: 14px 28px;
    box-shadow: 0 2px 12px rgba(3,39,84,.18);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 500; font-size: 16px; letter-spacing: .2px; }
.brand .mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 30px; border-radius: 5px;
    background: var(--accent); color: #fff;
    font-weight: 700; font-size: 13px; letter-spacing: .5px;
    box-shadow: 0 2px 8px rgba(17,155,207,.4);
}
.brand .brand-text b { font-weight: 600; }
.brand .brand-sub { opacity: .7; font-weight: 300; }
.user { display: flex; gap: 16px; align-items: center; font-size: 13px; }
.user .link-muted { color: #bfe2f2; text-decoration: none; }
.user .link-muted:hover { text-decoration: underline; }

/* ===== Кнопки ===== */
.btn {
    border: 0; border-radius: 7px; padding: 11px 18px;
    font-family: inherit; font-size: 14px; cursor: pointer; font-weight: 500;
    transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(17,155,207,.28); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: #fff; color: var(--navy); border: 1px solid var(--border); }
.btn-secondary:hover { background: #f6f9fb; border-color: var(--accent); }
.btn-link { background: none; color: var(--accent); padding: 6px; }
.btn:disabled { opacity: .55; cursor: default; }

/* ===== Карточки / панели ===== */
.card, .panel {
    background: var(--card); border: 1px solid var(--border-soft);
    border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}

/* ===== Поля ===== */
input[type=text], input[type=number] {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 7px; font-size: 15px; font-family: inherit; background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
input[type=text]:focus, input[type=number]:focus {
    outline: 0; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(17,155,207,.15);
}

/* ===== Вход ===== */
.login-wrap { display: flex; justify-content: center; padding: 64px 16px; }
.login-card { max-width: 430px; width: 100%; }
.login-card h1 { margin: 0 0 8px; font-size: 23px; font-weight: 600; color: var(--navy); }
.login-step { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.login-step label { font-size: 13px; color: var(--muted); }
.email-input { display: flex; align-items: stretch; }
.email-input input { flex: 1; border-radius: 7px 0 0 7px; border-right: 0; }
.email-input .domain {
    display: flex; align-items: center; padding: 0 14px;
    background: #f2f6f9; border: 1px solid var(--border); border-left: 0;
    border-radius: 0 7px 7px 0; color: var(--navy); font-weight: 500;
}
#otp-code { letter-spacing: 8px; text-align: center; font-size: 24px; font-weight: 600; }

/* ===== Конструктор ===== */
.builder {
    display: grid; grid-template-columns: 1fr 1fr; gap: 22px;
    padding: 24px; align-items: start; max-width: 1280px; margin: 0 auto;
}
@media (max-width: 900px) { .builder { grid-template-columns: 1fr; padding: 16px; } }

.form-panel h2, .preview-panel h2 { margin: 0 0 18px; font-size: 18px; font-weight: 600; color: var(--navy); }
fieldset { border: 1px solid var(--border-soft); border-radius: var(--radius); margin: 0 0 18px; padding: 16px 18px; }
legend { font-weight: 600; padding: 0 8px; color: var(--navy); font-size: 14px; }
.form-panel label { display: block; margin-bottom: 11px; font-size: 14px; }
.form-panel label.inline { display: flex; align-items: center; gap: 8px; }
label.inline input[type=number] { width: 92px; }

.module { border-bottom: 1px solid var(--border-soft); padding: 12px 0; }
.module:last-child { border-bottom: 0; }
.module-head { display: flex; align-items: center; gap: 11px; cursor: pointer; margin-bottom: 4px !important; }
.module-head input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); }
.module-name { font-weight: 600; flex: 1; color: var(--navy); }
.module-price { color: var(--accent); font-weight: 600; white-space: nowrap; }
.module-desc { font-size: 12.5px; color: var(--muted); margin-left: 28px; }
.module-body { margin: 12px 0 4px 28px; display: flex; flex-direction: column; gap: 9px;
    padding-left: 14px; border-left: 2px solid var(--border-soft); }
.options { display: flex; flex-direction: column; gap: 7px; }
.note { color: #8a5a00; font-size: 12.5px; background: #fff6e3; padding: 7px 10px; border-radius: 6px; }
input[type=checkbox] { accent-color: var(--accent); }

.service { display: flex; align-items: center; gap: 12px; margin-bottom: 9px; }
.service .qty-srv { width: 80px; }
.qty { width: 92px; }

/* ===== Предпросмотр ===== */
.preview-panel { position: sticky; top: 24px; }
.preview-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.preview { border: 1px solid var(--border-soft); border-radius: 8px; padding: 22px; min-height: 220px; background: #fff; }

.kp-doc { font-size: 13.5px; }
.kp-header { border-bottom: 2px solid var(--accent); padding-bottom: 10px; margin-bottom: 14px; }
.kp-header h3 { margin: 0 0 4px; color: var(--navy); font-size: 18px; }
.kp-num { color: var(--muted); }
.kp-client { margin-bottom: 14px; }
.kp-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.kp-table th, .kp-table td { border: 1px solid var(--border); padding: 7px 9px; text-align: left; }
.kp-table th { background: var(--navy); color: #fff; font-weight: 500; }
.kp-table td.c { text-align: center; }
.kp-table td.r { text-align: right; white-space: nowrap; }
.kp-table tfoot td { background: #f6f9fb; }
.kp-total td { font-weight: 700; font-size: 15px; background: #eaf5fb !important; color: var(--navy); }
.kp-note { font-size: 11.5px; color: #8a5a00; }
.kp-footer { margin-top: 16px; font-size: 11.5px; color: var(--muted); font-style: italic;
    border-top: 1px solid var(--border-soft); padding-top: 10px; }

/* ===== Блоки услуг (man-days) ===== */
fieldset.block { padding-top: 10px; }
fieldset.block.below-min { border-color: #e6b800; }
.block-head { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.block-head input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.block-name { font-weight: 600; color: var(--navy); }
.block-meta { font-size: 12.5px; color: var(--muted); margin: 2px 0 4px 2px; }
.block-meta .block-days { color: var(--accent); }

.items-head {
    display: flex; justify-content: space-between;
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px;
    color: var(--muted); padding: 8px 2px 4px; border-bottom: 1px solid var(--border-soft);
}
.block-body { margin-top: 8px; }
.svc-item {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 2px; border-bottom: 1px solid #f3f5f7;
}
.svc-label { flex: 1; margin: 0; cursor: pointer; }
.svc-label input[type=checkbox] { accent-color: var(--accent); }
.svc-name { font-size: 13.5px; }
.svc-name .pn { display: inline-block; margin-left: 6px; font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; }
.svc-name .en { display: block; font-size: 11.5px; color: var(--muted); }
.lic-item .lic-price { white-space: nowrap; font-weight: 500; color: var(--navy); }
.en-cell { font-size: 11px; color: var(--muted); }
.days-input { width: 70px; text-align: center; padding: 6px 8px; }
.min-warn { margin-top: 10px; color: #8a5a00; background: #fff6e3; padding: 8px 10px; border-radius: 6px; font-size: 12.5px; }

/* ===== Предпросмотр: блоки ===== */
.kp-block { margin-bottom: 18px; }
.kp-block-title { font-weight: 600; color: var(--navy); margin: 6px 0 4px; }
.kp-table .pn-cell { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.kp-minwarn { color: #8a5a00; background: #fff6e3; padding: 6px 9px; border-radius: 6px; font-size: 11.5px; margin-top: 4px; }
.kp-ratewarn { color: var(--err); background: #fdeceb; padding: 7px 10px; border-radius: 6px; font-size: 12px; margin-bottom: 12px; }
.kp-grand { width: 100%; margin-top: 6px; }
.kp-grand td { padding: 5px 9px; border: 0; }
.kp-grand .kp-total td { font-weight: 700; font-size: 15px; background: #eaf5fb; color: var(--navy); }

/* ===== Сообщения ===== */
.msg { margin-top: 12px; font-size: 14px; min-height: 20px; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--err); }
