:root {
  --bg: #0e1114;
  --bg-elev: #161b20;
  --bg-soft: #1c232b;
  --line: #2a333d;
  --text: #e8edf2;
  --muted: #8b97a5;
  --accent: #3dba8a;
  --accent-dim: #2a8f68;
  --danger: #e06c75;
  --warn: #d4a15a;
  --ok: #3dba8a;
  --radius: 10px;
  --font: "Manrope", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 120ms;
  --dur: 180ms;
  --dur-enter: 220ms;
}

* { box-sizing: border-box; }
html {
  color-scheme: dark;
}
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1a2830 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #18221c 0%, transparent 45%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.55rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 17, 20, 0.88);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.topbar-left {
  flex: 1 1 auto;
  min-width: 0;
  gap: 0.75rem;
}
.topbar-right {
  flex: 0 0 auto;
}
.op-desk {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.op-enable {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  cursor: pointer;
  user-select: none;
}
.op-enable input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.op-enable-track {
  width: 1.85rem;
  height: 1.05rem;
  border-radius: 999px;
  background: #3a4550;
  border: 1px solid var(--line);
  position: relative;
  flex-shrink: 0;
}
.op-enable-track::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: #c5cdd6;
  transition: transform var(--dur-fast) var(--ease-out);
}
.op-enable input:checked + .op-enable-track {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.op-enable input:checked + .op-enable-track::after {
  transform: translateX(0.78rem);
  background: var(--text);
}
.op-enable input:focus-visible + .op-enable-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.op-enable-name {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.op-enable:has(input:checked) .op-enable-name {
  color: var(--text);
}
.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
  flex-shrink: 0;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--text); }
.topbar-home {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition:
    color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}
.topbar-home:hover {
  color: var(--text);
  text-decoration: none;
  background: var(--bg-soft);
  border-color: var(--line);
}
.app-nav {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: stretch;
  height: 2.2rem;
  padding: 0.14rem;
  gap: 0.14rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(20, 24, 28, 0.55);
}
.app-nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0 0.4rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
}
.app-nav-link:hover {
  color: var(--text);
  text-decoration: none;
  background: var(--bg-soft);
}
.app-nav-link.is-on {
  color: var(--text);
  background: var(--bg-soft);
  border-color: var(--line);
}
.topbar-meters {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.18rem;
}
.topbar-meters .wp-lookups-chip {
  font-size: 0.72rem;
  padding: 0.12rem 0.5rem;
  line-height: 1.25;
}
.topbar-meters .flyout {
  width: 100%;
}

.container {
  width: min(1680px, calc(100% - 2rem));
  margin: 1.5rem auto 3rem;
}
.container-narrow { width: min(420px, calc(100% - 2rem)); }
.container.container-wide {
  width: min(1760px, calc(100% - 2rem));
}
.pool-stage-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}
#pool-tables.pool-tables-painting {
  pointer-events: none;
}
#pool-tables.pool-tables-painting .pool-stage-block {
  min-height: 3.5rem;
}
.pool-stage-block {
  min-width: 0;
}
.pool-stage-block + .pool-stage-block {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.pool-stage-head {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0 0 0.4rem;
}
.pool-stage-head h2 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 650;
}
.pool-stage-grid .table-wrap {
  overflow-x: auto;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  container-type: normal;
}
#pool-tables {
  min-width: 0;
  max-width: 100%;
}
#pool-tables > .table-wrap {
  max-width: 100%;
  overflow-x: auto;
}
.pool-stage-grid .numbers-table,
.pool-stage-grid .pool-stage-table.numbers-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.pool-stage-table.numbers-table th,
.pool-stage-table.numbers-table td {
  padding: 0.22rem 0.28rem;
}
.table-empty {
  margin: 0.2rem 0 0;
  padding: 0.35rem 0.15rem 0.1rem;
}
.table-empty[hidden] {
  display: none !important;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  animation: rise-in var(--dur-enter) var(--ease-out) both;
}
.page-head h1, .auth-card h1, .panel h2 { margin: 0.15rem 0 0.35rem; font-weight: 650; letter-spacing: -0.02em; }
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
}
.lede, .muted, .hint { color: var(--muted); }
.lede { margin: 0; max-width: 42rem; }

.panel, .auth-card, .stat {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  animation: rise-in var(--dur-enter) var(--ease-out) both;
}
.panel { margin-bottom: 1rem; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
}
.auth-card { margin-top: 12vh; padding: 1.6rem; }

.grid.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.grid.stats .stat:nth-child(1) { animation-delay: 30ms; }
.grid.stats .stat:nth-child(2) { animation-delay: 60ms; }
.grid.stats .stat:nth-child(3) { animation-delay: 90ms; }
.grid.stats .stat:nth-child(4) { animation-delay: 120ms; }
.grid.stats .stat:nth-child(5) { animation-delay: 150ms; }
.grid.stats .stat:nth-child(6) { animation-delay: 180ms; }
#auto-stats.grid.stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.stat-label { display: block; color: var(--muted); font-size: 0.8rem; }
.stat-value { display: block; font-size: 1.55rem; margin: 0.25rem 0; font-variant-numeric: tabular-nums; }
.hint { font-size: 0.78rem; }

.hub-cards {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.hub-cards-admin {
  grid-template-columns: 1fr 1fr 1fr 0.75fr;
}
.hub-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 0.4rem;
  min-height: 9.5rem;
  padding: 1.15rem 1.2rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
  animation: rise-in var(--dur-enter) var(--ease-out) both;
}
.hub-card:hover {
  border-color: var(--accent-dim);
  background: var(--bg-soft);
  text-decoration: none;
  color: inherit;
}
.hub-card:active {
  transform: scale(0.98);
  transition-duration: 100ms;
}
@media (hover: hover) and (pointer: fine) {
  .hub-card:hover {
    transform: translateY(-1px);
  }
  .hub-card:hover .hub-card-go {
    transform: translateX(3px);
  }
}
.hub-card-urgent {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}
.hub-card-admin {
  min-height: 9.5rem;
  opacity: 0.92;
}
.hub-card-admin:hover { opacity: 1; }
.hub-card-step {
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hub-card-admin .hub-card-step {
  color: var(--muted);
}
.hub-card-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.hub-card-text {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
  align-self: start;
}
.hub-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.35rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}
.hub-card-meta {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.hub-card-urgent .hub-card-meta {
  color: var(--accent);
  font-weight: 600;
}
.hub-card-go {
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1;
  transition: transform var(--dur-fast) var(--ease-out);
}
.hub-cards .hub-card:nth-child(1) { animation-delay: 40ms; }
.hub-cards .hub-card:nth-child(2) { animation-delay: 70ms; }
.hub-cards .hub-card:nth-child(3) { animation-delay: 100ms; }
.hub-cards .hub-card:nth-child(4) { animation-delay: 130ms; }

.desk-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: 0 0 0.85rem;
}
.desk-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
  padding: 0.32rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  color: inherit;
  text-decoration: none;
  font-size: 0.86rem;
  line-height: 1.3;
  white-space: nowrap;
}
.desk-chip:hover {
  border-color: var(--accent-dim);
  text-decoration: none;
  color: inherit;
}
.desk-chip.is-hot {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  color: var(--accent);
  font-weight: 600;
}
.desk-head {
  align-items: center;
  gap: 0.75rem;
}
.desk-head > .btn {
  flex-shrink: 0;
}
.desk-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.desk-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  text-decoration: none;
}
.desk-tab:hover {
  color: var(--text);
  text-decoration: none;
}
.desk-tab.is-on {
  border-color: var(--line);
  background: var(--bg-elev);
  color: inherit;
  font-weight: 650;
}
.desk-pane.is-off { display: none; }
.desk-wallet {
  display: inline-block;
  max-width: 100%;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* leftover in table-layout:fixed goes to columns without max-width. Cap all but FIO. */
.desk-table .col-phone {
  width: 7.6rem;
  max-width: 7.6rem;
}
.desk-table .col-wallet {
  width: 5rem;
  max-width: 5rem;
  white-space: nowrap;
  overflow: hidden;
}
.desk-service {
  display: inline-block;
  max-width: 6.6rem;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.desk-table .col-service {
  width: 6.6rem;
  max-width: 6.6rem;
  white-space: nowrap;
  overflow: hidden;
}
.desk-table .col-note {
  width: 9.5rem;
  max-width: 9.5rem;
  overflow: hidden;
}
.desk-table .col-timers {
  width: 4.8rem;
  max-width: 4.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.desk-table .col-state {
  width: 6.8rem;
  max-width: 6.8rem;
}
.desk-table .col-fio {
  width: 9.5rem;
  min-width: 8rem;
  max-width: 9.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.desk-table .col-fullka {
  width: 4.8rem;
  max-width: 4.8rem;
  white-space: nowrap;
}
.desk-table .col-actions {
  width: 11rem;
  max-width: 11rem;
  min-width: 11rem;
}
.desk-table td.row-actions,
.desk-table td.col-actions {
  white-space: nowrap;
  overflow: visible;
}
.desk-table td.col-actions .btn {
  margin: 0;
}
.desk-pane.table-wrap {
  overflow-x: clip;
  overflow-y: visible;
  container-type: normal;
}
.desk-manage {
  display: inline-block;
  position: relative;
  max-width: 100%;
  min-width: 0;
  vertical-align: middle;
}
.desk-manage-btn {
  width: auto;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  white-space: nowrap;
  padding: 0.28rem 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.desk-manage-panel {
  min-width: 13.5rem;
  padding: 0.4rem;
  z-index: 80;
  right: 0;
  left: auto;
}
.desk-manage.is-open > .desk-manage-panel {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  align-items: stretch;
}
.desk-manage.is-up > .desk-manage-panel {
  top: auto;
  bottom: calc(100% + 6px);
}
.desk-manage-panel .btn {
  margin: 0;
  width: 100%;
  max-width: none;
  justify-content: center;
}
.desk-table th,
.desk-table td {
  padding: 0.32rem 0.4rem;
  vertical-align: middle;
}
.wallet-grants {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: center;
}
.wallet-grant {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  margin: 0;
}
.wallet-rename {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.wallet-rename input {
  width: 9.5rem;
  max-width: 100%;
}

.stack { display: grid; gap: 0.85rem; }
.stack.tight { gap: 0.45rem; margin-top: 0.5rem; }
label.ks-profile-pick {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  grid-template-rows: none;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem 1rem;
  align-items: start;
}
.parse-engine {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 0.65rem;
  max-width: 44rem;
}
.parse-engine-block[hidden] { display: none; }
.parse-engine-block {
  margin: 0;
  padding: 0.85rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.parse-engine-block legend {
  padding: 0 0.4rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.parse-engine-hint {
  margin: 0;
  max-width: 40rem;
  line-height: 1.4;
}
.parse-engine-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}
.parse-engine .form-actions { margin-top: 0; }
.form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  grid-column: 1 / -1;
  margin-top: 0.15rem;
}
label {
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--muted);
}
label > .field-label {
  display: block;
  line-height: 1.3;
  min-height: 1.3em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

input, select, button, textarea {
  font: inherit;
  color-scheme: dark;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.65rem;
  background-color: var(--bg);
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  caret-color: var(--accent);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
}
input:not([type="checkbox"]):not([type="radio"])::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px rgba(61, 186, 138, 0.22);
}
input:not([type="checkbox"]):not([type="radio"]):-webkit-autofill,
input:not([type="checkbox"]):not([type="radio"]):-webkit-autofill:hover,
input:not([type="checkbox"]):not([type="radio"]):-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--accent);
  box-shadow: 0 0 0 1000px var(--bg) inset;
  border: 1px solid var(--line);
  transition: background-color 99999s ease-out 0s;
}

/* Compact dark checkboxes (not stretched by text-input rules) */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.1rem;
  height: 1.1rem;
  min-width: 1.1rem;
  min-height: 1.1rem;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  flex-shrink: 0;
  border: 1.5px solid #4a5560;
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  vertical-align: middle;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
input[type="checkbox"]::before {
  content: "";
  width: 0.65rem;
  height: 0.65rem;
  transform: scale(0);
  transition: transform var(--dur-fast) var(--ease-out);
  background: #04140e;
  clip-path: polygon(14% 44%, 0 65%, 40% 100%, 100% 18%, 80% 0, 38% 62%);
}
input[type="checkbox"]:hover {
  border-color: var(--accent-dim);
}
input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
input[type="checkbox"]:checked::before {
  transform: scale(1);
}
input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(61, 186, 138, 0.28);
}

.area-combobox {
  position: relative;
  min-height: 2.65rem;
}
.area-combobox > input[type="text"] {
  display: block;
}
.area-combobox.is-open input {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px rgba(61, 186, 138, 0.22);
}
.area-suggest {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  max-height: 240px;
  overflow: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  transform-origin: top center;
  animation: suggest-in var(--dur) var(--ease-out) both;
}
.area-suggest-item {
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.88rem;
}
.area-suggest-item:hover,
.area-suggest-item.is-active {
  background: var(--bg-soft);
}
.area-suggest-item.area-suggest-state {
  font-weight: 600;
}
.area-suggest-item.area-suggest-any {
  color: var(--muted);
}

.btn {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
  transition:
    filter var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; pointer-events: none; }
.btn-primary {
  background: linear-gradient(180deg, #45c994, var(--accent-dim));
  border-color: transparent;
  color: #04140e;
}
.btn.btn-primary.wake-btn:disabled,
.btn.btn-primary.wake-btn.wake-btn-busy {
  background: var(--bg-soft);
  color: var(--muted);
  border: 1px solid var(--line);
  opacity: 1;
  filter: none;
  transform: none;
  cursor: wait;
  pointer-events: none;
}
.btn-ghost { background: transparent; }
.btn-danger {
  background: transparent;
  border-color: #4a2a30;
  color: var(--danger);
}
.btn-sm { padding: 0.3rem 0.55rem; font-size: 0.82rem; font-weight: 500; }

.table-wrap { overflow-x: auto; width: 100%; container-type: inline-size; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; table-layout: auto; }
.numbers-table {
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
}
.pool-stage-table.numbers-table {
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.pool-stage-table col.col-keep { width: 2.8rem; }
.pool-stage-table col.col-phone { width: 12rem; }
.pool-stage-table col.col-who { width: 5.5rem; }
.pool-stage-table col.col-score { width: 4.8rem; }
.pool-stage-table col.col-refund { width: 5.4rem; }
.pool-stage-table col.col-state { width: 7.5rem; }
.pool-stage-table col.col-fullka { width: 4.8rem; }
.pool-stage-table col.col-actions { width: 11rem; }
.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 0.14rem;
  min-width: 0;
}
.numbers-table .col-state .cell-stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
}
.numbers-table .col-state .cell-stack > * {
  flex: 0 0 auto;
  max-width: 100%;
}
.numbers-table .col-state .badge {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}
.cell-kicker {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timer-stack {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}
.timer-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
}
.timer-label {
  color: var(--muted);
  font-size: 0.72rem;
  flex: 0 0 auto;
}
.timer-label-idle {
  opacity: 0.45;
}
.timer-row .mono {
  text-align: right;
  min-width: 0;
}
.col-who-fio {
  width: 11rem;
}
.col-who-fio .fio-cell {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fullka-open {
  margin-top: 0;
}
.fullka-open .btn {
  max-width: 100%;
}
.col-timers { width: 9.4rem; }
.col-state { width: 6.8rem; }
.numbers-table .col-state { width: 7.5rem; white-space: normal; }
.numbers-table .col-score {
  width: 4.8rem;
  min-width: 4.8rem;
  max-width: 4.8rem;
}
.numbers-table .col-refund {
  width: 5.4rem;
  min-width: 5.4rem;
  max-width: 5.4rem;
}
.col-state .badge { max-width: 100%; }
th, td { text-align: left; padding: 0.65rem 0.55rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.numbers-table th,
.numbers-table td {
  padding: 0.28rem 0.4rem;
  vertical-align: middle;
}
th { color: var(--muted); font-weight: 560; font-size: 0.8rem; }
.mono { font-family: var(--mono); font-size: 0.86rem; }
/* flex only on wrappers — never on <td> (breaks table borders/width) */
div.row-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}
td.row-actions {
  text-align: right;
  white-space: normal;
}
td.row-actions .btn + .btn {
  margin-left: 0.35rem;
}
.table-wrap tr:last-child > th,
.table-wrap tr:last-child > td {
  border-bottom: none;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  line-height: 1.3;
  white-space: nowrap;
  vertical-align: middle;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}
.badge-purchased { color: var(--warn); border-color: #5a4630; }
.badge-kept { color: var(--ok); border-color: #2f5a45; }
.badge-active { color: #7eb6ff; border-color: #2f4a6a; }
.badge-refunded { color: var(--muted); border-color: var(--line); }
.badge-failed { color: var(--danger); border-color: #5a3036; }
.badge-queued { color: #7eb6ff; border-color: #2f4a6a; }
.badge-running { color: var(--warn); border-color: #5a4630; }
.badge-done { color: var(--ok); border-color: #2f5a45; }

.alert {
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  margin-bottom: 0.9rem;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  animation: rise-in var(--dur) var(--ease-out) both;
}
.alert-error { border-color: #5a3036; color: #f0b0b6; }
.alert-ok { border-color: #2f5a45; color: #9ee0c4; }
.alert-warn { border-color: #5a4630; color: #e6c58a; }
.wp-lookups-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-family: var(--mono);
  color: var(--muted);
  white-space: nowrap;
}
.wp-lookups-chip.wp-lookups-low {
  color: #e6c58a;
  border-color: #5a4630;
  background: rgba(90, 70, 48, 0.25);
}
.gotsms-balance-chip {
  color: #9ee0c4;
}
button.gotsms-balance-chip {
  cursor: pointer;
  font: inherit;
  background: transparent;
  width: 100%;
  justify-content: space-between;
  gap: 0.3rem;
}
button.gotsms-balance-chip::after {
  content: "▾";
  font-size: 0.7em;
  opacity: 0.7;
}
.flyout[data-flyout="gotsms-balance"].is-open > .gotsms-balance-chip,
.flyout[data-flyout="gotsms-balance"] > .gotsms-balance-chip[aria-expanded="true"] {
  border-color: #2a8f68;
}
.flyout-panel-balance {
  min-width: 14rem;
  right: 0;
  left: auto;
}
.gotsms-balance-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.gotsms-balance-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.28rem 0;
  font-size: 0.82rem;
}
.gotsms-balance-list li.is-current .gotsms-balance-name {
  font-weight: 600;
}
.gotsms-balance-name { color: var(--text); }
.gotsms-balance-val {
  font-family: var(--mono);
  color: #9ee0c4;
  white-space: nowrap;
}
.gotsms-balance-val.is-err { color: #f0b0b6; }
.gotsms-balance-total {
  border-top: 1px solid var(--line);
  margin-top: 0.2rem;
  padding-top: 0.4rem;
  font-weight: 600;
}
.gotsms-topup-link {
  display: block;
  margin-top: 0.55rem;
  padding: 0.4rem 0.45rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--text);
  text-align: center;
  text-decoration: none;
  font-size: 0.88rem;
}
.gotsms-topup-link:hover {
  background: var(--bg-soft);
  text-decoration: none;
}
.wp-lookups-banner {
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  text-align: center;
}
body.maintenance-locked {
  overflow: hidden;
}
.maintenance-lock {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(900px 500px at 50% 20%, #1a2830 0%, transparent 55%),
    rgba(14, 17, 20, 0.94);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  text-align: center;
}
.maintenance-lock-inner {
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}
.maintenance-lock-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.maintenance-lock-sub {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}
.account-switch-lock {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(900px 500px at 50% 20%, #1a2830 0%, transparent 55%),
    rgba(14, 17, 20, 0.94);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  text-align: center;
  cursor: wait;
}
html.account-switching .account-switch-lock {
  display: flex;
}
.account-switch-lock-inner {
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}
.account-switch-spinner {
  width: 1.7rem;
  height: 1.7rem;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: account-switch-spin 0.75s linear infinite;
}
@keyframes account-switch-spin {
  to { transform: rotate(360deg); }
}
.account-switch-lock-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.account-switch-lock-name {
  margin: 0;
  color: var(--accent);
  font-weight: 600;
}
.account-switch-lock-name:empty {
  display: none;
}
.account-switch-lock-sub {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}
.wp-block-banner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.badge-wp-block { color: var(--danger); border-color: #5a3036; }
.badge-wp-pause { color: var(--warn); border-color: #5a4630; }
.error-text { color: #f0b0b6; font-size: 0.85rem; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}
.pool-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
}
.pool-toolbar-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.pool-toolbar-row .btn {
  min-height: 2.4rem;
  padding: 0.45rem 0.85rem;
}
.pool-search {
  width: min(260px, 100%);
  min-height: 2.4rem;
  padding: 0.45rem 0.65rem;
}
#pool-count {
  font-size: 0.82rem;
  white-space: nowrap;
}
.pool-int-tabs .btn.is-active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--text);
}
.op-stage-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.55rem 0 0.35rem;
}
.op-stage-toggles[hidden] { display: none; }
.pool-keep-btns {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-left: auto;
}
.pool-toolbar-actions .btn-primary {
  margin-left: 0;
}
.row-link { cursor: pointer; }
.row-link:hover td { background: rgba(255, 255, 255, 0.03); }
.check {
  display: inline-flex !important;
  grid-template-rows: none;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.col-keep {
  width: 3.25rem;
  min-width: 2.8rem;
  text-align: center !important;
  vertical-align: middle;
}
.pool-stage-table.numbers-table th.col-keep,
.pool-stage-table.numbers-table td.col-keep {
  width: 2.8rem;
  min-width: 2.8rem;
  overflow: visible;
}
.col-keep .keep-box {
  margin: 0 auto;
  display: inline-grid;
}
.col-phone {
  width: 7.6rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.numbers-table .col-phone {
  width: 11.5rem;
  min-width: 11.5rem;
  max-width: 11.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pool-stage-table.numbers-table th.col-phone,
.pool-stage-table.numbers-table td.col-phone {
  width: 12rem;
  min-width: 13ch;
  max-width: none;
  overflow: hidden;
  text-overflow: clip;
}
.col-who {
  width: 5.6rem;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.numbers-table .col-who {
  width: 5.5rem;
  min-width: 5.5rem;
}
td.col-phone {
  cursor: pointer;
}
td.col-phone:hover { color: var(--accent); }
.col-fio {
  min-width: 0;
  max-width: 12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.numbers-table .col-fio {
  width: 8rem;
  max-width: 8rem;
}
.col-note {
  width: 7.2rem;
  min-width: 0;
  max-width: none;
  cursor: default;
}
.col-note.col-note-edit { cursor: text; }
.col-note .note-text,
.col-note .note-placeholder {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.col-note .note-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.col-score {
  width: 4.6rem;
  white-space: nowrap;
}
.col-status { width: auto; white-space: nowrap; }
.col-refund {
  width: 5.2rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.col-life {
  width: 5.5rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.col-wakeup { width: 5.5rem; }
.wakeup-cell.refund-urgent { color: var(--warn); }
.wakeup-cell.refund-expired { color: var(--muted); }
.wake-stack {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.wake-stack .wake-stack-life { color: var(--muted); font-size: 0.78rem; }
.wake-meters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.wake-meter {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  background: var(--bg);
}
.wake-meter-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}
.wake-meter .stat-value { margin: 0; font-size: 1.15rem; }
.extend-renewal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}
.refund-cell.refund-urgent,
.life-cell.refund-urgent { color: var(--warn); }
.refund-cell.refund-expired,
.life-cell.refund-expired { color: var(--muted); }
.col-actions { width: 9.6rem; text-align: right !important; white-space: nowrap; }
.pool-stage-grid .numbers-table .col-actions { width: 11rem; }
td.row-actions {
  text-align: right;
  white-space: normal;
}
#pool-table td.col-actions,
.pool-stage-table td.col-actions,
#recent-table td.col-actions,
.desk-table td.col-actions {
  white-space: nowrap;
  overflow: visible;
  padding-right: 0.45rem;
}
#pool-table td.col-actions .btn,
.pool-stage-table td.col-actions .btn,
#recent-table td.col-actions .btn,
.desk-table td.col-actions .btn {
  margin: 0 0.2rem 0 0;
  vertical-align: middle;
}
#recent-table td.col-actions .desk-manage-btn,
.desk-table td.col-actions .desk-manage-btn {
  margin: 0;
  width: auto;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.28rem 0.5rem;
}
.numbers-table.desk-table .col-phone {
  width: 7.6rem;
  min-width: 0;
  max-width: 7.6rem;
}
.numbers-table.desk-table .col-wallet {
  width: 5rem;
  min-width: 0;
  max-width: 5rem;
}
.numbers-table.desk-table .col-service {
  width: 6.6rem;
  min-width: 0;
  max-width: 6.6rem;
}
.numbers-table.desk-table .col-note {
  width: 9.5rem;
  min-width: 0;
  max-width: 9.5rem;
}
.numbers-table.desk-table .col-timers {
  width: 4.8rem;
  min-width: 0;
  max-width: 4.8rem;
  padding-left: 0.12rem;
  padding-right: 0.12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.numbers-table.desk-table .col-state {
  width: 6.8rem;
  min-width: 0;
  max-width: 6.8rem;
}
.numbers-table.desk-table .col-fio {
  width: 9.5rem;
  min-width: 8rem;
  max-width: 9.5rem;
}
.numbers-table.desk-table .col-fullka {
  width: 4.8rem;
  min-width: 0;
  max-width: 4.8rem;
}
.numbers-table.desk-table .col-actions {
  width: 11rem;
  min-width: 11rem;
  max-width: 11rem;
  padding-right: 0.35rem;
}
#recent-table .desk-manage-panel .btn,
.desk-table .desk-manage-panel .btn {
  margin: 0;
  width: 100%;
  max-width: none;
}
.extend-combo {
  display: flex;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-soft);
}
.extend-combo .btn {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
#recent-table .desk-manage-panel .extend-combo .btn,
.desk-table .desk-manage-panel .extend-combo .btn {
  width: auto;
}
.extend-combo-main {
  flex: 1 1 auto;
}
.extend-combo-auto {
  flex: 0 0 auto;
  border-left: 1px solid var(--line) !important;
  font-size: 0.72rem;
  color: var(--muted);
}
.extend-combo-auto[data-renewal="1"] {
  color: var(--ok);
}
.extend-combo .btn:hover {
  background: rgba(255, 255, 255, 0.05);
}
.col-wp { width: auto; white-space: nowrap; }
.col-fullka { width: 4.8rem; white-space: nowrap; }
.badge-wp-found { color: var(--ok); border-color: #2f5a45; }
.badge-wp-none { color: var(--warn); border-color: #5a4630; }
.badge-wp-miss { color: var(--muted); border-color: var(--line); }
.badge-wp-run { color: #7eb6ff; border-color: #2f4a6a; }
.badge-wp-error { color: var(--danger); border-color: #5a3036; }
.badge-wp-idle { color: var(--muted); border-color: var(--line); }
.badge-ks-run { color: #7eb6ff; border-color: #2f4a6a; }
.badge-ks-score { color: var(--text); border-color: var(--line); }
.badge-ks-keep { color: var(--ok); border-color: #2f5a45; }
.badge-ks-fail { color: var(--warn); border-color: #5a4630; }
.badge-ks-error { color: var(--danger); border-color: #5a3036; }
.copy-fullka { max-width: 5rem; }
.open-fullka { max-width: 5rem; }
#pool-table tbody tr.pool-row,
.pool-stage-table tbody tr.pool-row { cursor: pointer; }
#pool-table tbody tr.pool-row:hover,
.pool-stage-table tbody tr.pool-row:hover { background: rgba(255,255,255,.03); }
.wp-record-body { max-height: 70vh; overflow: auto; }
.wp-record-dl { display: grid; grid-template-columns: 8rem 1fr; gap: 0.4rem 0.75rem; margin: 0; }
.wp-record-dl dt { color: var(--muted, #8b919a); font-size: 0.8rem; }
.wp-record-dl dd { margin: 0; }
.wp-record-list { margin: 0; padding-left: 1.1rem; }
#wp-record-dialog { width: min(720px, calc(100% - 2rem)); }
#extend-dialog { width: min(420px, calc(100% - 2rem)); }
#sms-dialog { width: min(560px, calc(100% - 2rem)); }
#wake-dialog { width: min(420px, calc(100% - 2rem)); }
.sms-body {
  max-height: 60vh;
  overflow: auto;
}
.sms-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.sms-empty { margin: 0; }
.sms-phase { margin: 0 0 0.75rem; }
.sms-btn.sms-live {
  border-color: var(--ok);
  color: var(--ok);
}
.sms-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  background: var(--bg);
}
.sms-card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}
.sms-from { font-weight: 600; }
.sms-to { margin: 0.2rem 0 0; font-size: 0.82rem; }
.sms-code-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.55rem 0 0.35rem;
  flex-wrap: wrap;
}
.sms-code-label { color: var(--muted); font-size: 0.78rem; }
.sms-code {
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  color: var(--ok);
}
.sms-text {
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
  line-height: 1.4;
}
.sms-toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 80;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.55rem;
  width: min(22rem, calc(100% - 2rem));
  pointer-events: none;
}
.sms-toast {
  pointer-events: auto;
  border: 1px solid #2f5a45;
  background: #121a16;
  color: var(--text);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  animation: rise-in var(--dur-enter) var(--ease-out) both;
}
.sms-toast-title { display: block; margin-bottom: 0.25rem; }
.sms-toast-code { margin: 0.2rem 0; color: var(--ok); }
.sms-toast-body { margin: 0.25rem 0 0.6rem; white-space: pre-wrap; font-size: 0.88rem; }
.extend-now { margin: 0 0 0.75rem; }
.extend-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.extend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  margin: 0;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.extend-row:hover {
  border-color: var(--accent);
  background: rgba(61, 186, 138, 0.08);
}
.extend-row:disabled {
  opacity: 0.55;
  cursor: default;
}
.extend-title { font-weight: 600; }
.extend-price {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}
#pool-table th, .pool-stage-table th, #batch-table th, #recent-table th {
  white-space: nowrap;
}
#pool-table th.col-timers,
.pool-stage-table th.col-timers,
#pool-table th.col-who-fio,
.pool-stage-table th.col-who-fio,
#pool-table th.col-state,
.pool-stage-table th.col-state,
#pool-table th.col-note,
.pool-stage-table th.col-note,
#recent-table th.col-timers,
#recent-table th.col-who-fio,
#recent-table th.col-state,
#recent-table th.col-note,
#recent-table th.col-fio {
  white-space: normal;
  line-height: 1.2;
}

dialog {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 12px;
  width: min(640px, calc(100% - 2rem));
  padding: 1rem;
  opacity: 0;
  transform: translateY(6px) scale(0.98);
}
dialog[open] {
  animation: dialog-in var(--dur-enter) var(--ease-out) both;
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  animation: fade-in var(--dur) var(--ease-out) both;
}
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin: 0 0 0.75rem; gap: 0.75rem; }
.dialog-head-actions { display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.inline-details summary { list-style: none; display: inline-block; cursor: pointer; }
.inline-details summary::-webkit-details-marker { display: none; }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes suggest-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.flyout { position: relative; }
.flyout-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  min-width: 16rem;
  padding: 0.7rem 0.8rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  animation: suggest-in var(--dur) var(--ease-out) both;
}
.flyout-hover:hover > .flyout-panel,
.flyout.is-open > .flyout-panel { display: block; }
.desk-manage.is-open > .desk-manage-panel {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  align-items: stretch;
  min-width: 13.5rem;
  width: max-content;
  padding: 0.4rem;
  z-index: 80;
  right: 0;
  left: auto;
  position: absolute;
}
.topbar-user-btn,
.topbar-user-name {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 8px;
  padding: 0.32rem 0.65rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}
.topbar-user-name {
  border-color: transparent;
  background: transparent;
  cursor: default;
  color: var(--muted);
}
.flyout-panel-user {
  right: 0;
  left: auto;
  width: min(52rem, 94vw);
  max-height: min(78vh, 640px);
  overflow: auto;
  padding: 0.75rem;
}
.users-flyout-scroll { max-height: 68vh; overflow: auto; }
.flyout-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.op-line { margin: 0.2rem 0; font-size: 0.88rem; }
.op-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.55rem;
}
.op-actions .btn { white-space: nowrap; }
.btn-sm { padding: 0.32rem 0.55rem; font-size: 0.8rem; }
.btn-danger { border-color: #5a3036; color: #f0b0b6; }
.flyout-panel-op { min-width: min(28rem, 94vw); }
.op-queue-kicker {
  margin: 0.7rem 0 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.op-queue {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: calc(1.85rem * 5);
  overflow-y: auto;
}
.op-queue-empty {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.2rem 0;
}
.op-queue-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 1.85rem;
  padding: 0.12rem 0;
  border-bottom: 1px solid var(--line);
}
.op-queue-row.is-current .op-queue-phone { color: var(--text); }
.op-queue-phone { flex: 1 1 auto; font-size: 0.82rem; }
.op-queue-state { flex: 0 0 auto; font-size: 0.72rem; color: var(--muted); }

@media (max-width: 900px) {
  .grid.stats { grid-template-columns: 1fr 1fr; }
  #auto-stats.grid.stats { grid-template-columns: 1fr 1fr; }
  .hub-cards,
  .hub-cards-admin { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .parse-engine-row { grid-template-columns: 1fr; }
  .app-nav-link {
    font-size: 0.82rem;
  }
  .workspace-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .workspace-head-mid {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

.workspace {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  padding: 1rem 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.workspace-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem 1.25rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}
.workspace-head-id {
  min-width: 0;
}
.workspace-head-mid {
  min-width: 0;
  display: flex;
  justify-content: center;
}
.workspace-kicker {
  margin: 0.28rem 0 0;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  color: var(--muted);
}
.workspace-title {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.workspace-title.workspace-wallet {
  text-transform: none;
  letter-spacing: -0.02em;
  font-size: 1.7rem;
  font-weight: 750;
  color: var(--accent);
  line-height: 1.15;
}
.work-buy-link {
  color: inherit;
  font-weight: 650;
}
.workspace-warn {
  margin: 0.35rem 0 0;
  color: #e8b4a2;
  font-size: 0.85rem;
}
.workspace-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}
.desk-stats {
  display: flex;
  align-items: stretch;
  min-width: 0;
  max-width: 34rem;
  width: 100%;
  background: rgba(14, 17, 20, 0.55);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.desk-stat {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.14rem;
  min-width: 0;
  padding: 0.48rem 0.55rem 0.42rem;
  text-align: center;
  border-right: 1px solid var(--line);
}
.desk-stat:last-child {
  border-right: none;
}
.desk-stat-value {
  font-family: var(--mono);
  font-size: 1.02rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}
.desk-stat.is-zero .desk-stat-value {
  color: var(--muted);
}
.desk-stat-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
}
.flyout-panel-services {
  right: 0;
  left: auto;
  min-width: min(22rem, 90vw);
}
.flyout-panel-services input[type="search"] {
  width: 100%;
  margin: 0.35rem 0 0.55rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
}
.service-results {
  max-height: 16rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.service-pick {
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0.4rem 0.45rem;
  border-radius: 6px;
  cursor: pointer;
}
.service-pick:hover { background: var(--bg-soft); }
.service-pick.is-current { background: var(--bg-soft); font-weight: 600; }
.service-favorites {
  max-height: 10rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0 0 0.45rem;
}
.service-fav-empty { font-size: 0.82rem; margin: 0.1rem 0 0.2rem; }
.service-row {
  display: flex;
  align-items: stretch;
  gap: 0.12rem;
}
.service-row .service-pick { flex: 1; min-width: 0; }
.service-star {
  flex: 0 0 2rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  font-size: 1rem;
  line-height: 1;
}
.service-star:hover { background: var(--bg-soft); color: var(--text); }
.service-star.is-on { color: #e6b84c; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .btn:active,
  .hub-card:hover,
  .hub-card:active { transform: none; }
}

#recent-table td.col-actions .desk-manage-btn.btn.btn-sm,
.desk-table td.col-actions .desk-manage-btn.btn.btn-sm {
  width: auto;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0.28rem 0.5rem;
}
