:root {
    color-scheme: light;
    font-family: "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
    color: #172033;
    background: #f3f6fb;
    line-height: 1.5;
    --page-gutter: clamp(14px, 4vw, 48px);
    --touch-size: 44px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .6; }
.hidden { display: none !important; }
button, input, select, a { min-height: var(--touch-size); }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #f3b948; outline-offset: 2px; }
.skip-link { position: absolute; z-index: 10; top: 8px; left: 8px; padding: 8px 12px; border-radius: 8px; color: #fff; background: #173b62; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    padding: 24px max(24px, calc((100vw - 1240px) / 2));
    color: #fff;
    background: linear-gradient(120deg, #173b62, #237c91);
}
.page-header-main { min-width: 0; }
.site-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.site-nav-link { display: inline-flex; align-items: center; padding: 5px 11px; border: 1px solid rgb(255 255 255 / 28%); border-radius: 999px; color: #d8f0f2; font-size: 12px; text-decoration: none; }
.site-nav-link:hover, .site-nav-link.is-current { color: #173b62; background: #fff; }
.eyebrow, .section-kicker { margin: 0 0 5px; font-size: 11px; letter-spacing: .16em; font-weight: 700; }
.eyebrow { color: #a8e8eb; }
.section-kicker { color: #43889d; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(26px, 4vw, 40px); }
h2 { margin-bottom: 0; font-size: 21px; }
.subtitle { margin: 0; color: #d8f0f2; }
.media-service-info { margin: 10px 0 0; color: #b9e6e8; font-size: 13px; }
.page-content { width: min(1240px, calc(100% - 48px)); margin: 28px auto 64px; }
.panel { padding: 24px; margin-bottom: 24px; border: 1px solid #e1e8f1; border-radius: 16px; background: #fff; box-shadow: 0 8px 28px rgb(30 63 99 / 6%); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; }
.panel-heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.count-badge { padding: 4px 10px; border-radius: 999px; color: #22627a; background: #e7f6f7; font-size: 13px; }
.two-column { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.message { min-height: 0; margin-bottom: 16px; padding: 0; border-radius: 8px; }
.message:not(:empty) { padding: 11px 14px; }
.message.success { color: #17653d; background: #e7f7ed; }
.message.error { color: #a33131; background: #fff0f0; }
.toast {
    position: fixed;
    z-index: 1000;
    top: 18px;
    left: 50%;
    max-width: min(560px, calc(100vw - 32px));
    padding: 12px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgb(23 32 51 / 20%);
    opacity: 0;
    color: #17653d;
    background: #e7f7ed;
    font-size: 14px;
    font-weight: 700;
    pointer-events: none;
    transform: translate(-50%, -16px);
    transition: opacity .2s ease, transform .2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.error { color: #a33131; border-color: #f0caca; background: #fff0f0; }
.toast.success { border-color: #bde8cc; }
.state { padding: 28px 12px; text-align: center; color: #748197; }
.hidden { display: none !important; }
.table-wrapper { overflow-x: auto; }
.stream-table { width: 100%; border-collapse: collapse; }
.stream-table th, .stream-table td { padding: 13px 10px; border-bottom: 1px solid #edf1f6; text-align: left; vertical-align: middle; }
.stream-table th { color: #66758a; font-size: 13px; font-weight: 700; white-space: nowrap; }
.stream-table td { font-size: 14px; }
.source-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #66758a; }
.mobile-card-list { display: none; }
.mobile-card { padding: 14px; border: 1px solid #dce5ee; border-radius: 12px; background: #fbfdff; box-shadow: 0 4px 12px rgb(30 63 99 / 5%); }
.mobile-card + .mobile-card { margin-top: 10px; }
.mobile-card-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.mobile-card-heading strong { min-width: 0; overflow-wrap: anywhere; }
.mobile-card-id { flex: 0 0 auto; color: #738399; font-size: 12px; }
.mobile-card-field { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-top: 1px solid #edf1f6; font-size: 13px; }
.mobile-card-label { flex: 0 0 62px; color: #718096; font-weight: 700; }
.mobile-card-value { min-width: 0; color: #2d3b50; text-align: right; overflow-wrap: anywhere; }
.mobile-card-field-long .mobile-card-value { text-align: left; }
.mobile-record-toggle { display: flex; align-items: center; gap: 9px; min-height: var(--touch-size); margin-top: 5px; color: #435269; font-size: 13px; font-weight: 700; }
.mobile-record-toggle input, .stream-table input[type="checkbox"] { width: 20px; height: 20px; min-height: 20px; accent-color: #237c91; }
.mobile-card-actions { margin-top: 10px; padding-top: 10px; border-top: 1px solid #edf1f6; }
.status-pill { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 12px; }
.status-on { color: #17653d; background: #e7f7ed; }
.status-off { color: #69778a; background: #eef1f5; }
.row-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.button { padding: 9px 15px; border: 0; border-radius: 8px; color: #fff; background: #237c91; font-weight: 700; transition: background .15s, transform .15s; }
.button:hover:not(:disabled) { background: #1a6477; transform: translateY(-1px); }
.button-secondary { color: #24516a; background: #e8f0f7; }
.button-secondary:hover:not(:disabled) { background: #d7e5f0; }
.button-small { padding: 6px 10px; font-size: 12px; }
.page-header .button-secondary { color: #fff; background: rgb(255 255 255 / 15%); border: 1px solid rgb(255 255 255 / 35%); }
.page-header .button-secondary:hover:not(:disabled) { background: rgb(255 255 255 / 25%); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid label, .url-field { display: flex; flex-direction: column; gap: 6px; color: #58677c; font-size: 13px; font-weight: 700; }
.full-width { grid-column: 1 / -1; }
input, select { width: 100%; min-width: 0; padding: 10px 11px; border: 1px solid #d5dfeb; border-radius: 8px; outline: none; color: #172033; background: #fff; }
input:focus, select:focus { border-color: #3d9bb0; box-shadow: 0 0 0 3px rgb(61 155 176 / 13%); }
input[readonly] { color: #758399; background: #f5f7fa; }
input[type="url"], input[name="url"] { overflow-wrap: anywhere; }
.checkbox-label { flex-direction: row !important; align-items: center; min-height: var(--touch-size); padding-top: 28px; }
.checkbox-label input { width: 20px; height: 20px; min-height: 20px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.url-field { margin-bottom: 16px; }
.url-actions { display: flex; gap: 8px; min-width: 0; }
.url-actions input { flex: 1; min-width: 0; }
.url-actions .button { flex: 0 0 auto; }
.video-player { width: 100%; aspect-ratio: 16 / 9; margin-top: 20px; border-radius: 10px; background: #101820; }
.hint { margin: 18px 0 0; color: #78869a; font-size: 13px; line-height: 1.65; }

@media (max-width: 900px) {
    .two-column { grid-template-columns: 1fr; }
    .page-header { align-items: flex-start; flex-direction: column; }
    .page-header > .button { width: 100%; }
}
@media (max-width: 640px) {
    html { scroll-padding-top: 12px; }
    body { padding-bottom: env(safe-area-inset-bottom); }
    .page-header { gap: 16px; padding: 20px var(--page-gutter) 24px; }
    .site-nav { margin-bottom: 16px; }
    .page-header h1 { font-size: clamp(25px, 8vw, 34px); }
    .page-content { width: calc(100% - 20px); margin-top: 14px; margin-bottom: 40px; }
    .panel { padding: 16px; margin-bottom: 14px; border-radius: 12px; }
    .panel-heading { align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
    .panel-heading-actions { justify-content: flex-start; width: 100%; }
    .panel-heading-actions .button { flex: 1; }
    .form-grid { grid-template-columns: 1fr; }
    .full-width { grid-column: auto; }
    .checkbox-label { padding-top: 0; }
    .table-wrapper { display: none; }
    .mobile-card-list { display: block; }
    .form-actions { width: 100%; }
    .form-actions .button { flex: 1 1 140px; }
    .url-actions { align-items: stretch; flex-direction: column; }
    .url-actions .button { width: 100%; }
    .row-actions .button { flex: 1 1 80px; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
    .button:hover:not(:disabled) { transform: none; }
}
