:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  --accent: #FF6B00;
  --accent-light: #FF8A33;
  --accent-text: #C84F00;
  --ink: #1B1B1B;
  --muted: #6B7280;
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --line: #E5E7EB;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --sidebar-width: 276px;
  --card-radius: 16px;
  --control-radius: 12px;
  --shadow: 0 4px 16px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}

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

a { color: var(--accent-text); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

.app-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  color: #FFFFFF;
  background: var(--ink);
  border-right: 1px solid rgba(255, 255, 255, .06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 4px 8px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  color: #FFFFFF;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: 14px;
  font-weight: 800;
}

.brand-copy { min-width: 0; display: grid; }
.brand-copy strong { font-size: 16px; white-space: nowrap; }
.brand-copy small { color: rgba(255, 255, 255, .58); font-size: 11px; white-space: nowrap; }

.side-nav { display: grid; gap: 6px; margin-top: 20px; }

.nav-item {
  min-height: 46px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: rgba(255, 255, 255, .70);
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 650;
  text-decoration: none;
  transition: color .18s, background .18s, border-color .18s;
}

.nav-item:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, .06);
}

.nav-item.active {
  color: #FFFFFF;
  background: rgba(255, 107, 0, .16);
  border-color: rgba(255, 107, 0, .42);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-icon { width: 24px; text-align: center; color: inherit; font-size: 18px; }

.nav-count {
  min-width: 23px;
  padding: 2px 7px;
  color: #FFFFFF;
  background: var(--danger);
  border-radius: 999px;
  font-size: 11px;
  text-align: center;
}

.nav-count.neutral { color: var(--ink); background: rgba(255, 255, 255, .76); }
.nav-count.schedule { background: var(--warning); }

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .10); }
.sidebar-meta { display: grid; padding: 0 12px 12px; color: rgba(255, 255, 255, .52); font-size: 11px; }
.sidebar-meta strong { color: #FFFFFF; font-size: 13px; }
.sidebar-footer form { margin: 0; }

.sidebar-logout {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: rgba(255, 255, 255, .72);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 650;
  cursor: pointer;
}

.sidebar-logout:hover { color: #FFFFFF; background: rgba(255, 255, 255, .06); }

.app-main { min-width: 0; }
.mobile-topbar { display: none; }

.page-content {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 32px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-heading h1 { margin: 2px 0 4px; font-size: 30px; line-height: 1.15; font-weight: 800; }
.page-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--accent-text); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

h1, h2, h3 { color: var(--ink); }
h2 { margin: 0; font-size: 20px; line-height: 1.25; }
h3 { margin: 0; font-size: 17px; }

.card {
  margin-bottom: 20px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid rgba(27, 27, 27, .06);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading p { margin: 5px 0 0; }
.muted { color: var(--muted); }

.button, button:not(.menu-toggle):not(.sidebar-overlay):not(.sidebar-logout) {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  color: #FFFFFF;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--control-radius);
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background .18s, border-color .18s, transform .18s;
}

.button:hover, button:not(.menu-toggle):not(.sidebar-overlay):not(.sidebar-logout):hover:not(:disabled) {
  color: #FFFFFF;
  background: var(--accent-light);
  border-color: var(--accent-light);
}

.button:active, button:active:not(:disabled) { transform: translateY(1px); }

.button.secondary, button.secondary {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.button.secondary:hover, button.secondary:hover:not(:disabled) {
  color: var(--accent-text);
  background: rgba(255, 107, 0, .07);
  border-color: var(--accent);
}

button.danger {
  color: var(--danger);
  background: var(--surface);
  border-color: rgba(239, 68, 68, .42);
}

button.danger:hover:not(:disabled) { color: #FFFFFF; background: var(--danger); border-color: var(--danger); }
button.small { min-height: 36px !important; padding: 7px 10px !important; font-size: 12px; }
button.text-button { min-height: 34px !important; padding: 4px 8px !important; background: transparent; border-color: transparent; }
button:disabled { opacity: .46; cursor: not-allowed; }

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  transition: border-color .18s, box-shadow .18s;
}

input[type="file"] { padding: 8px; }
input::placeholder { color: rgba(107, 114, 128, .70); }
input:hover, select:hover, textarea:hover { border-color: var(--accent-light); }

input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(255, 107, 0, .25);
  outline-offset: 2px;
}

input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
form { display: grid; gap: 10px; }
label { display: grid; gap: 6px; color: var(--ink); font-weight: 650; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.sync-form { display: flex; align-items: center; gap: 14px; margin-top: 14px; }

.notice {
  margin-bottom: 18px;
  padding: 13px 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  font-weight: 650;
}
.notice.success { background: rgba(34, 197, 94, .10); border-color: rgba(34, 197, 94, .42); }
.notice.error { background: rgba(239, 68, 68, .10); border-color: rgba(239, 68, 68, .42); }

.status-badge {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 9px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
}

.status-badge.online { background: rgba(34, 197, 94, .10); border-color: rgba(34, 197, 94, .42); }
.status-badge.offline, .status-badge.error { background: rgba(239, 68, 68, .10); border-color: rgba(239, 68, 68, .42); }
.status-badge.downloading { background: rgba(59, 130, 246, .10); border-color: rgba(59, 130, 246, .42); }
.status-badge.scheduled { background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .44); }
.connection-summary { display: flex; gap: 8px; flex-wrap: wrap; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  padding: 18px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid rgba(27, 27, 27, .06);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform .18s, border-color .18s;
}

.kpi-card:hover { color: var(--ink); border-color: rgba(255, 107, 0, .32); transform: translateY(-2px); }
.kpi-icon { width: 40px; height: 40px; display: grid; place-items: center; background: var(--bg); border-radius: 12px; font-size: 18px; font-weight: 800; }
.kpi-icon.success { color: var(--success); background: rgba(34, 197, 94, .10); }
.kpi-icon.danger { color: var(--danger); background: rgba(239, 68, 68, .10); }
.kpi-icon.warning { color: var(--warning); background: rgba(245, 158, 11, .12); }
.kpi-icon.info { color: var(--info); background: rgba(59, 130, 246, .10); }
.kpi-copy { min-width: 0; display: grid; }
.kpi-copy small { color: var(--muted); font-size: 11px; font-weight: 650; white-space: nowrap; }
.kpi-copy strong { font-size: 30px; line-height: 1.15; font-weight: 800; }
.kpi-link { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 20px; }
.dashboard-card { min-width: 0; }
.attention-list { display: grid; gap: 8px; }
.attention-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 12px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; }
.attention-row:hover { color: var(--ink); border-color: rgba(255, 107, 0, .32); }
.attention-row > span:nth-child(2) { display: grid; min-width: 0; }
.attention-row small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.state-dot { width: 10px; height: 10px; display: inline-block; flex: 0 0 10px; background: var(--muted); border-radius: 50%; box-shadow: 0 0 0 4px rgba(107, 114, 128, .10); }
.state-dot.online { background: var(--success); box-shadow: 0 0 0 4px rgba(34, 197, 94, .12); }
.state-dot.offline, .state-dot.error { background: var(--danger); box-shadow: 0 0 0 4px rgba(239, 68, 68, .12); }

.schedule-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.schedule-summary > div { display: grid; align-content: start; padding: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.schedule-summary small { margin-top: 5px; color: var(--muted); }
.summary-number { font-size: 32px; line-height: 1.1; font-weight: 800; }
.summary-number.accent { color: var(--accent-text); }

.compact-tv-list { display: grid; gap: 6px; }
.compact-tv-row { display: grid; grid-template-columns: 12px minmax(160px, .8fr) minmax(200px, 1.3fr) auto; align-items: center; gap: 12px; padding: 10px 12px; color: var(--ink); border-bottom: 1px solid var(--line); text-decoration: none; }
.compact-tv-row:last-child { border-bottom: 0; }
.compact-tv-row > span:nth-child(3) { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty-state { min-height: 150px; display: grid; place-items: center; align-content: center; gap: 6px; padding: 24px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 12px; }
.empty-state strong { color: var(--ink); font-size: 16px; }
.empty-state p { margin: 0; }
.empty-state > span { width: 42px; height: 42px; display: grid; place-items: center; color: var(--success); background: rgba(34, 197, 94, .10); border-radius: 50%; font-size: 22px; }

.highlight-card { border-color: rgba(255, 107, 0, .22); }
.pending-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.pending-card { min-width: 0; display: flex; flex-direction: column; gap: 16px; padding: 18px; overflow: hidden; background: rgba(255, 107, 0, .035); border: 1px solid rgba(255, 107, 0, .25); border-radius: 12px; }
.pending-card > div { min-width: 0; display: grid; align-content: start; }
.pending-card form { min-width: 0; width: 100%; display: grid; gap: 10px; }
.pending-card input, .pending-card select, .pending-card button { min-width: 0; width: 100%; max-width: 100%; }
.pending-card select { overflow: hidden; text-overflow: ellipsis; }
.pending-card small { color: var(--muted); }
.card-label { color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.pairing-code { color: var(--accent-text); font-size: 30px; font-weight: 800; letter-spacing: 5px; }

.create-panel { padding: 0; overflow: hidden; }
.create-panel summary { padding: 18px 22px; font-size: 16px; font-weight: 750; cursor: pointer; }
.create-panel[open] summary { border-bottom: 1px solid var(--line); }
.create-panel > form { padding: 20px 22px 22px; }

.tv-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.tv-card { min-width: 0; display: grid; gap: 16px; padding: 20px; background: var(--surface); border: 1px solid rgba(27, 27, 27, .07); border-radius: var(--card-radius); box-shadow: var(--shadow); scroll-margin-top: 16px; }
.tv-card.has-issue { border-color: rgba(239, 68, 68, .28); }
.tv-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tv-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tv-title > div { min-width: 0; display: grid; gap: 5px; }
.tv-title h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-icon { width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center; color: var(--accent-text); background: rgba(255, 107, 0, .10); border-radius: 14px; font-size: 22px; }
.icon-link { width: 38px; height: 38px; display: grid; place-items: center; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; font-size: 18px; text-decoration: none; }
.icon-link:hover { color: var(--accent-text); border-color: var(--accent); }
.tv-now-playing { display: grid; gap: 4px; padding: 14px; background: var(--bg); border-radius: 12px; }
.tv-now-playing > strong { overflow-wrap: anywhere; font-size: 16px; }

.download-block { padding: 12px; background: rgba(59, 130, 246, .07); border: 1px solid rgba(59, 130, 246, .24); border-radius: 12px; }
.download-block > div:first-child { display: flex; justify-content: space-between; gap: 12px; }
.progress { height: 8px; margin-top: 9px; overflow: hidden; background: var(--line); border-radius: 999px; }
.progress span { display: block; height: 100%; background: var(--info); border-radius: inherit; transition: width .3s; }
.inline-alert { padding: 10px 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; }
.inline-alert.info { background: rgba(59, 130, 246, .08); border-color: rgba(59, 130, 246, .28); }
.inline-alert.error { background: rgba(239, 68, 68, .08); border-color: rgba(239, 68, 68, .28); }

.tv-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 0; }
.tv-meta div { min-width: 0; display: grid; align-content: start; }
.tv-meta dt { color: var(--muted); font-size: 11px; font-weight: 650; }
.tv-meta dd { margin: 1px 0 0; overflow-wrap: anywhere; font-weight: 650; }
.assign-form { padding-top: 14px; border-top: 1px solid var(--line); }
.tv-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.tv-card-footer form { display: block; }

.media-library { display: grid; gap: 8px; }
.media-card { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.media-card:hover { border-color: rgba(255, 107, 0, .32); }
.media-thumb { width: 46px; height: 46px; display: grid; place-items: center; color: #FFFFFF; background: var(--ink); border-radius: 10px; }
.media-info { min-width: 0; display: grid; }
.media-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-info span, .media-usage { color: var(--muted); font-size: 12px; }
.media-usage { display: flex; gap: 14px; white-space: nowrap; }
.media-usage strong { color: var(--ink); }

.schedule-screen-list { display: grid; gap: 18px; }
.schedule-screen-card { scroll-margin-top: 16px; }
.schedule-screen-title { display: flex; align-items: flex-start; gap: 12px; }
.schedule-screen-title .state-dot { margin-top: 7px; }
.schedule-screen-title p { margin: 4px 0 0; }
.schedule-form { display: grid; grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(180px, 1fr)) auto; gap: 10px; align-items: end; }
.schedule-list { display: grid; gap: 8px; margin-top: 16px; }
.schedule-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.schedule-row > div { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.schedule-row span:not(.status-badge) { color: var(--muted); }
.schedule-row form { display: block; }
.empty-inline { margin: 16px 0 0; padding: 12px; color: var(--muted); background: var(--bg); border-radius: 10px; }

.centered { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--ink); border-top: 4px solid var(--accent); }
.login-card { width: min(420px, 100%); margin: 0; border-top: 4px solid var(--accent); }
.login-card h1 { margin: 0 0 2px; font-size: 28px; }
.login-card > p { margin: 0 0 20px; }

.sidebar-overlay { display: none; }

.user-list { display: grid; gap: 16px; }
.user-card { display: grid; gap: 18px; }
.user-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.user-card-head h2 { margin: 0; font-size: 21px; }
.user-card-head p { margin: 4px 0 0; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.check-row input { width: 18px; height: 18px; margin: 0; }
.status-pill { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.status-pill.online { color: #17643b; background: #dff5e8; }
.status-pill.offline { color: #8a3541; background: #fae3e7; }
.user-password-form { margin-top: 2px; }
.user-password-form input { min-width: 260px; }

@media (max-width: 1260px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .tv-card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1000px) and (min-width: 701px) {
  :root { --sidebar-width: 84px; }
  .sidebar { padding-inline: 12px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand-copy, .nav-item > span:nth-child(2), .nav-count, .sidebar-meta, .sidebar-logout > span:last-child { display: none; }
  .nav-item { display: flex; justify-content: center; padding: 8px; }
  .nav-item.active { box-shadow: inset 0 -3px 0 var(--accent); }
  .sidebar-logout { justify-content: center; }
  .page-content { padding: 26px; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .form-grid { grid-template-columns: 1fr; }
  .permission-grid { grid-template-columns: 1fr; }
  .schedule-form { grid-template-columns: 1fr 1fr; }
  .schedule-form label:first-child { grid-column: 1 / -1; }
  .schedule-form button { width: 100%; }
}

@media (max-width: 700px) {
  .app-layout { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; width: min(84vw, 300px); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 12px 0 28px rgba(0, 0, 0, .24); }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 20; display: block; visibility: hidden; opacity: 0; background: rgba(0, 0, 0, .42); border: 0; transition: opacity .2s, visibility .2s; }
  .sidebar-open .sidebar-overlay { visibility: visible; opacity: 1; }
  .mobile-topbar { position: sticky; top: 0; z-index: 15; min-height: 64px; display: grid; grid-template-columns: 44px minmax(0, 1fr) 16px; align-items: center; gap: 10px; padding: 8px 14px; color: #FFFFFF; background: var(--ink); border-bottom: 3px solid var(--accent); }
  .mobile-topbar > div { display: grid; }
  .mobile-topbar small { color: rgba(255, 255, 255, .60); }
  .menu-toggle { width: 44px; height: 44px; padding: 0; color: #FFFFFF; background: transparent; border: 1px solid rgba(255, 255, 255, .14); border-radius: 12px; font-size: 21px; cursor: pointer; }
  .mobile-status { width: 10px; height: 10px; background: var(--success); border-radius: 50%; }
  .mobile-status.warning { background: var(--warning); }
  .page-content { padding: 18px 12px 30px; }
  .page-heading { align-items: stretch; flex-direction: column; gap: 14px; }
  .page-heading h1 { font-size: 26px; }
  .page-actions, .page-actions .button { width: 100%; }
  .page-actions { display: grid; grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { padding: 14px; }
  .kpi-copy small { white-space: normal; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .schedule-summary { grid-template-columns: 1fr; }
  .compact-tv-row { grid-template-columns: 12px minmax(0, 1fr) auto; }
  .compact-tv-row > span:nth-child(3) { grid-column: 2 / -1; grid-row: 2; }
  .inline-form, .schedule-form { grid-template-columns: 1fr; }
  .schedule-form label:first-child { grid-column: auto; }
  .sync-form { align-items: stretch; flex-direction: column; }
  .sync-form button { width: 100%; }
  .tv-meta { grid-template-columns: 1fr; }
  .tv-card-footer { align-items: flex-start; flex-direction: column; }
  .media-card { grid-template-columns: 46px minmax(0, 1fr); }
  .media-usage { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--line); white-space: normal; }
  .schedule-row { align-items: flex-start; flex-direction: column; }
  .schedule-row form, .schedule-row button { width: 100%; }
}

@media (max-width: 430px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-card { grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; }
  .kpi-link { grid-column: 3; }
  .pending-grid { grid-template-columns: 1fr; }
  .pairing-code { font-size: 26px; }
}
