/* Operator console. shadcn/ui-style tokens (zinc), external stylesheet only (strict CSP). */
:root {
  color-scheme: light dark;
  --background: #ffffff;
  --foreground: #09090b;
  --card: #ffffff;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --accent: #f4f4f5;
  --ring: #a1a1aa;
  --destructive: #dc2626;
  --warn: #b45309;
  --ok: #15803d;
  --info: #2563eb;
  --sidebar: #fafafa;
  --radius: 0.5rem;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: #09090b;
    --foreground: #fafafa;
    --card: #0c0c0e;
    --muted: #27272a;
    --muted-foreground: #a1a1aa;
    --border: #27272a;
    --input: #3f3f46;
    --primary: #fafafa;
    --primary-foreground: #18181b;
    --accent: #27272a;
    --ring: #52525b;
    --destructive: #f87171;
    --warn: #fbbf24;
    --ok: #4ade80;
    --info: #60a5fa;
    --sidebar: #0c0c0e;
  }
}
* {
  box-sizing: border-box;
}
html {
  background: var(--background);
  color: var(--foreground);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    'Segoe UI',
    Inter,
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body {
  margin: 0;
}
a {
  color: inherit;
  text-underline-offset: 3px;
}
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  color: var(--muted-foreground);
}
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--card);
  padding: 0.5rem;
}
.skip-link:focus {
  left: 0.5rem;
  z-index: 10;
}

/* App shell */
.app {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 0.75rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  align-items: center;
  display: flex;
  gap: 0.6rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
}
.brand-mark {
  align-items: center;
  background: var(--primary);
  border-radius: 0.4rem;
  color: var(--primary-foreground);
  display: inline-flex;
  font-size: 0.7rem;
  font-weight: 700;
  height: 1.75rem;
  justify-content: center;
  width: 1.75rem;
}
.brand small {
  color: var(--muted-foreground);
  display: block;
  font-weight: 400;
  font-size: 0.75rem;
}
.nav-label {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 500;
  margin: 0 0 0.25rem;
  padding: 0 0.5rem;
}
.admin-nav ul {
  display: flex;
  flex-direction: column;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.admin-nav a {
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted-foreground);
  display: block;
  font-weight: 500;
  padding: 0.45rem 0.6rem;
  text-decoration: none;
}
.admin-nav a:hover {
  background: var(--accent);
  color: var(--foreground);
}
.admin-nav a[aria-current='page'] {
  background: var(--accent);
  color: var(--foreground);
}
.sidebar-footer {
  border-top: 1px solid var(--border);
  margin-top: auto;
  padding: 0.75rem 0.5rem 0;
}
.user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.avatar {
  align-items: center;
  background: var(--muted);
  border-radius: 999px;
  display: inline-flex;
  font-weight: 600;
  height: 2rem;
  justify-content: center;
  text-transform: uppercase;
  width: 2rem;
}
.user-meta {
  line-height: 1.2;
  min-width: 0;
}
.user-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-meta span {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}
.signout {
  color: var(--muted-foreground);
  display: inline-block;
  font-size: 0.8rem;
  margin-top: 0.6rem;
}

.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  align-items: center;
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--background) 85%, transparent);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  height: 3.5rem;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 5;
}
.breadcrumb {
  color: var(--muted-foreground);
  font-size: 0.85rem;
  margin: 0;
}
.breadcrumb strong {
  color: var(--foreground);
  font-weight: 500;
}
.session {
  color: var(--muted-foreground);
  font-size: 0.8rem;
  margin: 0;
}
main {
  display: block;
  padding: 1.5rem;
  max-width: 90rem;
  width: 100%;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
}
h2 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 2rem 0 0.75rem;
}
.callouts {
  padding: 1rem 1.5rem 0;
  max-width: 90rem;
}

/* Alerts */
.capability-banner,
.notice,
.state {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
}
.capability-banner summary {
  cursor: pointer;
  font-weight: 500;
}
.capability-banner summary::marker {
  color: var(--warn);
}
.capability-banner h2,
.state h2 {
  font-size: 0.95rem;
  margin: 0 0 0.25rem;
}
.capability-banner ul {
  color: var(--muted-foreground);
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}
.capability-banner,
.state-warning,
.notice-warning {
  border-left: 3px solid var(--warn);
}
.notice-error,
.state-error {
  border-left: 3px solid var(--destructive);
}
.notice-success {
  border-left: 3px solid var(--ok);
}
.notice-info {
  border-left: 3px solid var(--info);
}
.notice p,
.state p {
  margin: 0.15rem 0;
}

/* Tables */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
}
caption {
  color: var(--muted-foreground);
  font-size: 0.8rem;
  padding: 0.75rem 1rem 0.25rem;
  text-align: left;
}
th,
td {
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 1rem;
  text-align: left;
  vertical-align: top;
}
th {
  color: var(--muted-foreground);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: color-mix(in srgb, var(--muted) 55%, transparent);
}

/* Badges */
.badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 0.05rem 0.55rem;
  white-space: nowrap;
}
.badge-ok {
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  border-color: transparent;
  color: var(--ok);
}
.badge-warn {
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  border-color: transparent;
  color: var(--warn);
}
.badge-danger {
  background: color-mix(in srgb, var(--destructive) 12%, transparent);
  border-color: transparent;
  color: var(--destructive);
}
.badge-info {
  background: color-mix(in srgb, var(--info) 12%, transparent);
  border-color: transparent;
  color: var(--info);
}
.badge-neutral,
.badge-role {
  background: var(--muted);
  border-color: transparent;
  color: var(--muted-foreground);
}

.muted {
  color: var(--muted-foreground);
  font-size: 0.8rem;
}
.empty-state,
.loading-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted-foreground);
  padding: 2rem 1rem;
  text-align: center;
}
.pagination {
  color: var(--muted-foreground);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-size: 0.8rem;
  margin: 0.75rem 0 1.5rem;
}
.pagination p {
  margin: 0;
}
.pagination a {
  color: var(--foreground);
  font-weight: 500;
}

/* Forms as cards */
.detail-section {
  margin-top: 1.5rem;
}
.detail-section > .action-form {
  margin: 0 0 0.75rem;
}
.filter-form,
.action-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0 0 1rem;
  padding: 1rem 1.25rem;
}
.filter-form fieldset {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}
.filter-form legend {
  margin-bottom: 0.5rem;
}
.filter-form .field {
  margin: 0;
  min-width: 10rem;
}
.filter-form p {
  margin: 0;
}
fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
fieldset[disabled] {
  opacity: 0.6;
}
legend {
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0;
}
.action-form fieldset > p:not(.field):not(.field-help) {
  color: var(--muted-foreground);
  margin: 0.25rem 0 0.75rem;
}
.field {
  margin: 0 0 0.75rem;
}
.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}
.field-checkbox {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}
.field-checkbox label {
  font-weight: 400;
  margin: 0;
}
input[type='text'],
input[type='number'],
input[type='password'],
input:not([type]),
select,
textarea {
  background: transparent;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  color: var(--foreground);
  font: inherit;
  height: 2.25rem;
  max-width: 32rem;
  padding: 0 0.75rem;
  width: 100%;
}
textarea {
  height: auto;
  min-height: 5rem;
  padding: 0.5rem 0.75rem;
}
input::placeholder {
  color: var(--muted-foreground);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}
input[type='checkbox'] {
  accent-color: var(--primary);
  height: 1rem;
  width: 1rem;
}
.field-help {
  color: var(--muted-foreground);
  font-size: 0.8rem;
  margin: 0.25rem 0 0.75rem;
}
.button {
  align-items: center;
  background: var(--primary);
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  color: var(--primary-foreground);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 500;
  height: 2.25rem;
  justify-content: center;
  padding: 0 1rem;
  text-decoration: none;
}
.button:hover {
  opacity: 0.9;
}
.button[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}
.secret-reveal {
  background: var(--muted);
  border: 1px solid var(--destructive);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
  padding: 0.75rem 1rem;
  white-space: pre-wrap;
}
.secret-reveal code {
  color: var(--foreground);
  font-size: 0.95rem;
}
.request-id,
.field-errors {
  color: var(--muted-foreground);
  font-size: 0.8rem;
}
.admin-footer {
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 0.75rem;
  margin-top: auto;
  padding: 1rem 1.5rem;
}
.admin-footer p {
  margin: 0.15rem 0;
}
[dir='auto'] {
  unicode-bidi: isolate;
}

/* Sign-in page */
.auth-page {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: var(--muted);
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.08);
  max-width: 24rem;
  padding: 2rem;
  width: 100%;
}
.auth-card h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0.75rem 0 0.25rem;
}
.auth-card .subtitle {
  color: var(--muted-foreground);
  margin: 0 0 1.25rem;
}
.auth-card .action-form {
  border: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
}
.auth-card .action-form legend {
  display: none;
}
.auth-card input {
  max-width: none;
}
.auth-card .button {
  width: 100%;
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    height: auto;
    position: static;
  }
  .admin-nav ul {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .sidebar-footer {
    display: none;
  }
}
/* Playlist page */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0 0 1.5rem;
  padding: 1.25rem;
}
.card h2 {
  margin-top: 0;
}
.card input[readonly] {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  max-width: none;
}
.inline-form {
  display: inline-block;
  margin: 0 0.4rem 0 0;
}
.actions {
  white-space: nowrap;
  text-align: right;
}
.button-outline {
  background: transparent;
  border-color: var(--input);
  color: var(--foreground);
}
.button-outline:hover {
  background: var(--accent);
}
.button-danger {
  background: var(--destructive);
  color: #fff;
}
.confirm-inline {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  margin-right: 0.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
