/* ═══════════════════════════════════════════════════════════════════════════
   NetSoccer2 Admin Panel — Design System
   Mobile-first responsive layout with collapsible sidebar
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Design Tokens ──────────────────────────────────────────────────── */

:root {
  /* Backgrounds */
  --bg:           #0b100f;
  --bg-elevated:  #121a18;
  --bg-panel:     #17211f;
  --bg-soft:      #1d2926;

  /* Borders */
  --line:         rgba(183, 210, 198, 0.14);
  --line-strong:  rgba(183, 210, 198, 0.24);

  /* Text */
  --text:         #eef7f1;
  --text-soft:    #b6c9bf;
  --text-muted:   #789087;

  /* Accents */
  --accent:       #60d394;
  --accent-rgb:   96, 211, 148;
  --accent-2:     #43c7b7;
  --accent-2-rgb: 67, 199, 183;

  /* Semantic */
  --warning:        #f5b85f;
  --warning-rgb:    245, 184, 95;
  --danger:         #ef6f6c;
  --danger-rgb:     239, 111, 108;
  --danger-strong:  #ff5d57;

  /* Elevation */
  --shadow:     0 24px 90px rgba(0, 0, 0, 0.42);
  --shadow-sm:  0 8px 24px rgba(0, 0, 0, 0.22);

  /* Radii */
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;

  /* Typography */
  --font-display: "Inter", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-body:    "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;

  /* Layout */
  --sidebar-width: 280px;
  --topbar-height: auto;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration: 180ms;
}


/* ── 2. Reset & Base ───────────────────────────────────────────────────── */

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

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 14% 14%, rgba(var(--accent-2-rgb), 0.18), transparent 28rem),
    radial-gradient(circle at 88% 16%, rgba(var(--accent-rgb), 0.14), transparent 24rem),
    linear-gradient(135deg, #08100f 0%, #121614 45%, #0b100f 100%);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}


/* ── 3. Login View ─────────────────────────────────────────────────────── */

.login-view {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: 20px;
}

.login-orbit {
  position: absolute;
  width: min(78vw, 920px);
  aspect-ratio: 1;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 50%;
  background:
    linear-gradient(transparent 49%, rgba(var(--accent-rgb), 0.12) 50%, transparent 51%),
    linear-gradient(90deg, transparent 49%, rgba(var(--accent-2-rgb), 0.08) 50%, transparent 51%);
  mask-image: radial-gradient(circle, transparent 0 43%, black 44% 100%);
  opacity: 0.6;
  animation: rotate-orbit 30s linear infinite;
}

.login-card {
  position: relative;
  width: min(100%, 460px);
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(18, 26, 24, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.login-card h1,
.topbar h1,
.panel-title h2,
.editor-head h2,
.modal-panel h2 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.04em;
  font-weight: 800;
}

.login-card h1 {
  margin-top: 8px;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
}

.login-copy {
  margin: 14px 0 24px;
  color: var(--text-soft);
  line-height: 1.55;
  font-size: 0.9rem;
}

.eyebrow,
.muted-label {
  margin: 0;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}


/* ── 4. App Shell ──────────────────────────────────────────────────────── */

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 1fr;
}


/* ── 5. Sidebar ────────────────────────────────────────────────────────── */

.sidebar {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: grid;
  height: 100vh;
  height: 100dvh;
  width: min(var(--sidebar-width), 85vw);
  grid-template-rows: auto 1fr auto auto;
  gap: 20px;
  border-right: 1px solid var(--line);
  background: rgba(10, 15, 14, 0.96);
  padding: 22px 16px;
  backdrop-filter: blur(20px);
  transform: translateX(-100%);
  transition: transform 320ms var(--ease-out);
  overflow-y: auto;
  overscroll-behavior: contain;
}

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

/* Sidebar backdrop (mobile) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 14;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 320ms var(--ease-out);
  pointer-events: none;
}

.sidebar-open .sidebar-backdrop {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  min-width: 40px;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07100d;
  font-weight: 900;
  font-size: 0.95rem;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 0.95rem;
}

.brand span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Session & Language cards */
.session-card,
.language-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(23, 33, 31, 0.76);
  padding: 14px;
}

.language-card .field {
  margin-bottom: 0;
}

.session-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-card span:last-of-type {
  color: var(--text-muted);
  font-size: 0.84rem;
}


/* ── 6. Navigation ─────────────────────────────────────────────────────── */

.nav-list {
  display: grid;
  align-content: start;
  gap: 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text-soft);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  transition:
    background var(--duration) ease,
    border-color var(--duration) ease,
    color var(--duration) ease;
}

.nav-item:hover,
.nav-item:focus-visible {
  border-color: var(--line);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--text);
}

.nav-item.is-active {
  border-color: var(--line);
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--text);
  box-shadow: inset 4px 0 0 var(--accent);
  font-weight: 700;
}

/* Nav icons via SVG mask-image */
.nav-item::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  min-width: 20px;
  background: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  opacity: 0.8;
}

/* Dashboard / Overview — grid icon */
.nav-item[data-route="overview"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E");
}

/* Online — wifi icon */
.nav-item[data-route="online"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h.01'/%3E%3Cpath d='M2 8.82a15 15 0 0 1 20 0'/%3E%3Cpath d='M5 12.86a10 10 0 0 1 14 0'/%3E%3Cpath d='M8.5 16.43a5 5 0 0 1 7 0'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h.01'/%3E%3Cpath d='M2 8.82a15 15 0 0 1 20 0'/%3E%3Cpath d='M5 12.86a10 10 0 0 1 14 0'/%3E%3Cpath d='M8.5 16.43a5 5 0 0 1 7 0'/%3E%3C/svg%3E");
}

/* Players — person icon */
.nav-item[data-route="players"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
}

/* Teams — people icon */
.nav-item[data-route="teams"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
}

/* National — globe icon */
.nav-item[data-route="national"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='2' y1='12' x2='22' y2='12'/%3E%3Cpath d='M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='2' y1='12' x2='22' y2='12'/%3E%3Cpath d='M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z'/%3E%3C/svg%3E");
}

/* Bans — shield icon */
.nav-item[data-route="bans"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3Cline x1='8' y1='11' x2='16' y2='11'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3Cline x1='8' y1='11' x2='16' y2='11'/%3E%3C/svg%3E");
}

/* Broadcast — megaphone icon */
.nav-item[data-route="broadcast"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 11 18-5v12L3 13v-2z'/%3E%3Cpath d='M11.6 16.8a3 3 0 1 1-5.8-1.6'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 11 18-5v12L3 13v-2z'/%3E%3Cpath d='M11.6 16.8a3 3 0 1 1-5.8-1.6'/%3E%3C/svg%3E");
}

/* Database — cylinder icon */
.nav-item[data-route="database"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='12' cy='5' rx='9' ry='3'/%3E%3Cpath d='M21 12c0 1.66-4 3-9 3s-9-1.34-9-3'/%3E%3Cpath d='M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='12' cy='5' rx='9' ry='3'/%3E%3Cpath d='M21 12c0 1.66-4 3-9 3s-9-1.34-9-3'/%3E%3Cpath d='M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5'/%3E%3C/svg%3E");
}


/* ── 7. Workspace & Topbar ─────────────────────────────────────────────── */

.workspace {
  min-width: 0;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin-top: 4px;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  justify-content: space-between;
}

/* Hamburger toggle button */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: background var(--duration) ease, border-color var(--duration) ease;
  flex-shrink: 0;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  border-color: rgba(var(--accent-rgb), 0.36);
  background: rgba(var(--accent-rgb), 0.08);
}

.sidebar-toggle svg {
  width: 22px;
  height: 22px;
}

/* Status Pill */
.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
  padding: 5px 12px;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
  transition: border-color var(--duration) ease, background var(--duration) ease, color var(--duration) ease;
}

/* Dynamic status pill states */
.status-pill.status-loading {
  border-color: rgba(var(--warning-rgb), 0.36);
  background: rgba(var(--warning-rgb), 0.1);
  color: #ffe0ac;
}

.status-pill.status-ok {
  border-color: rgba(var(--accent-rgb), 0.36);
  background: rgba(var(--accent-rgb), 0.1);
  color: #b8f5ce;
}

.status-pill.status-error {
  border-color: rgba(var(--danger-rgb), 0.36);
  background: rgba(var(--danger-rgb), 0.1);
  color: #ffd1d0;
}

/* Badge variants */
.badge.good {
  border-color: rgba(var(--accent-rgb), 0.32);
  background: rgba(var(--accent-rgb), 0.12);
  color: #b8f5ce;
}

.badge.warn {
  border-color: rgba(var(--warning-rgb), 0.36);
  background: rgba(var(--warning-rgb), 0.12);
  color: #ffe0ac;
}

.badge.danger {
  border-color: rgba(var(--danger-rgb), 0.38);
  background: rgba(var(--danger-rgb), 0.12);
  color: #ffd1d0;
}


/* ── 8. Dashboard Grid ─────────────────────────────────────────────────── */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.metric-card,
.panel,
.editor-panel,
.action-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    rgba(18, 26, 24, 0.86);
  box-shadow: var(--shadow-sm);
}

.metric-card {
  padding: 18px;
}

.metric-card span {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
  font-weight: 800;
}


/* ── 9. Panels, Tables & Cards ─────────────────────────────────────────── */

.panel {
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.panel-title {
  display: grid;
  gap: 4px;
}

.panel-title h2 {
  font-size: 1.05rem;
}

.panel-title p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.panel-body {
  padding: 16px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* Scroll shadow indicator for tables */
.table-wrap::after {
  content: "";
  position: sticky;
  right: 0;
  top: 0;
  bottom: 0;
  width: 32px;
  pointer-events: none;
  background: linear-gradient(to left, rgba(11, 16, 15, 0.6), transparent);
  display: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  border-bottom: 1px solid rgba(183, 210, 198, 0.1);
  padding: 11px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

td {
  color: var(--text-soft);
  font-size: 0.88rem;
}

tbody tr:hover {
  background: rgba(var(--accent-rgb), 0.05);
}

tr.row-selected td {
  background: rgba(100, 160, 255, 0.08);
}

.th-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.th-sortable:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
}

.th-sort-active {
  color: var(--accent);
}

.col-cb {
  width: 40px;
  text-align: center;
}

.col-cb input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Views */
.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: rise-in 220ms ease-out;
}


/* ── 10. Forms & Fields ────────────────────────────────────────────────── */

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field span,
.field-row label > span,
.check-field span {
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.field-row input,
.field-row select,
.field-row textarea,
.search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  background: rgba(7, 12, 11, 0.52);
  color: var(--text);
  padding: 11px 13px;
  font-size: 0.92rem;
  transition: border-color var(--duration) ease, box-shadow var(--duration) ease, background var(--duration) ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.field-row input:focus,
.field-row select:focus,
.field-row textarea:focus,
.search-input:focus {
  border-color: rgba(var(--accent-rgb), 0.68);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.12);
  background: rgba(7, 12, 11, 0.72);
}

.form-error {
  margin: 12px 0 0;
  color: #ffd1d0;
  font-weight: 700;
  font-size: 0.9rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.field-row {
  display: grid;
  gap: 7px;
}

.field-row.wide {
  grid-column: 1 / -1;
}

.readout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.readout {
  border: 1px solid rgba(183, 210, 198, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
  padding: 10px;
}

.readout span {
  display: block;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.readout strong {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(183, 210, 198, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
  padding: 11px 12px;
  min-height: 44px;
}

.check-field input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar .search-input {
  width: min(100%, 320px);
}


/* ── 11. Buttons ───────────────────────────────────────────────────────── */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 9px 16px;
  font-weight: 700;
  font-size: 0.9rem;
  transition:
    transform var(--duration) ease,
    border-color var(--duration) ease,
    background var(--duration) ease,
    color var(--duration) ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(var(--accent-rgb), 0.36);
}

.button-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06110e;
  font-weight: 800;
}

.button-ghost {
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
}

.button-warning {
  border-color: rgba(var(--warning-rgb), 0.24);
  background: rgba(var(--warning-rgb), 0.13);
  color: #ffe0ac;
}

.button-danger {
  border-color: rgba(var(--danger-rgb), 0.28);
  background: rgba(var(--danger-rgb), 0.14);
  color: #ffd1d0;
}

.button-small {
  min-height: 38px;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 0.82rem;
}

.button-wide {
  width: 100%;
}


/* ── 12. Editor & Split Layout ─────────────────────────────────────────── */

.split-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.editor-panel {
  overflow: hidden;
}

.editor-head {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.editor-head p {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.editor-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.action-card {
  display: grid;
  gap: 10px;
  border-radius: var(--radius-md);
  padding: 14px;
}

.action-card h3 {
  margin: 0;
  font-size: 0.92rem;
}

.action-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}


/* ── 13. Database, Broadcast & Module-Specific ─────────────────────────── */

.broadcast-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.broadcast-box textarea {
  min-height: 120px;
  resize: vertical;
}

.char-counter {
  color: var(--text-muted);
  font-size: 0.84rem;
  text-align: right;
}

.database-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.db-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.selection-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(255, 200, 80, 0.08);
  border: 1px solid rgba(255, 200, 80, 0.22);
  border-radius: var(--radius-sm);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(12px);
}

.selection-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-left: 10px;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
}

.selection-group.danger {
  border-left-color: rgba(var(--danger-rgb), 0.4);
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(var(--danger-rgb), 0.06);
}

.selection-count {
  font-weight: 600;
  color: var(--accent);
  margin-right: 4px;
}

/* Collapsible details/summary */
.db-details {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(18, 26, 24, 0.5);
  overflow: hidden;
}

.db-details summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  cursor: pointer;
  color: var(--text-soft);
  font-weight: 700;
  font-size: 0.9rem;
  user-select: none;
  transition: background var(--duration) ease;
  list-style: none;
}

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

.db-details summary::before {
  content: "▶";
  font-size: 0.7rem;
  transition: transform var(--duration) ease;
}

.db-details[open] summary::before {
  transform: rotate(90deg);
}

.db-details summary:hover {
  background: rgba(255, 255, 255, 0.03);
}

.db-details-body {
  padding: 0 16px 16px;
}

.current-season-banner {
  padding: 8px 12px;
  margin-bottom: 12px;
  background: rgba(80, 200, 120, 0.09);
  border: 1px solid rgba(80, 200, 120, 0.22);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.current-season-banner.empty {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.history-item {
  border: 1px solid rgba(183, 210, 198, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
  padding: 12px;
}

.history-item time {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.code-output {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(7, 12, 11, 0.7);
  color: var(--text-soft);
  padding: 12px;
  white-space: pre-wrap;
  font-size: 0.85rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.empty-state {
  display: grid;
  min-height: 160px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  padding: 24px;
  text-align: center;
}


/* ── 14. Modals, Toasts, Utilities & Animations ────────────────────────── */

/* Modal */
.modal-host {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(8px);
}

.modal-panel {
  position: relative;
  width: min(100%, 480px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: #121a18;
  box-shadow: var(--shadow);
  padding: 22px;
}

.modal-panel p {
  color: var(--text-soft);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* Toasts */
.toast-region {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  display: grid;
  gap: 10px;
  width: min(340px, calc(100vw - 32px));
}

.toast {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  background: rgba(18, 26, 24, 0.96);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  padding: 13px 14px;
  font-size: 0.9rem;
  animation: rise-in 220ms ease-out;
}

.toast.error {
  border-left-color: var(--danger-strong);
}

.toast.warning {
  border-left-color: var(--warning);
}

/* Utility classes */
.muted {
  color: var(--text-muted);
}

.danger-text {
  color: #ffd1d0;
}

/* Keyframes */
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rotate-orbit {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}


/* ── 15. Media Queries — Desktop-Up ────────────────────────────────────── */

/* ≥ 480px — Small phone landscape / large phone */
@media (min-width: 480px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .readout-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-card {
    padding: 36px;
  }
}

/* ≥ 768px — Tablet */
@media (min-width: 768px) {
  .workspace {
    padding: 26px;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .topbar-actions {
    width: auto;
    justify-content: flex-end;
  }

  .panel-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 18px;
  }

  .editor-head {
    flex-direction: row;
    justify-content: space-between;
    padding: 18px;
  }

  .panel-body {
    padding: 18px;
  }

  .editor-body {
    padding: 18px;
  }

  .metric-card {
    padding: 22px;
  }

  .metric-card strong {
    font-size: 2.4rem;
    margin-top: 12px;
  }

  .broadcast-layout {
    grid-template-columns: minmax(0, 0.95fr) minmax(280px, 0.55fr);
  }

  .database-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ≥ 1024px — Desktop: persistent sidebar */
@media (min-width: 1024px) {
  .app-shell {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: auto;
    width: auto;
    transform: translateX(0);
    transition: none;
    overflow-y: auto;
  }

  .sidebar-backdrop {
    display: none !important;
  }

  .sidebar-toggle {
    display: none;
  }

  .workspace {
    padding: 30px;
  }

  .topbar h1 {
    font-size: clamp(2rem, 3vw, 3.4rem);
  }

  .split-layout {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.78fr);
  }
}

/* ≥ 1280px — Large desktop */
@media (min-width: 1280px) {
  .dashboard-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
