/* Vitrine showroom visits — brand navy #2E3192 + yellow #FFCD00 from the logo. */
:root {
  --navy: #2E3192;
  --navy-700: #23266f;
  --navy-50: #eef0fb;
  --yellow: #FFCD00;
  --yellow-50: #fff8d6;
  --bg: #f4f5f9;
  --surface: #ffffff;
  --line: #e3e5ee;
  --line-strong: #cfd3e1;
  --text: #1c1f3a;
  --muted: #6b7088;
  --ok: #138a52;
  --ok-bg: #e5f6ed;
  --warn: #b45d00;
  --warn-bg: #fff1dc;
  --full: #c62828;
  --full-bg: #fde8e8;
  --custom: #7c3aed;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 24, 60, .06), 0 4px 16px rgba(20, 24, 60, .06);
  --shadow-lg: 0 12px 40px rgba(20, 24, 60, .18);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Arabic", Tahoma, sans-serif;
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 20px; }
a { color: var(--navy); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.req { color: var(--full); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- boot + login ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--surface); }
.boot img { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 10% -10%, var(--navy-50), transparent 60%),
              radial-gradient(900px 400px at 110% 110%, var(--yellow-50), transparent 60%), var(--bg);
}
.login-card {
  width: min(400px, 100%); background: var(--surface); border-radius: 18px; padding: 32px 28px;
  box-shadow: var(--shadow-lg); display: grid; gap: 14px; border-top: 5px solid var(--yellow);
}
.login-logo { width: 150px; margin: 0 auto 4px; display: block; }
.login-card h1 { text-align: center; font-size: 22px; color: var(--navy); }
.login-card > p { text-align: center; margin: -6px 0 6px; }

/* ---------- forms ---------- */
label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: #3a3f5c; }
input, select, textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 9px;
  background: #fff; font-size: 15px; font-weight: 400; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(46, 49, 146, .15); }
input[type=color] { padding: 3px; height: 40px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; min-width: 0; }
legend { font-size: 13px; font-weight: 600; color: #3a3f5c; padding: 0 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: flex; align-items: center; gap: 7px; font-weight: 500; font-size: 14px; cursor: pointer; }
.checks input { width: 17px; min-height: 17px; height: 17px; accent-color: var(--navy); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.field-row .narrow { max-width: 110px; }
.form-error { margin: 0; padding: 9px 12px; border-radius: 9px; background: var(--full-bg); color: var(--full); font-size: 14px; }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px;
  border-radius: 9px; border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-700); }
.btn.primary:disabled { background: #a5a7cc; cursor: not-allowed; }
.btn.ghost { background: #fff; border-color: var(--line-strong); color: var(--text); }
.btn.ghost:hover { border-color: var(--navy); color: var(--navy); }
.btn.danger { background: #fff; border-color: #f0c2c2; color: var(--full); }
.btn.danger:hover { background: var(--full-bg); }
.btn.small { min-height: 32px; padding: 5px 11px; font-size: 13px; }
.btn.wide { width: 100%; min-height: 44px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong); background: #fff;
  font-size: 24px; line-height: 1; cursor: pointer; display: inline-grid; place-items: center; color: var(--navy); flex: none;
}
.icon-btn:hover { background: var(--navy-50); border-color: var(--navy); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 64px;
  background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(0, 0, 0, .02);
}
.brand img { height: 34px; display: block; }
.tabs { display: flex; gap: 2px; height: 100%; flex: 1; }
.tabs a {
  display: flex; align-items: center; padding: 0 14px; color: var(--muted); text-decoration: none; font-weight: 600;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--navy); border-bottom-color: var(--yellow); }
.top-right { display: flex; align-items: center; gap: 12px; position: relative; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ok); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(19, 138, 82, .5); animation: ping 2s infinite; }
.live.off { color: var(--full); }
.live.off i { background: var(--full); animation: none; }
@keyframes ping { 70% { box-shadow: 0 0 0 7px rgba(19, 138, 82, 0); } 100% { box-shadow: 0 0 0 0 rgba(19, 138, 82, 0); } }
.user-btn { display: flex; align-items: center; gap: 8px; border: 0; background: none; cursor: pointer; padding: 4px; border-radius: 30px; font-weight: 600; }
.user-btn:hover { background: var(--bg); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: var(--yellow); display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
}
.bell { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.bell:hover { background: var(--bg); color: var(--navy); }
.bell.has { color: var(--navy); }
.bell-count {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; border: 2px solid var(--surface);
  background: var(--full); color: #fff; font-size: 10px; font-weight: 800; line-height: 14px; text-align: center; font-variant-numeric: tabular-nums;
}
.notif-panel {
  position: absolute; right: 0; top: 50px; width: min(380px, calc(100vw - 24px)); max-height: min(70vh, 560px); display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 30; overflow: hidden;
}
.notif-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px 2px; }
.notif-head strong { font-size: 15px; color: var(--navy); }
.notif-head .link-btn:disabled { color: var(--muted); cursor: default; background: none; }
.notif-btns { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.alert-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; max-width: 1400px; margin: 14px auto 0; padding: 10px 14px;
  background: var(--navy); color: #fff; border-radius: 12px; border-left: 4px solid var(--yellow); font-size: 14px;
}
.alert-banner[hidden] { display: none; }
.alert-banner .ab-text { flex: 1 1 240px; }
.alert-banner .ab-btns { display: flex; gap: 8px; }
.alert-banner .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .4); background: transparent; }
.alert-banner .btn.primary { background: var(--yellow); color: var(--navy); border-color: var(--yellow); }
.red-text { color: var(--full) !important; margin-right: auto; }
.notif-scope { margin: 0; padding: 0 14px 10px; border-bottom: 1px solid var(--line); }
.notif-list { overflow-y: auto; }
.notif-empty { padding: 18px 14px; margin: 0; }
.notif {
  display: grid; grid-template-columns: 26px 1fr; gap: 10px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line);
  background: #fff; padding: 11px 14px; cursor: pointer; font: inherit; color: inherit;
}
.notif:hover { background: var(--bg); }
.notif.new { background: #fffbe6; box-shadow: inset 3px 0 0 var(--yellow); }
.notif.new:hover { background: #fff6cc; }
.notif-main { display: grid; gap: 2px; min-width: 0; }
.notif-line { font-size: 13px; }
.notif-cust { font-weight: 700; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-sub { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.notif-time { font-size: 11px; color: var(--muted); }
.menu {
  position: absolute; right: 0; top: 48px; min-width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px; display: grid; z-index: 30;
}
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: grid; }
.menu button { text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: var(--bg); }

.view { padding: 20px; max-width: 1400px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.section-title { margin: 28px 0 10px; font-size: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }

/* ---------- calendar ---------- */
.cal-top { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.branch-bar { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.legend .hint { margin-left: auto; }
.legend .hint + #hoursNote { margin-left: 0; }
.info-sample { color: var(--navy); }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 30px; background: #fff;
  border: 1px solid var(--line-strong); cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text);
}
.chip:hover { border-color: var(--navy); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip .swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.chip.on .swatch { box-shadow: 0 0 0 2px #fff; }
/* showroom chip + its map button, joined into one pill */
.chip-group { display: inline-flex; flex: none; }
.chip-group .chip { border-radius: 30px 0 0 30px; }
.chip-map {
  display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px 7px 10px; border-radius: 0 30px 30px 0; background: var(--navy-50, #eef0fb);
  border: 1px solid var(--line-strong); border-left: 0; font-weight: 600; font-size: 13px; color: var(--navy); text-decoration: none; white-space: nowrap;
}
.chip-map:hover { background: var(--yellow, #FFCD00); }

.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.cal-title { display: flex; align-items: center; gap: 12px; }
.cal-title h2 { font-size: 24px; color: var(--navy); min-width: 190px; text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); margin-bottom: 12px; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend #hoursNote { margin-left: auto; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot.ok { background: var(--ok); } .dot.warn { background: #f59e0b; } .dot.full { background: var(--full); }
.dot.custom { background: var(--custom); }

.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow span {
  padding: 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  background: #fafbfd; border-bottom: 1px solid var(--line); text-align: center;
}
.day {
  position: relative; min-height: 118px; padding: 8px 9px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: #fff; cursor: pointer; text-align: left; border-top: 0; border-left: 0; display: flex; flex-direction: column; gap: 6px;
  transition: background .12s;
}
.day:nth-child(7n) { border-right: 0; }
.day:hover { background: #f8f9fe; }
.day:focus-visible { outline: 2px solid var(--navy); outline-offset: -2px; z-index: 1; }
.day.other { background: #fbfbfd; }
.day.other .num, .day.other .slot { opacity: .45; }
.day.past { background: repeating-linear-gradient(135deg, #fbfbfd, #fbfbfd 6px, #f5f6fa 6px, #f5f6fa 12px); }
.day.past .slot { opacity: .6; }
.day.today .num { background: var(--yellow); color: var(--navy); }
.day.selected { box-shadow: inset 0 0 0 2px var(--navy); }
.day-top { display: flex; align-items: center; gap: 4px; }
.day.locked { cursor: default; }
.day.locked:not(.past) { background: repeating-linear-gradient(135deg, #fff, #fff 6px, #f6f6fa 6px, #f6f6fa 12px); }
.day.locked:not(.past) .slot { opacity: .55; }
.lock-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #eceef4; border-radius: 10px; padding: 2px 7px; white-space: nowrap; }
.day-info {
  margin-left: auto; height: 26px; min-width: 26px; padding: 0 7px; border-radius: 13px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--navy); font-size: 12px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; gap: 4px; line-height: 1; flex: none;
}
.day-info:hover, .day-info:focus-visible { background: var(--navy); color: #fff; border-color: var(--navy); outline: none; }
.book-hint { display: none; font-size: 11px; font-weight: 700; color: var(--navy); background: var(--yellow); border-radius: 10px; padding: 2px 8px; white-space: nowrap; }
.day:not(.locked):hover .book-hint, .day:not(.locked):focus-visible .book-hint { display: inline-block; }
.num { font-weight: 700; font-size: 14px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
.mine-badge { font-size: 11px; font-weight: 700; color: var(--navy); background: var(--navy-50); border-radius: 20px; padding: 1px 7px; }
.custom-flag { width: 7px; height: 7px; border-radius: 50%; background: var(--custom); display: inline-block; }
.custom-note { font-size: 11px; color: var(--custom); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* one showroom: big counter */
.slot.big { margin-top: auto; display: grid; gap: 5px; }
.slot.big .count { font-size: 22px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.slot.big .count small { font-size: 14px; font-weight: 600; color: var(--muted); }
.slot.big .left { font-size: 12px; font-weight: 600; }
.bar { height: 6px; border-radius: 6px; background: #eceef5; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 6px; background: var(--ok); }
.lvl-ok .count, .lvl-ok .left { color: var(--ok); }
.lvl-warn .count, .lvl-warn .left { color: var(--warn); }
.lvl-warn .bar i { background: #f59e0b; }
.lvl-full .count, .lvl-full .left { color: var(--full); }
.lvl-full .bar i, .bar.lvl-full i, .bar.lvl-closed i { background: var(--full); }
.bar.lvl-warn i { background: #f59e0b; }
.lvl-closed .count, .lvl-closed .left { color: var(--muted); }

/* all showrooms: one row each */
.slot.row { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; min-width: 0; }
.slot.row .swatch { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.slot.row .bname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #4a4f6b; }
.slot.row .count { font-variant-numeric: tabular-nums; padding: 0 6px; border-radius: 10px; }
.slot.row.lvl-ok .count { background: var(--ok-bg); }
.slot.row.lvl-warn .count { background: var(--warn-bg); }
.slot.row.lvl-full .count { background: var(--full-bg); }
.slot.row.lvl-closed .count { background: #eef0f4; }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 22, 50, .3); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--bg); z-index: 41;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .18s ease-out;
}
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.drawer-head p { margin: 0; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.drawer-head h2 { font-size: 22px; color: var(--navy); }
.drawer-body { overflow-y: auto; padding: 16px 20px 40px; display: grid; gap: 16px; align-content: start; }
.bcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.bcard-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-left: 4px solid var(--navy); }
.bcard-head h3 { font-size: 16px; flex: 1; }
.bcard-head .addr { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.bcard-head .addr a { color: inherit; }
.cap-pill { font-weight: 800; font-size: 15px; padding: 4px 10px; border-radius: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cap-pill.lvl-ok { background: var(--ok-bg); color: var(--ok); }
.cap-pill.lvl-warn { background: var(--warn-bg); color: var(--warn); }
.cap-pill.lvl-full { background: var(--full-bg); color: var(--full); }
.cap-pill.lvl-closed { background: #eef0f4; color: var(--muted); }
.bcard .bar { margin: 0 16px; }
.slot-editor { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 16px; background: #fafbfe; border-top: 1px solid var(--line); margin-top: 12px; font-size: 13px; }
.slot-editor strong { color: var(--custom); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: #fff; }
.stepper button { width: 34px; height: 34px; border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--navy); }
.stepper button:hover { background: var(--navy-50); }
.stepper input { width: 56px; min-height: 34px; border: 0; border-radius: 0; text-align: center; padding: 4px; font-weight: 700; }
.slot-editor .note-in { flex: 1; min-width: 120px; min-height: 34px; padding: 5px 9px; font-size: 13px; }
.visits { display: grid; padding: 4px 0; }
.visit { display: grid; grid-template-columns: 58px 1fr auto; gap: 10px; padding: 11px 16px; border-top: 1px solid var(--line); align-items: start; }
.visit.cancelled { opacity: .55; }
.visit.cancelled .vname { text-decoration: line-through; }
.vtime { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; font-size: 14px; }
.vtime.none { color: var(--muted); font-weight: 500; font-size: 12px; }
.vname { font-weight: 700; min-width: 0; }
.vhead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.by-tag {
  flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; font-weight: 600; color: var(--muted); background: #eef0f4; border-radius: 10px; padding: 1px 8px;
}
.by-tag::before { content: "by "; font-weight: 400; }
.by-tag.mine { background: #fff4c2; color: #6b5300; }
.by-tag.online { background: var(--ok-bg); color: var(--ok); }
.by-tag.online::before { content: none; }
.avatar.online { background: var(--ok); color: #fff; font-size: 9px; letter-spacing: .02em; }
.notif-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notif-mark { font-size: 11px; padding: 2px 6px; }
#linksTable tr.off td { opacity: .6; }
.link-cell { display: grid; gap: 6px; min-width: 220px; }
.link-cell code { font-size: 12px; background: var(--bg); border-radius: 6px; padding: 4px 7px; word-break: break-all; direction: ltr; }
.link-cell .row { display: flex; gap: 6px; }
.num-cell { font-variant-numeric: tabular-nums; font-weight: 700; }
.vname, .vnotes, .table [dir=auto] { text-align: left; }
.vmeta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 10px; }
.vmeta a { color: var(--navy); text-decoration: none; font-weight: 600; direction: ltr; }
.vnotes { font-size: 13px; margin-top: 4px; color: #3a3f5c; white-space: pre-wrap; }
.vactions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.vbtns { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.link-btn { border: 0; background: none; color: var(--navy); font-weight: 600; font-size: 12px; cursor: pointer; padding: 3px 6px; border-radius: 6px; }
.link-btn:hover { background: var(--navy-50); }
.link-btn.red { color: var(--full); }
.link-btn.red:hover { background: var(--full-bg); }
.no-visits { padding: 14px 16px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
.bcard-foot { padding: 12px 16px; border-top: 1px solid var(--line); }
.bcard-foot .btn { width: 100%; }

.status { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.st-booked { background: var(--navy-50); color: var(--navy); }
.st-visited { background: var(--ok-bg); color: var(--ok); }
.st-no_show { background: var(--warn-bg); color: var(--warn); }
.st-cancelled { background: #eef0f4; color: var(--muted); }

/* ---------- list ---------- */
.list-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.list-head #listNew { margin-left: auto; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 16px; border-radius: 7px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--navy); color: #fff; }
.period-nav { display: flex; align-items: center; gap: 10px; }
.period-nav strong { min-width: 200px; text-align: center; font-size: 17px; color: var(--navy); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-width: 150px; }
.filters input[type=search] { flex: 1; min-width: 200px; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; display: grid; min-width: 110px; box-shadow: var(--shadow); }
.stat b { font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #fafbfd; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfe; }
.table .sub { display: block; font-size: 12px; color: var(--muted); }
.table td.nowrap { white-space: nowrap; }
.table .swatch { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.day-sep td { background: #f4f5fb; font-weight: 700; color: var(--navy); font-size: 13px; padding: 7px 12px; }

/* ---------- settings ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.scard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 10px; border-top: 4px solid var(--navy); }
.scard h3 { font-size: 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scard p { margin: 0; font-size: 13px; color: var(--muted); }
.scard .big-num { font-size: 30px; font-weight: 800; color: var(--navy); line-height: 1; }
.scard .big-num small { font-size: 13px; font-weight: 600; color: var(--muted); }
.scard .row { display: flex; align-items: center; gap: 8px; }
.range-form, .rules-form { display: grid; gap: 14px; }
.rules-form > p.muted { margin: 0; }
#noticeForm { margin-bottom: 12px; }
.help { font-size: 12px; font-weight: 400; color: var(--muted); }
.rules-preview { margin: 0; padding: 10px 12px; border-radius: 9px; background: var(--navy-50); color: var(--navy); font-weight: 600; font-size: 14px; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-day { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfd; }
.week-day strong { font-size: 13px; color: var(--navy); }
.week-day label { font-size: 11px; font-weight: 600; gap: 3px; }
.week-day input { min-height: 34px; padding: 5px 8px; font-size: 14px; }
.week-day.set { border-color: var(--custom); background: #f7f2ff; }
.win-note { margin: -4px 0 0; padding: 9px 12px; border-radius: 9px; font-size: 13px; background: var(--navy-50); color: var(--navy); }
.win-note.bad { background: var(--full-bg); color: var(--full); font-weight: 600; }
.win-note.admin { background: var(--warn-bg); color: #7a3f00; }
@media (max-width: 900px) { .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) { .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- activity ---------- */
.people { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.person { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 30px; background: #fff; border: 1px solid var(--line-strong); cursor: pointer; font-weight: 600; font-size: 13px; }
.person:hover, .person.on { border-color: var(--navy); }
.person.on { background: var(--navy-50); }
.person b { color: var(--navy); font-variant-numeric: tabular-nums; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; flex: none; }
.avatar.none { background: #e5e7ef; color: var(--muted); }
.feed { display: grid; gap: 14px; }
.feed-day { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.feed-day > h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--navy); background: #fafbfd; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.act { display: grid; grid-template-columns: 70px 32px 1fr; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: start; }
.feed-day > h3 + .act { border-top: 0; }
.act-time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 4px; white-space: nowrap; }
.act-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.act-line b { font-size: 14px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; letter-spacing: .02em; background: var(--navy-50); color: var(--navy); }
.badge.b-red { background: var(--full-bg); color: var(--full); }
.badge.b-green { background: var(--ok-bg); color: var(--ok); }
.badge.b-amber { background: var(--warn-bg); color: var(--warn); }
.badge.b-purple { background: #f1eafe; color: var(--custom); }
.badge.b-teal { background: #e0f4f1; color: #0f766e; }
.badge.b-gray { background: #eef0f4; color: var(--muted); }
.act-subject { font-weight: 600; margin-top: 3px; text-align: left; }
.act-details { font-size: 13px; color: #3a3f5c; white-space: pre-line; margin-top: 2px; text-align: left; }
.act-meta { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.act-meta .link-btn { padding: 0; }
.more-wrap { text-align: center; margin-top: 14px; }

/* ---------- dialogs ---------- */
.dlg { border: 0; padding: 0; border-radius: 16px; width: min(640px, calc(100% - 24px)); box-shadow: var(--shadow-lg); max-height: calc(100vh - 24px); }
.dlg.narrow-dlg { width: min(460px, calc(100% - 24px)); }
.dlg::backdrop { background: rgba(20, 22, 50, .45); }
.dlg form { display: flex; flex-direction: column; max-height: calc(100vh - 24px); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { color: var(--navy); font-size: 19px; }
.dlg-body { padding: 16px 20px; display: grid; gap: 14px; overflow-y: auto; }
.dlg-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fafbfd; }
.dlg-foot .muted { margin-right: auto; }
.cap-live { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 11px; font-weight: 600; font-size: 14px; }
.cap-live .big { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cap-live .grow { flex: 1; display: grid; gap: 6px; }
.cap-live.lvl-ok { background: var(--ok-bg); color: var(--ok); }
.cap-live.lvl-warn { background: var(--warn-bg); color: var(--warn); }
.cap-live.lvl-warn .bar i { background: #f59e0b; }
.cap-live.lvl-full, .cap-live.lvl-closed { background: var(--full-bg); color: var(--full); }
.cap-live.lvl-full .bar i, .bar.lvl-full i, .bar.lvl-closed i { background: var(--full); }
.bar.lvl-warn i { background: #f59e0b; }
.cap-live .bar { background: rgba(255, 255, 255, .7); }
.cap-live.flash { animation: flash .8s; }
@keyframes flash { 30% { box-shadow: 0 0 0 4px rgba(255, 205, 0, .7); } }
.dup { background: var(--warn-bg); color: #7a3f00; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.dup strong { display: block; margin-bottom: 4px; }
.history { font-size: 12px; color: var(--muted); margin: 0; padding-left: 16px; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; inset: auto auto 18px 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100;
  width: min(420px, calc(100% - 32px)); margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; color: inherit;
}
.toasts:popover-open { display: grid; }
.toast { background: var(--text); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 14px; animation: up .2s ease-out; }
.toast.err { background: var(--full); }
.toast.ok { background: var(--navy); border-left: 4px solid var(--yellow); }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }

body:not(.is-admin) .admin-only { display: none !important; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .brand img { height: 26px; }
  .tabs a { padding: 0 9px; font-size: 14px; }
  #userName, .live span { display: none; }
  .view { padding: 14px 12px; }
  .alert-banner { margin: 10px 12px 0; }
  .day { min-height: 82px; padding: 5px; gap: 3px; }
  .slot.big .count { font-size: 16px; }
  .slot.big .left { display: none; }
  .slot.row .bname { display: none; }
  .slot.row { font-size: 11px; }
  .slot.row .count { padding: 0 3px; }
  .custom-note { display: none; }
  .mine-badge { display: none; }
  .day-info { height: 22px; min-width: 22px; padding: 0 3px; font-size: 11px; }
  .day-info span, .book-hint { display: none !important; }
  .lock-tag { font-size: 0; padding: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
  .legend .hint { margin-left: 0; }
  .cal-title h2 { font-size: 19px; min-width: 0; }
  .legend #hoursNote { margin-left: 0; }
}
@media (max-width: 640px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 12px 0; }
  .tabs { order: 3; flex: 0 0 100%; height: 42px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .top-right { margin-left: auto; }
  .num { width: 24px; height: 24px; font-size: 13px; }
  .day { min-height: 70px; }
  .cal-dow span { padding: 8px 2px; font-size: 11px; letter-spacing: 0; }
  .list-head #listNew { margin-left: 0; width: 100%; }
  .act { grid-template-columns: 26px 1fr; gap: 10px; }
  .act-time { grid-column: 2; grid-row: 1; padding: 0; }
  .act-who { grid-row: 1 / span 2; }
  .act-main { grid-column: 2; }
  .cal-top { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 10px; }
  .branch-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .branch-bar .chip { flex: none; }
  .period-nav strong { min-width: 0; flex: 1; font-size: 15px; }
  .period-nav { width: 100%; }
  .filters select, .filters input { flex: 1 1 140px; min-width: 0; }
  /* table rows become cards */
  #listTable thead { display: none; }
  #listTable tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 12px; border-bottom: 1px solid var(--line); gap: 2px 10px; }
  #listTable tr.day-sep { padding: 0; }
  #listTable td { border: 0; padding: 0; }
  #listTable td[data-l]:not(:empty)::before { content: attr(data-l) ": "; color: var(--muted); font-size: 12px; }
  #listTable td.c-name { grid-column: 1; font-size: 15px; }
  #listTable td.c-status { grid-column: 2; grid-row: 1; text-align: right; }
  #listTable td.c-act { grid-column: 1 / -1; }
  .visit { grid-template-columns: 50px 1fr; }
  .vactions { grid-column: 1 / -1; align-items: flex-start; }
  .vbtns { justify-content: flex-start; }
}

@media print {
  .topbar, .filters, .list-head, .branch-bar, .drawer, .toasts { display: none !important; }
  body { background: #fff; }
}

.page-head .row { display: flex; gap: 8px; flex-wrap: wrap; }
