/* Rezerwacje sal — Kursoria demo */

:root {
  --navy: #0e2a3d;
  --navy-2: #14384f;
  --ink: #1b2733;
  --ink-soft: #425466;
  --muted: #66788a;
  --line: #dfe6ec;
  --line-soft: #ecf1f5;
  --bg: #f2f5f8;
  --surface: #ffffff;
  --primary: #14607a;
  --primary-dark: #0f4d63;
  --primary-soft: #e6f2f5;
  --ok: #1f7a4d;
  --ok-soft: #e7f5ed;
  --warn: #9a6b1f;
  --warn-soft: #fbf3e3;
  --danger: #a4342f;
  --danger-soft: #fbeceb;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 39, 55, .05), 0 8px 24px rgba(16, 39, 55, .05);
  --shadow-pop: 0 12px 40px rgba(12, 31, 44, .16);
  --header-h: 64px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 17px; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- topbar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 28px;
  height: var(--header-h); padding: 0 24px;
  background: var(--navy); color: #fff;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  color: #fff; text-decoration: none; flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 8px;
  background: #1d4a63; border: 1px solid rgba(255,255,255,.18);
  font-weight: 700; font-size: 18px; letter-spacing: .02em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; font-weight: 600; }
.brand-text span { font-size: 11.5px; color: #a9c1cf; }

.mainnav { display: flex; align-items: stretch; height: 100%; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }

.navbtn {
  appearance: none; border: 0; background: transparent; color: #c3d3de;
  font: inherit; font-size: 14px; padding: 0 14px; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.navbtn:hover { color: #fff; background: rgba(255,255,255,.05); }
.navbtn.is-active { color: #fff; border-bottom-color: #8fc3d3; border-bottom-width: 3px; font-weight: 600; background: rgba(255,255,255,.06); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.iconbtn {
  position: relative; display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.16); background: transparent;
  color: #dbe7ef; cursor: pointer;
}
.iconbtn:hover { background: rgba(255,255,255,.08); color: #fff; }

.notif-count {
  position: absolute; top: 3px; right: 3px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: #d4695f; color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
}

.notif-wrap { position: relative; }

.notif-pop {
  position: absolute; right: 0; top: 46px; width: 370px; max-width: calc(100vw - 32px);
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-pop); overflow: hidden;
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line-soft);
}
.notif-list { max-height: 340px; overflow-y: auto; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.notif-item:last-child { border-bottom: 0; }
.notif-item.is-unread { background: #f4f9fb; }
.notif-item strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.notif-item time { display: block; color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.notif-empty { padding: 22px 16px; color: var(--muted); font-size: 13.5px; text-align: center; }

.userselect { display: flex; align-items: center; gap: 9px; }
.userselect select {
  appearance: none; background: rgba(255,255,255,.08); color: #fff;
  border: 1px solid rgba(255,255,255,.18); border-radius: 8px;
  font: inherit; font-size: 13px; padding: 8px 26px 8px 10px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c3d3de' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
  max-width: 245px;
}
.userselect select option { color: var(--ink); background: #fff; }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 50%; background: #245b76; color: #fff;
  font-size: 11.5px; font-weight: 700; letter-spacing: .03em; flex-shrink: 0;
}

.demo-strip {
  display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap;
  padding: 7px 16px; background: #e8eef3; border-bottom: 1px solid #d7e0e7;
  color: #3d5364; font-size: 12.5px;
}
.demo-strip strong { color: #24404f; }
.demo-strip .linkbtn { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- layout ---------- */

.page { max-width: 1320px; margin: 0 auto; padding: 26px 24px 48px; }

.view { display: none; }
.view.is-active { display: block; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 20px;
}
.page-head .sub { margin-top: 5px; color: var(--muted); font-size: 13.5px; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 18px;
}
.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 14px;
}
.hint { color: var(--muted); font-size: 12.5px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-size: 13.5px; font-weight: 500; line-height: 1;
  padding: 10px 14px; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid #2f89a6; outline-offset: 2px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { border-color: #b9c7d2; color: var(--ink); }
.btn-watching { background: var(--primary-soft); color: var(--primary-dark); border-color: #a8c9d5; font-weight: 600; }
.btn-watching:hover { background: #d9ebf0; }
.btn-danger { background: #fff; color: var(--danger); border-color: #e7c2bf; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 7px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.linkbtn {
  appearance: none; border: 0; background: transparent; padding: 0;
  color: var(--primary); font: inherit; font-size: 12.5px; cursor: pointer;
}
.linkbtn:hover { text-decoration: underline; }

.iconbtn-sm {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
  color: var(--ink-soft); cursor: pointer;
}
.iconbtn-sm:hover { background: #f5f8fa; }

/* ---------- toolbar ---------- */

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 12px;
}
.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-label { font-size: 14px; font-weight: 600; margin-left: 6px; }

.segmented {
  display: inline-flex; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; overflow: hidden;
}
.segmented button {
  appearance: none; border: 0; background: transparent; font: inherit;
  font-size: 13px; color: var(--ink-soft); padding: 8px 14px; cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.is-active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }

.field-inline { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-soft); }
input[type="date"], input[type="time"], input[type="datetime-local"],
input[type="text"], input[type="number"], select, textarea {
  font: inherit; font-size: 13.5px; color: var(--ink);
  background: #fff; border: 1px solid #cfdae3; border-radius: 7px;
  padding: 8px 10px; min-height: 38px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(47, 137, 166, .35); outline-offset: 1px;
  border-color: #7fb0c2;
}
textarea { resize: vertical; min-height: 74px; }

.room-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 12px; font: inherit; font-size: 12.5px; color: var(--ink-soft); cursor: pointer;
}
.chip:hover { border-color: #b9c7d2; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.chip.is-active { border-color: var(--primary); background: var(--primary); color: #fff; font-weight: 600; }
.chip.is-active .dot { outline: 1px solid rgba(255,255,255,.85); }
.chip.is-dim { opacity: .45; }

/* ---------- calendar ---------- */

.calendar-card { padding: 0; overflow: hidden; }

.day-view { overflow-x: auto; scrollbar-width: thin; }
.day-view::-webkit-scrollbar { height: 9px; }
.day-view::-webkit-scrollbar-thumb { background: #b9c7d2; border-radius: 5px; }
.day-view::-webkit-scrollbar-track { background: #eef2f5; }
.scroll-hint { display: none; padding: 8px 12px; color: var(--muted); font-size: 12px; background: #fafcfd; border-bottom: 1px solid var(--line-soft); }
.day-grid {
  display: grid; grid-template-columns: 62px repeat(var(--rooms, 1), minmax(190px, 1fr));
  min-width: 780px;
}
.dg-corner { border-bottom: 1px solid var(--line); background: #fafcfd; }
.dg-head {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 10px; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line-soft);
  background: #fafcfd; min-width: 0;
}
.dg-head .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dg-head strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dg-head span { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }

.dg-times { border-right: 1px solid var(--line-soft); }
.dg-time {
  height: 54px; font-size: 11.5px; color: var(--muted);
  text-align: right; padding-right: 9px; transform: translateY(-8px);
  border-bottom: 1px solid var(--line-soft);
}
.dg-time:last-child { border-bottom: 0; }

.dg-col {
  position: relative; border-left: 1px solid var(--line-soft);
  background-image: repeating-linear-gradient(
    to bottom, transparent 0, transparent 53px, var(--line-soft) 53px, var(--line-soft) 54px
  );
  background-size: 100% 54px;
}
.dg-col.is-dim { opacity: .38; }
.dg-col.is-closed { background-color: #f6f8fa; }

.res-block {
  position: absolute; left: 5px; right: 5px;
  border-radius: 6px; border: 1px solid; border-left-width: 3px;
  padding: 4px 7px; overflow: hidden; cursor: pointer;
  font-size: 11.5px; line-height: 1.35; text-align: left;
  background-clip: padding-box;
}
.res-block:hover { filter: brightness(.97); box-shadow: 0 2px 8px rgba(16,39,55,.12); }
.res-block strong { display: block; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-block .rb-meta { display: block; color: inherit; opacity: .88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
.res-block.is-short { padding: 2px 6px; }
.res-block.is-short .rb-meta { display: none; }

.blk-block {
  position: absolute; left: 5px; right: 5px;
  border-radius: 6px; border: 1px dashed #b8a888;
  background: repeating-linear-gradient(135deg, #f7f2e8 0 8px, #f1e9d9 8px 16px);
  color: #6d5730; padding: 4px 7px; font-size: 11px; line-height: 1.35; overflow: hidden;
}
.blk-block strong { display: block; font-size: 11px; font-weight: 600; }

.now-line { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid #c05149; z-index: 5; pointer-events: none; }
.now-line::before {
  content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px;
  border-radius: 50%; background: #c05149;
}

.cal-empty {
  padding: 46px 20px; text-align: center; color: var(--muted); font-size: 13.5px;
}

/* week matrix */

.week-view { padding: 6px 14px 14px; overflow-x: auto; }
.week-grid { display: grid; grid-template-columns: 178px repeat(5, minmax(140px, 1fr)); min-width: 880px; }
.wg-corner { padding: 10px 8px; }
.wg-day {
  padding: 10px 8px; text-align: center; font-size: 12.5px; color: var(--ink-soft);
  border-left: 1px solid var(--line-soft);
}
.wg-day strong { display: block; font-size: 13px; color: var(--ink); font-weight: 600; }
.wg-day.is-today strong { color: var(--primary); }
.wg-row { display: contents; }
.wg-label {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 4px;
  border-top: 1px solid var(--line-soft); font-size: 12.5px; min-width: 0;
}
.wg-label .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.wg-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wg-cell {
  position: relative; height: 54px; margin: 0; border: 0; border-top: 1px solid var(--line-soft);
  border-left: 1px solid var(--line-soft); background: #fff; cursor: pointer; padding: 0;
}
.wg-cell:hover { background: #f6fafc; }
.wg-cell.is-dim { opacity: .4; }
.wg-bar { position: absolute; top: 20px; height: 13px; border-radius: 3px; opacity: .9; }
.wg-count {
  position: absolute; right: 5px; top: 4px; font-size: 11px; font-weight: 600; color: #5b6b7a;
}
.wg-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #a9b8c3; font-size: 16px; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 9px; height: 9px; border-radius: 50%; }
.legend .dash { width: 14px; height: 8px; border-radius: 2px; border: 1px dashed #b8a888; background: #f3ecdd; }

/* ---------- rooms ---------- */

.rooms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; margin-bottom: 18px; }

.room-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 12px;
  border-top: 3px solid var(--room-color, var(--primary));
}
.room-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.room-card h3 { font-size: 16.5px; }
.room-loc { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  border-radius: 999px; padding: 4px 9px; font-size: 11.5px; font-weight: 600;
}
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.status-pill.is-free { background: var(--ok-soft); color: var(--ok); }
.status-pill.is-busy { background: var(--danger-soft); color: var(--danger); }
.status-pill.is-soon { background: var(--warn-soft); color: var(--warn); }

.room-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; font-size: 13px; color: var(--ink); }
.room-meta b { display: block; font-size: 11px; color: #5b6b7a; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.room-equip { display: flex; flex-wrap: wrap; gap: 6px; }
.equip-tag { background: #f1f5f8; border: 1px solid #e3eaef; border-radius: 5px; padding: 3px 7px; font-size: 11.5px; color: var(--ink-soft); }
.room-next { border-top: 1px solid var(--line-soft); padding-top: 10px; font-size: 12.5px; color: var(--ink-soft); }
.room-next b { font-weight: 600; }
.room-actions { display: flex; gap: 8px; margin-top: auto; }
.room-actions .btn { flex: 1; }

.watched-card .card-head { margin-bottom: 10px; }
.watch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px;
}
.watch-row:first-child { border-top: 0; }
.watch-row .watch-meta { color: var(--muted); font-size: 12.5px; }
.watch-empty { color: var(--muted); font-size: 13.5px; padding: 6px 0 2px; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .ta-right { text-align: right; }
.data-table .muted { color: var(--muted); font-size: 12.5px; }
.badge {
  display: inline-block; border-radius: 999px; padding: 3px 8px;
  font-size: 11.5px; font-weight: 600; background: #eef3f6; color: var(--ink-soft);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.cancel { background: var(--danger-soft); color: var(--danger); }
.badge.pending { background: var(--warn-soft); color: var(--warn); }

.empty { padding: 38px 16px; text-align: center; color: var(--muted); font-size: 13.5px; display: grid; gap: 12px; justify-items: center; }

/* ---------- tabs / admin ---------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button {
  appearance: none; border: 0; background: transparent; font: inherit; font-size: 13.5px;
  color: var(--muted); padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button.is-active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.inline-form {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  padding: 12px; background: #f7fafb; border: 1px solid var(--line-soft);
  border-radius: 8px; margin-bottom: 14px;
}
.inline-form label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); }
.inline-form .grow { flex: 1; min-width: 200px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  width: 36px; height: 20px; border-radius: 999px; background: #c9d5de;
  position: relative; transition: background .15s; flex-shrink: 0;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px;
  border-radius: 50%; background: #fff; transition: left .15s;
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { left: 19px; }
.switch input:focus-visible + .track { outline: 2px solid #2f89a6; outline-offset: 2px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-card .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.stat-card .value { font-size: 28px; font-weight: 600; margin-top: 6px; letter-spacing: -.02em; }
.stat-card .note { font-size: 12px; color: var(--muted); margin-top: 2px; }

.bar-row { display: grid; grid-template-columns: 170px 1fr 52px; gap: 12px; align-items: center; padding: 9px 0; font-size: 13px; }
.bar-track { height: 9px; border-radius: 5px; background: #e9eff3; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; }

/* ---------- display board ---------- */

.display-board {
  border-radius: 14px; padding: 46px 32px; text-align: center; color: #fff;
  background: #1f6b4a; box-shadow: var(--shadow); min-height: 320px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
}
.display-board.is-busy { background: #8c332e; }
.display-board .db-room { font-size: 15px; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.display-board .db-status { font-size: clamp(44px, 9vw, 92px); font-weight: 700; letter-spacing: -.02em; line-height: 1.05; }
.display-board .db-until { font-size: clamp(20px, 3.4vw, 30px); opacity: .95; }
.display-board .db-now { margin-top: 8px; font-size: 14px; opacity: .8; }
.display-board .db-next {
  margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.25);
  font-size: 15px; max-width: 720px;
}
.display-board .db-next strong { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; opacity: .75; margin-bottom: 4px; font-weight: 600; }

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(10, 26, 37, .5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 16px; overflow-y: auto;
}
.modal {
  width: 100%; max-width: 620px; background: #fff; border-radius: 12px;
  box-shadow: var(--shadow-pop); overflow: hidden; animation: pop .14s ease-out;
}
.modal.is-wide { max-width: 760px; }
@keyframes pop { from { transform: translateY(6px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 20px; border-bottom: 1px solid var(--line-soft);
}
.modal-head h2 { font-size: 18px; }
.modal-head p { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.modal-close {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.modal-close:hover { background: #f1f5f8; color: var(--ink); }
.modal-body { padding: 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px; border-top: 1px solid var(--line-soft); background: #fafcfd;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field > label, .form-field > .label { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.form-field .help { font-size: 11.5px; color: var(--muted); }
.form-field .error { font-size: 12px; color: var(--danger); min-height: 0; }
.form-field.has-error input, .form-field.has-error select, .form-field.has-error textarea { border-color: #d28a85; }

.check-row { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

.radio-row { display: flex; flex-direction: column; gap: 9px; }
.radio-card {
  display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line);
  border-radius: 8px; padding: 11px 12px; cursor: pointer; font-size: 13px;
}
.radio-card:has(input:checked) { border-color: #7fb0c2; background: #f3f9fb; }
.radio-card input { margin-top: 2px; accent-color: var(--primary); }
.radio-card b { display: block; font-size: 13px; }
.radio-card span { color: var(--muted); font-size: 12px; }

.form-error {
  margin-top: 12px; padding: 10px 12px; border-radius: 8px;
  background: var(--danger-soft); border: 1px solid #eccbc8; color: var(--danger); font-size: 13px;
}
.form-note {
  margin-top: 12px; padding: 10px 12px; border-radius: 8px;
  background: #f2f7fa; border: 1px solid #dbe8ef; color: var(--ink-soft); font-size: 12.5px;
}

.detail-list { display: grid; grid-template-columns: 130px 1fr; gap: 9px 14px; font-size: 13.5px; }
.detail-list dt { color: var(--muted); font-size: 12.5px; }
.detail-list dd { margin: 0; }

/* ---------- toast ---------- */

.toast-root {
  position: fixed; right: 18px; bottom: 18px; z-index: 120;
  display: flex; flex-direction: column; gap: 10px; max-width: min(390px, calc(100vw - 36px));
}
.toast {
  background: #122c3d; color: #fff; border-radius: 9px; padding: 12px 14px;
  box-shadow: var(--shadow-pop); font-size: 13px; line-height: 1.45;
  display: flex; gap: 10px; align-items: flex-start;
  animation: slide .18s ease-out;
}
.toast.is-ok { background: #1d5c41; }
.toast.is-warn { background: #6d4c17; }
.toast.is-error { background: #7c2d28; }
.toast strong { display: block; font-size: 13px; margin-bottom: 2px; }
.toast .toast-x { margin-left: auto; background: transparent; border: 0; color: rgba(255,255,255,.7); cursor: pointer; font-size: 16px; line-height: 1; }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  max-width: 1320px; margin: 0 auto; padding: 18px 24px 28px;
  color: var(--muted); font-size: 12px; border-top: 1px solid var(--line);
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .topbar { gap: 14px; padding: 0 14px; }
  .brand-text span { display: none; }
  .userselect select { max-width: 150px; }
}

@media (max-width: 820px) {
  .brand-text { display: none; }
  .page { padding: 18px 14px 36px; }
  h1 { font-size: 22px; }
  .page-head { flex-direction: column; gap: 12px; }
  .head-actions { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-list { grid-template-columns: 110px 1fr; }
  .display-board { padding: 34px 18px; min-height: 240px; }
}

@media (max-width: 620px) {
  .mainnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; height: 54px;
    background: #0b2231; border-top: 1px solid rgba(255,255,255,.12); justify-content: space-around; }
  .navbtn { flex: 1; padding: 0 6px; font-size: 11.5px; border-bottom: 0; border-top: 3px solid transparent; }
  .navbtn.is-active { border-bottom: 0; border-top-color: #8fc3d3; background: rgba(255,255,255,.09); }
  .scroll-hint { display: block; }
  .userselect select { max-width: 148px; font-size: 12px; }
  body { padding-bottom: 58px; }
  .demo-strip { font-size: 11.5px; }
  .toolbar { gap: 10px; }
  .bar-row { grid-template-columns: 110px 1fr 46px; }
}
