/* ===== База ===== */
:root {
  --bg: #0b1626;
  --bg2: #101f35;
  --card: #15263f;
  --card2: #1b2f4d;
  --line: #24395a;
  --text: #eaf0fa;
  --muted: #9fb0c8;
  --accent: #ff7a1a;
  --accent-dark: #e5650a;
  --ok: #2ecc71;
  --err: #ff5d5d;
  --radius: 14px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }
.w100 { width: 100%; }

a { color: inherit; text-decoration: none; }

/* ===== Кнопки ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 10px; border: 1px solid transparent;
  font-size: 15px; font-weight: 600; cursor: pointer; transition: .18s;
}
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #ff9440); color: #1d1005; }
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost { border-color: var(--line); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: #7e1f1f; color: #ffd9d9; }
.btn-danger:hover { background: #a12a2a; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* ===== Шапка ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 22, 38, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 28px; height: 66px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 19px; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #ffb01a);
  color: #1d1005; font-weight: 800; font-size: 15px;
}
.logo-text b { color: var(--accent); }
.main-nav { display: flex; gap: 22px; margin-left: auto; font-size: 15px; color: var(--muted); }
.main-nav a:hover { color: var(--text); }
.header-phone { font-weight: 700; color: var(--accent); white-space: nowrap; }

/* ===== Hero ===== */
.hero { padding: 76px 0 60px; background: radial-gradient(1100px 480px at 50% -10%, #1c3357 0%, transparent 60%), var(--bg); }
.hero-inner { max-width: 820px; margin: 0 auto; text-align: center; }
.badge {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: rgba(255, 122, 26, .14); border: 1px solid rgba(255, 122, 26, .4);
  color: #ffb01a; font-size: 13px; font-weight: 600; margin-bottom: 18px;
}
.hero h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.18; margin-bottom: 16px; }
.hero-accent {
  font-size: 20px; font-weight: 700; color: var(--accent); margin-bottom: 12px;
}
.lead { color: var(--muted); font-size: 17px; max-width: 640px; margin: 0 auto 28px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 26px; }
.hero-points { list-style: none; display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; color: var(--muted); font-size: 14px; }

/* ===== Секции ===== */
.section { padding: 64px 0; scroll-margin-top: 78px; }
.section-alt { background: var(--bg2); }
.section-title { font-size: clamp(24px, 3vw, 32px); text-align: center; margin-bottom: 10px; }
.section-sub { text-align: center; color: var(--muted); margin-bottom: 36px; }

.grid { display: grid; gap: 20px; }
.services-grid { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; transition: .18s;
}
.service-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.service-icon { font-size: 30px; margin-bottom: 12px; }
.service-card h3 { font-size: 17px; margin-bottom: 8px; }
.service-card p { color: var(--muted); font-size: 14px; }

.steps-grid { grid-template-columns: repeat(3, 1fr); }
.step { text-align: center; padding: 10px; }
.step-num {
  width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), #ffb01a);
  color: #1d1005; font-size: 22px; font-weight: 800;
}
.step h3 { margin-bottom: 8px; }
.step p { color: var(--muted); font-size: 15px; }

.contacts-grid { grid-template-columns: repeat(3, 1fr); }
.contact-card { text-align: center; }
.contact-label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.contact-value { font-size: 18px; font-weight: 600; }
.contact-value a { color: var(--accent); }
.contact-hint { margin-top: 8px; color: #6c7d96; font-size: 12px; }

/* ===== Подвал ===== */
.site-footer { border-top: 1px solid var(--line); padding: 26px 0; color: var(--muted); font-size: 14px; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-inner a { color: var(--accent); }

/* ===== Чат-виджет ===== */
.chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 100;
  width: 62px; height: 62px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #ffb01a);
  color: #1d1005; font-size: 27px;
  box-shadow: 0 12px 30px rgba(255, 122, 26, .45);
  transition: .18s;
}
.chat-fab:hover { transform: scale(1.07); }

.chat-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 101;
  width: 390px; max-width: calc(100vw - 24px);
  height: 560px; max-height: calc(100vh - 44px);
  display: flex; flex-direction: column;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .5); overflow: hidden;
}
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: linear-gradient(135deg, #1b2f4d, #16273f);
  border-bottom: 1px solid var(--line);
}
.chat-title { font-weight: 700; font-size: 15px; }
.chat-subtitle { font-size: 12px; color: var(--muted); }
.chat-close {
  background: none; border: none; color: var(--muted); font-size: 26px;
  cursor: pointer; line-height: 1; padding: 0 4px;
}
.chat-close:hover { color: var(--text); }

.chat-messages { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.msg {
  max-width: 84%; padding: 10px 14px; border-radius: 14px; font-size: 14.5px;
  white-space: pre-wrap; word-break: break-word;
}
.msg.bot { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--accent), #ff9440); color: #1d1005; border-bottom-right-radius: 4px; font-weight: 500; }
.msg.typing { color: var(--muted); font-style: italic; }

.chat-success { margin: 0 14px 10px; padding: 14px; border-radius: 12px; background: rgba(46, 204, 113, .1); border: 1px solid rgba(46, 204, 113, .45); font-size: 14px; }
.chat-success.refused { background: rgba(160, 170, 190, .08); border-color: rgba(160, 170, 190, .4); }
.chat-success button { margin-top: 10px; }

/* Календарь и выбор времени в чате */
.chat-ui { padding: 0 14px 10px; }
.chat-ui-hint { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.cal { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font-size: 14px; font-weight: 600; }
.cal-nav {
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: none; color: var(--muted); font-size: 15px;
}
.cal-nav:hover:not([disabled]) { border-color: var(--accent); color: var(--text); }
.cal-nav[disabled] { opacity: .35; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { font-size: 11px; color: var(--muted); text-align: center; padding: 2px 0; }
.cal-day {
  height: 30px; border-radius: 8px; font-size: 12.5px;
  border: 1px solid transparent; background: none; color: var(--text);
}
.cal-day.empty { visibility: hidden; }
.cal-day.off { color: #5a6b84; }
.cal-day.free { border-color: rgba(46, 204, 113, .5); color: #7ee2a8; cursor: pointer; }
.cal-day.free:hover { background: rgba(46, 204, 113, .12); }
.tslot-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tslot {
  padding: 8px 12px; border-radius: 10px; cursor: pointer; font-size: 13.5px;
  border: 1px solid rgba(46, 204, 113, .5); color: #7ee2a8; background: var(--card);
}
.tslot:hover { background: rgba(46, 204, 113, .12); }
.cal-back {
  margin-top: 8px; padding: 7px 14px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: none; color: var(--muted); font-size: 13px;
}
.cal-back:hover { border-color: var(--accent); color: var(--text); }
.consent-row { display: flex; gap: 10px; margin-bottom: 2px; }
.consent-btn {
  padding: 9px 26px; border-radius: 10px; border: none; cursor: pointer;
  font-size: 14px; font-weight: 600; transition: .15s;
}
.consent-yes { background: rgba(46, 204, 113, .9); color: #06290f; }
.consent-yes:hover { filter: brightness(1.1); }
.consent-no { background: rgba(255, 93, 93, .85); color: #330b0b; }
.consent-no:hover { filter: brightness(1.1); }

/* Страница «Обработка персональных данных» */
.policy-wrap { max-width: 860px; margin: 0 auto; padding: 40px 20px 60px; }
.policy-wrap h1 { font-size: clamp(24px, 3vw, 32px); margin-bottom: 6px; }
.policy-edition { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.policy-wrap h2 { font-size: 19px; margin: 24px 0 8px; }
.policy-wrap p, .policy-wrap li { color: var(--muted); margin-bottom: 10px; }
.policy-wrap ul { padding-left: 22px; margin-bottom: 12px; }
.policy-wrap b { color: var(--text); }
.policy-wrap .back-link { display: inline-block; margin-bottom: 22px; color: var(--accent); font-size: 15px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }

.chat-input-row { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--card); }
.chat-input-row input {
  flex: 1; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 14px; color: var(--text); font-size: 14.5px; outline: none;
}
.chat-input-row input:focus { border-color: var(--accent); }
.chat-send {
  width: 46px; border: none; border-radius: 10px; cursor: pointer; font-size: 17px;
  background: linear-gradient(135deg, var(--accent), #ff9440); color: #1d1005;
}
.chat-send[disabled] { opacity: .55; cursor: not-allowed; }

/* ===== Админка ===== */
.admin-body { background: var(--bg); min-height: 100vh; }
.admin-wrap { max-width: 1200px; margin: 0 auto; padding: 26px 20px 60px; }

.login-view { max-width: 380px; margin: 12vh auto 0; }
.login-card { padding: 30px; }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card p { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.login-card input {
  width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; color: var(--text); font-size: 15px; outline: none; margin-bottom: 14px;
}
.login-card input:focus { border-color: var(--accent); }
.login-error { color: var(--err); font-size: 14px; margin-bottom: 12px; min-height: 18px; }

.admin-top {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 22px;
}
.admin-top h1 { font-size: 22px; margin-right: auto; }
.tab-btn {
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
  padding: 9px 18px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.tab-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(255, 122, 26, .08); }

.admin-filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-filters select, .admin-filters input {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); padding: 10px 14px; font-size: 14px; outline: none;
}
.admin-filters input { min-width: 240px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.crm { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 980px; }
table.crm th, table.crm td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.crm th { background: var(--card); color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
table.crm tr:last-child td { border-bottom: none; }
table.crm td.num { color: var(--muted); white-space: nowrap; }
table.crm td.wrap { max-width: 260px; white-space: normal; }

.status-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-new { background: rgba(64, 140, 255, .15); color: #7db4ff; }
.st-confirmed { background: rgba(38, 208, 206, .15); color: #6fe0de; }
.st-in_progress { background: rgba(255, 122, 26, .15); color: #ffa35c; }
.st-done { background: rgba(46, 204, 113, .15); color: #7ee2a8; }
.st-cancelled { background: rgba(160, 170, 190, .15); color: #a9b4c6; }

.row-actions { display: flex; gap: 8px; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-secondary { background: var(--card2); border: 1px solid var(--line); color: var(--text); }
.btn-secondary:hover { border-color: var(--accent); }

.empty-state { text-align: center; color: var(--muted); padding: 48px 20px; }

.docs-upload { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.docs-hint { color: var(--muted); font-size: 13.5px; margin-bottom: 16px; max-width: 720px; }
.docs-upload input[type="file"] { color: var(--muted); font-size: 14px; }

dialog {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0;
  background: var(--bg2); color: var(--text); width: 480px; max-width: calc(100vw - 32px);
}
dialog::backdrop { background: rgba(4, 10, 20, .7); }
.dialog-body { padding: 24px; }
.dialog-body h2 { font-size: 19px; margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 13px; color: var(--muted); }
.form-field input, .form-field textarea, .form-field select {
  background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); padding: 9px 12px; font-size: 14px; outline: none; font-family: inherit;
}
.form-field textarea { resize: vertical; min-height: 64px; }
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { border-color: var(--accent); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* Мастера и занятость */
.day-checks { display: flex; gap: 12px; flex-wrap: wrap; }
.day-checks label { display: flex; align-items: center; gap: 5px; font-size: 14px; color: var(--text); }
.day-checks input { accent-color: var(--accent); }

#scheduleDialog { width: 660px; max-width: calc(100vw - 32px); }
.sched-date-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.sched-date-row input[type="date"] {
  background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); padding: 8px 12px; font-size: 14px; outline: none;
}
.sched-hint { color: var(--muted); font-size: 13.5px; }
.slot-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.slot {
  width: 74px; padding: 8px 0; text-align: center; border-radius: 8px;
  font-size: 13.5px; cursor: pointer; border: 1px solid var(--line);
  background: var(--card); color: var(--text); transition: .15s;
}
.slot:hover:not([disabled]) { border-color: var(--accent); }
.slot.busy { background: rgba(255, 93, 93, .16); border-color: rgba(255, 93, 93, .55); color: #ffb3b3; }
.slot.booking { background: rgba(64, 140, 255, .16); border-color: rgba(64, 140, 255, .55); color: #a9ccff; }
.slot[disabled] { cursor: default; }
.slot-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.lg { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.lg-free { border: 1px solid var(--line); background: var(--card); }
.lg-busy { background: rgba(255, 93, 93, .45); }
.lg-booking { background: rgba(64, 140, 255, .45); }
.sched-note { color: var(--muted); font-size: 12.5px; }

/* Архив диалогов */
#dialogViewDialog { width: 620px; max-width: calc(100vw - 32px); }
.dialog-messages {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 430px; overflow-y: auto; padding: 14px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
.outcome-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.oc-booking { background: rgba(46, 204, 113, .15); color: #7ee2a8; }
.oc-refused, .oc-declined { background: rgba(255, 93, 93, .14); color: #ffa3a3; }
.oc-cancelled { background: rgba(160, 170, 190, .15); color: #b9c3d4; }
.oc-no_booking { background: rgba(255, 122, 26, .14); color: #ffa35c; }
.oc-progress { background: rgba(64, 140, 255, .15); color: #8fbaff; }

/* ===== Адаптив ===== */
@media (max-width: 900px) {
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .steps-grid, .contacts-grid { grid-template-columns: 1fr; }
  .main-nav { display: none; }
}
@media (max-width: 540px) {
  .services-grid { grid-template-columns: 1fr; }
  .hero { padding: 52px 0 40px; }
  .chat-panel { right: 8px; bottom: 8px; height: calc(100vh - 20px); }
  .chat-fab { right: 14px; bottom: 14px; }
  .header-phone { font-size: 14px; }
}
