:root {
  color-scheme: dark;
  --bg: #07080b;
  --panel: rgba(15, 18, 24, 0.86);
  --panel-strong: rgba(22, 25, 33, 0.94);
  --panel-soft: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(229, 9, 20, 0.44);
  --text: #f4f7fb;
  --muted: #a5adba;
  --muted-2: #737d8e;
  --accent: #e50914;
  --accent-2: #ff3944;
  --ok: #19b978;
  --info: #45a3ff;
  --danger: #ff5b64;
  --warning: #e7b447;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at 76% 10%, rgba(229, 9, 20, 0.2), transparent 30%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0.68)),
    url('/web/assets/redmax-bg.png') center/cover fixed no-repeat,
    var(--bg);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 22%),
    linear-gradient(90deg, rgba(229, 9, 20, 0.09), transparent 34%);
  z-index: -1;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  width: 272px;
  height: 100vh;
  padding: 22px 16px;
  background: linear-gradient(180deg, rgba(8, 9, 13, 0.98), rgba(10, 7, 9, 0.94));
  border-right: 1px solid var(--line);
  box-shadow: 18px 0 60px rgba(0, 0, 0, 0.32);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  margin-bottom: 18px;
  padding: 10px;
  border: 1px solid rgba(229, 9, 20, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(229, 9, 20, 0.15), rgba(255, 255, 255, 0.035));
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 44px;
  background: url('/web/assets/redmax-logo.png') center/contain no-repeat;
  color: transparent;
  font-weight: 800;
}

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

.brand strong {
  font-size: 18px;
}

.brand small {
  color: var(--muted);
  margin-top: 4px;
  font-size: 12px;
}

.provider-link {
  display: block;
  margin: 0 0 18px;
  padding: 10px 12px;
  color: #ffdadd;
  text-decoration: none;
  font-size: 13px;
  border: 1px solid rgba(229, 9, 20, 0.26);
  border-radius: 8px;
  background: rgba(229, 9, 20, 0.1);
}

.provider-link:hover {
  border-color: var(--accent-2);
  background: rgba(229, 9, 20, 0.18);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 11px 12px 11px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.nav-item::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  transform: translateY(-50%);
  opacity: 0.55;
}

.nav-item.active,
.nav-item:hover {
  color: var(--text);
  border-color: rgba(229, 9, 20, 0.3);
  background: linear-gradient(90deg, rgba(229, 9, 20, 0.26), rgba(255, 255, 255, 0.04));
}

.main {
  flex: 1;
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 84px;
  margin-bottom: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(18, 21, 29, 0.92), rgba(50, 11, 15, 0.5));
  box-shadow: var(--shadow);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  font-weight: 800;
}

h2 {
  font-size: 15px;
  font-weight: 750;
}

h2 small {
  color: var(--muted);
  display: inline-block;
  font-size: 12px;
  font-weight: 650;
  margin-left: 8px;
}

p {
  color: var(--muted);
  margin-top: 7px;
  font-size: 13px;
}

button {
  min-height: 36px;
  border: 1px solid rgba(229, 9, 20, 0.38);
  background: linear-gradient(180deg, #e50914, #9f0710);
  color: #fff;
  border-radius: 7px;
  padding: 9px 12px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(229, 9, 20, 0.12);
}

button:hover {
  border-color: rgba(255, 255, 255, 0.26);
  filter: brightness(1.08);
}

button:active {
  transform: translateY(1px);
}

button.danger {
  color: #fff;
  border-color: rgba(255, 91, 100, 0.5);
  background: linear-gradient(180deg, #6d2027, #391419);
}

.icon-btn {
  min-width: 104px;
}

.row-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.filter-actions {
  flex: 1;
  align-items: center;
  justify-content: flex-end;
}

.filter-actions input,
.filter-actions select {
  width: auto;
  min-width: 170px;
}

.filter-actions input {
  flex: 1 1 260px;
  max-width: 520px;
}

.filter-actions select {
  flex: 0 1 220px;
}

.filter-actions button,
.filter-actions span {
  flex: 0 0 auto;
}

.finance-subnav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(18, 21, 29, 0.88), rgba(56, 11, 18, 0.5));
}

.syncvod-subnav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(18, 21, 29, 0.88), rgba(56, 11, 18, 0.5));
}

.channel-subnav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(18, 21, 29, 0.88), rgba(56, 11, 18, 0.5));
}

.finance-tab,
.syncvod-tab,
.channel-tab {
  min-width: 168px;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.finance-tab.active,
.syncvod-tab.active,
.channel-tab.active {
  border-color: rgba(229, 9, 20, 0.65);
  background: linear-gradient(180deg, #e50914, #9f0710);
}

.billing-tab-panel {
  display: none;
}

.billing-tab-panel.active {
  display: grid;
  gap: 16px;
}

.syncvod-panel {
  display: none;
}

.syncvod-panel.active {
  display: grid;
  gap: 16px;
}

.channel-panel {
  display: none;
}

.channel-panel.active {
  display: block;
}

.single-list {
  display: block;
}

.floating-form {
  display: none;
}

.floating-form.open {
  display: grid !important;
  position: fixed !important;
  z-index: 1000 !important;
  left: 50% !important;
  top: 50% !important;
  width: min(760px, calc(100vw - 36px)) !important;
  max-width: min(760px, calc(100vw - 36px)) !important;
  min-width: 0 !important;
  right: auto !important;
  bottom: auto !important;
  margin: 0 !important;
  max-height: calc(100vh - 48px) !important;
  overflow: auto !important;
  transform: translate(-50%, -50%) !important;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.72);
}

.floating-form.open.wide-form {
  width: min(880px, calc(100vw - 36px)) !important;
  max-width: min(880px, calc(100vw - 36px)) !important;
}

.floating-form.open.provider-modal {
  width: min(920px, calc(100vw - 36px)) !important;
  max-width: min(920px, calc(100vw - 36px)) !important;
}

.floating-form.open.provider-wide-modal {
  width: min(1320px, calc(100vw - 36px)) !important;
  max-width: min(1320px, calc(100vw - 36px)) !important;
}

.provider-wide-modal .table-wrap {
  max-height: calc(100vh - 280px);
}

.provider-modal-filter {
  margin-bottom: 12px;
}

.floating-form.open .panel-head {
  position: sticky;
  top: 0;
  z-index: 2;
}

body.form-modal-open::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(2px);
}

body.form-modal-open {
  overflow: hidden;
}

.vod-source-drawer {
  max-width: 760px;
}

.vod-library-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
}

.vod-library-card {
  min-height: 82px;
  text-align: left;
  padding: 16px;
  border-color: var(--line);
  background: linear-gradient(135deg, rgba(20, 23, 31, 0.92), rgba(58, 13, 20, 0.54));
  box-shadow: none;
}

.vod-library-card span,
.vod-library-card strong {
  display: block;
}

.vod-library-card span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.vod-library-card strong {
  margin-top: 8px;
  font-size: 22px;
}

.vod-library-card.active {
  border-color: rgba(229, 9, 20, 0.75);
  background: linear-gradient(180deg, rgba(229, 9, 20, 0.72), rgba(121, 5, 13, 0.7));
}

.billing-form-wide {
  max-width: 760px;
}

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

#billingTabNotices.active,
#billingTabCharges.active {
  align-items: start;
}

#billingTabNotices .billing-form-wide,
#billingTabCharges .table-panel,
#billingTabCustomers .billing-form-wide,
#billingTabCustomers .table-panel {
  max-width: none;
  width: 100%;
}

#billingTabCustomers .table-panel {
  min-width: 0;
}

.billing-section-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(18, 21, 29, 0.88), rgba(56, 11, 18, 0.5));
}

.billing-section-tab,
.notice-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.billing-section-tab,
.notice-mode-tabs .billing-tab-btn {
  min-width: 160px;
}

.billing-section-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.billing-section-tab.active,
.notice-mode-tabs .billing-tab-btn.active {
  border-color: rgba(229, 9, 20, 0.65);
  background: linear-gradient(180deg, #e50914, #9f0710);
}

.billing-customer-section {
  display: none !important;
}

.billing-customer-section.active {
  display: grid !important;
}

#noticeHistoryPanel[hidden],
#noticeTemplatesPanel[hidden] {
  display: none !important;
}

.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.input-action button {
  white-space: nowrap;
}

.row-actions button,
.vod-tab,
.category-tab {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text);
  box-shadow: none;
}

.row-actions button:hover,
.vod-tab:hover,
.category-tab:hover {
  border-color: rgba(229, 9, 20, 0.54);
  background: rgba(229, 9, 20, 0.18);
}

.view { display: none; }
.view.active { display: block; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  background: linear-gradient(145deg, rgba(20, 24, 32, 0.94), rgba(34, 11, 15, 0.78));
  box-shadow: var(--shadow);
}

.metric::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -34px;
  width: 92px;
  height: 92px;
  border: 1px solid rgba(229, 9, 20, 0.3);
  border-radius: 50%;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 13px;
  font-size: 34px;
  line-height: 1;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel + .panel,
.vod-tabs-panel,
.vod-metrics,
#planChannelsPanel {
  margin-top: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  margin: -16px -16px 16px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
  background: linear-gradient(90deg, rgba(229, 9, 20, 0.16), rgba(255, 255, 255, 0.035));
}

.split {
  display: grid;
  grid-template-columns: minmax(290px, 390px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.form-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.panel.form-panel.floating-form:not(.open) {
  display: none !important;
}

.panel.form-panel.floating-form.open {
  display: grid !important;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 38px;
  background: rgba(5, 7, 11, 0.72);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 7px;
  padding: 9px 10px;
  outline: none;
}

input[type='checkbox'],
input[type='radio'] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  padding: 0;
  margin: 0;
  accent-color: var(--red);
  cursor: pointer;
  vertical-align: middle;
}

table input[type='checkbox'],
table input[type='radio'] {
  display: inline-block;
}

td:first-child,
th:first-child {
  width: 42px;
  text-align: center;
}

.hook-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 10, 14, 0.72);
}

.hook-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.hook-card h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.hook-card small {
  color: var(--muted);
}

.code-textarea {
  width: 100%;
  min-height: 168px;
  resize: vertical;
  font-family: Consolas, Monaco, 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.55;
  color: #f6f8fb;
  background: #07090d;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
}

input:focus,
select:focus {
  border-color: rgba(229, 9, 20, 0.85);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.16);
}

input[readonly] {
  color: #d9e4ef;
  background: rgba(255, 255, 255, 0.055);
}

.compact-select,
.compact-input {
  min-width: 150px;
  min-height: 34px;
  padding: 8px;
  font-size: 12px;
}

.wide-input {
  min-width: 290px;
  min-height: 34px;
  padding: 8px;
  font-size: 12px;
}

.order-input {
  width: 76px;
  min-width: 76px;
  min-height: 34px;
  padding: 8px;
  text-align: center;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.inline-check input {
  width: auto;
  min-height: auto;
}

.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 10px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(4, 6, 10, 0.38);
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding: 11px;
  font-size: 12px;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #c4cbd6;
  font-weight: 800;
  background: rgba(18, 21, 28, 0.98);
}

tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.018);
}

tr:hover td {
  background: rgba(229, 9, 20, 0.06);
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(25, 185, 120, 0.14);
  color: #bfffe2;
  border: 1px solid rgba(25, 185, 120, 0.2);
}

.status.blocked {
  background: rgba(255, 91, 100, 0.12);
  color: #ffc5c9;
  border-color: rgba(255, 91, 100, 0.28);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 32px));
  background: rgba(16, 20, 28, 0.96);
  border: 1px solid rgba(229, 9, 20, 0.4);
  color: var(--text);
  padding: 13px 15px;
  border-radius: 9px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: 160ms ease;
}

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

.channels-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 9px;
}

.plan-content-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 16px;
}

.plan-content-grid.two-cols {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.plan-content-tab-panel {
  display: none;
}

.plan-content-tab-panel.active {
  display: block;
}

.plan-content-tab.active,
.syncvod-tab.active {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-color: rgba(255, 78, 78, 0.65);
  color: #fff;
}

.compact-filter-row {
  margin: 0 0 14px;
}

.hidden-by-filter {
  display: none !important;
}

.plan-content-grid h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
}

.empty-text {
  margin: 0;
  color: var(--muted-2);
  font-size: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  background: rgba(5, 8, 13, 0.68);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.check-row span small {
  display: block;
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 11px;
}

.channel-logo {
  display: block;
  width: 58px;
  height: 38px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.poster-thumb {
  display: block;
  width: 48px;
  height: 70px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.image-thumb-button {
  display: inline-flex;
  width: auto;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.image-thumb-button:hover {
  filter: brightness(1.1);
}

.logo-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 38px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: var(--muted-2);
  font-size: 10px;
}

.vod-tab.active,
.category-tab.active {
  border-color: rgba(229, 9, 20, 0.72);
  background: linear-gradient(180deg, #e50914, #8e0710);
  color: #fff;
}

.vod-tab-box { display: none; }
.vod-tab-box.active { display: block; }
.category-tab-box { display: none; }
.category-tab-box.active { display: block; }

.truncate {
  display: inline-block;
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.progress-cell {
  min-width: 180px;
}

.progress-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
}

.progress-bar {
  height: 18px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--info));
  transition: width 180ms ease;
}

.progress-main {
  margin-bottom: 16px;
}

.progress-main .progress-bar {
  height: 28px;
  box-shadow: 0 0 18px rgba(229, 9, 20, 0.18);
}

.vod-progress-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.vod-progress-grid span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.vod-progress-log {
  min-height: 260px;
  max-height: 420px;
  margin: 12px 0 0;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.library-toolbar input {
  flex: 1 1 260px;
  max-width: 520px;
}

.library-toolbar select {
  flex: 0 1 130px;
  width: auto;
}

.library-toolbar button,
.library-toolbar span {
  flex: 0 0 auto;
}

.library-toolbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.job-log-mini {
  max-width: 420px;
  max-height: 92px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--muted);
  font-size: 11px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(6px);
}

.modal-panel {
  width: min(1480px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(18, 18, 24, 0.98), rgba(35, 7, 12, 0.98));
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.55);
}

.modal-body {
  max-height: calc(92vh - 96px);
  overflow: auto;
  padding: 14px;
}

.series-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.series-modal-title h2 {
  margin: 0 0 4px;
}

.series-modal-title .poster-thumb,
.series-modal-title .logo-empty {
  width: 48px;
  min-width: 48px;
  height: 66px;
}

.series-modal .table-wrap {
  max-height: calc(92vh - 140px);
}

.category-channels-modal {
  width: min(1380px, 96vw);
}

.category-channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.category-channel-grid .check-row {
  margin: 0;
  min-height: 48px;
}

.image-modal-panel {
  width: min(760px, 92vw);
}

.image-modal-body {
  display: grid;
  place-items: center;
  padding: 18px;
}

.image-modal-body img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.channel-player-modal {
  width: min(980px, 94vw);
}

.player-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.player-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

#channelPlayerVideo {
  width: 100%;
  min-height: 420px;
  max-height: 68vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050508;
}

@media (max-width: 760px) {
  .player-toolbar {
    grid-template-columns: 1fr;
  }

  #channelPlayerVideo {
    min-height: 240px;
  }
}

#liveCategoryChannelList .check-row span {
  display: flex;
  align-items: center;
  gap: 8px;
}

#liveCategoryChannelList .channel-logo,
#liveCategoryChannelList .logo-empty {
  width: 34px;
  min-width: 34px;
  height: 24px;
}

.provider-detail-grid {
  display: grid;
  grid-template-columns: minmax(310px, 430px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.detail-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.detail-card {
  min-height: 78px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(229, 9, 20, 0.055));
}

.detail-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 7px;
  text-transform: uppercase;
}

.detail-card strong {
  display: block;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.portal-access strong,
.portal-access small {
  display: block;
}

.portal-access small {
  color: var(--muted);
  margin-top: 4px;
}

.panel-subsection {
  margin-top: 18px;
}

.panel-subsection h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 15px;
}

.charge-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(5, 8, 13, 0.56);
}

.charge-form button {
  min-height: 38px;
}

.charge-send-controls {
  display: grid;
  grid-template-columns: 74px minmax(150px, 1fr);
  gap: 7px;
  min-width: 260px;
}

.source-category strong {
  display: block;
  color: var(--text);
  margin-bottom: 5px;
}

.source-category small,
.category-destination span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.category-destination {
  min-width: 230px;
}

.switch-cell {
  display: inline-grid;
  gap: 4px;
  min-width: 72px;
  color: var(--muted);
  font-size: 11px;
}

.switch-cell input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-cell span {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  width: 68px;
  height: 28px;
  border-radius: 999px;
  background: rgba(115, 125, 142, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.11);
  overflow: hidden;
}

.switch-cell span::before {
  content: "";
  position: absolute;
  width: 27px;
  height: 22px;
  left: 3px;
  top: 2px;
  border-radius: 999px;
  background: #e7edf5;
  transition: transform 160ms ease;
  z-index: 1;
}

.switch-cell b,
.switch-cell em {
  position: relative;
  z-index: 2;
  font-style: normal;
  font-size: 10px;
  text-align: center;
}

.switch-cell b { color: #d7ffe9; }
.switch-cell em { color: #ffd6d6; }

.switch-cell input:checked + span {
  background: rgba(25, 185, 120, 0.72);
  border-color: rgba(25, 185, 120, 0.5);
}

.switch-cell input:checked + span::before {
  transform: translateX(34px);
}

.provider-page {
  min-height: 100vh;
  padding: 24px;
}

.provider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  min-height: 112px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(18, 21, 29, 0.94), rgba(58, 10, 16, 0.58)),
    var(--panel);
  box-shadow: var(--shadow);
}

.provider-title,
.topbar-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.topbar-logo {
  display: block;
  width: 92px;
  min-width: 92px;
  height: 58px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(229, 9, 20, 0.18), rgba(255, 255, 255, 0.04)),
    url('/web/assets/redmax-logo.png') center/contain no-repeat;
  border: 1px solid rgba(229, 9, 20, 0.24);
  box-shadow: 0 16px 34px rgba(229, 9, 20, 0.14);
}

.provider-select {
  display: flex;
  gap: 8px;
  min-width: min(100%, 440px);
}

.provider-select select { flex: 1; }

.provider-main {
  display: grid;
  gap: 16px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 430px);
  display: grid;
  gap: 12px;
}

.redmax-login-page {
  background:
    radial-gradient(circle at 50% 12%, rgba(229, 9, 20, 0.32), transparent 28%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.84), rgba(0, 0, 0, 0.58)),
    url('/web/assets/redmax-bg.png') center/cover fixed no-repeat,
    var(--bg);
}

.redmax-login-card {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border-color: rgba(229, 9, 20, 0.3);
  background:
    linear-gradient(150deg, rgba(18, 21, 29, 0.96), rgba(44, 8, 13, 0.82)),
    var(--panel);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.54);
}

.redmax-login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 24%),
    radial-gradient(circle at 82% 10%, rgba(229, 9, 20, 0.24), transparent 24%);
}

.redmax-login-card > * {
  position: relative;
  z-index: 1;
}

.login-logo {
  width: 100%;
  height: 190px;
  margin: -8px 0 2px;
  border-radius: 8px;
  background: url('/web/assets/redmax-logo.png') center/contain no-repeat;
  filter: drop-shadow(0 18px 36px rgba(229, 9, 20, 0.22));
}

.login-kicker {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.login-message {
  min-height: 20px;
  color: #ffb4b4;
  font-size: 12px;
  font-weight: 800;
}

.variable-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.035);
  border-radius: 8px;
}

.copy-chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.notice-template-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(420px, 1fr));
  gap: 16px;
  align-items: start;
}

.notice-template-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0,0,0,0.22);
}

.notice-template-grid {
  display: grid;
  grid-template-columns: 110px minmax(150px, 1fr) minmax(170px, 220px) minmax(95px, 140px);
  gap: 10px;
  align-items: end;
}

.notice-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.notice-template-card textarea {
  min-height: 150px;
  resize: vertical;
}

@media (max-width: 1200px) {
  #billingTabCustomers.active {
    display: block;
  }

  .notice-template-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .notice-template-list,
  .notice-template-grid {
    grid-template-columns: 1fr;
  }
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(3px);
}

.busy-overlay.show {
  display: flex;
}

.busy-card {
  width: min(420px, calc(100vw - 36px));
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 24px;
  border: 1px solid rgba(239, 35, 60, 0.55);
  border-radius: 10px;
  background: rgba(14, 16, 23, 0.96);
  color: #fff;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.busy-card small {
  color: var(--muted);
}

.busy-spinner {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 4px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--red);
  animation: busy-spin 0.8s linear infinite;
}

.order-modal {
  width: min(980px, 94vw);
}

.order-list {
  display: grid;
  gap: 8px;
  max-height: 70vh;
  overflow: auto;
  padding-right: 4px;
}

.order-row {
  align-items: center;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 28px 48px minmax(0, 1fr) 58px auto;
  min-height: 58px;
  padding: 8px 10px;
}

.order-row.dragging {
  opacity: 0.55;
}

.order-row.drag-over {
  border-color: rgba(229, 9, 20, 0.9);
  box-shadow: inset 0 0 0 1px rgba(229, 9, 20, 0.35);
}

.order-handle {
  color: var(--muted);
  cursor: grab;
  font-weight: 800;
  letter-spacing: 1px;
  text-align: center;
}

.order-row img,
.order-empty-image {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  display: block;
  height: 38px;
  object-fit: contain;
  width: 48px;
}

.order-empty-image::after {
  color: var(--muted);
  content: "sem";
  display: grid;
  font-size: 10px;
  height: 100%;
  place-items: center;
}

.order-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.order-main strong,
.order-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-position {
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

@keyframes busy-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1160px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .charge-form {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 880px) {
  .app-shell { display: block; }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav-item { text-align: center; padding: 10px 6px; }
  .nav-item::before { display: none; }
  .main { padding: 16px; }
  .metric-grid,
  .split,
  .provider-detail-grid,
  .plan-content-grid,
  .charge-form {
    grid-template-columns: 1fr;
  }
  .topbar {
    align-items: flex-start;
    display: grid;
  }
}

@media (max-width: 720px) {
  .provider-page { padding: 14px; }
  .provider-header { display: grid; }
  .provider-select {
    min-width: 0;
    width: 100%;
  }
  .provider-select button {
    flex: 1;
  }
  .provider-title,
  .topbar-title {
    align-items: flex-start;
  }
  .topbar-logo {
    width: 72px;
    min-width: 72px;
    height: 48px;
  }
  .login-logo {
    height: 150px;
  }
  .link-row { grid-template-columns: 1fr; }
  .panel-head {
    align-items: flex-start;
    display: grid;
  }
}


.vod-evidence {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.vod-evidence-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  margin-bottom: 10px;
}

.vod-evidence-head span,
.vod-evidence-list small,
.vod-evidence-title {
  color: var(--muted);
}

.vod-evidence-grid {
  margin-top: 0;
}

.vod-evidence-title {
  font-size: 12px;
  font-weight: 800;
  margin-top: 12px;
  text-transform: uppercase;
}

.vod-evidence-list {
  margin: 8px 0 0;
  padding-left: 18px;
  max-height: 150px;
  overflow: auto;
  color: var(--text);
}

.vod-evidence-list li {
  margin: 4px 0;
}


/* sync-evidence-fix-style */
.sync-notice {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 208, 86, 0.35);
  border-radius: 8px;
  background: rgba(255, 208, 86, 0.10);
  color: #ffe29a;
  font-weight: 800;
}
