:root {
  --blue: #2a62a0;
  --blue-dark: #1f4a7a;
  --red: #b5121b;
  --slate: #3b4652;
  --bg: #f4f5f7;
  --line: #e3e6ea;
  --text: #1f2933;
  --muted: #6b7785;
  --green: #1a8a3a;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); display: flex; min-height: 100vh; }
body.auth { justify-content: center; align-items: flex-start; }
a { color: var(--blue); text-decoration: none; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0; }
.muted { color: var(--muted); font-size: 13px; }

.sidebar { width: 230px; background: #17212b; color: #cfd6de; padding: 18px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.brand { font-weight: 700; color: #fff; font-size: 16px; padding: 0 10px 16px; }
.sidebar nav { flex: 1; overflow-y: auto; }
.sidebar nav a { display: block; padding: 8px 10px; border-radius: 6px; color: #cfd6de; }
.sidebar nav a:hover, .sidebar nav a.active { background: #243344; color: #fff; }
.nav-head { text-transform: uppercase; font-size: 11px; letter-spacing: .08em; color: #7d8a98; padding: 16px 10px 4px; }
.logout { display: flex; flex-direction: column; gap: 6px; padding: 10px; }
.logout .muted { color: #8794a3; }

.main { flex: 1; padding: 24px 28px; min-width: 0; max-width: 1400px; }
body.auth .main { max-width: 420px; padding-top: 12vh; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.login h1 { margin-bottom: 14px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: #e8f1fb; border: 1px solid #c4dbf2; }
.flash.error { background: #fdeaea; border-color: #f3c1c1; color: #8a1118; }
.flash.success { background: #e7f6ec; border-color: #bfe3cb; color: #14602a; }

.btn { display: inline-block; background: var(--red); color: #fff; border: 0; padding: 8px 14px; border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: #fff; color: var(--red); border: 1px solid #efc4c6; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
form.inline { display: inline; }

label { display: block; font-weight: 600; font-size: 13px; }
label input, label select, label textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid #cdd3da; border-radius: 6px; font: inherit; font-weight: 400; background: #fff; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
label.check input { width: auto; margin: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 760px; }
.form-grid .full, .form-grid .form-actions { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; }
.product-row { display: flex; gap: 8px; margin-bottom: 8px; }
.product-row select { flex: 1; padding: 8px 10px; border: 1px solid #cdd3da; border-radius: 6px; font: inherit; }

.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.table th { text-align: left; background: #f7f8fa; font-size: 13px; padding: 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td.actions, .table th.actions { text-align: right; white-space: nowrap; }
.ref-ok { color: var(--green); font-weight: 600; }
.ref-full { color: var(--red); font-weight: 600; }

/* Event page */
.event-meta { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 18px; }
.event-meta div strong { display: block; font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.slot-group { margin-bottom: 18px; border: 1px solid var(--line); background: #fff; }
.time-bar { background: var(--blue); color: #fff; padding: 8px 12px; font-size: 20px; font-weight: 500; }
.slots { border: 0; border-radius: 0; }
.slots td.info { font-size: 12px; color: var(--muted); line-height: 1.5; }
.slots td.act { background: var(--slate); text-align: center; white-space: nowrap; width: 110px; vertical-align: middle; }
.slots tr.blocked td:not(.act) { background: #fafafa; color: #9aa4af; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: var(--red); color: #fff; border: 0; border-radius: 4px; font-size: 15px; font-weight: 700; cursor: pointer; text-decoration: none; }
.icon-btn:hover { filter: brightness(1.1); }
.dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--blue); vertical-align: middle; margin-left: 4px; }
.dot.on { background: var(--blue); }
.pill { display: inline-block; background: #eef3f9; border-radius: 10px; padding: 1px 8px; font-size: 12px; margin: 1px 2px 1px 0; }
.summary { background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.summary .big { font-size: 20px; font-weight: 700; }
dialog { border: 0; border-radius: 10px; padding: 20px; width: min(460px, 92vw); box-shadow: 0 20px 50px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog textarea { width: 100%; min-height: 110px; padding: 8px; border: 1px solid #cdd3da; border-radius: 6px; font: inherit; margin: 10px 0; }

@media (max-width: 820px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .form-grid { grid-template-columns: 1fr; }
  .main { padding: 16px; }
}
