:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #1c2b3a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0f6cbd;
  --brand-dark: #0a4f8a;
  --accent: #0ea5e9;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --ok: #16a34a;
  --weekend: #eef1f6;
  --today: #fff8e1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  box-shadow: 0 2px 10px rgba(15, 60, 110, .15);
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand .logo { font-size: 32px; }
.brand h1 { margin: 0; font-size: 20px; font-weight: 600; }
.brand .subtitle { margin: 2px 0 0; font-size: 13px; opacity: .85; }

.nav { display: flex; gap: 8px; }
.nav a {
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  opacity: .85;
  transition: .15s;
}
.nav a:hover { opacity: 1; background: rgba(255,255,255,.12); }
.nav a.active { opacity: 1; background: rgba(255,255,255,.2); font-weight: 600; }

main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px 20px 40px; }

.week-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 22px;
}
.week-controls h2 { margin: 0; font-size: 21px; font-weight: 600; min-width: 280px; text-align: center; }
.nav-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  width: 42px; height: 42px;
  font-size: 20px;
  cursor: pointer;
  color: var(--ink);
  transition: .15s;
}
.nav-btn:hover:not(:disabled) { background: var(--accent); color: #fff; border-color: var(--accent); }
.nav-btn:disabled { opacity: .35; cursor: default; }

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}

.day-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(15, 60, 110, .06);
}
.day-card.weekend { background: var(--weekend); }
.day-card.today .day-head { border-left: 3px solid var(--accent); }

.day-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 108, 189, .04);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.day-head .wd { font-weight: 700; font-size: 14px; }
.day-head .num { font-size: 13px; color: var(--muted); }
.day-head .closed { font-size: 11px; color: #b45309; font-weight: 600; }

.day-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; flex: 1; }

.entry {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  line-height: 1.35;
}
.entry .e-time { font-weight: 700; color: var(--brand-dark); }
.entry .e-svc { font-weight: 600; }
.entry .e-agent { margin-top: 2px; color: var(--ink); }
.entry .e-phone { color: var(--muted); font-size: 11.5px; }
.entry .e-details { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.empty-day {
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  padding: 18px 6px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

/* админка */
.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: .15s;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.btn.danger:hover { background: var(--danger); color: #fff; }

.login-box { display: flex; justify-content: center; padding: 60px 0; }
.login-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px 34px;
  width: 340px;
  box-shadow: 0 4px 16px rgba(15,60,110,.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.login-form h2 { margin: 0 0 6px; font-size: 18px; }
.login-form label { font-size: 13px; color: var(--muted); }
.login-form input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
}
.login-form input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.error { color: var(--danger); font-size: 13px; margin: 0; }
.hidden { display: none !important; }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  justify-content: space-between;
  padding-left: 28px;
  padding-right: 28px;
}

/* Панель закрытых дней */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 22px;
  box-shadow: 0 1px 3px rgba(15, 60, 110, .06);
}
.closed-days-panel h3 { margin: 0 0 4px; font-size: 16px; }
.closed-days-panel .hint { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.closed-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.closed-form .date-input, .closed-form .text-input {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
}
.closed-form .date-input { width: 170px; }
.closed-form .text-input { flex: 1; min-width: 200px; }
.closed-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.closed-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #fecaca;
  background: #fff5f5;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
}
.closed-item .ci-date { font-weight: 600; color: var(--danger); }
.closed-item .ci-label { color: var(--muted); margin-left: 8px; }
.closed-item .ci-rm { border: none; background: transparent; color: var(--danger); cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 6px; }
.closed-empty { color: var(--muted); font-size: 13px; padding: 6px 2px; }
.ok { color: var(--ok); font-size: 13px; margin: 8px 0 0; }
.day-head .closed-badge { font-size: 11px; font-weight: 700; color: #fff; background: var(--danger); border-radius: 10px; padding: 1px 8px; }

@media (max-width: 1000px) {
  .week-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .week-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; gap: 10px; }
}