/* TENNIS-SHOP.RU — операционный журнал мастерской
   Токены бренда собраны в одном месте: подставьте точные цвета tennis-shop.ru. */

:root {
  --paper: #ffffff;
  --surface: #f3f6f3;
  --surface-2: #e9efea;
  --ink: #16211d;
  --ink-2: #3d4d47;
  --muted: #77857e;
  --line: #dfe6e1;
  --line-strong: #c6d2cb;

  --accent: #0b7a4b;          /* основная кнопка, активный пункт меню */
  --accent-ink: #ffffff;
  --accent-soft: #e6f2ec;
  --signal: #c7e63c;          /* «мяч»: бесплатная натяжка, сегодняшний день */
  --alert: #b3352b;
  --alert-soft: #fbeceb;

  --r: 8px;
  --rail: 232px;
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.015em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 14px; font-weight: 600; color: var(--ink-2); }
p { margin: 0 0 10px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ─────────── каркас ─────────── */

.shell { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail);
  flex: 0 0 var(--rail);
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding: 20px 14px 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: baseline; gap: 8px; padding: 0 8px 22px; }
.brand b { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.brand span { font-size: 11px; color: var(--muted); font-weight: 600; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 9px 10px; border-radius: var(--r);
  font-size: 14px; font-weight: 600; color: var(--ink-2);
}
.nav a:hover { background: var(--surface); color: var(--ink); }
.nav a.on { background: var(--accent); color: var(--accent-ink); }
.nav a .pill { font-size: 11px; font-weight: 700; opacity: .75; }
.nav hr { border: 0; border-top: 1px solid var(--line); margin: 14px 4px; }

.rail-foot { margin-top: auto; padding: 18px 10px 0; font-size: 12px; color: var(--muted); }
.rail-foot b { display: block; color: var(--ink); font-size: 13px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 26px; background: var(--paper); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar .grow { flex: 1; }

.page { padding: 22px 26px 60px; }

/* ─────────── элементы управления ─────────── */

.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  padding: 8px 14px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink);
}
.btn:hover { border-color: var(--ink-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); }
.btn-sm { padding: 5px 9px; font-size: 13px; }
.btn-danger { color: var(--alert); border-color: transparent; background: transparent; }
.btn-danger:hover { background: var(--alert-soft); }

input[type=text], input[type=date], input[type=number], input[type=password], select, textarea {
  font-family: var(--font); font-size: 14px; color: var(--ink);
  padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--paper); width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }

.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line-strong);
  font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--paper); cursor: pointer;
}
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ─────────── блоки ─────────── */

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.card > header {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.card > header h2 { font-size: 15px; }
.card > .body { padding: 16px; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }

/* Табло смен — единственный «громкий» элемент интерфейса */
.board { display: grid; gap: 1px; background: var(--line); border-radius: 12px; overflow: hidden; }
.board .slot { background: var(--paper); padding: 18px 18px 16px; }
.board .slot .where { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.board .slot .who { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.board .slot .who.empty { color: var(--line-strong); font-weight: 600; font-size: 20px; }
.board .slot.live { box-shadow: inset 3px 0 0 var(--signal); }

.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat .k { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat .v { font-size: 27px; font-weight: 800; letter-spacing: -0.03em; margin-top: 2px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.warn .v { color: var(--alert); }

/* Столбики натяжек по дням */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 84px; }
.spark .bar { flex: 1; background: var(--surface-2); border-radius: 3px 3px 0 0; position: relative; min-height: 3px; }
.spark .bar.has { background: var(--accent); }
.spark .bar.today { background: var(--signal); }
.spark-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }

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

.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th {
  text-align: left; font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--paper);
  position: sticky; top: 0; z-index: 2; white-space: nowrap;
}
table.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover td { background: var(--surface); }
table.tbl td.num, table.tbl th.num { text-align: right; white-space: nowrap; }
table.tbl td.dim { color: var(--muted); }
table.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line-strong); background: var(--surface); }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--ink-2);
}
.tag.free { background: var(--signal); color: #2b3406; }
.tag.ok { background: var(--accent-soft); color: var(--accent); }
.tag.bad { background: var(--alert-soft); color: var(--alert); }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* ─────────── панель ввода ─────────── */

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100vw;
  background: var(--paper); border-left: 1px solid var(--line); z-index: 60;
  display: flex; flex-direction: column; transform: translateX(102%);
  transition: transform .22s ease;
}
.drawer.open { transform: none; }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }
.drawer header { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer header h2 { flex: 1; }
.drawer .body { padding: 18px; overflow-y: auto; flex: 1; }
.drawer footer { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.scrim { position: fixed; inset: 0; background: rgba(22,33,29,.35); z-index: 50; display: none; }
.scrim.open { display: block; }

.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.hint.free { color: #4a5c0a; background: var(--signal); padding: 8px 10px; border-radius: var(--r); font-weight: 600; }

/* ─────────── график смен ─────────── */

.sched { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--paper); }
.sched th { font-size: 12px; color: var(--muted); font-weight: 700; text-align: left; padding: 9px 10px;
            border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.sched td { border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); padding: 0; }
.sched td:first-child { border-left: 0; }
.sched .daycell { padding: 8px 10px; white-space: nowrap; font-weight: 600; }
.sched .daycell small { color: var(--muted); font-weight: 600; margin-left: 5px; }
.sched tr.weekend .daycell { background: var(--surface); }
.sched tr.today .daycell { box-shadow: inset 3px 0 0 var(--signal); }
.sched select {
  display: block; border: 0; border-radius: 0; background: transparent; padding: 8px 10px;
  font-weight: 600; width: 100%; appearance: none; cursor: pointer;
}
.sched select:hover { background: var(--surface); }
.sched select.none { color: var(--line-strong); font-weight: 500; }
.sched select.vac { color: var(--alert); background: var(--alert-soft); }
.sched td select + select { border-top: 1px solid var(--line); }

/* ─────────── прочее ─────────── */

.flash { padding: 10px 14px; border-radius: var(--r); font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.flash.ok { background: var(--accent-soft); color: var(--accent); }
.flash.error { background: var(--alert-soft); color: var(--alert); }

.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--surface); padding: 20px; }
.login-box { width: 360px; max-width: 100%; background: var(--paper); border: 1px solid var(--line);
             border-radius: 14px; padding: 28px; }
.login-box .brand { padding-bottom: 18px; }

.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }

.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form > * { flex: 1 1 130px; }
.inline-form button { flex: 0 0 auto; }

@media (max-width: 1100px) {
  .g-side, .g-4 { grid-template-columns: 1fr; }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .shell { flex-direction: column; }
  .rail { width: 100%; height: auto; position: static; flex: none;
          border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav hr, .rail-foot { display: none; }
  .brand { padding-bottom: 12px; }
  .page, .topbar { padding-left: 14px; padding-right: 14px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .drawer { width: 100%; }
}
