:root {
  --bg: #07090e;
  --surface: #0e121b;
  --surface-2: #141a25;
  --surface-3: #1a2230;
  --line: rgba(255, 255, 255, .085);
  --text: #f5f7fb;
  --muted: #8992a4;
  --lime: #c8f264;
  --lime-2: #a9dd34;
  --danger: #ff6b78;
  --radius: 18px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .42);
}

* { box-sizing: border-box; }
html { color-scheme: dark; background: var(--bg); }
body { margin: 0; min-height: 100vh; overflow-x: hidden; color: var(--text); background: var(--bg); font-family: "DM Sans", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.ambient { position: fixed; z-index: 0; pointer-events: none; filter: blur(4px); opacity: .46; }
.ambient-one { width: 560px; height: 560px; border-radius: 50%; top: -330px; left: 34%; background: radial-gradient(circle, rgba(200,242,100,.23), transparent 68%); }
.ambient-two { width: 640px; height: 640px; right: -320px; bottom: -360px; background: radial-gradient(circle, rgba(74,91,255,.14), transparent 68%); }

.brand { display: inline-flex; align-items: center; gap: 12px; font: 800 15px/1 "Manrope", sans-serif; letter-spacing: .17em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(200,242,100,.45); border-radius: 10px; color: #0d1204; background: var(--lime); font-size: 18px; letter-spacing: 0; box-shadow: 0 0 28px rgba(200,242,100,.14); }
.brand-compact { margin: 30px 26px 48px; }
.eyebrow { display: block; color: var(--lime); font-size: 11px; font-weight: 700; letter-spacing: .2em; }

.login-view { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(430px, .85fr); min-height: 100vh; }
.login-story { display: flex; flex-direction: column; padding: 48px clamp(40px, 7vw, 110px); border-right: 1px solid var(--line); }
.story-copy { margin: auto 0; max-width: 680px; }
.story-copy h1 { margin: 20px 0 26px; font: 700 clamp(54px, 6.2vw, 96px)/.98 "Manrope", sans-serif; letter-spacing: -.055em; }
.story-copy h1 em { color: var(--lime); font-style: normal; }
.story-copy p { max-width: 540px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.7; }
.legal-note { margin: 0; color: #626b7b; font-size: 12px; }
.login-panel, .centered-view { display: grid; place-items: center; padding: 32px; }
.auth-card { width: min(100%, 440px); padding: 44px; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(145deg, rgba(20,26,37,.94), rgba(11,14,21,.96)); box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.auth-heading { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .14em; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime); }
.auth-card h1, .auth-card h2 { margin: 22px 0 8px; font: 700 34px/1.15 "Manrope", sans-serif; letter-spacing: -.035em; }
.auth-card > p { margin: 0 0 30px; color: var(--muted); line-height: 1.55; }
label { display: block; margin: 18px 0 8px; color: #b6bdc9; font-size: 13px; font-weight: 600; }
input, select, textarea { width: 100%; min-height: 50px; padding: 0 15px; border: 1px solid var(--line); border-radius: 11px; outline: none; color: var(--text); background: #0b0f17; transition: border-color .2s, box-shadow .2s; }
textarea { padding-top: 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(200,242,100,.65); box-shadow: 0 0 0 3px rgba(200,242,100,.08); }
select { appearance: none; cursor: pointer; }
.select-wrap { position: relative; }
.select-wrap::after { content: "⌄"; position: absolute; right: 16px; top: 12px; color: var(--muted); pointer-events: none; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 700; transition: transform .18s, background .18s, border-color .18s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-primary { color: #101407; background: var(--lime); box-shadow: 0 8px 24px rgba(200,242,100,.13); }
.button-primary:hover { background: #d5fa7b; }
.button-wide { width: 100%; justify-content: space-between; margin-top: 26px; min-height: 52px; padding: 0 18px; }
.button-ghost { border-color: var(--line); color: #c5cbd5; background: transparent; }
.button-danger { color: var(--danger); border-color: rgba(255,107,120,.22); background: rgba(255,107,120,.06); }
.form-message { min-height: 18px; margin-top: 14px; color: var(--danger); font-size: 13px; line-height: 1.4; }
.form-message.success { color: var(--lime); }
.admin-link { display: block; margin-top: 16px; color: var(--muted); font-size: 12px; text-align: center; }
.admin-link:hover { color: var(--text); }

.app-shell { position: relative; z-index: 1; display: grid; grid-template-columns: 220px minmax(0,1fr); min-height: 100vh; }
.sidebar, .admin-sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; border-right: 1px solid var(--line); background: rgba(8,11,17,.8); backdrop-filter: blur(18px); }
.primary-nav { display: grid; gap: 5px; padding: 0 14px; }
.nav-item { display: flex; align-items: center; gap: 13px; width: 100%; min-height: 46px; padding: 0 14px; border: 0; border-radius: 10px; cursor: pointer; color: #7f899b; background: transparent; font-size: 14px; text-align: left; transition: color .18s, background .18s; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.045); }
.nav-item.active { color: #111508; background: var(--lime); font-weight: 700; }
.nav-icon { width: 18px; text-align: center; }
.sidebar-bottom { display: grid; gap: 4px; margin-top: auto; padding: 14px; }
.account-chip { display: flex; align-items: center; gap: 11px; width: 100%; margin-top: 10px; padding: 14px 8px 4px; border: 0; border-top: 1px solid var(--line); min-width: 0; color: var(--text); background: transparent; cursor: pointer; text-align: left; }
.avatar { display: grid; flex: 0 0 34px; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #15190d; background: var(--lime); font-weight: 800; }
.account-chip div:last-child { min-width: 0; }
.account-chip strong, .account-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-chip strong { font-size: 13px; }
.account-chip small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.main-content { min-width: 0; padding: 35px clamp(24px, 4vw, 58px) 70px; }
.topbar { display: flex; align-items: center; gap: 26px; min-height: 66px; }
.topbar h2 { margin: 5px 0 0; font: 700 27px/1.2 "Manrope", sans-serif; letter-spacing: -.035em; }
.search-wrap { display: flex; align-items: center; gap: 10px; width: min(340px, 38vw); margin-left: auto; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; background: rgba(14,18,27,.78); }
.search-wrap input { min-height: 44px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.search-wrap kbd { padding: 3px 6px; border: 1px solid var(--line); border-radius: 5px; color: #677083; font: 10px/1.2 monospace; }
.library-toolbar { display: flex; align-items: center; gap: 14px; margin: 35px 0 25px; }
.category-list { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.category-list::-webkit-scrollbar { display: none; }
.category-chip { flex: 0 0 auto; min-height: 36px; padding: 0 15px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; color: var(--muted); background: rgba(16,21,31,.7); font-size: 12px; font-weight: 600; }
.category-chip:hover, .category-chip.active { color: #111508; border-color: var(--lime); background: var(--lime); }
.toolbar-button, .sort-select { flex: 0 0 auto; min-height: 36px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: rgba(16,21,31,.8); font-size: 11px; }
.toolbar-button { padding: 0 12px; cursor: pointer; }
.toolbar-button.active { color: #111508; border-color: var(--lime); background: var(--lime); }
.sort-select { width: auto; min-width: 132px; padding: 0 30px 0 11px; }
.content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 23px 17px; }
.media-card { min-width: 0; cursor: pointer; }
.poster { position: relative; overflow: hidden; aspect-ratio: 2/3; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg,#1a2130,#0c1018); box-shadow: 0 14px 30px rgba(0,0,0,.2); transition: transform .22s, border-color .22s, box-shadow .22s; }
.media-card.live-card .poster { aspect-ratio: 16/10; }
.poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s, opacity .2s; }
.poster img[data-failed="true"] { opacity: 0; }
.poster::after { content: ""; position: absolute; inset: auto 0 0; height: 45%; background: linear-gradient(transparent,rgba(0,0,0,.68)); opacity: 0; transition: opacity .2s; }
.play-badge { position: absolute; z-index: 2; display: grid; place-items: center; width: 44px; height: 44px; left: 50%; top: 50%; border-radius: 50%; color: #111508; background: var(--lime); box-shadow: 0 8px 28px rgba(0,0,0,.35); opacity: 0; transform: translate(-50%,-42%) scale(.86); transition: opacity .2s, transform .2s; }
.favorite-button { position: absolute; z-index: 3; display: grid; place-items: center; width: 32px; height: 32px; right: 8px; top: 8px; border: 1px solid rgba(255,255,255,.14); border-radius: 9px; cursor: pointer; color: #d5d9e2; background: rgba(5,7,10,.72); opacity: 0; transition: opacity .2s, color .2s, background .2s; }
.favorite-button.active { color: #111508; border-color: var(--lime); background: var(--lime); opacity: 1; }
.media-card:hover .favorite-button { opacity: 1; }
.media-card:hover .poster { transform: translateY(-4px); border-color: rgba(200,242,100,.5); box-shadow: 0 20px 38px rgba(0,0,0,.38); }
.media-card:hover .poster img { transform: scale(1.035); }
.media-card:hover .poster::after, .media-card:hover .play-badge { opacity: 1; }
.media-card:hover .play-badge { transform: translate(-50%,-50%) scale(1); }
.poster-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(200,242,100,.68); font: 800 34px "Manrope",sans-serif; }
.media-meta { padding: 11px 3px 0; }
.media-meta h3 { overflow: hidden; margin: 0; color: #e7eaf0; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.media-meta p { display: flex; justify-content: space-between; margin: 5px 0 0; color: #6e7788; font-size: 11px; }
.rating { color: #d2a950; }
.content-status { display: grid; place-items: center; min-height: 330px; color: var(--muted); }
.content-status p { margin-top: 14px; }
.loader { width: 30px; height: 30px; border: 2px solid rgba(255,255,255,.12); border-top-color: var(--lime); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { padding: 65px 20px; color: var(--muted); text-align: center; }
.empty-state h3 { margin: 12px 0 5px; color: var(--text); }
.empty-state p { margin: 0; }
.empty-icon { margin: auto; color: var(--lime); font-size: 36px; }

.modal { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2,4,8,.8); backdrop-filter: blur(9px); }
.player-dialog, .form-dialog { position: relative; z-index: 1; width: min(1050px, 94vw); border: 1px solid var(--line); border-radius: 18px; background: #0d1119; box-shadow: var(--shadow); }
.player-head, .dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.player-head h2, .dialog-head h2 { margin: 4px 0 0; font: 700 19px "Manrope", sans-serif; }
.player-subtitle { max-width: 760px; margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.live-pill { color: var(--lime); font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.icon-button { display: grid; flex: 0 0 auto; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; color: #aab1be; background: rgba(255,255,255,.03); font-size: 20px; }
.icon-button:hover { color: var(--text); background: rgba(255,255,255,.08); }
.video-stage { position: relative; overflow: hidden; aspect-ratio: 16/9; border-radius: 0 0 18px 18px; background: #000; }
.video-stage video { width: 100%; height: 100%; background: #000; }
.player-message { position: absolute; inset: 0; display: grid; place-items: center; padding: 30px; color: #d8dce4; background: rgba(0,0,0,.78); text-align: center; }
.toast { position: fixed; z-index: 90; right: 24px; bottom: 24px; max-width: 380px; padding: 14px 18px; border: 1px solid rgba(200,242,100,.28); border-radius: 11px; color: #dfffa0; background: #141c0e; box-shadow: var(--shadow); font-size: 13px; }
.announcement { margin: 18px 0; padding: 13px 15px; border: 1px solid color-mix(in srgb, var(--lime) 25%, transparent); border-radius: 11px; background: color-mix(in srgb, var(--lime) 7%, transparent); }
.announcement strong { display: block; color: var(--lime); font-size: 12px; }
.announcement p { margin: 4px 0 0; color: #aab2c0; font-size: 12px; line-height: 1.5; }
.catchup-dialog { max-height: min(760px,90vh); overflow: hidden; }
.catchup-list { max-height: min(620px,72vh); overflow-y: auto; padding: 10px 20px 22px; }
.program-row { display: grid; grid-template-columns: 135px minmax(0,1fr) auto; align-items: center; gap: 16px; padding: 15px 4px; border-bottom: 1px solid var(--line); }
.program-time { color: var(--lime); font: 600 11px ui-monospace,monospace; }
.program-copy { min-width: 0; }
.program-copy strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.program-copy small { display: block; overflow: hidden; margin-top: 4px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.account-details { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 0; padding: 22px; }
.account-details > div { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.02); }
.account-details > div:last-child { grid-column: 1 / -1; }
.account-details dt { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.account-details dd { margin: 7px 0 0; color: var(--text); font-size: 13px; }

.admin-body { min-height: 100vh; }
.centered-view { position: relative; z-index: 1; min-height: 100vh; }
.compact-card { width: min(430px, 94vw); }
.compact-card .brand { margin-bottom: 46px; }
.admin-shell { position: relative; z-index: 1; display: grid; grid-template-columns: 230px minmax(0,1fr); min-height: 100vh; }
.admin-nav-label { margin: 0 28px 12px; color: #555f70; font-size: 10px; font-weight: 700; letter-spacing: .2em; }
.admin-sidebar > .nav-item { width: auto; margin: 0 14px; }
.admin-main { min-width: 0; padding: 46px clamp(28px,5vw,72px) 70px; }
.admin-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; }
.admin-header h1 { margin: 7px 0 8px; font: 700 36px/1.1 "Manrope",sans-serif; letter-spacing: -.04em; }
.admin-header p, .section-heading p { margin: 0; color: var(--muted); }
.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin: 38px 0 26px; }
.stat-card { padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: rgba(14,18,27,.8); }
.stat-card > span { color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin: 11px 0 5px; font: 700 28px "Manrope",sans-serif; }
.stat-card small { color: #5e6878; }
.stat-accent { border-color: rgba(200,242,100,.2); background: linear-gradient(135deg,rgba(200,242,100,.08),rgba(14,18,27,.8)); }
.stat-card small .status-dot, .stat-card small i { margin-right: 7px; }
.panel-section { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: rgba(12,16,24,.88); }
.settings-section { margin-top: 24px; }
.settings-form { display: grid; grid-template-columns: minmax(0,1fr) 150px; gap: 4px 20px; padding: 24px 26px 28px; }
.settings-form label { margin-top: 10px; }
.settings-wide { grid-column: 1 / -1; }
.settings-toggle { grid-column: 1 / -1; width: 100%; margin: 20px 0 4px !important; }
.section-heading { display: flex; justify-content: space-between; padding: 24px 26px; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin: 0 0 5px; font: 700 18px "Manrope",sans-serif; }
.section-heading p { font-size: 12px; }
.table-wrap { overflow-x: auto; }
.panel-table { width: 100%; border-collapse: collapse; }
.panel-table th { padding: 13px 20px; color: #5f6878; background: rgba(255,255,255,.018); font-size: 10px; letter-spacing: .12em; text-align: left; text-transform: uppercase; }
.panel-table td { padding: 18px 20px; border-top: 1px solid rgba(255,255,255,.055); color: #aeb5c1; font-size: 13px; }
.panel-table tbody tr:hover { background: rgba(255,255,255,.018); }
.provider-cell { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 600; }
.provider-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--lime); background: rgba(200,242,100,.1); }
.endpoint { display: block; overflow: hidden; max-width: 350px; color: #7d8798; font-family: ui-monospace,monospace; text-overflow: ellipsis; white-space: nowrap; }
.status-badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 999px; color: var(--lime); background: rgba(200,242,100,.08); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.status-badge.off { color: #7d8798; background: rgba(255,255,255,.05); }
.actions { display: flex; justify-content: flex-end; gap: 7px; }
.action-button { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; color: #8992a2; background: transparent; font-size: 11px; }
.action-button:hover { color: var(--text); border-color: rgba(255,255,255,.2); }
.action-button.danger:hover { color: var(--danger); border-color: rgba(255,107,120,.3); }
.form-dialog { width: min(520px,94vw); padding-bottom: 22px; }
.small-dialog { width: min(470px,94vw); }
.form-dialog > label, .form-dialog > input, .form-dialog > p, .form-dialog > .form-message { width: calc(100% - 44px); margin-left: 22px; margin-right: 22px; }
.form-dialog > p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.field-help { margin-top: 8px !important; }
.field-help code { color: #aab3c1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin: 25px 22px 0; padding-top: 18px; border-top: 1px solid var(--line); }
.toggle-row { display: flex !important; align-items: center; justify-content: space-between; gap: 20px; margin-top: 24px !important; padding: 15px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.toggle-row span strong, .toggle-row span small { display: block; }
.toggle-row span small { margin-top: 3px; color: var(--muted); font-weight: 400; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-row i { position: relative; flex: 0 0 42px; width: 42px; height: 24px; border-radius: 99px; background: #2b3240; transition: background .2s; }
.toggle-row i::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #80899a; transition: transform .2s, background .2s; }
.toggle-row input:checked + i { background: rgba(200,242,100,.27); }
.toggle-row input:checked + i::after { transform: translateX(18px); background: var(--lime); }
.mobile-only { display: none; }

@media (max-width: 900px) {
  .login-view { grid-template-columns: 1fr; }
  .login-story { min-height: 48vh; padding: 30px; border-right: 0; border-bottom: 1px solid var(--line); }
  .story-copy { margin: 80px 0; }
  .legal-note { display: none; }
  .sidebar, .admin-sidebar { position: fixed; z-index: 20; left: -240px; width: 220px; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: var(--shadow); }
  .app-shell, .admin-shell { grid-template-columns: 1fr; }
  .mobile-only { display: grid; }
  .main-content { padding: 25px 20px 60px; }
  .stat-row { grid-template-columns: 1fr; }
  .admin-main { padding: 30px 20px 60px; }
  .admin-header { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
  .login-panel { padding: 18px; }
  .auth-card { padding: 29px 23px; }
  .story-copy h1 { font-size: 48px; }
  .search-wrap { width: 46px; margin-left: auto; cursor: pointer; }
  .search-wrap:focus-within { position: absolute; z-index: 4; left: 20px; right: 20px; width: auto; }
  .search-wrap:not(:focus-within) input, .search-wrap:not(:focus-within) kbd { display: none; }
  .topbar { align-items: center; }
  .content-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px 11px; }
  .category-list { margin-right: -20px; }
  .library-toolbar { flex-wrap: wrap; }
  .category-list { flex-basis: 100%; order: 3; }
  .modal { padding: 10px; }
  .player-dialog { width: 100%; }
  .panel-table th:nth-child(4), .panel-table td:nth-child(4) { display: none; }
  .settings-form { grid-template-columns: 1fr; }
  .settings-wide, .settings-toggle { grid-column: 1; }
  .program-row { grid-template-columns: 1fr auto; }
  .program-time { grid-column: 1 / -1; }
}
