:root {
  color-scheme: light;
  --bg: #f7f6f4;
  --surface: #f0efec;
  --border: #e3e1dc;
  --text: #1a1916;
  --muted: #6a6762;
  --accent: #e85d3a;
  --accent-hover: #c94b2c;
  --badge: #fde8e1;
  --sidebar: #141210;
  --sidebar-text: #e8e2d8;
  --topbar: #e5e3dd;
  --rail-hover: #e7e5e0;
  --msg-user: #e8e7e4;
  --msg-peer: #d6dee6;
  font-family: Inter, system-ui, sans-serif;
}

html.dark {
  color-scheme: dark;
  --bg: #121110;
  --surface: #1c1b19;
  --border: #3a3834;
  --text: #f4f3f0;
  --muted: #9c9890;
  --accent: #f07852;
  --accent-hover: #e85d3a;
  --badge: #3f2118;
  --topbar: #2a2825;
  --rail-hover: #262420;
  --msg-user: #2a2926;
  --msg-peer: #2a333c;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  background: var(--accent);
  color: white;
}

button:hover {
  background: var(--accent-hover);
}

button.secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

button.secondary:hover {
  border-color: var(--muted);
}

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.login-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
}

.login-card p {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-card label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

label:has(> input[type="checkbox"]),
label:has(> input[type="radio"]) {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.login-card input:not([type="checkbox"]):not([type="radio"]) {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}

.login-card button {
  width: 100%;
  margin-top: 0.5rem;
}

.error {
  color: #dc2626;
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

.shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
}

.topbar,
.queue-topbar {
  min-height: 3.5rem;
  padding: 0.75rem 1.25rem;
  box-shadow: none;
  position: relative;
  z-index: 2;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--topbar);
}

.site-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.tenant-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tenant-tabs a,
.tenant-tabs button {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
}

.tenant-tabs a.active,
.tenant-tabs button.active {
  background: var(--badge);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.main {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  min-height: 0;
  overflow: hidden;
}

.queue-panel {
  border-right: 1px solid var(--border);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.queue-panel h2 {
  margin: 0;
  padding: 1rem 1.25rem 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.queue-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.85rem 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: inherit;
  border-radius: 0;
  text-decoration: none;
}

.queue-item:hover,
.queue-item.selected {
  background: var(--rail-hover);
}

.queue-item .row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--badge);
  color: var(--accent-hover);
}

html.dark .badge {
  color: var(--accent);
}

.badge-poke {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.queue-item .preview {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item .meta {
  font-size: 0.75rem;
  color: var(--muted);
}

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

.chat-empty {
  display: grid;
  place-items: center;
  flex: 1;
  color: var(--muted);
}

.chat-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.chat-header h2 {
  margin: 0;
  font-size: 1rem;
}

.chat-header .sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-anchor: none;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.msg-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 0.35rem;
}

.msg-main {
  display: flex;
  flex-direction: column;
  max-width: 75%;
  gap: 0.25rem;
}

.msg-wrap.user .msg-main {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-wrap.peer .msg-main {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-wrap--actions .msg {
  cursor: pointer;
  position: relative;
  padding-right: 3.9rem;
}

.msg {
  position: relative;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.msg-wrap.user .msg {
  background: var(--msg-user);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  margin-left: 0.4rem;
}

.msg-wrap.peer .msg {
  background: var(--msg-peer);
  border: 1px solid var(--border);
  border-bottom-right-radius: 4px;
  margin-right: 0.4rem;
}

.msg-wrap.user .msg::after,
.msg-wrap.peer .msg::after {
  content: "";
  position: absolute;
  top: 12px;
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
}

.msg-wrap.user .msg::after {
  left: -6px;
  background: var(--msg-user);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.msg-wrap.peer .msg::after {
  right: -6px;
  background: var(--msg-peer);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.msg-line {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  max-width: 100%;
}

.msg-wrap.peer .msg-line {
  flex-direction: row-reverse;
}

.msg-line .msg {
  min-width: 0;
}

.msg-body {
  min-width: 0;
}

.msg-flag {
  flex: none;
  display: inline-flex;
  margin-top: 0.45rem;
  color: #d97706;
}

.msg-flag--handled {
  color: var(--muted);
}

html.dark .msg-flag:not(.msg-flag--handled) {
  color: #fbbf24;
}

.msg-overlay-mark {
  flex: none;
  align-self: flex-start;
  margin-top: 0.45rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.msg-wrap time {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
}

.msg-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.45rem;
}

.msg-stamp {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.msg-stamp time {
  display: inline;
}

.msg-read {
  display: inline-flex;
  flex: none;
  color: #9aa0a6;
}

.msg-read svg {
  display: block;
  overflow: visible;
}

.msg-read--yes {
  color: #3cb85c;
}

html.dark .msg-read {
  color: #8b929a;
}

html.dark .msg-read--yes {
  color: #4ade80;
}

@keyframes msg-target-flash {
  0%, 60% { outline-color: #f59e0b; }
  100% { outline-color: transparent; }
}

.msg-wrap--target .msg {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
  animation: msg-target-flash 2.5s ease-out forwards;
}

.msg-actions {
  position: absolute;
  top: 0.4rem;
  right: 0.3rem;
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.msg-wrap--actions:hover .msg-actions,
.msg-wrap--actions .msg-actions:focus-within,
.msg-wrap.is-armed .msg-actions,
.msg-wrap.is-open .msg-actions {
  opacity: 1;
  pointer-events: auto;
}

.msg-action,
.msg-panel-close {
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 6px;
}

.msg-action:hover,
.msg-panel-close:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

.msg-action[aria-pressed="true"] {
  background: var(--bg);
  color: var(--accent);
  border-color: var(--border);
}

.msg-action svg,
.msg-panel-close svg {
  width: 0.95rem;
  height: 0.95rem;
}

.msg-panel {
  width: 100%;
}

.msg-panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem 1rem;
}

.msg-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.msg-panel-head strong {
  font-size: 0.8rem;
  font-weight: 650;
}

.msg-panel-card > .meta {
  margin: 0 0 0.7rem;
}

.msg-panel-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.msg-panel-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.msg-panel-fields select {
  flex: 0 1 16rem;
}

.msg-panel-fields input {
  flex: 1 1 12rem;
}

.msg-panel-form textarea,
.msg-panel-form select,
.msg-panel-form input[type="text"],
.msg-panel-form input:not([type]) {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.msg-panel-form textarea {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  line-height: 1.4;
}

.msg-panel-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.msg-panel-footer .secondary {
  margin-right: auto;
}

.msg-panel-footer button {
  font-size: 0.85rem;
  padding: 0.45rem 0.95rem;
}

.msg-op-name {
  font-weight: 700;
  color: var(--text);
}

.msg-user-time {
  font-weight: 400;
}

.msg-user-time--unknown {
  font-style: italic;
}

.msg-image {
  display: block;
  max-width: 100%;
  max-height: 280px;
  border-radius: 8px;
}

.msg-caption {
  margin-top: 0.35rem;
}

.gallery-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.gallery-tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.65rem;
}

.gallery-tab {
  flex: 1 1 0;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
}

.gallery-tab:hover,
.gallery-tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  border-color: var(--muted);
}

.gallery-tab[aria-selected="true"] {
  border-color: var(--accent);
  color: var(--text);
}

.gallery-item--ref img {
  opacity: 0.85;
}

.gallery-empty {
  margin: 0;
  padding: 0.5rem 0;
}

.gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.gallery-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  width: 88px;
}

.gallery-item img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.gallery-send {
  display: block;
  padding: 0;
  background: transparent;
  border-radius: 6px;
}

.gallery-send:hover {
  background: transparent;
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.compose-dock {
  flex: 0 0 auto;
  padding: 0.75rem 1.1rem 0.65rem;
  border-top: 1px solid var(--border);
  background: inherit;
}

.compose-row {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
}

.compose-lang {
  flex: 0 0 auto;
  align-self: center;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  line-height: 1;
  min-width: 2.1rem;
  text-align: center;
}

.photo-picker,
.emoji-picker {
  position: relative;
  flex: 0 0 auto;
  align-self: center;
}

.compose-photo-btn {
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}

.compose-photo-btn:hover,
.compose-photo-btn[aria-expanded="true"] {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

.compose-photo-btn svg {
  width: 1.35rem;
  height: 1.35rem;
}

.photo-dot {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
}

.photo-pop,
.emoji-pop,
.compose-pop {
  z-index: 50;
}

.photo-pop {
  width: min(22rem, 72vw);
  max-height: 18rem;
  overflow: auto;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

.photo-upload {
  margin-top: 0.7rem;
}

.compose {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
}

.compose textarea:disabled,
.compose button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.compose textarea:disabled {
  background: #fff;
}

html.dark .compose textarea:disabled {
  background: var(--surface);
}

.compose textarea {
  flex: 1;
  min-height: 2.75rem;
  max-height: 8rem;
  resize: vertical;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

html.dark .compose textarea {
  background: var(--bg);
}

.inline-form {
  display: inline;
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
}

.app-content {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
  min-width: 0;
}

.app-shell.nav-collapsed .app-content {
  grid-template-columns: 0 1fr;
}

.app-shell.nav-collapsed .sidebar {
  overflow: hidden;
  padding: 0;
  border: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 0.75rem 0;
  overflow-y: auto;
}

.sidebar a,
.sidebar .nav-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.9rem;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  border-radius: 0;
}

.sidebar a:hover,
.sidebar a.active,
.sidebar .nav-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar a.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-badge {
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

.nav-section {
  margin: 1rem 1rem 0.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9a9186;
}

.nav-form {
  margin: 0;
}

.nav-prefs {
  display: flex;
  gap: 0.25rem;
  margin-top: auto;
  padding: 0.75rem 0.75rem 0.15rem;
}

.nav-prefs .nav-form {
  flex: 1;
}

.sidebar .nav-icon {
  display: grid;
  place-items: center;
  width: 100%;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--sidebar-text);
  cursor: pointer;
}

.sidebar .nav-icon:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-glyph {
  width: 1.2rem;
  height: 1.2rem;
}

.app-main {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.app-shell > .topbar {
  background: var(--topbar);
}

.topbar-start {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.nav-burger {
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.nav-burger:hover {
  background: var(--rail-hover);
}

.nav-burger svg {
  width: 1.15rem;
  height: 1.15rem;
}

.queue-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
}

.queue-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-bottom: 1px solid transparent;
  z-index: 40;
}

.queue-back {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  justify-self: start;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.queue-topbar .nav-burger {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--sidebar-text);
}

.queue-back:hover .nav-burger {
  background: rgba(255, 255, 255, 0.14);
}

.queue-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-width: 0;
}

.queue-title,
.queue-names {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-center .badge {
  background: var(--badge);
  color: var(--accent-hover);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  font-size: 0.8rem;
}

.queue-right {
  justify-self: end;
  overflow: visible;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.pane-toggles {
  display: none;
  align-items: center;
  gap: 0.3rem;
}

.pane-toggle {
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.pane-toggle:hover,
.pane-toggle[aria-expanded="true"] {
  background: var(--rail-hover);
  border-color: var(--muted);
}

html.dark .pane-toggle {
  color: var(--text);
  border-color: var(--border);
  background: var(--bg);
}

html.dark .pane-toggle:hover,
html.dark .pane-toggle[aria-expanded="true"] {
  background: var(--rail-hover);
  border-color: var(--muted);
}

.queue-acts {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.queue-act-form {
  margin: 0;
}

.queue-act {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.55rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.queue-act:hover {
  background: var(--rail-hover);
}

.queue-act-form .queue-act {
  color: var(--accent);
}

.queue-act-form--pause .queue-act {
  color: inherit;
}

.queue-act-icon {
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
}

.queue-dialog {
  width: min(26rem, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 16px 48px rgba(17, 24, 39, 0.22);
}

.queue-dialog::backdrop {
  background: rgba(17, 24, 39, 0.45);
}

.queue-dialog-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.15rem 1.2rem 1.1rem;
}

.queue-dialog-form h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.queue-dialog-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.queue-dialog-field input,
.queue-dialog-field textarea {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 400;
}

.queue-dialog-field textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.queue-dialog-field input::placeholder,
.queue-dialog-field textarea::placeholder {
  color: var(--muted);
  font-size: 0.8rem;
}

.queue-dialog-ignore {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  font-size: 0.85rem;
}

.queue-dialog-ignore input {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.queue-dialog-ignore-label {
  display: block;
  font-weight: 650;
}

.queue-dialog-hint {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--muted);
}

.queue-dialog-ignore .queue-dialog-hint {
  margin-top: 0.25rem;
}

.queue-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
}

.queue-dialog-actions button {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
}

.queue-dialog-cancel {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.queue-dialog-cancel:hover {
  background: var(--rail-hover);
}

.queue-dialog-actions button[type="submit"] {
  border: 0;
  background: var(--accent);
  color: #fff;
}

.queue-dialog-actions button[type="submit"]:hover {
  filter: brightness(0.95);
}

.queue-body {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.queue-body > .workspace,
.queue-body > .waiting {
  flex: 1 1 auto;
  min-height: 0;
}

html.dark .topbar,
html.dark .queue-topbar {
  box-shadow: none;
}

html.dark .queue-topbar {
  background: var(--topbar);
}

.queue-topbar .queue-act {
  color: var(--sidebar-text);
}

.queue-topbar .queue-act:hover,
html.dark .queue-topbar .queue-act:hover {
  background: rgba(255, 255, 255, 0.08);
}

.queue-topbar .queue-act-form .queue-act {
  color: var(--accent);
}

.queue-topbar .queue-act-form--pause .queue-act {
  color: var(--sidebar-text);
}

.queue-topbar .pane-toggle,
html.dark .queue-topbar .pane-toggle {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--sidebar-text);
}

.queue-topbar .pane-toggle:hover,
.queue-topbar .pane-toggle[aria-expanded="true"],
html.dark .queue-topbar .pane-toggle:hover,
html.dark .queue-topbar .pane-toggle[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
}

html.dark .queue-act:hover {
  background: var(--rail-hover);
}

.queue-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.queue-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.8rem;
  background: var(--bg);
}

.queue-btn.active {
  border-color: var(--accent);
}

.queue-btn .count {
  background: var(--accent);
  color: white;
  border-radius: 999px;
  padding: 0 0.4rem;
  font-size: 0.7rem;
}

.who {
  font-size: 0.8rem;
  color: var(--muted);
}

.app-body {
  min-height: 0;
  min-width: 0;
  overflow: auto;
}

.page-title {
  margin: 0;
  padding: 1.5rem 1.25rem 0;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.app-body > .page-title + .panel {
  padding-top: 0.85rem;
}

.app-body:has(.workspace),
.app-body:has(.shell-inner),
.app-body:has(.waiting) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.app-body:has(.workspace) > .workspace,
.app-body:has(.shell-inner) > .shell-inner,
.app-body:has(.waiting) > .waiting {
  flex: 1 1 auto;
  min-height: 0;
}

.shell-inner {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  min-height: 0;
}

.shell-inner .tenant-tabs {
  padding: 0.65rem 1.25rem;
}

.shell-inner .main {
  height: 100%;
}

.panel {
  padding: 1.25rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

.filter-row input[type='number'] {
  width: 5.5rem;
}

.overview-status-filter {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.overview-status-filter .field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.overview-status-filter select {
  font: inherit;
  font-weight: 400;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.overview-filters-box {
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.overview-filters-box > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  padding: 0.7rem 1rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.85rem;
}

.overview-filters-box > summary::-webkit-details-marker {
  display: none;
}

.overview-filters-box > summary::before {
  content: '▸';
  color: var(--muted);
  font-size: 0.75rem;
}

.overview-filters-box[open] > summary::before {
  content: '▾';
}

.overview-filters-box[open] > summary {
  border-bottom: 1px solid var(--border);
}

.overview-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.overview-filter-chips span {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--badge);
  color: var(--text);
  font-weight: 500;
  font-size: 0.78rem;
}

.form-card.overview-filters {
  max-width: none;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem 0.85rem;
  padding: 0.85rem 1rem 1rem;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.form-card.overview-filters > .field {
  flex: 1 1 9.5rem;
  min-width: 8rem;
}

.form-card.overview-filters > .date-range {
  flex-basis: 16rem;
}

.form-card.overview-filters .field-set {
  min-width: 0;
  padding: 0.55rem 0.7rem 0.7rem;
}

.form-card.overview-filters .form-actions {
  flex: 0 0 auto;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  margin: 0 0 0 auto;
}

.form-card.overview-filters .form-actions .secondary-link {
  text-align: center;
}

.filter-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.form-card.overview-filters.reports-filters .checkbox-row {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.3;
}

.date-range {
  position: relative;
}

.date-range-toggle {
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  font: inherit;
  font-weight: 400;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.date-range-toggle:hover,
.date-range-toggle[aria-expanded="true"] {
  background: var(--surface);
  color: var(--text);
  border-color: var(--muted);
}

.date-range-cal {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.35rem);
  left: 0;
  width: 18.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.date-range-nav {
  display: grid;
  grid-template-columns: 2rem 1fr 2rem;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.date-range-nav strong {
  text-align: center;
  font-size: 0.9rem;
}

.date-range-nav button {
  padding: 0.2rem 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.date-range-nav button:hover {
  background: var(--rail-hover);
  color: var(--text);
}

.date-range-week,
.date-range-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.15rem;
  text-align: center;
}

.date-range-week {
  margin-bottom: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
}

.date-range-day {
  padding: 0.35rem 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-weight: 500;
  font-size: 0.8rem;
}

.date-range-day:hover {
  background: var(--badge);
}

.date-range-day.is-in {
  background: var(--badge);
}

.date-range-day.is-today {
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.date-range-day.is-bound {
  background: var(--accent);
  color: #fff;
}

.date-range-day.is-bound.is-today {
  box-shadow: inset 0 0 0 1.5px #fff;
}

.date-range-hint {
  margin: 0.55rem 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
}

.date-range-clear {
  width: 100%;
}

@media (max-width: 1100px) {
  .form-card.overview-filters .form-actions {
    flex-direction: row;
    align-items: center;
  }
}

.form-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
  max-width: 26rem;
}

.form-back {
  margin: 0 0 1rem;
  font-size: 0.85rem;
}

.form-card .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.form-card .field input,
.form-card .field select {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-weight: 400;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.form-card .field-hint,
.field-set .field-hint {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--muted);
}

.field-set {
  margin: 0;
  padding: 0.85rem 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.field-set legend {
  padding: 0 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.field-set .field-hint {
  margin: 0 0 0.7rem;
}

.lang-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.lang-picks .checkbox-row {
  margin: 0;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.85rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 0.15rem;
}

.checkbox-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.button-link,
.secondary-link {
  display: inline-block;
  margin-bottom: 0.75rem;
}

.form-actions .secondary-link {
  margin: 0;
}

.panel h2 {
  margin: 1.5rem 0 0.75rem;
  font-size: 1rem;
}

.stats-block {
  margin-top: 1.25rem;
}

.stats-block:first-of-type {
  margin-top: 0.75rem;
}

.stats-block h2 {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
}

.stats-table th.num,
.stats-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stats-table .stats-type {
  vertical-align: middle;
  font-weight: 600;
}

.stats-table .stats-total td {
  font-weight: 600;
  border-bottom: none;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.data-table a {
  color: var(--text);
  text-underline-offset: 0.12em;
}

.data-table a:hover {
  color: var(--accent);
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.28rem 0.45rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--sidebar);
  color: var(--sidebar-text);
  font-weight: 600;
  border-bottom-color: var(--sidebar);
}

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

.overview-table th,
.overview-table td {
  white-space: nowrap;
}

.overview-chat .overview-lang {
  font-weight: 700;
  margin-right: 0.4em;
}

.overview-table .overview-chat a {
  color: var(--accent);
}

.overview-table .overview-chat a:hover {
  color: var(--accent-hover);
}

.overview-num {
  font-variant-numeric: tabular-nums;
}

.overview-table .overview-clip {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overview-table .overview-flags {
  white-space: normal;
  max-width: 12rem;
}

.overview-member {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.72rem;
  line-height: 1.2;
}

.overview-member--paid {
  background: #dcfce7;
  color: #166534;
}

.overview-member--free {
  background: #e5e5e5;
  color: #525252;
}

.overview-extra-time {
  display: block;
  font-weight: 600;
}

.overview-row--locked {
  background: #f5ead0;
}

.overview-row--waiting {
  background: #e7efe6;
  animation: overview-waiting-pulse 1.8s ease-in-out infinite;
}

.overview-row--stale {
  background: #e8e4db;
}

.overview-row--poke {
  background: #e4eef5;
}

.overview-row--ignored {
  background: #fee2e2;
  color: #7f1d1d;
}

.overview-row--ignored a {
  color: #991b1b;
}

html.dark .data-table thead th {
  background: #2a241e;
  border-bottom-color: #2a241e;
}

html.dark .overview-row--locked {
  background: #3d2e18;
  color: #fefce8;
}

html.dark .overview-row--waiting {
  background: #243328;
  animation-name: overview-waiting-pulse-dark;
}

html.dark .overview-row--stale {
  background: #2a2620;
  color: var(--text);
}

html.dark .overview-row--poke {
  background: #1c2d3a;
  color: var(--text);
}

html.dark .overview-row--ignored {
  background: #7f1d1d;
  color: #fecaca;
}

html.dark .overview-row--ignored a {
  color: #fecaca;
}

html.dark .overview-member--paid {
  background: #14532d;
  color: #bbf7d0;
}

html.dark .overview-member--free {
  background: #3a3834;
  color: #d4d4d4;
}

@keyframes overview-waiting-pulse {
  0%,
  100% {
    background: #e7efe6;
  }
  50% {
    background: #d5e6d2;
  }
}

@keyframes overview-waiting-pulse-dark {
  0%,
  100% {
    background: #243328;
  }
  50% {
    background: #2d4034;
  }
}

@media (prefers-reduced-motion: reduce) {
  .overview-row--waiting {
    animation: none;
  }
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: flex-end;
  margin-top: 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.pager a[aria-current='page'] {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.muted {
  color: var(--muted);
}

.report-handle {
  position: relative;
}

.report-handle > summary {
  list-style: none;
}

.report-handle > summary::-webkit-details-marker {
  display: none;
}

.report-handle-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  cursor: pointer;
}

.report-handle-check:hover,
.report-handle[open] > .report-handle-check {
  background: #15803d;
}

.report-handle-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 14rem;
  padding: 0.65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.report-handle-pop input,
.report-handle-pop button {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
}

.rbac-guide {
  margin-top: 0;
  padding-top: 0;
}

.rbac-guide h2 {
  margin-top: 0;
}

.rbac-blurbs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.85rem 1.25rem;
  margin: 0 0 1.25rem;
}

.rbac-blurb p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.rbac-scroll {
  overflow-x: auto;
}

.rbac-table {
  min-width: 48rem;
}

.rbac-table th[scope='row'] {
  font-weight: 600;
  white-space: nowrap;
}

.rbac-table td {
  text-align: center;
}

.rbac-yes {
  color: #047857;
  font-weight: 600;
}

.rbac-no {
  color: var(--muted);
}

.waiting {
  height: 100%;
  min-height: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: 0.65rem;
  padding: 2rem 1.25rem;
}

.waiting-hero {
  display: grid;
  justify-items: center;
  gap: 1.35rem;
}

.waiting-mark {
  position: relative;
  width: 8.5rem;
  height: 8.5rem;
  display: grid;
  place-items: center;
}

.waiting-ring,
.waiting-ping {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.waiting-ring--outer {
  inset: 0;
  border: 1px solid var(--border);
}

.waiting-ring--inner {
  inset: 1.35rem;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
}

.waiting-ping {
  inset: 2.15rem;
  border: 1.5px solid var(--accent);
  opacity: 0;
}

.waiting-ember {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow:
    0 0 0 6px var(--badge),
    0 0 18px color-mix(in srgb, var(--accent) 50%, transparent);
  animation: waiting-breathe 2.8s ease-in-out infinite;
}

.waiting-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
}

.waiting.is-paused .waiting-ember {
  background: var(--muted);
  box-shadow: 0 0 0 6px var(--surface);
  animation: none;
}

.waiting.is-paused .waiting-ring--inner {
  border-color: var(--border);
}

.waiting.is-paused .waiting-title {
  color: var(--text);
}

.waiting-resume {
  display: inline-block;
  padding: 0.55rem 1.15rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.waiting-resume:hover {
  background: var(--accent-hover);
}

.waiting.is-beat .waiting-ping {
  animation: waiting-ping 1.15s ease-out;
}

@keyframes waiting-breathe {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.18);
    opacity: 0.82;
  }
}

@keyframes waiting-ping {
  0% {
    inset: 2.15rem;
    opacity: 0.65;
  }
  100% {
    inset: -0.35rem;
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .waiting-ember,
  .waiting.is-beat .waiting-ping {
    animation: none;
  }

  .waiting-ember {
    opacity: 1;
  }
}

.workspace {
  --rail-w: 3.5rem;
  --pane-min: 300px;
  display: grid;
  grid-template-columns: minmax(var(--pane-min), 1fr) minmax(22rem, 1.4fr) minmax(var(--pane-min), 1fr) var(--rail-w);
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  position: relative;
}

.workspace:has(.action-rail:not(.collapsed)) {
  --rail-w: 14.75rem;
}

.action-rail {
  z-index: 4;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 0.75rem 0.85rem 1rem;
  border-left: 1px solid var(--border);
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
}

.action-rail.collapsed {
  padding: 0.5rem 0.28rem;
}

.action-rail.collapsed .rail-copy,
.action-rail.collapsed .rail-fields {
  display: none;
}

.action-rail.collapsed .rail-actions {
  pointer-events: none;
}

.action-rail.collapsed .rail-row {
  padding: 0.2rem;
  justify-content: center;
}

.action-rail.collapsed .rail-actions .rail-row {
  cursor: default;
}

.rail-toggle,
.rail-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.action-rail:not(.collapsed) .rail-toggle,
.action-rail:not(.collapsed) .rail-actions {
  gap: 0.75rem;
}

.rail-toggle {
  margin-bottom: 0.25rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}

.rail-option details {
  margin: 0;
}

.rail-row {
  display: flex;
  align-items: flex-start;
  gap: 0.95rem;
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: 12px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.rail-row:hover {
  background: var(--rail-hover);
}

.action-rail.collapsed .rail-row:hover {
  background: none;
}

summary.rail-row {
  list-style: none;
}

summary.rail-row::-webkit-details-marker {
  display: none;
}

.rail-icon {
  flex: 0 0 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
}

.rail-row:hover .rail-icon--collapse,
.rail-row:hover .rail-icon--expand,
.rail-row:hover .rail-icon--takeover,
.rail-row:hover .rail-icon--clear,
.rail-row:hover .rail-icon--skip,
.rail-row:hover .rail-icon--copy,
.rail-row:hover .rail-icon--extra,
.rail-row:hover .rail-icon--next,
.rail-row:hover .rail-icon--sun,
.rail-row:hover .rail-icon--moon,
.rail-row:hover .rail-icon--sound-on,
.rail-row:hover .rail-icon--sound-off {
  color: var(--text);
}

.rail-glyph {
  width: 1.3rem;
  height: 1.3rem;
  fill: currentColor;
}

.rail-icon--collapse .rail-glyph,
.rail-icon--expand .rail-glyph,
.rail-icon--takeover .rail-glyph,
.rail-icon--clear .rail-glyph,
.rail-icon--sun .rail-glyph,
.rail-icon--sound-on .rail-glyph,
.rail-icon--sound-off .rail-glyph,
.rail-icon--extra .rail-glyph {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail-icon--moon .rail-glyph {
  fill: currentColor;
  stroke: none;
}

.rail-icon--collapse,
.rail-icon--expand,
.rail-icon--takeover,
.rail-icon--clear,
.rail-icon--skip,
.rail-icon--copy,
.rail-icon--extra,
.rail-icon--next {
  background: none;
  color: var(--muted);
}

.rail-icon--ignore {
  background: none;
  color: #c45c26;
}

.rail-icon--alert {
  background: none;
  color: #b91c1c;
}

.rail-icon--like {
  background: none;
  color: var(--accent);
}

.rail-prefs {
  margin-top: auto;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  pointer-events: auto;
}

.action-rail:not(.collapsed) .rail-prefs {
  gap: 0.75rem;
}

.rail-copy {
  min-width: 0;
  padding-top: 0.12rem;
}

.rail-title {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.2;
}

.rail-hint {
  display: block;
  margin-top: 0.18rem;
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--muted);
}

.rail-extra-reason {
  display: block;
  margin-top: 0.2rem;
}

.rail-fields {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.55rem 0.6rem 0 3.9rem;
}

.rail-fields select,
.rail-fields input,
.rail-fields button {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}

.rail-fields button {
  cursor: pointer;
  font-weight: 600;
}

.session-clocks {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.session-clocks .sub {
  font-weight: 650;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.session-clocks-times {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.session-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.session-chip--hint {
  color: var(--muted);
  font-weight: 500;
}

.session-clocks time[data-countdown],
.session-clocks time[data-local] {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.side-pane {
  padding: 0 0 1rem;
  border-right: 1px solid var(--border);
  min-width: var(--pane-min, 300px);
  min-height: 0;
  overflow-y: auto;
  font-size: 0.85rem;
  background: var(--surface);
}

.side-pane--player {
  border-right: none;
  border-left: 1px solid var(--border);
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin: 0;
  padding: 0.4rem 0.5rem 0.4rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
  background: var(--msg-user);
  border-bottom: 1px solid var(--border);
}

.side-head h3 {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.pane-close {
  display: none;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  border: 0;
}

.pane-close svg {
  width: 0.95rem;
  height: 0.95rem;
}

.pane-close:hover {
  background: var(--rail-hover);
}

.pane-backdrop {
  display: none;
}

.side-pane--player .side-head {
  color: var(--text);
  background: var(--msg-peer);
  border-bottom-color: var(--border);
}

.side-pane--player .pane-close:hover {
  background: var(--rail-hover);
}

.side-pane h4 {
  margin: 0 0 0.5rem;
  padding: 0 0.85rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.side-id,
.side-facts,
.side-bio,
.side-looking,
.notes {
  margin-left: 0.85rem;
  margin-right: 0.85rem;
}

.side-id {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 0.7rem;
  margin-top: 0.85rem;
  align-items: start;
}

.side-photo {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.side-photo.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.72rem;
  text-align: center;
}

.side-id-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.side-name {
  font-weight: 700;
  font-size: 1rem;
  margin: 0;
  overflow-wrap: anywhere;
}

.side-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.side-credit {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  width: fit-content;
  margin-top: 0.15rem;
  padding: 0.2rem 0.5rem 0.22rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  line-height: 1.2;
}

.side-credit-kicker {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.side-credit-value {
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.side-credit--empty {
  background: #fee2e2;
  border-color: #fca5a5;
}

html.dark .side-credit {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

html.dark .side-credit--empty {
  background: #7f1d1d;
  border-color: #b91c1c;
  color: #fee2e2;
}

.side-facts {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.85rem;
}

.side-fact {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: 0.4rem;
  align-items: baseline;
}

.side-fact dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.side-fact dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.side-chats {
  margin: 0;
}

.side-chats summary {
  cursor: pointer;
  list-style-position: outside;
}

.side-chats ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

.side-chats .meta {
  margin: 0.35rem 0 0;
}

.side-bio,
.side-looking {
  margin-top: 0.7rem;
}

.notes {
  margin-top: 1.1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

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

html.dark .workspace-chat {
  background: #161514;
}

.workspace-chat .chat-header,
.workspace-chat .compose-dock,
.workspace-chat .skip-form,
.workspace-chat .error {
  flex: 0 0 auto;
}

.workspace-chat .messages {
  flex: 1 1 auto;
  min-height: 0;
}

.compose-meta {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  padding-left: 0.15rem;
}

html.dark .photo-pop {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.emoji-pop emoji-picker {
  width: min(22rem, 88vw);
  height: 22rem;
  --border-radius: 10px;
  --box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

html.dark .emoji-pop emoji-picker {
  --box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.compose-hint {
  font-size: 0.85rem;
}

.compose-hint--short {
  color: #b45309;
  font-weight: 600;
}

.compose-hint--ok {
  color: var(--muted);
  font-weight: 400;
}

html.dark .rbac-yes {
  color: #34d399;
}

html.dark .compose-hint--short {
  color: #fbbf24;
}

.compose textarea {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.compose-send {
  flex: 0 0 auto;
  align-self: center;
}

.skip-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.skip-form select,
.skip-form input {
  font: inherit;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}

.notes h4 {
  padding: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
  color: var(--text);
}

.note-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0;
  border: none;
}

.note-form textarea,
.note-cat-toggle,
.note-cat-search {
  font: inherit;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--text) 22%, var(--border));
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

html.dark .note-form textarea,
html.dark .note-cat-toggle,
html.dark .note-cat-search {
  background: var(--bg);
}

.note-form textarea {
  min-height: 5rem;
  resize: vertical;
}

.note-form > button[type='submit'] {
  width: 100%;
  font-weight: 650;
  text-transform: none;
  letter-spacing: 0;
}

.note-cat {
  position: relative;
}

.note-cat-toggle {
  text-align: left;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  text-transform: uppercase;
}

html.dark .note-cat-toggle {
  background: var(--bg);
}

.note-cat-toggle:hover {
  background: var(--rail-hover);
}

.note-cat-menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 0.4rem;
}

.note-cat-options {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  max-height: 12rem;
  overflow-y: auto;
}

.note-cat-option {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  font-weight: 600;
  text-transform: uppercase;
}

.note-cat-option:hover {
  background: var(--rail-hover);
  color: var(--text);
}

.note-cat-option.is-active,
.note-cat-option.is-active:hover {
  background: var(--badge);
  color: var(--accent-hover);
}

.note-show-all,
.note-show-cat {
  display: inline-block;
  margin: 0.55rem 0 0.4rem;
  color: var(--accent);
  font-size: 0.82rem;
}

.note-show-all[hidden],
.note-show-cat[hidden],
.note-empty-cat[hidden],
.note-empty[hidden] {
  display: none;
}

.note-history {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.note-group-title {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.note-item-meta {
  color: var(--muted);
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

.note-item-body {
  position: relative;
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--text) 16%, var(--border));
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(26, 25, 22, 0.06);
  padding: 0.55rem 0.65rem 1.55rem;
}

html.dark .note-item-body {
  background: var(--bg);
}

.note-item-body p {
  margin: 0;
  white-space: pre-wrap;
}

.note-item-delete {
  position: absolute;
  right: 0.5rem;
  bottom: 0.25rem;
  margin: 0;
}

.note-item-delete button {
  background: none;
  color: #dc2626;
  padding: 0;
  font-size: 0.78rem;
  border-radius: 0;
}

.note-item-delete button:hover {
  background: none;
  text-decoration: underline;
}

@media (max-width: 1079px) {
  .pane-toggles {
    display: flex;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) var(--rail-w);
  }

  .workspace-chat {
    grid-column: 1;
    grid-row: 1;
  }

  .action-rail {
    grid-column: 2;
    grid-row: 1;
  }

  .pane-backdrop:not([hidden]) {
    display: block;
    position: absolute;
    grid-column: 1 / -1;
    grid-row: 1;
    inset: 0 var(--rail-w) 0 0;
    z-index: 15;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(17, 24, 39, 0.28);
  }

  .side-pane {
    position: absolute;
    grid-column: 1 / -1;
    grid-row: 1;
    top: 0;
    bottom: 0;
    z-index: 20;
    min-width: min(var(--pane-min), calc(100% - var(--rail-w)));
    width: min(22rem, calc(100% - var(--rail-w)));
    background: var(--bg);
    box-shadow: 0 0 28px rgba(15, 23, 42, 0.18);
    pointer-events: none;
    transition: transform 0.18s ease, opacity 0.18s ease, visibility 0.18s ease;
  }

  .side-pane--customer {
    left: 0;
  }

  .side-pane--player {
    right: var(--rail-w);
    left: auto;
    border-left: 1px solid var(--border);
  }

  .side-pane:not(.is-open) {
    z-index: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .side-pane--customer:not(.is-open) {
    transform: translateX(-105%);
  }

  .side-pane--player:not(.is-open) {
    transform: translateX(105%);
  }

  .side-pane.is-open {
    z-index: 20;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }

  .pane-close {
    display: inline-grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  .side-pane {
    transition: none;
  }
}

@media (max-width: 768px) {
  .app-content {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .app-shell.nav-collapsed .app-content {
    grid-template-columns: 1fr;
    grid-template-rows: 0 1fr;
  }
  .sidebar {
    display: flex;
    flex-wrap: wrap;
    padding: 0.25rem;
  }
  .queue-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    justify-items: stretch;
  }
  .queue-back {
    justify-self: start;
  }
  .queue-right {
    justify-self: end;
  }
  .main {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 36%) minmax(0, 1fr);
  }
  .queue-panel {
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

.chat-alert {
  background: #b91c1c;
  color: #fff;
  padding: 0.5rem 0.85rem;
  font-weight: 600;
  flex: 0 0 auto;
}

.claim-block {
  background: #f59e0b;
  color: #1a1d27;
  padding: 0.55rem 0.85rem;
  font-weight: 600;
  flex: 0 0 auto;
}

.workspace-chat .claim-block,
.workspace-chat .take-waiting {
  flex: 0 0 auto;
}

.take-waiting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  background: #e7efe6;
  border-bottom: 1px solid #c5d6c2;
  color: #1f4a3a;
}

.take-waiting p {
  margin: 0;
  font-weight: 600;
}

.take-waiting button {
  flex: 0 0 auto;
  background: #047857;
}

.take-waiting button:hover {
  background: #065f46;
}

html.dark .take-waiting {
  background: #243328;
  border-bottom-color: #2d4034;
  color: #d1e4d4;
}

.alert-form {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.history-cap-hint {
  padding: 0.35rem 0.75rem;
}
