@import url("https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700;800&family=Unbounded:wght@500;600;700&display=swap");

:root,
html.theme-dark {
  --bg: #323541;
  --bg-card: #2a2d3a;
  --bg-elevated: #35394a;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --accent: #facc15;
  --accent-soft: #ffed4e;
  --accent-dim: rgba(250, 204, 21, 0.15);
  --accent-on: #18181b;
  --border: rgba(255, 255, 255, 0.08);
  --ok: #22c55e;
  --ok-bg: rgba(34, 197, 94, 0.16);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.16);
  --warn: #facc15;
  --warn-bg: rgba(250, 204, 21, 0.14);
  --info: #60a5fa;
  --info-bg: rgba(96, 165, 250, 0.16);
  --font-display: "Unbounded", system-ui, sans-serif;
  --font-body: "Onest", system-ui, sans-serif;
  --card-radius: 12px;
  --btn-radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.35);
  --rail: 76px;
  --rail-expanded: 280px;
  --panel: 280px;
  --topbar: 56px;
  --bottom: 64px;
  --duration: 180ms;
  --focus-ring: 0 0 0 2px var(--accent);
  --rail-bg: #323541;
  --rail-fg: #e5e7eb;
  --rail-icon: #a1a1aa;
  --rail-hover-fg: #fafafa;
  --rail-hover-bg: rgba(250, 204, 21, 0.1);
  --rail-hover-border: rgba(255, 255, 255, 0.08);
  --rail-arrow: #9ca3af;
  --rail-shadow: none;
  color-scheme: dark;
}

html.theme-light {
  --bg: #f4f4f7;
  --bg-card: #ffffff;
  --bg-elevated: #ececf1;
  --text: #18181b;
  --text-muted: #52525b;
  --accent: #eab308;
  --accent-soft: #ca8a04;
  --accent-dim: rgba(234, 179, 8, 0.22);
  --accent-on: #18181b;
  --border: rgba(24, 24, 27, 0.12);
  --ok: #16a34a;
  --ok-bg: #dcfce7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warn: #eab308;
  --warn-bg: #fef9c3;
  --info: #2563eb;
  --info-bg: #dbeafe;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --rail-bg: #ffffff;
  --rail-fg: #374151;
  --rail-icon: #6b7280;
  --rail-hover-fg: #18181b;
  --rail-hover-bg: rgba(234, 179, 8, 0.14);
  --rail-hover-border: rgba(24, 24, 27, 0.08);
  --rail-arrow: #9ca3af;
  --rail-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

button, a, [role="button"], input[type="checkbox"], select, label, .row-click { cursor: pointer; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-on);
  padding: 8px 12px;
  border-radius: var(--btn-radius);
}
.skip-link:focus { left: 8px; }

.icon { width: 20px; height: 20px; display: block; flex: 0 0 auto; }

.app {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  transition: grid-template-columns var(--duration) ease;
}
html.rail-expanded { --rail: var(--rail-expanded); }

.rail {
  position: sticky;
  top: 0;
  height: 100dvh;
  background: var(--rail-bg);
  color: var(--rail-fg);
  border-right: 1px solid var(--border);
  box-shadow: var(--rail-shadow);
  display: flex;
  flex-direction: column;
  z-index: 46;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--topbar);
  padding: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
  text-decoration: none;
}
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.brand-text { display: none; min-width: 0; }
.brand-name { display: block; font-family: var(--font-display); font-size: 14px; font-weight: 600; letter-spacing: 0.02em; }
.brand-sub { display: block; font-size: 11px; color: var(--text-muted); font-weight: 500; }
.app.rail-expanded .brand { justify-content: flex-start; padding: 8px 12px; }
.app.rail-expanded .brand-text { display: block; }

.rail-nav {
  flex: 1;
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rail-btn {
  position: relative;
  width: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--rail-fg);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font: 600 13px/1.2 var(--font-body);
  padding: 6px 4px;
  text-decoration: none;
}
.rail-btn .icon { color: var(--rail-icon); }
.rail-label { display: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; text-align: left; }
.app.rail-expanded .rail-btn {
  flex-direction: row;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px 14px;
}
.app.rail-expanded .rail-label { display: block; }
.rail-nav .rail-btn::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 6px 0 0 6px;
  opacity: 0;
}
.rail-nav .rail-btn:hover::before,
.rail-nav .rail-btn.active::before { opacity: 1; }
.app.rail-expanded .rail-nav .rail-btn::after {
  content: "›";
  font-size: 18px;
  font-weight: 700;
  color: var(--rail-arrow);
  margin-left: auto;
  flex-shrink: 0;
  transform: translateX(0);
  transition: color var(--duration) ease, transform var(--duration) ease;
}
.app.rail-expanded .rail-nav .rail-btn:hover::after,
.app.rail-expanded .rail-nav .rail-btn.active::after {
  color: var(--accent);
  transform: translateX(2px);
}
.rail-btn:hover, .rail-btn.active, .rail-btn.is-hover {
  background: var(--rail-hover-bg);
  color: var(--rail-hover-fg);
  border-color: var(--rail-hover-border);
}
.rail-btn:hover .icon, .rail-btn.active .icon, .rail-btn.is-hover .icon { color: var(--accent); }
#collapseBtn .icon {
  transform: rotate(180deg);
  transition: transform var(--duration) ease;
}
html.rail-expanded #collapseBtn .icon,
.app.rail-expanded #collapseBtn .icon { transform: none; }
.rail-btn.logout { color: #fca5a5; }
.rail-btn.logout:hover { background: var(--danger-bg); }

.rail-bottom {
  padding: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rail-bottom-row { display: flex; gap: 4px; }
.app.rail-expanded .rail-bottom-row { flex-direction: row; }
.support-badge {
  display: none;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: auto;
  border-radius: 999px;
  background: var(--ok);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
}
.app.rail-expanded .support-badge { display: inline-flex; }

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.crumb { min-width: 0; }
.crumb h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crumb p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.top-actions { display: flex; align-items: center; gap: 8px; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 12px;
  min-width: 220px;
  height: 40px;
  color: var(--text-muted);
  font: 400 14px var(--font-body);
}
.search input {
  border: 0;
  background: transparent;
  color: var(--text);
  width: 100%;
  font: 400 14px var(--font-body);
  outline: none;
}
.search kbd {
  font: 500 11px var(--font-body);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--text-muted);
}

.chip, .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text);
}
.chip.ok, .badge.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn, .badge.warn { background: var(--warn-bg); color: var(--warn); }
.chip.danger, .badge.danger { background: var(--danger-bg); color: var(--danger); }
.chip.info, .badge.info { background: var(--info-bg); color: var(--info); }

.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  flex: 0 0 auto;
}
.icon-btn:hover { background: var(--bg-elevated); }
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.main {
  padding: 12px 16px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.list-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.info-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
  color: var(--text);
  background: var(--info-bg);
  border: 1px solid color-mix(in srgb, var(--info) 45%, var(--border));
}
.info-banner .icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--info);
}

.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.autofill-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}
.toolbar-search-wrap {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1 1 240px;
  min-width: 200px;
  max-width: 520px;
}
.page-toolbar .toolbar-search {
  margin-left: 0;
  flex: 1 1 auto;
  min-width: 140px;
  max-width: none;
  min-height: 40px;
}
.page-toolbar .btn {
  flex: 0 0 auto;
  align-self: center;
}

.cursor-pointer { cursor: pointer; }
.btn {
  min-height: 40px;
  border-radius: var(--btn-radius);
  border: 1px solid transparent;
  padding: 8px 14px;
  font: 600 14px var(--font-body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--accent-on); }
.btn-primary:hover { background: var(--accent-soft); }
.btn-secondary { background: var(--bg-card); border-color: var(--border); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.field, .select, input:not([type]), input[type="text"], input[type="search"], input[type="number"], input[type="password"], input[type="date"], input[type="time"], input[type="tel"], input[type="email"], input[type="url"], textarea, select {
  width: 100%;
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  padding: 8px 12px;
  font: 400 14px var(--font-body);
}
textarea { min-height: 88px; resize: vertical; }
label.lbl {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  min-width: 0;
}
label.lbl > .lbl-t {
  line-height: 1.2;
}
label.lbl > input,
label.lbl > select,
label.lbl > textarea {
  min-width: 0;
}
label.lbl.lbl-area > textarea { min-height: 72px; }
.lbl-check { align-content: start; }
.lbl-check > span { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.field-hint {
  display: block;
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 400;
  color: var(--text-muted);
}
.field-hint a { color: var(--accent); }
input.field-locked, textarea[readonly], input[readonly] {
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: not-allowed;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: flex-end;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 8px 10px;
  margin-bottom: 8px;
}
.period-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-height: 40px;
}
.period-bar .period-label { color: var(--text-muted); font-size: 13px; font-weight: 600; }
.period-display { font-weight: 600; font-variant-numeric: tabular-nums; }
.period-bar .btn { white-space: nowrap; }
.filters .lbl,
.period-bar .lbl-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 220px;
  width: 220px;
  max-width: 240px;
  min-width: 0;
}
.filters .lbl.lbl-check {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
}
.filters .lbl .lbl-t {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}
.filters .lbl select,
.filters .lbl input:not([type="checkbox"]) {
  width: 100%;
}
.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
}
input.check {
  appearance: none;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-elevated);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
input.check:checked {
  background: var(--accent);
  border-color: var(--accent);
}
input.check:checked::after {
  content: "";
  width: 9px;
  height: 5px;
  border: 2px solid var(--accent-on);
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg) translate(0, -1px);
}
input.check:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 10px 12px;
}
.kpi .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.kpi .v { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.25; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
}
.card-h {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.card-b { padding: 10px 12px; }

.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--card-radius); background: var(--bg-card); }
.table-wrap.is-fill {
  flex: 1 1 auto;
  min-height: 0;
}
.list-page .table-wrap.is-fill {
  min-height: 0;
}
.list-page .pager {
  margin-top: auto;
  flex-shrink: 0;
  background: var(--bg);
  padding: 8px 0 0;
  position: sticky;
  bottom: 0;
  z-index: 2;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data:not(.is-compact) { min-width: 0; width: 100%; }
.list-page table.data:not(.is-compact) {
  width: 100%;
  min-width: 0;
}
table.data.is-compact {
  width: max-content;
  max-width: 100%;
  min-width: 0;
}
table.data.is-compact th,
table.data.is-compact td,
table.data.is-compact th.name,
table.data.is-compact td.name,
table.data.is-compact th.num,
table.data.is-compact td.num {
  width: auto;
  min-width: 0;
}
table.data th, table.data td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
table.data th {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  z-index: 1;
}
table.data td.num, table.data th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  width: 1%;
  white-space: nowrap;
}
table.data th.name, table.data td.name {
  min-width: 8rem;
  width: 1%;
  white-space: nowrap;
}
table.data th.check-col, table.data td.check-col {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  padding-left: 8px;
  padding-right: 8px;
  white-space: nowrap;
  box-sizing: border-box;
}
table.data th.act-col, table.data td.act-col {
  width: 1%;
  white-space: nowrap;
}
table.data th.row-fill,
table.data td.row-fill {
  width: auto;
  min-width: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
}
.doc-lines-table col.col-name { width: auto; }
.doc-lines-table col.col-num { width: 88px; }
.doc-lines-table col.col-check,
.doc-lines-table col.col-act { width: 44px; }
.doc-lines-table td.num input {
  width: 4.8em;
  max-width: 100%;
  padding: 6px 8px;
  text-align: right;
}
.doc-lines-table td.name select { min-width: 0; width: 100%; }
table.data tbody tr:hover { background: var(--accent-dim); }
table.data tbody tr.selected { background: var(--accent-dim); }
.list-page table.data th:not(.row-fill):not(.check-col),
.list-page table.data td:not(.row-fill):not(.check-col),
#licensesTable th:not(.row-fill):not(.check-col),
#licensesTable td:not(.row-fill):not(.check-col) {
  width: 1%;
}
.list-page table.data td.name,
.list-page table.data td.text {
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulkbar {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.bulkbar.show { display: flex; }

.cards-mobile { display: none; }

.main:has(.wp-shell) { padding-bottom: 16px; }
.wp-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
  gap: 10px;
  min-height: calc(100dvh - var(--topbar) - 40px);
  align-items: stretch;
}
.wp-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.wp-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--card-radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.wp-panel h3 {
  margin: 0 0 8px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.wp-toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.wp-toolbar h3 { margin: 0; padding: 0; border: 0; }
.wp-toolbar-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.wp-search { margin-bottom: 8px; }
.wp-scroll { overflow: auto; flex: 1; min-height: 0; }
.wp-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0;
}
.wp-dot.busy { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.wp-dot.free { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.wp-dot.booked { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.wp-legend {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin: 0 0 8px; font-size: 12px; color: var(--text-muted);
}
.wp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wp-left { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.wp-pc-row[data-status="busy"] td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.wp-pc-row[data-status="free"] td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.wp-pc-row[data-status="booked"] td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.wp-pc-row.selected { background: var(--accent-dim); }
.wp-data-row { cursor: pointer; }
.wp-data-row.is-menu-open { background: var(--accent-dim); }
.wp-pc-table { min-width: 960px; }
.wp-empty-hint-row td {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  padding: 16px 12px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  cursor: default;
}
.wp-empty-hint-link {
  color: #7dd3fc;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.wp-empty-hint-link:hover,
.wp-empty-hint-link:focus-visible {
  color: #bae6fd;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
html.theme-light .wp-empty-hint-link { color: #0369a1; }
html.theme-light .wp-empty-hint-link:hover,
html.theme-light .wp-empty-hint-link:focus-visible { color: #0284c7; }
table.data th.is-sortable {
  cursor: pointer;
  user-select: none;
}
table.data th.is-sortable:hover { color: var(--text); }
table.data th.is-sortable::after {
  content: "";
  display: inline-block;
  margin-left: 6px;
  border: 4px solid transparent;
  border-top-color: currentColor;
  opacity: 0.28;
  vertical-align: 2px;
}
table.data th[data-sort="asc"]::after {
  opacity: 1;
  transform: rotate(180deg);
  vertical-align: 1px;
}
table.data th[data-sort="desc"]::after { opacity: 1; }
.wp-actions { display: flex; flex-wrap: nowrap; gap: 4px; min-width: 210px; }
.wp-actions .btn { min-height: 32px; padding: 4px 8px; font-size: 12px; }
.cart-summary { display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; }
.cart-summary div { display: flex; justify-content: space-between; }
.cart-summary .total { font-weight: 700; font-size: 15px; color: var(--accent); }
.btn-checkout { width: 100%; margin-top: 8px; }
.is-hidden { display: none !important; }
.wp-mobile-nav { display: none; }
.wp-cart-count {
  display: inline-flex; min-width: 18px; height: 18px; padding: 0 5px;
  margin-left: 4px; border-radius: 999px; background: var(--accent); color: var(--accent-on);
  font-size: 11px; font-weight: 700; align-items: center; justify-content: center;
}
.wp-cart-count[hidden] { display: none; }
.chart-hero {
  background:
    radial-gradient(120% 80% at 80% 0%, rgba(250, 204, 21, 0.12), transparent 55%),
    var(--bg-card);
}
.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 320px; }
.pcs-columns-dropdown-title { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.chart-legend {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: center;
  margin-top: 8px; font-size: 13px; color: var(--text-muted);
}
.chart-legend i {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px;
}
.cols-drop {
  position: absolute; right: 0; top: 100%; z-index: 5;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; min-width: 180px;
  display: none; box-shadow: var(--shadow-md);
}
.cols-drop.open { display: grid; gap: 6px; }
.drop-wrap { position: relative; }

.dyn-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.dyn-grid .dyn-wide { grid-column: 1 / -1; }
.pay-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 6px;
}
.pay-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--btn-radius);
  background: var(--bg-elevated);
  cursor: pointer;
}
.pay-opt:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.pay-opt .icon { width: 18px; height: 18px; color: var(--text-muted); }
.pay-opt input { accent-color: var(--accent); }
.wp-row-menu {
  position: fixed;
  z-index: 80;
  min-width: 220px;
  padding: 6px;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}
.wp-row-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
}
.wp-row-menu-item:hover,
.wp-row-menu-item:focus-visible {
  background: var(--accent-dim);
  outline: none;
}
.wp-row-menu-item.is-disabled {
  cursor: default;
  color: var(--text-muted);
  min-height: auto;
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: stretch;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid .lbl-num { max-width: none; }
.form-grid .lbl-num input { max-width: 9rem; }
.form-tiles { display: flex; flex-direction: column; gap: 8px; }
.form-tile .card-b { padding-top: 10px; }
.drawer-b { padding: 16px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; }

.drawer-back {
  position: fixed;
  inset: 0;
  left: var(--rail);
  background: rgba(0,0,0,.45);
  z-index: 50;
  display: none;
}
.drawer-back.open { display: block; }
.drawer {
  position: fixed;
  top: 0;
  left: var(--rail);
  right: auto;
  height: 100dvh;
  width: min(560px, calc(100vw - var(--rail)));
  background: var(--bg);
  border-right: 1px solid var(--border);
  z-index: 60;
  transform: translateX(-100%);
  transition: transform var(--duration) ease;
  display: flex;
  flex-direction: column;
  visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-h {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.drawer-f {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.drawer-f .btn { min-height: 40px; margin: 0; }

.panel {
  position: fixed;
  top: 12px;
  left: var(--rail);
  width: var(--panel);
  max-height: calc(100dvh - 24px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  z-index: 47;
  display: flex;
  flex-direction: column;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration) ease;
}
.panel.open { visibility: visible; pointer-events: auto; opacity: 1; }
.panel.panel-general {
  top: 8px;
  width: min(740px, calc(100vw - var(--rail) - 24px));
  max-height: calc(100dvh - 16px);
}
.panel-h {
  padding: 12px 14px;
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.panel-list { overflow: auto; padding: 8px; display: grid; gap: 2px; }
.panel a, .panel-setup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
}
.panel a .icon, .panel-setup .icon, .general-col-title .icon, .fav-item .icon {
  width: 18px; height: 18px; color: var(--text-muted); flex: 0 0 auto;
}
.panel a.active .icon, .panel a:hover .icon, .panel-setup:hover .icon { color: var(--accent); }
.panel a:hover, .panel a.active, .panel-setup:hover { background: var(--accent-dim); color: var(--accent); }
.panel-setup {
  display: none;
  margin-bottom: 8px;
  border: 1px dashed var(--border);
}
.panel.panel-general .panel-list {
  display: block;
  overflow: auto;
  padding: 10px 12px 14px;
}
.general-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 20px;
  align-items: start;
}
.general-col { min-width: 0; }
.panel.panel-general a {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 13px;
  gap: 8px;
}
.general-col-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-family: var(--font-display);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 44;
  display: none;
  pointer-events: none;
}
.overlay.open { display: block; pointer-events: auto; }

.toast {
  position: fixed;
  right: 16px;
  bottom: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  z-index: 80;
  box-shadow: var(--shadow-md);
  display: none;
}
.toast.show { display: block; }

.app-confirm {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 12, 24, 0.55);
}
.app-confirm[hidden] { display: none; }
.app-confirm-box {
  width: min(420px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 20px 16px;
  box-shadow: var(--shadow-md);
}
.app-confirm-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 2px solid var(--warning, #d4a017);
  background:
    linear-gradient(var(--warning, #d4a017), var(--warning, #d4a017)) center 9px / 2px 12px no-repeat,
    radial-gradient(circle at 50% 26px, var(--warning, #d4a017) 2px, transparent 2.2px);
}
.app-confirm-msg {
  margin: 0 0 16px;
  text-align: center;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.btn-small {
  padding: 4px 8px;
  font-size: 12px;
  min-height: 32px;
}
.sales-act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.app-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
@media (prefers-reduced-motion: reduce) {
  .app-confirm { transition: none; }
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.sheet.open { display: flex; }
.sheet-box {
  width: min(560px, 100%);
  height: min(86dvh, 720px);
  max-height: min(86dvh, 720px);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
}
.sheet-h, .sheet-f {
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.sheet-h { border-bottom: 1px solid var(--border); }
.sheet-f { border-top: 1px solid var(--border); padding-bottom: calc(14px + env(safe-area-inset-bottom)); align-items: center; }
.sheet-h h2 { margin: 0; font-size: 16px; font-family: var(--font-display); }
.sheet-b { overflow: auto; padding: 8px 12px 16px; flex: 1; }
.fav-group { margin-bottom: 12px; }
.fav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.fav-item:hover { background: var(--accent-dim); }
.fav-title { flex: 1; min-width: 0; }
.fav-item .icon { flex: 0 0 auto; }
.fav-item .check { flex: 0 0 auto; }
.fav-ord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  width: 18px;
  height: 18px;
  padding: 0;
  margin-left: auto;
  border-radius: 999px;
  background: var(--ok);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 18px;
  line-height: 1;
}
.fav-ord[hidden] { display: none !important; }
.fav-item:has(.fav-ord:not([hidden])) { background: var(--accent-dim); }
.fav-item.fav-section {
  font-weight: 700;
  margin-bottom: 4px;
}
.fav-item.fav-section .fav-title { font-family: var(--font-display); font-size: 13px; }
.fav-group .fav-item:not(.fav-section) { padding-left: 28px; }

.cmd {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px;
  background: rgba(0,0,0,.45);
}
.cmd.open { display: flex; }
.cmd-box {
  width: min(560px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.cmd-box input {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  min-height: 48px;
}
.cmd-list { max-height: 360px; overflow: auto; }
.cmd-list button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 10px 14px;
  min-height: 44px;
  font: 400 14px var(--font-body);
}
.cmd-list button:hover, .cmd-list button.active { background: var(--accent-dim); }

.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 1fr 64px; gap: 8px; align-items: center; font-size: 13px; }
.bar {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
}
.bar > span { display: block; height: 100%; background: var(--accent); }

.steps { display: flex; gap: 8px; overflow: auto; margin-bottom: 16px; }
.step {
  flex: 1;
  min-width: 120px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 12px;
  color: var(--text-muted);
}
.step.on { border-color: var(--accent); color: var(--text); }
.setup-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 14px;
}
.setup-list li { margin: 4px 0; }

.setup-lock {
  position: fixed;
  inset: 0;
  z-index: 82;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.55);
}
.setup-lock.is-open { display: flex; }
body.setup-locked .app,
body.setup-locked .bottom-nav,
body.setup-locked .drawer,
body.setup-locked .drawer-back,
body.setup-locked .cmd,
body.setup-locked .sheet,
body.setup-locked .panel,
body.setup-locked .overlay {
  pointer-events: none;
  user-select: none;
}
.setup-card {
  width: min(640px, 100%);
  margin: auto;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 32px 28px 24px;
}
.setup-card .setup-brand { margin-bottom: 16px; }
.setup-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.setup-lead {
  margin: 0 0 20px;
  color: var(--text-muted);
  line-height: 1.55;
  font-size: 15px;
}
.setup-pills {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
  padding: 0;
}
.setup-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg-elevated);
  border: 1px solid transparent;
}
.setup-pill-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 12px;
}
.setup-pill.is-active {
  color: var(--accent-on);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.setup-pill.is-active .setup-pill-num {
  background: var(--accent-on);
  color: var(--accent);
}
.setup-pill.is-done { color: var(--text); border-color: var(--border); }
.setup-pill.is-done .setup-pill-num { background: var(--ok); color: #fff; }
.setup-card h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
}
.setup-live {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
}
.setup-live:not(.is-error) {
  background: var(--ok-bg);
  color: var(--ok);
}
.setup-card .doc-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.setup-card-close {
  float: right;
  margin: -8px -8px 0 0;
}
.setup-logout {
  margin-top: 16px;
  display: inline-block;
  color: var(--text-muted);
  font-size: 13px;
}
@media (prefers-reduced-motion: reduce) {
  .setup-lock { scroll-behavior: auto; }
}
@media screen and (max-width: 640px) {
  .setup-card { padding: 22px 16px 18px; }
}

.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(440px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: var(--shadow-md);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.auth-brand img { width: 40px; height: 40px; }
.auth-brand span { font-family: var(--font-display); font-weight: 700; }
.auth h1 { margin: 0 0 16px; font-size: 22px; font-family: var(--font-display); }
.auth .form-grid { gap: 12px; }
.auth .lbl > input,
.auth .lbl > select,
.auth .lbl > textarea {
  background: var(--bg-elevated);
}
.auth .lbl-check {
  color: var(--text);
}
.auth .lbl-check .lbl-t { color: var(--text); font-weight: 500; }
.auth input::placeholder { color: var(--text-muted); opacity: 1; }
.auth-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 13px; }
.auth-links a,
.auth-legal a { color: var(--accent); }
.auth-legal {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}
.auth-alert,
.alert { padding: 10px 12px; border-radius: 8px; background: var(--danger-bg); color: var(--danger); font-size: 13px; margin-bottom: 12px; }
.auth input:-webkit-autofill,
.auth input:-webkit-autofill:hover,
.auth input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  box-shadow: 0 0 0 1000px var(--bg-elevated) inset;
  transition: background-color 9999s ease-out;
}

.legal-page {
  min-height: 100dvh;
  padding: 24px;
}
.legal-card {
  width: min(840px, 100%);
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: var(--shadow-md);
}
.legal-card h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.3;
}
.legal-card h2 {
  margin: 28px 0 12px;
  font-size: 18px;
  font-weight: 600;
}
.legal-card p,
.legal-card li {
  color: var(--text);
  line-height: 1.65;
}
.legal-card .text-muted,
.legal-card .text-muted a {
  color: var(--text-muted);
}
.legal-card a:not(.btn) { color: var(--accent); }
.legal-card a.btn-primary { color: var(--accent-on); }
.legal-card a.btn-secondary { color: var(--text); }
.legal-card ul,
.legal-card ol {
  margin: 0 0 16px;
  padding-left: 22px;
}
.legal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}
.legal-actions .btn { min-height: 40px; }

@media screen and (max-width: 640px) {
  .legal-card { padding: 20px 16px; }
  .legal-actions { display: grid; grid-template-columns: 1fr; }
}

.mobile-menu, .bottom-nav { display: none; }

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 8px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}
.pager-per {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pager-per select {
  min-height: 32px;
  padding: 4px 8px;
}
.list-infinite-sentinel {
  height: 1px;
  pointer-events: none;
}
.list-infinite-sentinel.is-loading {
  height: 28px;
  margin: 4px 0;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  background-size: 200% 100%;
}

.dash-page { display: flex; flex-direction: column; gap: 8px; }
.dash-page .kpi-grid { margin-bottom: 0; }
.dash-block > summary.card-h {
  list-style: none;
  cursor: pointer;
}
.dash-block > summary.card-h::-webkit-details-marker { display: none; }
.dash-block .card-h [data-period-display] { font-weight: 500; color: var(--text-muted); }

.dyn-line-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.manager-ops {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  align-items: start;
}
.manager-op-card .card-h {
  justify-content: flex-start;
  gap: 8px;
}
.manager-op-card .op-desc {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}
.manager-op-card .btn { margin-top: 4px; }

.muted { color: var(--text-muted); }
.singleton-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
  min-height: 0;
}
.singleton-page .form-tiles { flex: 1; }

.display-mode-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--btn-radius);
  overflow: hidden;
  background: var(--bg-card);
}
.display-mode-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.display-mode-toggle label {
  cursor: pointer;
  padding: 8px 14px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.display-mode-toggle label:hover { color: var(--text); }
.display-mode-toggle input:checked + label {
  background: var(--accent);
  color: var(--accent-on);
}
.display-mode-toggle input:focus-visible + label {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sched-page { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 8px; }
.sched-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sched-sub { margin: 0; color: var(--text-muted); font-size: 13px; }
.sched-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: end;
}
.sched-page .sched-graph {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sched-page .sched-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sched-page.is-list .sched-graph { display: none; }
.sched-page:not(.is-list) .sched-list { display: none; }
.sched-graph-card .card-b { overflow: auto; }
.sched-track-col { position: relative; }
.sched-page .table-wrap.is-fill {
  flex: 1 1 auto;
  min-height: 0;
}
.sched-page .pager {
  margin-top: auto;
  flex-shrink: 0;
  background: var(--bg);
  padding: 8px 0 0;
  position: sticky;
  bottom: 0;
  z-index: 2;
}
.sched-hours, .sched-row {
  display: flex;
  align-items: stretch;
  min-width: 720px;
}
.sched-gutter {
  flex: 0 0 92px;
  width: 92px;
  padding: 6px 8px 6px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
}
.sched-hours-track, .sched-track {
  flex: 1;
  position: relative;
  min-height: 22px;
}
.sched-h {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-muted);
}
.sched-hours { flex: 0 0 auto; }
.sched-row {
  min-height: 36px;
  border-bottom: 1px solid var(--border);
}
.sched-track { background: var(--bg-elevated); border-radius: 4px; margin: 4px 0; }
.sched-block {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-on);
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0.92;
}
.sched-block.is-tariff,
.sched-block.is-reserve { background: var(--accent); color: var(--accent-on); }
.sched-block.is-off { opacity: 0.35; }
.sched-now {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 92px;
  width: calc(100% - 92px);
  pointer-events: none;
  z-index: 2;
}
.sched-now::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--now);
  width: 2px;
  background: var(--accent);
}
.sched-now span {
  position: absolute;
  left: var(--now);
  top: 0;
  transform: translate(-50%, -100%);
  background: var(--accent);
  color: var(--accent-on);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
}

.licenses-page { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 8px; }
.lic-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  justify-content: space-between;
}
.lic-create { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.lic-subscribe {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--btn-radius);
  background: var(--bg-card);
}
.lic-subscribe-kicker { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.lic-subscribe-value { margin: 2px 0 0; font-weight: 700; }
.lic-renew-info { margin: 0; font-size: 13px; color: var(--text-muted); }
.lic-table-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}
.lic-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.lic-filter {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--btn-radius);
  background: var(--bg-card);
  color: var(--text-muted);
  font: 600 13px var(--font-body);
  cursor: pointer;
}
.lic-filter:hover, .lic-filter.is-active { color: var(--text); }
.lic-filter.is-active { background: var(--accent); color: var(--accent-on); border-color: transparent; }
.lic-row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lic-row-actions .btn { min-height: 32px; padding: 4px 10px; font-size: 12px; }
#licensesTable {
  width: max-content;
  min-width: 100%;
}
#licensesTable th.lic-col-key,
#licensesTable td.lic-col-key,
#licensesTable th.lic-col-pass,
#licensesTable td.lic-col-pass {
  white-space: normal;
  min-width: 16rem;
  max-width: 28rem;
  vertical-align: top;
}
#licensesTable td.lic-col-key code,
#licensesTable td.lic-col-pass code {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-all;
  font-size: 12px;
  line-height: 1.35;
}
code { font-size: 12px; }

.period-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.45);
  padding: 16px;
}
.period-modal.open { display: grid; }
.period-modal-box {
  width: min(420px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 10px;
}
.period-modal-box h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 18px;
  font-family: var(--font-display);
}
.period-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.check { width: 18px; height: 18px; accent-color: var(--accent); }

.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.doc-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
  min-height: calc(100dvh - var(--topbar) - 40px);
}
.doc-lines-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
.doc-lines-card .card-b {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.doc-lines-card .table-wrap.is-fill {
  flex: 1;
  min-height: 240px;
}
.doc-close .icon { width: 18px; height: 18px; }
#formCloseBtn[hidden] { display: none !important; }
.doc-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 12px 0 calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  bottom: 0;
  z-index: 3;
}
.doc-foot .btn { min-height: 40px; margin: 0; }
.bp-head-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.bp-summary {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}
.bp-gen-bar,
.bp-add-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.bp-add-row {
  margin-top: 14px;
  margin-bottom: 0;
  align-items: center;
}
.bp-gen-bar .lbl {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  grid-template-rows: none;
}
.bp-gen-bar .lbl-t {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.bp-gen-bar input,
.bp-add-row input {
  width: 100%;
  min-height: 44px;
}
.bp-gen-bar .btn,
.bp-add-row .btn {
  min-height: 44px;
  white-space: nowrap;
}
@media (max-width: 1100px) {
  .bp-head-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .bp-gen-bar,
  .bp-add-row { grid-template-columns: 1fr 1fr; }
  .bp-gen-bar .btn,
  .bp-add-row .btn { grid-column: 1 / -1; width: 100%; }
}
.doc-lines-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.doc-lines input, .doc-lines select {
  min-height: 36px;
  font-size: 13px;
}
.doc-lines td { vertical-align: middle; }
.doc-totals {
  display: flex;
  justify-content: flex-end;
  gap: 24px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.doc-line-cards { display: none; }

@media (max-width: 1100px) {
  .wp-shell { grid-template-columns: 1fr; min-height: 0; }
  .split-2 { grid-template-columns: 1fr; }
  .general-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .app, .app.rail-expanded { grid-template-columns: 1fr; --rail: 0px; }
  .drawer, .drawer-back { left: 0; }
  .drawer { width: 100%; }
  .rail { display: none; }
  .panel, .panel.panel-general {
    left: 8px;
    top: 8px;
    width: min(320px, calc(100vw - 16px));
    max-height: calc(100dvh - 16px);
  }
  .general-cols { grid-template-columns: 1fr; }
  .doc-line-table { display: block; }
  .doc-line-cards { display: none !important; }
  .doc-totals { justify-content: space-between; }
  .doc-foot { padding-bottom: calc(var(--bottom) + 8px + env(safe-area-inset-bottom)); }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .search { display: none; }
  .main {
    padding: 12px;
    padding-bottom: calc(var(--bottom) + 16px + env(safe-area-inset-bottom));
  }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .lbl-num input { max-width: none; }
  .table-wrap.desktop-only { display: block; }
  .cards-mobile { display: none !important; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  table.data { font-size: 11px; min-width: 520px; }
  table.data th, table.data td { padding: 5px 7px; }
  table.data th { font-size: 10px; letter-spacing: 0.02em; }
  .dyn-grid { grid-template-columns: 1fr; }
  .pay-group { grid-template-columns: 1fr; }
  .m-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    text-align: left;
    color: inherit;
    width: 100%;
  }
  .m-card .t { font-weight: 700; margin-bottom: 6px; }
  .m-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 3px 0; }
  .m-row span:first-child { color: var(--text-muted); }
  .bottom-nav {
    display: flex;
    align-items: stretch;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(var(--bottom) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 40;
  }
  .bottom-nav a, .bottom-nav button {
    background: transparent;
    border: 0;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font: 500 10px var(--font-body);
    text-decoration: none;
    min-height: 48px;
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
  }
  .panel-setup { display: flex; }
  .bottom-nav .icon { width: 20px; height: 20px; }
  .bottom-nav span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 2px;
  }
  .bottom-nav .on .icon { color: var(--accent); }
  .mobile-menu { display: inline-flex; }
  .topbar .chip { display: none; }
  .crumb p { display: none; }
  .wp-mobile-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
  }
  .wp-mobile-nav button {
    min-height: 44px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    border-radius: 10px;
    font: 600 13px var(--font-body);
  }
  .wp-mobile-nav button.is-active { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
  .wp-shell.is-pcs .wp-panel[data-wp-panel]:not([data-wp-panel="pcs"]),
  .wp-shell.is-products .wp-panel[data-wp-panel]:not([data-wp-panel="products"]),
  .wp-shell.is-cart .wp-panel[data-wp-panel]:not([data-wp-panel="cart"]) { display: none; }
  .chart-box, .chart-box.tall { height: 210px; }
  .list-page .pager {
    bottom: 0;
    padding-bottom: 4px;
  }
  .page-toolbar .toolbar-search-wrap { flex: 1 1 100%; max-width: none; margin-left: 0; }
  .page-toolbar .toolbar-search { flex: 1 1 auto; max-width: none; margin-left: 0; }
  .page-toolbar .btn { width: auto; flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
