:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: #0d1c30;
  --panel-raised: #12243b;
  --line: rgba(157, 185, 220, .14);
  --text: #eef5ff;
  --muted: #92a6c0;
  --cyan: #55d8df;
  --blue: #66a8ff;
  --gold: #ffc66b;
  --red: #ff8792;
  --green: #4ed5ac;
  --radius: 22px;
  --shadow: 0 24px 80px rgba(0, 0, 0, .28);
  font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(ellipse at 84% 8%, rgba(30, 105, 194, .19), transparent 35%),
    radial-gradient(ellipse at 9% 46%, rgba(19, 151, 162, .09), transparent 28%),
    var(--bg);
  font-size: 15px;
  line-height: 1.6;
}
body[dir="rtl"] { font-family: "Segoe UI", Tahoma, Arial, sans-serif; }
a { color: inherit; }
.shell { max-width: 1240px; margin: 0 auto; padding: 0 36px; }
.topbar { height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; font-size: 21px; font-weight: 800; letter-spacing: -.7px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid rgba(85, 216, 223, .4); border-radius: 13px; color: #071520; background: linear-gradient(135deg, var(--cyan), #4e98ff); font-size: 24px; font-weight: 800; box-shadow: 0 5px 20px rgba(68, 187, 215, .22); }
.brand-accent { color: var(--cyan); }
.brand small { display: block; color: var(--muted); font-size: 8px; font-weight: 600; line-height: 1.2; letter-spacing: 2px; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.top-actions form, .device-head form, .playlist-row form { margin: 0; }
.manager-chip, .lang-link { height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; color: #c5d4e8; text-decoration: none; font-size: 12px; }
.manager-chip i, .status i, .active-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(78, 213, 172, .12); }
.lang-link { color: var(--cyan); font-weight: 700; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 13px; padding: 0 16px; border: 1px solid transparent; border-radius: 12px; font: inherit; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; transition: transform .16s, background .16s, border-color .16s, color .16s; }
.button:hover { transform: translateY(-1px); }
.button--primary { color: #061423; background: linear-gradient(110deg, #5ce0dc, #58a6ff); box-shadow: 0 7px 25px rgba(66, 177, 219, .16); }
.button--primary:hover { filter: brightness(1.06); }
.button--quiet, .button--outline { color: #ccd9e9; background: transparent; border-color: var(--line); }
.button--quiet { min-height: 38px; }
.button--quiet:hover, .button--outline:hover { color: var(--cyan); border-color: rgba(85, 216, 223, .45); }
.button--outline { background: rgba(255, 255, 255, .025); }
.button--danger { color: #ff9aa4; background: rgba(255, 119, 133, .13); border-color: rgba(255, 119, 133, .25); }
.button--wide { width: 100%; min-height: 50px; justify-content: space-between; padding: 0 18px; }
.button--small { min-height: 34px; padding: 0 12px; font-size: 12px; }
.button:focus-visible, .icon-button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(85, 216, 223, .65); outline-offset: 2px; }

.hero { position: relative; display: flex; align-items: center; justify-content: space-between; min-height: 248px; overflow: hidden; margin: 34px 0 47px; padding: 38px 46px; border: 1px solid rgba(99, 166, 223, .18); border-radius: 28px; background: linear-gradient(114deg, rgba(15, 43, 73, .98), rgba(12, 35, 59, .84) 62%, rgba(15, 61, 76, .75)); box-shadow: var(--shadow); }
.hero::before { position: absolute; inset: 0; background: linear-gradient(135deg, transparent 40%, rgba(77, 202, 222, .065)); content: ""; pointer-events: none; }
.hero-copy { position: relative; z-index: 1; max-width: 690px; }
.eyebrow { display: inline-block; color: var(--cyan); font-size: 10px; font-weight: 700; letter-spacing: 1.65px; text-transform: uppercase; }
.hero h1 { max-width: 620px; margin: 10px 0 9px; font-size: clamp(30px, 4vw, 48px); line-height: 1.18; letter-spacing: -1.5px; }
.hero p { margin: 0; color: #aac0d7; font-size: 15px; }
.hero-orbit { position: relative; width: 174px; height: 174px; flex: none; margin-inline-end: 42px; }
.orbit { position: absolute; inset: 5px; border: 1px solid rgba(91, 219, 223, .19); border-radius: 50%; }
.orbit--two { inset: 27px; border-color: rgba(91, 219, 223, .25); }
.orbit-core { position: absolute; inset: 48px; display: grid; place-items: center; border: 1px solid rgba(104, 218, 224, .48); border-radius: 30px; transform: rotate(45deg); color: var(--cyan); background: linear-gradient(135deg, #153b59, #123143); font-size: 40px; font-weight: 800; box-shadow: 0 0 45px rgba(62, 199, 211, .18); }
.orbit-core i { transform: rotate(-45deg); font-style: normal; }
.orbit-dot { position: absolute; top: 18px; right: 35px; width: 11px; height: 11px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 18px var(--gold); }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.section-heading h2, .form-card h2, .pairing-card h2 { margin: 3px 0 0; font-size: 23px; letter-spacing: -.55px; }
.count-pill { padding: 5px 10px; border: 1px solid rgba(85, 216, 223, .2); border-radius: 999px; color: #80e3e4; background: rgba(85, 216, 223, .06); font-size: 11px; font-weight: 700; white-space: nowrap; }
.count-pill--small { min-width: 28px; padding: 2px 8px; text-align: center; }
.device-card, .form-card, .pairing-card, .empty-state { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(140deg, rgba(15, 32, 52, .98), rgba(11, 25, 42, .97)); box-shadow: 0 15px 48px rgba(0, 0, 0, .13); }
.device-card { overflow: visible; margin-bottom: 15px; }
.device-head { display: flex; align-items: center; gap: 13px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.device-avatar { width: 44px; height: 44px; display: grid; flex: none; place-items: center; border-radius: 14px; color: #6ce2e1; background: linear-gradient(145deg, #1d5a7b, #143956); font-size: 20px; font-weight: 800; }
.device-title { min-width: 0; flex: 1; }
.device-title h3 { overflow: hidden; margin: 0; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.device-id { display: block; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.status, .active-pill { display: inline-flex; align-items: center; gap: 8px; color: #7ce2bd; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status--off { color: #f7a6ae; }
.status--off i { background: var(--red); }
.icon-button { position: relative; width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: #bdcde0; background: rgba(255, 255, 255, .025); font-size: 19px; cursor: pointer; text-decoration: none; }
.icon-button--danger { color: #ff8d98; }
.icon-button--danger:hover { border-color: rgba(255, 119, 133, .5); background: rgba(255, 119, 133, .08); }
.device-body { padding: 19px 22px 22px; }
.list-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.list-header h4 { margin: 0; font-size: 13px; }
.list-header p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.list-empty, .pending-empty { padding: 14px 16px; border: 1px dashed rgba(153, 184, 218, .2); border-radius: 13px; color: var(--muted); font-size: 12px; }
.playlist-row { position: relative; display: flex; align-items: center; gap: 11px; min-height: 66px; margin-top: 8px; padding: 9px 10px; border: 1px solid rgba(147, 177, 212, .1); border-radius: 14px; background: rgba(255, 255, 255, .025); }
.playlist-kind { width: 39px; height: 39px; display: grid; flex: none; place-items: center; border-radius: 12px; color: var(--cyan); background: rgba(66, 188, 208, .12); font: 800 11px Inter, "Segoe UI", sans-serif; }
.playlist-kind--xtream { color: #83b7ff; background: rgba(76, 144, 255, .14); }
.playlist-meta { min-width: 0; flex: 1; }
.playlist-meta strong, .playlist-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playlist-meta strong { font-size: 13px; }
.playlist-meta span { color: var(--muted); font-size: 10px; }
.active-pill { padding: 5px 9px; border: 1px solid rgba(78, 213, 172, .17); border-radius: 999px; background: rgba(78, 213, 172, .06); }
.active-pill i { width: 6px; height: 6px; }
.edit-details { position: relative; }
.edit-details summary { list-style: none; }
.edit-details summary::-webkit-details-marker { display: none; }
.edit-popover { position: absolute; z-index: 5; top: 42px; inset-inline-end: 0; width: min(340px, calc(100vw - 48px)); padding: 16px; border: 1px solid rgba(128, 178, 224, .24); border-radius: 17px; background: #10233a; box-shadow: 0 18px 60px rgba(0, 0, 0, .45); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(300px, .95fr); gap: 17px; margin-top: 39px; }
.form-card, .pairing-card { padding: 23px; }
.section-heading--inside { align-items: center; margin-bottom: 7px; }
.step-number { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid rgba(85, 216, 223, .25); border-radius: 12px; color: var(--cyan); font-size: 22px; }
.form-intro, .pairing-card > p { margin: 0 0 19px; color: var(--muted); font-size: 12px; }
.stack-form { display: grid; gap: 13px; }
.stack-form label { display: grid; gap: 6px; color: #c7d7e9; font-size: 12px; font-weight: 600; }
.stack-form input, .stack-form select, .pair-code-form input { width: 100%; min-width: 0; height: 45px; padding: 0 12px; border: 1px solid rgba(142, 176, 214, .18); border-radius: 11px; color: #f1f6fc; background: #091728; font: inherit; font-size: 13px; }
.stack-form input::placeholder, .pair-code-form input::placeholder { color: #647b96; }
.stack-form input[type="url"], .stack-form input[type="email"] { direction: ltr; text-align: left; }
.stack-form select { appearance: auto; }
.form-footnote { margin: 13px 0 0; color: #8298b2; font-size: 10px; }
.pairing-card { overflow: hidden; background: radial-gradient(ellipse at 85% 2%, rgba(49, 131, 195, .19), transparent 40%), linear-gradient(145deg, #10233a, #0b1b2e); }
.pairing-card h2 { font-size: 20px; }
.pairing-art { position: relative; height: 92px; display: flex; align-items: center; justify-content: center; gap: 28px; margin: 3px 0 13px; }
.pairing-screen { width: 116px; height: 67px; display: grid; place-items: center; border: 5px solid #264967; border-radius: 10px; color: var(--cyan); background: linear-gradient(135deg, #10283d, #0a1727); font-size: 14px; font-weight: 800; box-shadow: 0 10px 24px #0005; }
.pairing-link { color: var(--gold); font-size: 28px; }
.pairing-phone { width: 42px; height: 67px; border: 3px solid #416380; border-radius: 11px; background: linear-gradient(160deg, #163550, #0a1a2b); box-shadow: inset 0 -5px 0 rgba(81, 204, 218, .16); }
.pending-list { display: grid; gap: 7px; margin: 14px 0; }
.pending-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .025); }
.pending-item b, .pending-item small { display: block; }
.pending-item b { font-size: 12px; }
.pending-item small { color: var(--muted); font-size: 10px; }
.pending-tag { color: var(--gold); font-size: 10px; }
.pair-code-actions { display: flex; align-items: flex-start; gap: 9px; margin-top: 13px; }
.pair-code-form { min-width: 0; display: flex; flex: 1; gap: 8px; }
.pair-code-form input { font: 700 15px Inter, "Segoe UI", sans-serif; letter-spacing: 3px; text-align: center; direction: ltr; }
.reject-details { position: relative; }
.reject-details summary { width: max-content; min-width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; border: 1px solid rgba(255, 119, 133, .22); border-radius: 12px; color: #ff9aa4; cursor: pointer; list-style: none; font-size: 11px; white-space: nowrap; }
.reject-details summary::-webkit-details-marker { display: none; }
.reject-details summary::after { content: "×"; font-size: 19px; }
.reject-details[open] .pair-code-form { position: absolute; z-index: 5; top: 49px; inset-inline-end: 0; width: min(330px, calc(100vw - 48px)); padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #10233a; box-shadow: var(--shadow); }
.reject-details[open] summary { font-size: 0; }
.reject-details[open] summary::after { content: "×"; font-size: 20px; }
.empty-state { margin-bottom: 16px; padding: 38px 22px; text-align: center; }
.empty-icon { width: 50px; height: 50px; display: grid; place-items: center; margin: 0 auto 10px; border-radius: 16px; color: var(--cyan); background: rgba(85, 216, 223, .1); font-size: 26px; }
.empty-state h3 { margin: 0; font-size: 17px; }
.empty-state p { max-width: 440px; margin: 5px auto 0; color: var(--muted); font-size: 12px; }
.footer { display: flex; justify-content: space-between; gap: 14px; margin: 39px 0 20px; padding-top: 17px; border-top: 1px solid var(--line); color: #8094ad; font: 600 9px Inter, "Segoe UI", sans-serif; letter-spacing: .7px; }
.toast { margin: 13px 0 0; padding: 11px 15px; border: 1px solid rgba(78, 213, 172, .22); border-radius: 12px; color: #82e6c1; background: rgba(78, 213, 172, .08); font-size: 12px; }
.toast--error { border-color: rgba(255, 119, 133, .25); color: #ffadb5; background: rgba(255, 119, 133, .08); }
.toast--warning { border-color: rgba(255, 190, 82, .35); color: #ffd38a; background: rgba(255, 190, 82, .10); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, .94fr) minmax(400px, 1.06fr); margin: 0 -36px; }
.login-story { position: relative; min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 42px clamp(30px, 7vw, 100px); background: radial-gradient(ellipse at 0 100%, rgba(69, 216, 221, .19), transparent 48%), linear-gradient(145deg, #0d2943, #0b1c31 62%, #0a1728); }
.login-story::after { position: absolute; inset-inline-end: -230px; bottom: 16%; width: 440px; height: 440px; border: 1px solid rgba(86, 209, 222, .16); border-radius: 50%; box-shadow: 0 0 0 42px rgba(86, 209, 222, .025), 0 0 0 90px rgba(86, 209, 222, .018); content: ""; }
.story-copy { position: relative; z-index: 1; max-width: 470px; margin: auto 0; }
.story-copy h1 { margin: 13px 0; font-size: clamp(37px, 4.4vw, 59px); line-height: 1.12; letter-spacing: -2px; }
.story-copy p { max-width: 370px; color: #a7bfd5; }
.story-foot { color: #7189a5; font: 600 9px Inter, "Segoe UI", sans-serif; letter-spacing: 1.3px; }
.login-panel { display: flex; flex-direction: column; padding: 35px clamp(28px, 7vw, 104px); background: radial-gradient(ellipse at 70% 15%, rgba(58, 118, 182, .08), transparent 38%); }
.panel-top { display: flex; align-items: center; justify-content: flex-end; }
.mobile-brand { display: none; }
.login-card { width: min(100%, 405px); margin: auto; }
.login-card h2 { margin: 9px 0 3px; font-size: 32px; letter-spacing: -1px; }
.login-card > p { margin: 0 0 26px; }
.login-card .stack-form { gap: 18px; }
.login-card .stack-form label { gap: 8px; }
.login-card .stack-form input { height: 52px; }
.security-note { margin: 18px 0 0; color: #8097b2; font-size: 11px; text-align: center; }
.security-note span { color: var(--green); }
.inline-error { margin: 12px 0; padding: 10px 12px; border: 1px solid rgba(255, 119, 133, .25); border-radius: 10px; color: #ffadb5; background: rgba(255, 119, 133, .08); font-size: 12px; }

@media (max-width: 920px) {
  .shell { padding: 0 23px; }
  .login-layout { margin: 0 -23px; }
  .hero { padding: 30px 32px; }
  .hero-orbit { margin-inline-end: 8px; transform: scale(.8); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .pairing-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, .95fr); column-gap: 20px; align-items: center; }
  .pairing-card > .eyebrow, .pairing-card h2, .pairing-card > p { grid-column: 1; }
  .pairing-art { grid-column: 2; grid-row: 1 / 4; }
  .pending-list, .pair-code-actions { width: 100%; grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  body { font-size: 14px; }
  .shell { padding: 0 15px; }
  .topbar { height: 68px; }
  .topbar > .brand { font-size: 18px; }
  .brand-mark { width: 36px; height: 36px; }
  .manager-chip { display: none; }
  .top-actions { gap: 8px; }
  .button--quiet { padding: 0 10px; font-size: 11px; }
  .hero { min-height: 0; margin: 20px 0 33px; padding: 25px 21px; border-radius: 21px; }
  .hero h1 { font-size: 31px; letter-spacing: -1px; }
  .hero p { max-width: 300px; font-size: 12px; }
  .hero-orbit { position: absolute; inset-inline-end: -48px; bottom: -92px; opacity: .14; transform: scale(.62); }
  .section-heading { align-items: center; }
  .section-heading h2 { font-size: 19px; }
  .eyebrow { font-size: 9px; }
  .device-head { gap: 9px; padding: 14px; }
  .device-avatar { width: 38px; height: 38px; border-radius: 12px; }
  .device-title h3 { font-size: 14px; }
  .device-id { max-width: 155px; font-size: 9px; }
  .status { gap: 5px; font-size: 9px; }
  .status i { width: 6px; height: 6px; box-shadow: 0 0 0 3px rgba(78, 213, 172, .1); }
  .icon-button { width: 31px; height: 31px; }
  .device-body { padding: 14px; }
  .list-header h4 { font-size: 12px; }
  .playlist-row { min-height: 0; flex-wrap: wrap; gap: 8px; padding: 9px; }
  .playlist-kind { width: 34px; height: 34px; }
  .playlist-meta { flex-basis: calc(100% - 55px); }
  .playlist-row > .active-pill, .playlist-row > form, .playlist-row > .edit-details { margin-inline-start: auto; }
  .playlist-row > .active-pill { margin-inline-start: 0; }
  .edit-popover { position: fixed; top: 50%; left: 50%; right: auto; width: min(350px, calc(100vw - 30px)); max-height: 86vh; overflow: auto; transform: translate(-50%, -50%); }
  .dashboard-grid { gap: 12px; margin-top: 29px; }
  .form-card, .pairing-card { padding: 17px; border-radius: 18px; }
  .section-heading--inside h2, .pairing-card h2 { font-size: 19px; }
  .pairing-card { display: block; }
  .pairing-art { height: 76px; margin-top: 8px; }
  .pairing-screen { height: 57px; }
  .pairing-phone { height: 59px; }
  .pairing-card > p { font-size: 11px; }
  .pairing-card > .eyebrow { margin-top: 5px; }
  .pair-code-actions { gap: 7px; }
  .pair-code-form { gap: 6px; }
  .pair-code-form .button { padding: 0 11px; font-size: 11px; }
  .pair-code-form input { height: 42px; letter-spacing: 2px; }
  .reject-details summary { width: 42px; min-width: 42px; padding: 0; font-size: 0; }
  .footer { flex-direction: column; font-size: 8px; }
  .login-layout { min-height: 100vh; display: flex; flex-direction: column; margin: 0 -15px; }
  .login-story { min-height: 0; padding: 22px 20px 25px; }
  .login-story > .brand { font-size: 18px; }
  .story-copy { margin: 35px 0 0; }
  .story-copy h1 { margin: 9px 0; font-size: 35px; }
  .story-copy p { margin: 0; font-size: 12px; }
  .story-foot { display: none; }
  .login-story::after { inset-inline-end: -125px; bottom: -160px; width: 230px; height: 230px; }
  .login-panel { flex: 1; padding: 20px; }
  .panel-top { justify-content: space-between; }
  .mobile-brand { display: block; font-size: 20px; font-weight: 800; }
  .login-card { margin: 44px auto 30px; }
  .login-card h2 { font-size: 27px; }
  .login-card > p { font-size: 12px; }
  .login-card .stack-form input { height: 49px; }
}
@media (max-width: 380px) {
  .shell { padding: 0 11px; }
  .top-actions { gap: 5px; }
  .lang-link { height: 34px; padding: 0 9px; }
  .button--quiet { padding: 0 8px; }
  .device-head { gap: 7px; padding: 12px 10px; }
  .device-id { max-width: 122px; }
  .device-body { padding: 11px; }
  .playlist-row { gap: 6px; }
  .pair-code-actions { flex-wrap: wrap; }
  .pair-code-form { flex-basis: 100%; }
  .reject-details { margin-inline-start: auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
