/* Бронирование рабочих мест — оформление. Палитра: белый, серый, зелёный. */

:root {
  --bg: #F4F6F5;
  --surface: #FFFFFF;
  --surface-2: #F8FAF9;
  --border: #E2E6E4;
  --border-strong: #CFD6D2;
  --text: #1C2320;
  --muted: #6E7A75;
  --muted-2: #94A09B;
  --green: #2F7D5D;
  --green-dark: #245F47;
  --green-soft: #E9F3EE;
  --green-line: #B9D9C9;
  --busy: #E4E8E6;
  --busy-line: #CBD3CF;
  --danger: #A8442E;
  --shadow-sm: 0 1px 2px rgba(28, 35, 32, .06);
  --shadow-md: 0 4px 16px rgba(28, 35, 32, .09);
  --shadow-lg: 0 18px 48px rgba(28, 35, 32, .18);
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

/* ─────────── общие элементы ─────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 18px; font-weight: 600; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .06s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-dark); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover:not(:disabled) { border-color: var(--muted-2); background: var(--surface-2); }
.btn-danger { background: var(--surface); border-color: #E0C4BC; color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #FBF2EF; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }

.link-btn {
  border: 0; background: none; padding: 0; color: var(--green);
  font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 13px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

.form-error {
  margin: 0 0 12px; padding: 9px 12px; border-radius: var(--radius-sm);
  background: #FBF2EF; color: var(--danger); font-size: 13.5px; border: 1px solid #EFDCD6;
}

:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ─────────── бренд ─────────── */

.brand, .login-brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  background: linear-gradient(140deg, var(--green) 0%, #4FA07B 100%);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.55);
}
.brand-text { font-weight: 700; letter-spacing: -.015em; }

/* ─────────── экран входа ─────────── */

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px;
  padding: 30px 28px 26px; box-shadow: var(--shadow-md);
}
.login-brand { margin-bottom: 22px; }
.login-title { font-size: 21px; margin-bottom: 4px; }
.login-sub { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }

/* ─────────── шапка ─────────── */

.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 11px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.user-box { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 12px 5px 5px;
}
.user-btn:hover { border-color: var(--border-strong); }
.user-avatar { display: flex; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--surface-2); flex: none; }
.user-avatar svg { width: 100%; height: 100%; }
.user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.user-name { font-weight: 620; font-size: 14px; }
.user-role { font-size: 11.5px; color: var(--muted); }
.chev { width: 16px; height: 16px; color: var(--muted-2); }

.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-md); padding: 6px; z-index: 40;
}
.menu-item {
  display: block; width: 100%; text-align: left; padding: 9px 11px;
  background: none; border: 0; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item-quiet { color: var(--muted); }

/* ─────────── содержимое ─────────── */

.content { max-width: 1080px; margin: 0 auto; padding: 20px 20px 40px; display: flex; flex-direction: column; gap: 16px; }

.hint-bar {
  margin: 0; padding: 11px 14px; border-radius: var(--radius-sm);
  background: #FDF7EA; border: 1px solid #F0E1BF; color: #6B5522; font-size: 13.5px;
}
.hint-bar .link-btn { color: #8A6A1F; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 18px 12px; flex-wrap: wrap; }
.card-title { font-size: 16px; }
.card-sub { margin: 3px 0 0; color: var(--muted); font-size: 13px; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot-free { background: var(--surface); border: 1.5px solid var(--green-line); }
.dot-mine { background: var(--green); }
.dot-busy { background: var(--busy); border: 1.5px solid var(--busy-line); }

/* ─────────── календарь ─────────── */

.calendar-strip {
  display: flex; gap: 8px; padding: 12px 18px 18px; overflow-x: auto;
  scrollbar-width: thin; scroll-snap-type: x proximity;
}
.day {
  position: relative; flex: 1 0 84px; min-width: 84px; scroll-snap-align: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 9px 8px 9px; cursor: pointer; text-align: center;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.day:hover { border-color: var(--border-strong); }
.day.is-selected { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-soft); }
.day.is-today .day-num { color: var(--green); }
.day.is-weekend { background: var(--surface-2); }
.day.is-full { background: #FAFAF9; }
.day-dow { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.day-num { font-size: 20px; font-weight: 680; line-height: 1.15; }
.day-mon { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.day-load { font-size: 11.5px; color: var(--muted); }
.day-load.is-full { color: var(--danger); }
.day-mine {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 4px;
  font-size: 11px; font-weight: 650; color: var(--green);
  background: var(--green-soft); border-radius: 999px; padding: 1px 7px;
}
.day-mark-bar { position: absolute; left: 10px; right: 10px; top: 0; height: 4px; border-radius: 0 0 4px 4px; }
.day-badge-today { position: absolute; top: -7px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 700; color: #fff; background: var(--green); border-radius: 999px; padding: 1px 8px; letter-spacing: .02em; }
.day-mark-btn {
  position: absolute; right: 4px; bottom: 4px; width: 22px; height: 22px;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted-2);
  cursor: pointer; display: grid; place-items: center;
}
.day:hover .day-mark-btn { background: var(--surface-2); color: var(--text); }
.day-mark-btn svg { width: 13px; height: 13px; }

/* ─────────── карта кабинета ─────────── */

.mark-banner { margin: 0 18px 4px; padding: 9px 13px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; border: 1px solid; }
.map-summary { font-size: 13px; color: var(--muted); text-align: right; }
.map-summary b { color: var(--text); font-size: 15px; }

.map-wrap { padding: 6px 18px 20px; }
.map { position: relative; width: 100%; max-width: 660px; margin: 0 auto; aspect-ratio: 700 / 640; }
.map-shell { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-shell .lbl { font-size: 15px; fill: #7C8783; font-family: inherit; }
.map-shell .lbl-sm { font-size: 13px; }
.map-shell .lbl-out { fill: #98A29E; }

.seat {
  position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 4px; cursor: pointer; text-align: center;
  background: var(--surface); border: 1.5px solid var(--green-line); border-radius: 9px;
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.seat:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); z-index: 5; }
.seat-code { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .03em; }
.seat-status { font-size: 11.5px; color: var(--green-dark); font-weight: 600; line-height: 1.2; }
.seat-avatar { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; }
.seat-avatar svg { width: 100%; height: 100%; display: block; }
.seat-who { font-size: 11.5px; font-weight: 600; color: var(--text); line-height: 1.15; }
.seat-hint, .seat-sub { font-size: 11px; color: var(--muted); line-height: 1.15; }

.seat-tag {
  position: absolute; top: 3px; left: 5px; font-size: 9.5px; font-weight: 700;
  color: var(--muted-2); letter-spacing: .04em;
}
.seat.is-mine .seat-tag { color: var(--green); }
.seat.is-free { background: var(--surface); border-color: var(--green-line); }
.seat.is-free .seat-status { color: var(--green); }
.seat.is-busy { background: var(--busy); border-color: var(--busy-line); cursor: pointer; }
.seat.is-busy .seat-code { color: var(--muted-2); }
.seat.is-mine { background: var(--green-soft); border-color: var(--green); }
.seat.is-mine .seat-who { color: var(--green-dark); }
.seat.is-selected { box-shadow: 0 0 0 3px var(--green-soft); border-color: var(--green); }

/* ─────────── кто в офисе ─────────── */

.office-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 18px 18px; }
.person-chip {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 14px 3px 3px; font-size: 13.5px;
}
.person-chip.is-me { background: var(--green-soft); border-color: var(--green-line); }
.person-chip.is-away { opacity: .62; }
.person-chip .pc-avatar { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none; }
.person-chip .pc-avatar svg { width: 100%; height: 100%; display: block; }
.person-chip .pc-seat { color: var(--muted); font-size: 12px; }
.office-empty { padding: 0 18px 18px; color: var(--muted); font-size: 13.5px; }
.office-group-title { width: 100%; font-size: 12px; font-weight: 600; color: var(--muted-2); text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }

.foot { text-align: center; color: var(--muted-2); font-size: 12px; padding: 6px 0 0; }

/* ─────────── модальное окно ─────────── */

.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(28, 35, 32, .38);
  display: grid; place-items: center; padding: 18px; overflow-y: auto;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: 100%; max-width: 460px; background: var(--surface);
  border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden;
  animation: rise .18s cubic-bezier(.2,.7,.3,1);
}
@keyframes rise { from { transform: translateY(10px); opacity: .6 } to { transform: none; opacity: 1 } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 14px 12px 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 16.5px; }
.modal-body { padding: 16px 20px; max-height: min(62vh, 520px); overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; padding: 14px 20px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.modal-foot .btn { flex: 0 1 auto; white-space: nowrap; }
.modal-foot .btn-primary, .modal-foot .btn-danger { flex: 1 1 auto; }

.seat-brief { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.seat-brief-icon { width: 44px; height: 44px; border-radius: 11px; background: var(--green-soft); color: var(--green-dark); display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; }
.seat-brief-main { line-height: 1.3; }
.seat-brief-main strong { display: block; font-size: 15px; }
.seat-brief-main span { color: var(--muted); font-size: 13px; }

.section-label { font-size: 12px; font-weight: 700; color: var(--muted-2); text-transform: uppercase; letter-spacing: .05em; margin: 4px 0 8px; }
.helper { color: var(--muted); font-size: 13px; margin: 0 0 12px; }

.picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.pick {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-align: left;
  transition: border-color .12s ease, background .12s ease;
}
.pick:hover:not(.is-disabled) { border-color: var(--border-strong); }
.pick.is-on { border-color: var(--green); background: var(--green-soft); }
.pick.is-disabled { opacity: .55; cursor: not-allowed; background: var(--surface-2); }
.pick-box { width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--border-strong); flex: none; display: grid; place-items: center; background: #fff; }
.pick.is-on .pick-box { background: var(--green); border-color: var(--green); }
.pick-box svg { width: 11px; height: 11px; color: #fff; opacity: 0; }
.pick.is-on .pick-box svg { opacity: 1; }
.pick-text { line-height: 1.2; min-width: 0; }
.pick-day { font-size: 13.5px; font-weight: 620; }
.pick-note { font-size: 11.5px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-actions { display: flex; gap: 12px; margin: 12px 0 2px; }

.color-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.swatch { width: 34px; height: 34px; border-radius: 9px; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.swatch.is-on { border-color: var(--text); }

.toast-wrap { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #223029; color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13.5px; box-shadow: var(--shadow-md); max-width: 92vw;
  animation: toast-in .2s ease;
}
.toast.is-err { background: #7E3524; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

/* ─────────── адаптивность ─────────── */

@media (max-width: 720px) {
  .content { padding: 14px 12px 32px; }
  .card-head { padding: 14px 14px 10px; }
  .calendar-strip { padding: 4px 14px 16px; }
  .day { flex: 0 0 78px; min-width: 78px; }
  .map-wrap { padding: 6px 10px 16px; overflow-x: auto; }
  .map { min-width: 330px; }
  .seat-hint, .seat-sub { display: none; }
  .seat-who, .seat-status, .seat-code { font-size: 10px; }
  .seat-avatar { width: 24px; height: 24px; }
  .seat { gap: 1px; padding: 2px; border-radius: 7px; }
  .map-shell .lbl { font-size: 17px; }
  .map-shell .lbl-sm { font-size: 15px; }
  .picker { grid-template-columns: 1fr; }
  .legend { font-size: 12px; }
  .user-meta { display: none; }
  .modal-foot { flex-direction: column-reverse; }
}


/* ─────────── вкладки ─────────── */

.tabs { background: var(--surface); border-bottom: 1px solid var(--border); }
.tabs-inner { max-width: 1080px; margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
  padding: 11px 14px; font-size: 14px; font-weight: 600; color: var(--muted);
  transition: color .15s ease, border-color .15s ease;
}
.tab:hover { color: var(--text); }
.tab.is-on { color: var(--green-dark); border-bottom-color: var(--green); }

/* ─────────── переключатель периода ─────────── */

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 3px; }
.seg-btn { background: none; border: 0; border-radius: 7px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg-btn.is-on { background: var(--surface); color: var(--green-dark); box-shadow: var(--shadow-sm); }

/* ─────────── показатели ─────────── */

.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 4px 18px 14px; }
.kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.kpi-val { display: block; font-size: 22px; font-weight: 680; letter-spacing: -.02em; line-height: 1.15; color: var(--green-dark); }
.kpi-lbl { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.kpi-lbl i { font-style: normal; color: var(--muted-2); }

/* ─────────── диаграмма ─────────── */

.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 18px 6px; }
.chart-title { font-size: 13px; font-weight: 600; color: var(--muted); }
.chart-wrap { padding: 0 18px 18px; overflow-x: auto; }
.chart { min-width: 520px; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg .ax { font-size: 10px; fill: var(--muted-2); font-family: inherit; }
.chart-svg .ax-sm { font-size: 9px; }

/* ─────────── таблица ─────────── */

.table-wrap { padding: 0 18px 18px; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 560px; }
.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: .04em; padding: 6px 10px; border-bottom: 1px solid var(--border);
}
.tbl th.num, .tbl td.num { text-align: right; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--surface-2); }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.is-on { background: var(--green-soft); }
.cell-person { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; }
.cell-person .pc-avatar { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none; }
.cell-person .pc-avatar svg { width: 100%; height: 100%; display: block; }
.tag { font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--green-dark); background: var(--green-soft); border-radius: 999px; padding: 1px 7px; }
.muted { color: var(--muted-2); }
.mini-bar { display: inline-block; width: 90px; height: 7px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; vertical-align: middle; }
.mini-bar i { display: block; height: 100%; background: var(--green); }
.mini-val { margin-left: 8px; color: var(--muted); font-size: 12.5px; }

/* ─────────── занятость мест ─────────── */

.seats-bars { padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 8px; }
.seat-bar { display: grid; grid-template-columns: 190px 1fr 40px; align-items: center; gap: 12px; font-size: 13px; }
.sb-name i { font-style: normal; color: var(--muted-2); font-size: 12px; }
.sb-track { height: 10px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.sb-track i { display: block; height: 100%; background: linear-gradient(90deg, #4FA07B, var(--green)); }
.sb-val { text-align: right; font-weight: 650; color: var(--muted); }

/* ─────────── выпадающий список ─────────── */

.select {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); outline: none;
}
.select:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

@media (max-width: 720px) {
  .tabs-inner { padding: 0 12px; }
  .tab { padding: 10px 10px; font-size: 13px; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 4px 14px 12px; }
  .kpi-val { font-size: 18px; }
  .seat-bar { grid-template-columns: 130px 1fr 34px; gap: 8px; font-size: 12px; }
  .chart-wrap, .table-wrap { padding-left: 14px; padding-right: 14px; }
}
