/* Obsidian Editorial — dark-first */
:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;
  --line: #334155;
  --line-strong: #475569;
  --accent: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.15);
  --accent-btn: #c0c1ff;
  --accent-btn-text: #1000a9;
  --danger: #fb7185;
  --warn: #fbbf24;
  --ok: #34d399;
  --pending: #fbbf24;
  --cancelled: #94a3b8;
  --radius: 0.5rem;
  --shadow: 0 0 20px rgba(0, 0, 0, 0.4);
  --font: "Inter", system-ui, sans-serif;
  --toast-ok-bg: rgba(52, 211, 153, 0.15);
  --toast-err-bg: rgba(251, 113, 133, 0.15);
  --sidebar-width: 260px;
  --topbar-height: 56px;
}

html[data-theme="light"] {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-hover: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --line: #cbd5e1;
  --line-strong: #94a3b8;
  --accent: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.12);
  --accent-btn: #4f46e5;
  --accent-btn-text: #ffffff;
  --danger: #e11d48;
  --warn: #d97706;
  --ok: #059669;
  --pending: #d97706;
  --cancelled: #64748b;
  --shadow: 0 0 20px rgba(15, 23, 42, 0.12);
  --toast-ok-bg: #ecfdf5;
  --toast-err-bg: #fff1f2;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

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

a:hover {
  text-decoration: underline;
}

.layout {
  min-height: 100vh;
  width: 100%;
  padding: 0;
  max-width: none;
  margin: 0;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--line);
  transition: transform 0.2s ease;
}

.sidebar-brand {
  padding: 20px 24px 12px;
}

.sidebar-brand a {
  color: inherit;
  text-decoration: none;
}

.sidebar-brand a:hover {
  text-decoration: none;
}

.sidebar-brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.sidebar-brand p {
  margin: 4px 0 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-transform: uppercase;
}

.sidebar-cta {
  padding: 8px 12px 16px;
}

.sidebar-cta .btn {
  width: 100%;
  justify-content: center;
  gap: 8px;
  display: inline-flex;
  align-items: center;
  background: var(--accent-btn);
  color: var(--accent-btn-text);
  border-color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sidebar-cta .btn:hover {
  filter: brightness(1.05);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  list-style: none;
  margin: 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-left: 2px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

.sidebar-nav a.active {
  color: var(--text);
  background: var(--surface);
  border-left-color: #6366f1;
}

.sidebar-nav a.active .material-symbols-outlined {
  color: #6366f1;
}

.sidebar-nav .material-symbols-outlined {
  font-size: 20px;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
}

.workspace {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--topbar-height);
  padding: 0 24px;
  margin: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  backdrop-filter: none;
}

.topbar-minimal {
  margin-left: 0;
  justify-content: flex-start;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.topbar-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.health-dots {
  display: none;
  align-items: center;
  gap: 12px;
  padding-left: 16px;
  margin-left: 8px;
  border-left: 1px solid var(--line);
}

@media (min-width: 1024px) {
  .health-dots {
    display: flex;
  }
}

.health-dot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-transform: uppercase;
}

.health-dot .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
}

.health-dot.ok .dot {
  background: var(--ok);
}

.health-dot.err .dot {
  background: var(--danger);
}

.health-dot.warn .dot {
  background: var(--warn);
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.workspace-main {
  flex: 1;
  padding: 24px;
  padding-bottom: 48px;
  overflow-x: auto;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 55;
}

body.sidebar-open .sidebar-backdrop {
  display: block;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-link:hover {
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.header-menu {
  position: relative;
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--bg);
  border-color: var(--line);
}

.icon {
  width: 20px;
  height: 20px;
}

.logout-form {
  display: inline;
  margin: 0;
}

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 280px;
  max-width: min(360px, 92vw);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 50;
  padding: 8px;
}

.dropdown-settings {
  min-width: 0;
  width: max-content;
  padding: 6px;
}

.dropdown-settings .dropdown-section {
  padding: 4px;
}

.dropdown-settings .dropdown-section + .dropdown-section {
  padding-top: 2px;
}

.dropdown-settings .dropdown-label {
  margin-bottom: 4px;
  font-size: 0.7rem;
}

.dropdown-settings .theme-choices,
.dropdown-settings .lang-choices {
  gap: 4px;
}

.dropdown-settings .theme-choices .btn,
.dropdown-settings .lang-choices .btn,
.dropdown-settings .lang-choices a {
  padding: 4px 10px;
  font-size: 0.75rem;
  min-width: 0;
  flex: 1;
  text-align: center;
  justify-content: center;
}

.dropdown-head,
.dropdown-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
}

.dropdown-head #notif-mark-all {
  flex-shrink: 0;
  white-space: nowrap;
}

.dropdown-foot {
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 10px;
}

.dropdown-foot .btn {
  width: 100%;
  justify-content: center;
}

.dropdown-section {
  padding: 8px;
}

.dropdown-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.theme-choices,
.lang-choices {
  display: flex;
  gap: 6px;
}

.theme-choices .btn.active,
.lang-choices .btn.active,
.lang-choices a.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.link-btn {
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0;
}

.notif-list {
  max-height: 320px;
  overflow: auto;
}

.notif-item {
  display: block;
  padding: 10px 8px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  border: 1px solid transparent;
}

.notif-item:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

.notif-item.unread {
  border-color: var(--line);
  background: color-mix(in srgb, var(--accent-soft) 60%, transparent);
}

table.data tr.row-unread td {
  background: color-mix(in srgb, var(--accent-soft) 45%, transparent);
}

.col-read {
  width: 10%;
}

.notif-item .notif-title {
  font-weight: 600;
  font-size: 0.88rem;
}

.notif-item .notif-msg {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.notif-item .notif-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 4px;
}

.badge-info {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-warn {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warn);
}

.badge-error {
  background: rgba(251, 113, 133, 0.15);
  color: var(--danger);
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .workspace {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .workspace-main {
    padding: 16px;
  }
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

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

.breadcrumb-sep {
  opacity: 0.5;
}

.breadcrumb-current {
  color: var(--text);
  font-weight: 600;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  padding: 16px;
  overflow: hidden;
  margin-bottom: 16px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  color: inherit;
  display: block;
  text-decoration: none;
}

a.stat-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.stat-card .label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
}


.stat-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--line);
  margin: 8px 0 16px;
}

.stat-bar-seg {
  height: 100%;
  min-width: 0;
}

.stat-bar-pending {
  background: var(--pending);
}

.stat-bar-success {
  background: var(--ok);
}

.stat-bar-failed {
  background: var(--danger);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.meta-item {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 0;
}

.meta-item .label {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-bottom: 4px;
}

.meta-item .value {
  display: block;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
}

.content-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
  line-height: 1.45;
}

.thumb {
  display: block;
  max-width: min(360px, 100%);
  max-height: 200px;
  width: auto;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin: 0 0 16px;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

table.data th,
table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

table.data th {
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

table.data tbody tr:last-child td {
  border-bottom: none;
}

table.data tr:hover td {
  background: var(--surface-hover);
}

.sort-link {
  color: inherit;
  text-decoration: none;
}

.sort-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.col-id { width: 9%; }
.col-title { width: 24%; }
.col-summary { width: 18%; }
.col-category { width: 10%; }
.col-status { width: 10%; }
.col-date { width: 12%; }
.col-actions {
  width: 14%;
  overflow: visible;
  white-space: normal;
}
.col-name { width: 18%; }
.col-url { width: 32%; }
.col-active { width: 8%; }
.col-site { width: 14%; }
.col-retries { width: 8%; }
.col-response { width: 14%; }
.col-check { width: 4%; }
.col-kind { width: 16%; }
.col-message { width: 42%; }

table.data td.col-message {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.log-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.log-detail {
  font-size: 0.8rem;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

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

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-published,
.badge-success {
  background: rgba(52, 211, 153, 0.15);
  color: var(--ok);
}

.badge-draft,
.badge-pending {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warn);
}

.badge-archived,
.badge-failed {
  background: rgba(251, 113, 133, 0.15);
  color: var(--danger);
}

.badge-cancelled {
  background: rgba(148, 163, 184, 0.15);
  color: var(--cancelled);
}

.empty {
  color: var(--muted);
  padding: 18px 4px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 28px 8px;
  color: var(--muted);
}

.alert-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, var(--surface));
  color: var(--text);
  margin-bottom: 14px;
  font-size: 0.9rem;
}

.site-picker {
  margin: 0;
  padding: 12px 14px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.site-picker legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-picker-hint {
  margin: 0 0 10px;
  padding: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.site-picker-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.site-picker-search {
  flex: 1 1 200px;
  min-width: 160px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
}

.site-picker-search:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.site-picker-count {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.site-picker-list {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.site-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.site-picker-item:last-of-type {
  border-bottom: none;
}

.site-picker-item:hover {
  background: var(--surface-hover);
}

.site-picker-item input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.site-picker-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-picker-empty {
  margin: 0;
  padding: 16px 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.site-checkboxes label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.88rem;
}

.field-error {
  color: var(--danger);
  font-size: 0.78rem;
  margin-top: 2px;
}

.back-link {
  display: inline-block;
  margin-bottom: 12px;
}

.footer {
  margin-top: 18px;
  padding: 0 24px 24px;
  margin-left: var(--sidebar-width);
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 900px) {
  .footer {
    margin-left: 0;
    padding: 0 16px 24px;
  }
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.form-stack label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

.form-hint {
  margin: -2px 0 4px;
  font-size: 0.8rem;
  line-height: 1.35;
}

.advanced-settings {
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.advanced-settings > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 14px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}

.advanced-settings > summary::-webkit-details-marker {
  display: none;
}

.advanced-settings > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.advanced-settings[open] > summary::before {
  transform: rotate(90deg);
}

.advanced-settings-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
}

.form-stack label.checkbox-row,
.form-stack label:has(> input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  color: var(--text);
  font-size: 0.9rem;
}

.form-stack label.checkbox-row input[type="checkbox"],
.form-stack label:has(> input[type="checkbox"]) > input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.form-stack input,
.form-stack textarea,
.form-stack select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  color: var(--text);
  background: var(--surface);
}

.form-stack input:focus,
.form-stack textarea:focus,
.form-stack select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn,
.form-stack button,
.actions-row button,
.btn-small,
.btn-secondary,
.btn-primary,
.btn-danger {
  appearance: none;
  border: 1px solid var(--accent);
  background: var(--accent-btn);
  color: var(--accent-btn-text);
  border-radius: var(--radius);
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
}

.btn:hover,
.btn-primary:hover,
.form-stack button:hover,
.actions-row button:hover {
  text-decoration: none;
  filter: brightness(1.05);
}

.btn:disabled,
.btn-primary:disabled,
button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-small {
  padding: 4px 8px;
  font-size: 0.78rem;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.btn-danger {
  background: rgba(251, 113, 133, 0.15);
  border-color: var(--danger);
  color: var(--danger);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-grid > .form-hint,
.form-grid > .advanced-settings,
.form-grid > .site-picker,
.form-grid > .form-actions,
.form-grid > button[type="submit"] {
  grid-column: 1 / -1;
}

.form-grid > button[type="submit"],
.form-grid > .form-actions .btn {
  justify-self: start;
  align-self: start;
  width: auto;
  height: auto;
  min-height: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 140px;
}

.filter-bar label.filter-grow {
  flex: 1 1 220px;
  min-width: 180px;
}

.filter-bar input,
.filter-bar select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  min-height: 36px;
  width: 100%;
}

.filter-bar input:focus,
.filter-bar select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.filter-actions .btn {
  min-height: 36px;
}

@media (max-width: 720px) {
  .filter-bar label,
  .filter-bar label.filter-grow {
    flex: 1 1 100%;
    min-width: 0;
  }

  .filter-actions {
    margin-left: 0;
    width: 100%;
  }

  .filter-actions .btn {
    flex: 1;
  }
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.source-edit-actions {
  margin-top: 12px;
}

.source-edit-actions > form {
  display: inline-flex;
  margin: 0;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.row-menu {
  position: relative;
  display: inline-block;
}

.row-menu > summary {
  list-style: none;
  cursor: pointer;
}

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

.row-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Table cells clip absolute menus; lift overflow while a row menu is open. */
table.data td.col-actions {
  overflow: visible;
  white-space: normal;
}

table.data tr:has(.row-menu[open]) {
  position: relative;
  z-index: 5;
}

.table-wrap:has(.row-menu[open]) {
  overflow: visible;
}

.row-menu-panel form,
.row-menu-panel a,
.row-menu-panel button {
  width: 100%;
  justify-content: flex-start;
}

.pager {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.pager-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.toast-root {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
}

.toast {
  opacity: 0;
  transform: translateY(8px);
  transition: 0.2s ease;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-ok {
  background: var(--toast-ok-bg);
  border-color: var(--ok);
}

.toast-err {
  background: var(--toast-err-bg);
  border-color: var(--danger);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 25, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 16px;
}

.hidden {
  display: none !important;
}

.modal.hidden {
  display: none !important;
}


.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  width: min(420px, 100%);
}

.modal-wide {
  width: min(720px, 100%);
}

.modal-card h3 {
  margin: 0 0 10px;
}

.json-pre {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.response-view {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  max-height: 420px;
  overflow: auto;
}

.response-dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.response-row {
  display: grid;
  gap: 4px;
}

.response-row dt {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.response-row dd {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 25, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
}

.loading-overlay.hidden {
  display: none !important;
}

.loading-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 22px;
  box-shadow: var(--shadow);
}

.card-list {
  display: none;
}

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

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
}

.queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.queue-item {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.queue-item .label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.queue-item .value {
  font-weight: 700;
  font-size: 1.1rem;
}

@media (max-width: 720px) {
  .layout {
    padding: 14px 10px 28px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .theme-label {
    display: none;
  }

  .table-desktop {
    display: none;
  }

  .card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .list-card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
  }

  .list-card .title {
    font-weight: 600;
    margin-bottom: 6px;
  }

  .list-card .meta {
    color: var(--muted);
    font-size: 0.82rem;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
}
