@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');

:root {
    color-scheme: light;
    --ink: #182230;
    --muted: #687588;
    --line: #e7ebf1;
    --primary: #465ce5;
    --primary-dark: #3449cf;
    --surface: #fff;
    --canvas: #f5f7fb;
    font-family: 'DM Sans', sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }
.topbar { height: 68px; padding: 0 5.3%; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.brand { color: var(--ink); display: inline-flex; align-items: center; gap: 11px; font-family: Manrope, sans-serif; font-size: 17px; font-weight: 700; }
.brand b { color: var(--primary); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px; background: #edf0ff; color: var(--primary); font-size: 19px; }
.brand-mark.small { width: 34px; height: 34px; border-radius: 11px; font-size: 14px; }
.topbar-right, .topbar-right form { display: flex; align-items: center; gap: 18px; }
.admin-label { color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #30b982; flex: 0 0 auto; }
.user-menu { position: relative; }
.user-menu-toggle { display: inline-flex; align-items: center; gap: 9px; min-height: 38px; padding: 0 10px 0 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 600; transition: background .15s, border-color .15s; }
.user-menu-toggle:hover { background: #f7f9fc; border-color: #d7dde7; }
.user-menu-toggle[aria-expanded="true"] { background: #edf0ff; border-color: #c9d2ff; }
.user-avatar { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: var(--primary); color: white; font-family: Manrope, sans-serif; font-size: 13px; font-weight: 700; }
.user-avatar.large { width: 38px; height: 38px; border-radius: 11px; font-size: 16px; }
.user-caret { width: 14px; height: 14px; color: var(--muted); transition: transform .15s; }
.user-menu-toggle[aria-expanded="true"] .user-caret { transform: rotate(180deg); }
.user-menu-panel { position: absolute; right: 0; top: calc(100% + 9px); z-index: 60; width: 230px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 18px 45px #1d2d4a26; }
.user-menu-panel[hidden] { display: none; }
.user-menu-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 12px; border-bottom: 1px solid #edf0f4; }
.user-menu-head strong { display: block; font-size: 13px; }
.user-menu-head small { display: inline-flex; align-items: center; gap: 6px; margin-top: 3px; color: var(--muted); font-size: 11px; }
.user-menu-form { margin: 0; }
.user-menu-item { width: 100%; min-height: 38px; margin-top: 6px; padding: 0 10px; display: flex; align-items: center; gap: 9px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 600; text-align: left; transition: background .15s; }
.user-menu-item:hover { background: #f7f9fc; }
.user-menu-item.danger { color: #bb3d49; }
.user-menu-item.danger:hover { background: #fff1f2; }
.user-menu-item svg { width: 15px; height: 15px; }
.page { width: min(1500px, 91%); margin: 40px auto 24px; }
h1, h2, p { margin-top: 0; }
h1, h2 { font-family: Manrope, sans-serif; letter-spacing: -.035em; }
h1 { margin-bottom: 7px; font-size: 32px; }
h2 { margin-bottom: 4px; font-size: 18px; }
.eyebrow { margin-bottom: 9px; color: var(--primary); font-size: 10px; font-weight: 700; letter-spacing: .13em; }
.muted { margin-bottom: 0; color: var(--muted); }
.button { min-height: 38px; border: 0; border-radius: 9px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .15s, transform .15s; }
.button:hover { transform: translateY(-1px); text-decoration: none; }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button:disabled:hover { transform: none; }
.primary { background: var(--primary); color: white; box-shadow: 0 4px 10px #465ce528; }
.primary:hover { background: var(--primary-dark); }
.secondary { background: #f0f2f8; color: #39465b; }
.secondary:hover { background: #e5e9f2; }
.text-button { min-height: 34px; padding: 0 8px; color: var(--muted); background: transparent; }
.text-button[aria-current="page"] { color: var(--primary); background: #edf0ff; }
.danger-button { color: #bb3d49; background: #fff1f2; }
.small-button { min-height: 25px; padding: 0 7px; font-size: 11px; }
.icon-button { width: 25px; min-width: 25px; padding: 0; font-size: 0; flex: 0 0 auto; }
.icon-button svg { width: 13px; height: 13px; display: block; }
.button-icon { font-size: 17px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card { min-height: 94px; padding: 19px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; display: flex; align-items: center; gap: 14px; box-shadow: 0 3px 14px #1b2a4406; }
.stat-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; font-size: 18px; }
.stat-icon.blue { color: #4b62df; background: #edf0ff; }
.stat-icon.green { color: #1b9b6a; background: #e9f8f1; }
.stat-icon.purple { color: #8d58ca; background: #f4edfc; }
.stat-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.stat-card strong { font-family: Manrope, sans-serif; font-size: 22px; }
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 3px 14px #1b2a4406; overflow: hidden; }
.form-card-head, .table-toolbar { padding: 22px 26px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.form-card-head .eyebrow, .table-toolbar .eyebrow { margin-bottom: 6px; }
.form-card-head h2, .table-toolbar h2 { margin: 0 0 6px; font-size: 22px; }
.table-toolbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.channel-edit-form { padding: 24px 26px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid label { display: grid; gap: 6px; color: #566276; font-size: 11px; font-weight: 600; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; padding: 0 11px; border: 1px solid #dfe4ed; border-radius: 8px; outline-color: var(--primary); color: var(--ink); background: white; font: inherit; font-size: 13px; }
.form-grid input, .form-grid select { height: 38px; }
.form-grid textarea { min-height: 128px; padding: 10px 11px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; line-height: 1.6; }
.form-grid textarea[name="drm_headers"] { min-height: 76px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid small { color: var(--muted); font-size: 10px; font-weight: 400; }
.form-grid .checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.form-grid .checkbox-label input { width: 16px; height: 16px; padding: 0; }
.form-actions { margin-top: 22px; display: flex; align-items: center; gap: 9px; }
.category-list { display: grid; }
.category-row { padding: 13px 26px; display: flex; align-items: center; gap: 14px; border-top: 1px solid #edf0f4; }
.category-row:first-child { border-top: 0; }
.category-rename { flex: 1; display: flex; align-items: center; gap: 8px; }
.category-rename input { width: min(360px, 100%); height: 36px; padding: 0 10px; border: 1px solid #dfe4ed; border-radius: 8px; outline-color: var(--primary); color: var(--ink); }
.category-count { color: var(--muted); font-size: 11px; white-space: nowrap; }
.category-empty { padding: 26px; }
.category-note { margin: 0; padding: 14px 26px; border-top: 1px solid #edf0f4; font-size: 11px; }
.form-section-head { margin: 26px 0 0; padding-top: 20px; border-top: 1px solid #edf0f4; }
.form-section-head h3 { margin: 0 0 4px; font-size: 14px; }
.form-section-head .muted { font-size: 11px; }
.feed-card { margin: 18px 26px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fcfdff; }
.feed-card-head { padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid #edf0f4; background: #f7f9fc; }
.feed-card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.feed-card-title strong { color: #283447; font-size: 13px; }
.feed-actions { display: flex; align-items: center; gap: 4px; }
.feed-card .channel-edit-form { padding: 18px 16px; }
.add-feed-card { background: var(--surface); }
.add-feed-card h3 { margin: 0; padding: 16px 16px 0; font-size: 14px; }
.feed-chip { display: inline-block; padding: 2px 7px; border-radius: 20px; background: #eef1f7; color: #526076; font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.feed-chip.drm-chip { color: #8a5a12; background: #fff3dd; }
.feed-chip.muted-chip { color: #9aa3b1; background: #f1f3f8; }
.feed-chips { display: inline-flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.feeds-cell { min-width: 110px; }
.feeds-cell strong { display: block; color: #283447; font-size: 11px; }
.feed-warning { margin: 14px 0 0; padding: 8px 11px; border-radius: 8px; color: #8a5a12; background: #fff3dd; font-size: 11px; }
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 3px 14px #1b2a4406; overflow: hidden; }
.filters { display: flex; align-items: center; gap: 8px; }
.search-box { height: 38px; width: 245px; padding: 0 10px; display: flex; align-items: center; gap: 7px; border: 1px solid #dfe4ed; border-radius: 9px; color: #8994a5; }
.search-box span { font-size: 21px; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.filters select { height: 38px; max-width: 180px; padding: 0 10px; border: 1px solid #dfe4ed; border-radius: 9px; background: white; color: #39465b; font-size: 12px; }
.clear-link { padding: 0 5px; font-size: 12px; }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 7px 12px; color: #7d8899; background: #fafbfc; font-size: 10px; font-weight: 700; letter-spacing: .055em; text-transform: uppercase; white-space: nowrap; }
td { padding: 4px 12px; border-top: 1px solid #edf0f4; color: #465366; font-size: 11px; line-height: 1.25; vertical-align: middle; }
tbody tr:hover { background: #fcfcff; }
.channel-cell { min-width: 170px; display: flex; align-items: center; gap: 7px; }
.channel-cell strong, .channel-cell small { display: block; }
.channel-cell strong { max-width: 180px; color: #283447; font-size: 12px; line-height: 1.25; }
.channel-cell small { max-width: 180px; margin-top: 0; color: #8994a4; font-size: 10px; line-height: 1.2; }
.channel-logo { width: 26px; height: 26px; flex: 0 0 auto; object-fit: contain; border: 1px solid #eef0f4; border-radius: 7px; background: white; }
img.channel-logo { cursor: zoom-in; }
.channel-logo.placeholder { display: grid; place-items: center; color: #8994a4; font-size: 12px; }
.channel-logo-button { position: relative; width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.channel-logo-button .channel-logo { cursor: pointer; }
.channel-logo-edit { position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: white; opacity: 0; transform: scale(.8); transition: opacity .15s, transform .15s; pointer-events: none; }
.channel-logo-edit svg { width: 9px; height: 9px; }
.channel-logo-button:hover .channel-logo-edit, .channel-logo-button:focus-visible .channel-logo-edit { opacity: 1; transform: scale(1); }
.channel-logo-button:hover .channel-logo { border-color: #c9d2ff; }
.channel-name-button { display: block; max-width: 180px; padding: 0; border: 0; background: transparent; cursor: text; text-align: left; border-radius: 5px; }
.channel-name-button strong { max-width: 180px; color: #283447; font-size: 12px; line-height: 1.25; }
.channel-name-button:hover strong, .channel-name-button:focus-visible strong { color: var(--primary); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.channel-name-button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.logo-preview { position: fixed; z-index: 100; width: 212px; padding: 10px; background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 45px #1d2d4a33; pointer-events: none; }
.logo-preview[hidden] { display: none; }
.logo-preview img { display: block; width: 190px; height: 190px; object-fit: contain; }
.player-dialog { width: min(960px, calc(100% - 28px)); max-width: 960px; margin: auto; padding: 0; border: 0; border-radius: 16px; background: #0d1420; color: #f5f7fb; box-shadow: 0 30px 80px #08101f80; }
.player-dialog::backdrop { background: #0c1524b8; backdrop-filter: blur(4px); }
.logo-dialog { width: min(420px, calc(100% - 24px)); margin: auto; padding: 0; border: 0; border-radius: 16px; background: var(--surface); box-shadow: 0 30px 80px #1d2d4a33; }
.logo-dialog::backdrop { background: #0c1524b3; backdrop-filter: blur(4px); }
.logo-dialog-form { display: flex; flex-direction: column; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 16px; border-bottom: 1px solid #edf0f4; }
.dialog-head .eyebrow { margin-bottom: 6px; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-body { display: flex; flex-direction: column; gap: 14px; padding: 18px 22px; }
.dialog-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; border-top: 1px solid #edf0f4; }
.logo-dialog-preview { display: flex; align-items: center; justify-content: center; height: 110px; border-radius: 12px; background: #f7f9fc; border: 1px dashed #d7dde7; overflow: hidden; }
.logo-dialog-preview img { width: 72px; height: 72px; object-fit: contain; }
.dialog-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.dialog-or::before, .dialog-or::after { content: ''; flex: 1; height: 1px; background: #edf0f4; }
.small-note { margin: 0; font-size: 11px; }
.player-shell { padding: 18px; }
.player-head { margin-bottom: 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.player-head .eyebrow { margin-bottom: 6px; color: #9fb0ff; }
.player-head h2 { margin: 0; color: white; font-size: 20px; overflow-wrap: anywhere; }
.player-head .button { color: white; background: #ffffff14; }
.player-head .button:hover { background: #ffffff24; }
#preview-player-video { display: block; width: 100%; max-height: 65vh; aspect-ratio: 16 / 9; border-radius: 10px; background: #000; }
.player-status { margin: 12px 0 0; color: #bdc8d8; font-size: 12px; line-height: 1.45; }
.player-status[hidden] { display: none; }
.player-status.error { color: #ff9aa5; }
.monospace { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.category-chip { display: inline-block; padding: 2px 6px; border-radius: 20px; background: #f1f3f8; color: #526076; white-space: nowrap; }
.url-cell { max-width: 190px; min-width: 100px; }
.url-cell a { display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.empty-value { color: #b0b8c4; }
.status-form { display: flex; align-items: center; margin: 0; }
.status-dot { width: 18px; height: 18px; min-height: 0; padding: 0; flex: 0 0 auto; position: relative; border: 0; border-radius: 50%; cursor: pointer; background: transparent; }
.status-dot::before { position: absolute; inset: 4px; content: ''; border-radius: 50%; background: currentColor; transition: transform .15s; }
.status-dot.enabled { color: #2fbd7e; }
.status-dot.disabled { color: #e05260; }
.status-dot:hover::before { transform: scale(1.3); }
.status-dot:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.manage-cell { display: flex; align-items: center; gap: 3px; }
.inline-form { display: inline; }
.select-cell { width: 34px; text-align: center; }
.select-cell input { width: 15px; height: 15px; margin: 0; padding: 0; accent-color: var(--primary); cursor: pointer; }
.bulk-delete-form { display: flex; align-items: center; }
.bulk-delete-form button:disabled { opacity: .45; cursor: not-allowed; }
.login-form label { display: grid; gap: 5px; color: #566276; font-size: 11px; font-weight: 600; }
.login-form input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid #dfe4ed; border-radius: 8px; outline-color: var(--primary); color: var(--ink); }
.pagination { padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; }
.pagination > div { display: flex; gap: 7px; }
.notice { margin-bottom: 16px; padding: 12px 15px; border-radius: 9px; font-size: 13px; }
.notice.success { color: #15744e; background: #e7f7ef; }
.notice.error { color: #a13843; background: #fff0f1; }
footer { padding: 22px 0 8px; color: #9aa3b1; text-align: center; font-size: 11px; }
footer span { padding: 0 5px; }
.empty-state { height: 130px; text-align: center; }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { margin-bottom: 6px; color: #475469; font-size: 13px; }
.empty-state span { color: #8b96a5; }
.empty-action { margin-top: 10px; }
.login-shell { min-height: 100vh; padding: 24px; display: grid; place-items: center; background: radial-gradient(ellipse at 18% 8%, #e6eaff 0, transparent 40%), var(--canvas); }
.login-card { width: min(420px, 100%); padding: 38px; background: white; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 60px #28365712; }
.login-card .brand-mark { margin-bottom: 24px; }
.login-card h1 { font-size: 28px; }
.login-card > .muted { margin-bottom: 25px; font-size: 13px; }
.login-form { display: grid; gap: 15px; }
.login-form label { gap: 7px; font-size: 12px; }
.login-form input { height: 43px; font-size: 14px; }
.full-width { width: 100%; height: 43px; margin-top: 3px; }
.login-hint { margin: 20px 0 0; padding: 10px; border-radius: 8px; color: var(--muted); background: #f7f8fb; text-align: center; font-size: 11px; }
.guide-source-card { margin-bottom: 18px; }
.guide-source-status { flex: 0 0 auto; text-align: right; font-size: 11px; line-height: 1.6; }
.guide-source-actions { padding: 16px 26px; display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.guide-source-form { flex: 1 1 420px; display: flex; align-items: flex-end; gap: 9px; flex-wrap: wrap; }
.guide-url-field { flex: 1 1 320px; display: grid; gap: 6px; color: #566276; font-size: 11px; font-weight: 600; }
.guide-url-field input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid #dfe4ed; border-radius: 8px; outline-color: var(--primary); color: var(--ink); background: white; font: inherit; font-size: 13px; }
.guide-card { overflow: hidden; }
.guide-filters input[type="date"] { height: 38px; padding: 0 10px; border: 1px solid #dfe4ed; border-radius: 9px; background: white; color: #39465b; font-size: 12px; }
.guide-daynav { padding: 10px 20px; display: flex; align-items: center; gap: 7px; border-bottom: 1px solid var(--line); background: #fcfcfe; }
.guide-scroll { width: 100%; overflow-x: auto; }
.guide-grid { min-width: 1640px; }
.guide-row { display: flex; align-items: stretch; border-top: 1px solid #edf0f4; }
.guide-row:first-child { border-top: 0; }
.guide-channel { position: sticky; left: 0; z-index: 2; width: 200px; min-width: 200px; padding: 6px 10px; display: flex; align-items: center; gap: 8px; background: white; border-right: 1px solid #edf0f4; }
.guide-head { background: #fafbfc; }
.guide-head .guide-channel { color: #7d8899; background: #fafbfc; font-size: 10px; font-weight: 700; letter-spacing: .055em; text-transform: uppercase; }
.guide-track { position: relative; flex: 1 0 1440px; min-width: 1440px; height: 54px; background-image: linear-gradient(to right, #eef0f4 1px, transparent 1px); background-size: calc(100% / 24) 100%; }
.guide-head .guide-track { height: 30px; background-color: #fafbfc; }
.guide-hour { position: absolute; top: 8px; padding-left: 5px; color: #8a95a5; font-size: 10px; font-weight: 600; white-space: nowrap; }
.guide-channel strong { display: block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #283447; font-size: 11px; }
.guide-channel small { display: block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8994a4; font-size: 9.5px; }
.guide-logo { width: 24px; height: 24px; flex: 0 0 auto; object-fit: contain; border: 1px solid #eef0f4; border-radius: 6px; background: white; }
.guide-logo.placeholder { display: grid; place-items: center; color: #8994a4; font-size: 10px; }
.guide-program { position: absolute; top: 5px; bottom: 5px; min-width: 2px; padding: 3px 5px; overflow: hidden; border-left: 2px solid #6b7cf0; border-radius: 5px; background: #eef2ff; color: #2b3a67; display: flex; align-items: center; cursor: default; }
.guide-program:nth-of-type(even) { background: #f2efff; border-left-color: #9a7cf0; }
.guide-program:hover { z-index: 1; background: #e3e9ff; }
.guide-program.current { background: #dfe8ff; border-left-color: var(--primary); box-shadow: inset 0 0 0 1px #c7d2ff; }
.guide-program.current:hover { background: #d6e1ff; }
.guide-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 600; }
.guide-now { position: absolute; top: 0; bottom: 0; z-index: 3; width: 2px; background: #e05260; pointer-events: none; }
.guide-now::before { position: absolute; top: -2px; left: 50%; width: 6px; height: 6px; content: ''; border-radius: 50%; background: #e05260; transform: translateX(-50%); }
.guide-empty { padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.guide-empty strong { color: #475469; font-size: 13px; }
.guide-empty span { color: #8b96a5; font-size: 12px; }

@media (max-width: 820px) {
    .page { width: 94%; margin-top: 25px; }
    .topbar { padding: 0 3%; }
    .table-toolbar, .form-card-head { align-items: flex-start; flex-direction: column; }
    .stats-grid { gap: 9px; }
    .stat-card { padding: 13px; gap: 9px; }
    .filters { width: 100%; flex-wrap: wrap; }
    .search-box { flex: 1 1 190px; }
    .form-grid { grid-template-columns: 1fr; }
    .category-row { flex-wrap: wrap; }
    .guide-source-status { text-align: left; }
    .guide-source-actions { padding: 14px 18px; }
    .guide-filters select { flex: 1 1 160px; }
}

@media (max-width: 520px) {
    .stats-grid { grid-template-columns: 1fr; }
    .topbar-right .purge-cache-form, .categories-link, .user-name { display: none; }
    .topbar-right { gap: 4px; }
    .topbar-right .text-button { padding: 0 5px; font-size: 12px; }
    .user-menu-toggle { padding: 0 6px; }
    .login-card { padding: 27px 22px; }
    .form-card-head, .table-toolbar, .channel-edit-form { padding-left: 18px; padding-right: 18px; }
    .category-row { padding-left: 18px; padding-right: 18px; }
    .category-note { padding-left: 18px; padding-right: 18px; }
    .category-rename { flex-wrap: wrap; }
    .guide-source-actions { padding: 14px 18px; }
    .guide-daynav { padding: 9px 12px; flex-wrap: wrap; }
    .guide-channel { width: 140px; min-width: 140px; }
    .guide-channel strong, .guide-channel small { max-width: 88px; }
    .guide-grid { min-width: 1580px; }
}

/* Live log + user-agent security */
.log-controls { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.log-live { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.log-live input { width: 15px; height: 15px; padding: 0; }
.state-row { padding: 12px 26px; display: flex; align-items: center; gap: 9px; border-bottom: 1px solid var(--line); background: #fafbfd; font-size: 12px; }
.state-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.state-dot.on { background: #30b982; box-shadow: 0 0 0 3px #30b98222; }
.state-dot.off { background: #b6bfcc; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; }
.log-table td, .log-table th { white-space: nowrap; }
.uri-cell, .ua-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.st-ok { color: #1b9b6a; }
.st-block { color: #c08a1e; }
.st-error { color: #c0392b; }
.service-chip { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: #eef1f7; color: #526076; }
.service-web { color: #4b62df; background: #edf0ff; }
.service-playlist { color: #8d58ca; background: #f4edfc; }
.service-clear { color: #1b9b6a; background: #e9f8f1; }
.service-auto { color: #b5651d; background: #fdf1e3; }
.note-chip { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 600; color: #8a5a12; background: #fff3dd; }
.variant-chip { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.variant-full { color: #3449cf; background: #edf0ff; }
.variant-clear { color: #15744e; background: #e7f7ef; }
.variant-deny { color: #a13843; background: #fff0f1; }
.log-manage { white-space: nowrap; }
.log-allow-form { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; }
.small-select { height: 25px; padding: 0 6px; border: 1px solid #dfe4ed; border-radius: 7px; background: white; color: #39465b; font-size: 11px; }
.allow-button { background: #15744e; color: white; }
.allow-button:hover { background: #115c3d; }
.enforce-form { display: flex; align-items: flex-end; gap: 9px; }
.enforce-label { display: grid; gap: 6px; color: #566276; font-size: 11px; font-weight: 600; }
.enforce-label select { height: 38px; padding: 0 10px; border: 1px solid #dfe4ed; border-radius: 9px; background: white; color: #39465b; font-size: 12px; }
.ua-test { padding: 16px 26px; border-bottom: 1px solid var(--line); }
.ua-test-form { display: flex; gap: 9px; flex-wrap: wrap; }
.ua-test-form input { flex: 1 1 320px; min-width: 200px; height: 38px; padding: 0 11px; border: 1px solid #dfe4ed; border-radius: 9px; outline-color: var(--primary); color: var(--ink); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.test-result { margin-top: 12px; padding: 11px 13px; border-radius: 9px; display: flex; flex-direction: column; gap: 3px; font-size: 12px; background: #f4f6fa; }
.test-result strong { font-size: 13px; }
.test-result code, .rule-pattern { padding: 1px 5px; border-radius: 5px; background: #eef1f7; color: #39465b; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.test-result.action-block { background: #fff0f1; color: #a13843; }
.test-result.action-clear { background: #fff8e7; color: #8a5a12; }
.test-result.action-playlist { background: #edf0ff; color: #3449cf; }
.test-result.action-serve { background: #e9f8f1; color: #15744e; }
.rule-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.rule-badge.action-block { color: #a13843; background: #fff0f1; }
.rule-badge.action-clear { color: #8a5a12; background: #fff3dd; }
.rule-badge.action-playlist { color: #3449cf; background: #edf0ff; }
.rule-badge.action-serve { color: #15744e; background: #e7f7ef; }
.rule-actions { display: flex; align-items: center; gap: 5px; }
.rule-actions-head { width: 1%; }
.rule-disabled { opacity: .55; }

@media (max-width: 720px) {
    .log-controls, .enforce-form { width: 100%; }
    .enforce-form { align-items: center; }
}

/* Request detail dialog */
.log-detail-head { width: 1%; }
.detail-dialog { width: min(760px, calc(100% - 28px)); max-width: 760px; max-height: calc(100% - 40px); margin: auto; padding: 0; border: 0; border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px #08101f4d; }
.detail-dialog::backdrop { background: #0c152499; backdrop-filter: blur(3px); }
.detail-shell { padding: 20px 24px 24px; overflow: auto; max-height: calc(100vh - 80px); }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.detail-head h2 { margin: 0; font-size: 19px; overflow-wrap: anywhere; }
.detail-grid { margin: 0 0 20px; display: grid; grid-template-columns: 150px 1fr; gap: 7px 14px; }
.detail-grid dt { color: var(--muted); font-size: 11px; font-weight: 600; }
.detail-grid dd { margin: 0; color: #283447; font-size: 12px; overflow-wrap: anywhere; }
.detail-section h3 { margin: 0 0 8px; font-size: 13px; }
.detail-pre { margin: 0; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: #f7f9fc; color: #39465b; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 520px) {
    .detail-grid { grid-template-columns: 1fr; gap: 2px 0; }
    .detail-grid dd { margin-bottom: 8px; }
}

/* Log filter bar */
.log-filters { padding: 12px 26px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); background: #fcfdff; }
.log-search { width: 280px; }
.log-filters select { height: 38px; max-width: 190px; padding: 0 10px; border: 1px solid #dfe4ed; border-radius: 9px; background: white; color: #39465b; font-size: 12px; }
.log-filter-count { font-size: 12px; margin-left: auto; }

@media (max-width: 720px) {
    .log-search { width: 100%; }
    .log-filters select { flex: 1 1 140px; max-width: none; }
    .log-filter-count { margin-left: 0; width: 100%; }
}
