:root {
  --red: #D41217;
  --red-hover: #AA0E12;
  --ink: #1A1A1A;
  --body: #4A4A4A;
  --label: #999999;
  --border: #E5E5E5;
  --bg: #FFFFFF;
  --bg-soft: #FAFAFA;
  --bg-section: #F5F5F0;
  --ok: #57B037;
  --hour: 26px;
  font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg-section); color: var(--body); font-size: 14.5px; line-height: 1.5; }
h1, h2 { color: var(--ink); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
h1 { font-size: 36px; margin: 6px 0 0; }
h2 { font-size: 17px; margin: 0 0 12px; }
.punch { color: var(--red); }
.eyebrow { font-size: 11px; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: var(--label); margin: 0; }
.muted, .hint { color: var(--label); font-size: 12px; }
.hint { margin: 0 0 8px; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; background: var(--bg); border-bottom: 2px solid var(--red); }
.brand { display: flex; align-items: center; gap: 14px; }
.logo { display: block; height: 40px; width: auto; }
.product { color: var(--ink); font-weight: 600; }
.meta { display: flex; gap: 12px; align-items: center; }
.pill { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border); }
.pill.mock { color: #8a6d00; border-color: #FFD700; background: #fffbe6; }
.pill.live { color: var(--ok); border-color: var(--ok); }

main { max-width: 1280px; margin: 0 auto; padding: 24px 16px 48px; }
.hero { margin-bottom: 20px; }
.layout { display: grid; grid-template-columns: 320px 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } h1 { font-size: 28px; } }

.card { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > label { flex: 1; }
.row.end { justify-content: flex-end; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--label); }
input, select { font: inherit; color: var(--ink); padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
input:focus, select:focus { outline: 2px solid rgba(212, 18, 23, .25); border-color: var(--red); }
button { font: inherit; cursor: pointer; border: 0; border-radius: 8px; padding: 8px 14px; background: var(--red); color: #fff; font-weight: 500; }
button:hover { background: var(--red-hover); }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--border); }
button.ghost:hover { background: var(--bg-soft); }
button.danger { background: transparent; color: var(--red); border: 1px solid var(--red); margin-right: auto; }
button.small { padding: 3px 8px; font-size: 12px; }
.error { color: var(--red); font-size: 13px; margin: 0; }

.employees { list-style: none; margin: 0 0 12px; padding: 0; }
.employees li { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.employees .name { color: var(--ink); font-weight: 500; }
.employees .sub { font-size: 12px; color: var(--label); }
.employees .err { color: var(--red); font-size: 12px; }
.employees .actions { display: flex; gap: 4px; }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--label); display: inline-block; }
.dot.available { background: var(--ok); }
.dot.off_work { background: #bbb; }
.dot.do_not_disturb, .dot.away { background: var(--red); }
.dot.lunch { background: #FFD700; }
.dot.business_trip { background: #00BFFF; }

.types { width: 100%; border-collapse: collapse; font-size: 13px; }
.types td { padding: 4px 2px; }
.types select { padding: 4px 6px; font-size: 12px; width: 100%; }
.types input[type=number] { width: 54px; padding: 4px 6px; font-size: 12px; }
.types label.inline { flex-direction: row; align-items: center; gap: 4px; white-space: nowrap; color: var(--body); }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; }

.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.cal-nav, .cal-actions { display: flex; align-items: center; gap: 6px; }
.cal-nav strong { color: var(--ink); margin-left: 8px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; margin-bottom: 8px; }
.calendar { display: grid; grid-template-columns: 44px repeat(7, minmax(90px, 1fr)); overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.calendar .dayhead { position: sticky; top: 0; background: var(--bg-soft); text-align: center; font-size: 12px; padding: 6px 2px; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); color: var(--ink); }
.calendar .dayhead.today { color: var(--red); font-weight: 600; }
.calendar .corner { background: var(--bg-soft); border-bottom: 1px solid var(--border); }
.hours { position: relative; }
.hours div { height: var(--hour); font-size: 10px; color: var(--label); text-align: right; padding-right: 6px; transform: translateY(-6px); }
.day { position: relative; border-left: 1px solid var(--border); height: calc(var(--hour) * 24);
  background-image: linear-gradient(var(--border) 1px, transparent 1px); background-size: 100% var(--hour); cursor: copy; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 3; pointer-events: none; }
.block { position: absolute; border-radius: 6px; padding: 2px 5px; font-size: 11px; line-height: 1.25; color: var(--ink); overflow: hidden; cursor: pointer; z-index: 2;
  border-left: 3px solid; background: var(--bg); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.block:hover { box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.block .t { color: var(--label); }

.log { width: 100%; border-collapse: collapse; font-size: 13px; }
.log th { text-align: left; font-weight: 500; color: var(--label); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; border-bottom: 1px solid var(--border); padding: 6px 4px; }
.log td { padding: 6px 4px; border-bottom: 1px solid var(--border); }
.log .ok { color: var(--ok); }
.log .fail { color: var(--red); }

dialog { border: 1px solid var(--border); border-radius: 14px; padding: 20px; width: min(480px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.25); }
fieldset.weekdays { border: 1px solid var(--border); border-radius: 8px; display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 10px; }
fieldset.weekdays legend { font-size: 12px; color: var(--label); }
fieldset.weekdays label { flex-direction: row; align-items: center; color: var(--ink); font-size: 13px; }
.no-repeat .repeat-only { display: none; }
.single-edit .repeat-row, .single-edit .repeat-only { display: none; }
.preview { margin: 0; padding: 8px 10px; background: var(--bg-soft); border-radius: 8px; font-size: 13px; color: var(--ink); }
.series-info:not([hidden]) { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
button.big { padding: 12px 14px; font-size: 14px; text-align: left; }
.people label { min-width: 150px; }
.people .order { display: inline-block; min-width: 18px; font-weight: 600; color: var(--red); }
.mode-continuous .daily-only { display: none; }
.notice { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 8px; border-radius: 8px;
  background: #FFF1D6; color: #8A5300; border: 1px solid #F0C36A; font-size: 13px; }
.notice button { margin-left: auto; }
.notice button + button { margin-left: 0; }

.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.queues { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.queues li { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--border); color: var(--ink); }
.queues li .sub { color: var(--label); }
.queues-pick:empty { display: none; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--body); margin: 2px 2px 0 0; }
.tag.warn { border-color: var(--red); color: var(--red); }

label.inline { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); font-size: 13px; }
.panel-warn { border-left: 3px solid var(--red); padding: 6px 10px; background: var(--bg-soft); border-radius: 6px; }
dialog.wide { width: min(640px, calc(100vw - 32px)); }
.import-list { max-height: 50vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.import-list td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
.import-list tr.taken { color: var(--label); }
.settings-mock .live-only { display: none; }
.result-ok { color: var(--ok); }
.result-fail { color: var(--red); }
.badge { display: table; white-space: nowrap; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; margin: 3px 0 2px; }
.badge.paused { background: #FFF1D6; color: #8A5300; border: 1px solid #F0C36A; }
.preview.preview-error { color: var(--red); }
.block .rep { color: var(--label); font-weight: 400; }
#rotationDialog fieldset.weekdays input[type=time] { padding: 3px 6px; }

/* tenant switched: the previous tenant's page must not be used until the new data is loaded */
body.tenant-loading main { opacity: .45; pointer-events: none; }

/* Login */
.login [hidden] { display: none !important; }
.login { max-width: 420px; padding-top: 48px; }
.login .card { padding: 24px; }
.login h2 { margin: 8px 0 4px; }
.qr { align-self: center; width: 240px; height: 240px; border: 1px solid var(--border); border-radius: 8px; image-rendering: pixelated; }
.secret { display: block; word-break: break-all; font-size: 12px; background: var(--bg-soft); padding: 6px 8px; border-radius: 6px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; list-style: none; margin: 0; padding: 0; font-family: ui-monospace, Menlo, monospace; }
.codes li { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--body); }
button:disabled { opacity: .5; cursor: default; }
.user { font-size: 12px; color: var(--label); }
body.role-viewer .write-only, body:not(.role-owner) .owner-only, body:not(.is-admin) .admin-only { display: none !important; }
