:root {
    --bg: #f5f8fc;
    --surface: #ffffff;
    --surface-2: #eef5fb;
    --line: #d8e4ef;
    --text: #17324d;
    --muted: #647a91;
    --brand: #0f9f92;
    --brand-2: #198bd1;
    --danger: #c9475d;
    --warning: #b67a10;
    --shadow: 0 12px 30px rgba(39, 83, 117, 0.09);
    --radius: 18px;
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Tahoma, Arial, sans-serif;
    min-height: 100vh;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hide { display: none !important; }

.layout, .shell { display: flex; min-height: 100vh; }
.side {
    width: 250px;
    background: #ffffff;
    border-left: 1px solid var(--line);
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 11px; font-size: 19px; font-weight: 800; margin-bottom: 34px; }
.logo {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, #8be6dd, #8bc7ec);
    display: grid;
    place-items: center;
    color: #14546a;
    font-weight: 900;
}
.nav { display: grid; gap: 7px; }
.nav a {
    display: flex;
    justify-content: space-between;
    padding: 13px 14px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--muted);
}
.nav a:hover, .nav a.active { background: #e7f6f4; color: #087f78; font-weight: 700; }

.main { flex: 1; padding: 30px; max-width: 1500px; margin: 0 auto; width: 100%; min-width: 0; }
.top { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 24px; }
.eyebrow { color: var(--brand); font-size: 13px; margin: 0 0 7px; font-weight: 700; }
.title { margin: 0; font-size: clamp(24px, 3.5vw, 34px); }
.muted { color: var(--muted); }
.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

.btn {
    display: inline-block;
    padding: 11px 15px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
    text-decoration: none;
}
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #ffffff; border: 0; font-weight: 700; }
.btn.danger { color: var(--danger); border-color: #efb6c0; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 19px;
    box-shadow: var(--shadow);
}
.label { display: block; color: var(--muted); font-size: 13px; }
.metric { font-size: 29px; font-weight: 800; margin: 9px 0; }

.section { margin-top: 24px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; gap: 10px; }
.section h2 { font-size: 20px; margin: 0; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 680px; }
.table th, .table td { text-align: right; padding: 14px 11px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { color: var(--muted); font-size: 12px; font-weight: 400; }

.badge { display: inline-flex; padding: 6px 10px; border-radius: 999px; font-size: 12px; width: fit-content; }
.ok { background: #daf5ef; color: #087f78; }
.off { background: #fde8ec; color: #a92d48; }
.trial { background: #fff2cc; color: #91600a; }

.form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fbfdff;
    color: var(--text);
    outline: none;
}
.field input:focus, .field select:focus { border-color: var(--brand); }

.alert { padding: 13px 15px; border-radius: 12px; background: #e7f6f4; color: #087f78; margin-bottom: 17px; }
.alert.error { background: #fde8ec; color: #a92d48; }
.notice { padding: 14px 16px; border-radius: 14px; background: #e7f6f4; border: 1px solid #b8e7e0; color: #087f78; margin-bottom: 18px; }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(145deg, #f5fbff, #eef9f6); padding: 16px; }
.login-box { width: min(92vw, 430px); background: #ffffff; border: 1px solid var(--line); border-radius: 22px; padding: 29px; box-shadow: var(--shadow); }
.login-box h1 { margin: 18px 0 8px; }
.login-box .field { margin-bottom: 12px; }
.switch { display: flex; gap: 8px; margin: 16px 0; }
.switch a { flex: 1; text-align: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--muted); }
.switch a.active { background: #e7f6f4; color: #087f78; border-color: #b8e7e0; font-weight: 700; }

/* Public Player */
.hero { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 20px; align-items: stretch; }
.hero-main {
    min-height: 290px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: linear-gradient(120deg, rgba(225, 247, 246, 0.94), rgba(238, 247, 253, 0.92)),
                url('https://images.unsplash.com/photo-1489599849927-2ee91cede3ba?auto=format&fit=crop&w=1400&q=80') center/cover;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    color: var(--text);
}
.hero-main h2 { font-size: clamp(24px, 3.5vw, 42px); margin: 10px 0 8px; }
.hero-main p { max-width: 600px; color: #2b4966; margin: 0 0 18px; line-height: 1.6; }

.mini-list { display: grid; gap: 12px; }
.mini { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.thumb { width: 64px; height: 52px; border-radius: 10px; background: linear-gradient(135deg, #0f9f92, #198bd1); flex-shrink: 0; }
.mini strong { display: block; margin-bottom: 4px; }
.mini small { color: var(--muted); }

.chips { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.chip { padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #ffffff; white-space: nowrap; }
.chip.active { background: var(--brand); color: #ffffff; border-color: var(--brand); font-weight: 700; }

.media-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.media {
    position: relative;
    min-height: 170px;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(150deg, #163952, #0a1728);
    border: 1px solid var(--line);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    color: #ffffff;
}
.media:before { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 30%, rgba(0, 0, 0, 0.72)); }
.media > * { position: relative; }
.media small { color: #cbd5e1; }
.media .play { position: absolute; top: 14px; right: 14px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); width: 38px; height: 38px; display: grid; place-items: center; }

.device-dialog {
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 24px;
    max-width: 380px;
    width: 90vw;
    box-shadow: var(--shadow);
}
.device-dialog h3 { margin-top: 0; }

@media (max-width: 1050px) {
    .grid { grid-template-columns: repeat(2, 1fr); }
    .media-grid { grid-template-columns: repeat(3, 1fr); }
    .hero { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .layout, .shell { display: block; }
    .side { height: auto; width: auto; position: static; padding: 15px; border-left: 0; border-bottom: 1px solid var(--line); }
    .brand { margin-bottom: 14px; }
    .nav { display: flex; overflow-x: auto; gap: 8px; }
    .nav a { white-space: nowrap; }
    .main { padding: 18px 14px; }
    .top { flex-direction: column; }
    .grid { grid-template-columns: 1fr 1fr; }
    .media-grid { grid-template-columns: repeat(2, 1fr); }
    .form { grid-template-columns: 1fr; }
    .field.full { grid-column: auto; }
}
