:root {
  color-scheme: dark;
  --bg: #09111e;
  --panel: #111d2d;
  --panel-2: #0c1727;
  --panel-3: #15243a;
  --line: rgba(222,235,255,.12);
  --line-strong: rgba(222,235,255,.18);
  --text: #f3f8ff;
  --muted: #9aacc4;
  --cyan: #42d9e8;
  --blue: #5d8cff;
  --violet: #a78bfa;
  --green: #4ade80;
  --amber: #fbbf24;
  --red: #fb7185;
  --rose: #f472b6;
  --shadow: 0 24px 70px rgba(0,0,0,.26);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { background: radial-gradient(circle at 18% 0%, rgba(66,217,232,.12), transparent 28%), radial-gradient(circle at 86% 8%, rgba(167,139,250,.12), transparent 25%), linear-gradient(135deg, #09111e 0%, #0d1726 42%, #111827 100%); }
a { color: inherit; }
button, input, select, textarea { font: inherit; }

.shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); background: rgba(6,13,25,.88); backdrop-filter: blur(18px); padding: 20px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.brand strong { display: block; font-size: 18px; }
.brand span, .user-box span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.logo-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 8px; background: linear-gradient(135deg, rgba(66,217,232,.24), rgba(167,139,250,.18)); color: #dffbff; font-weight: 900; letter-spacing: .02em; border: 1px solid rgba(66,217,232,.22); box-shadow: 0 12px 32px rgba(66,217,232,.12); }

nav { display: grid; gap: 7px; }
nav a { display: flex; align-items: center; gap: 11px; text-decoration: none; color: #cbd8e8; border-radius: 8px; padding: 9px 10px; transition: .15s ease; border: 1px solid transparent; }
nav a span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: rgba(255,255,255,.055); color: #bfd0e7; font-size: 11px; font-weight: 900; }
nav a:hover { background: rgba(255,255,255,.075); border-color: var(--line); transform: translateX(2px); }
nav a.active { background: linear-gradient(135deg, var(--cyan), var(--blue)); color: #06111f; font-weight: 800; box-shadow: 0 12px 28px rgba(66,217,232,.18); }
nav a.active span { background: rgba(6,17,31,.16); color: #06111f; }
.nav-group { border-radius: 8px; margin-bottom: 6px; }
.nav-group summary { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 8px 10px; color: #aebed3; cursor: pointer; border-radius: 8px; }
.nav-group summary span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: rgba(66,217,232,.08); color: #9ee8f1; font-size: 10px; font-weight: 900; }
.nav-group summary strong { font-size: 13px; text-transform: uppercase; letter-spacing: 0; }
.nav-group[open] summary { background: rgba(255,255,255,.035); border: 1px solid var(--line); }
.nav-group-links { display: grid; gap: 5px; padding: 5px 0 8px 16px; border-left: 1px solid rgba(66,217,232,.2); margin-left: 23px; }
.nav-group-links a { min-height: 34px; padding: 7px 8px; font-size: 13px; background: rgba(255,255,255,.025); }
.nav-group-links a span { width: 24px; height: 24px; font-size: 10px; }
.user-box { margin-top: 24px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.035)); }
.user-box a { display: inline-block; margin-top: 10px; color: var(--cyan); text-decoration: none; }

.content { padding: 28px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 18px; }
.page-head span { color: var(--muted); font-size: 13px; }
h1 { font-size: clamp(28px, 4vw, 42px); line-height: 1.05; margin: 6px 0 8px; letter-spacing: 0; }
h2 { margin: 0 0 16px; font-size: 20px; }
p { color: var(--muted); line-height: 1.55; }
.muted { color: var(--muted); font-size: 12px; }
.head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; min-width: 260px; }
.quick-link, .health-chip { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; padding: 0 12px; border: 1px solid var(--line); background: rgba(255,255,255,.055); color: #dce9fa; text-decoration: none; font-weight: 800; font-size: 13px; }
.quick-link:hover { border-color: rgba(66,217,232,.35); background: rgba(66,217,232,.1); }
.health-chip { color: #d5ffe4; background: rgba(74,222,128,.1); border-color: rgba(74,222,128,.24); }
.health-chip span { width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--green); box-shadow: 0 0 0 5px rgba(74,222,128,.12); }

.notice { border-radius: 8px; padding: 13px 14px; margin: 0 0 18px; border: 1px solid rgba(74,222,128,.25); background: rgba(74,222,128,.1); color: #c9fadd; }
.notice.bad { border-color: rgba(251,113,133,.3); background: rgba(251,113,133,.1); color: #ffd1d8; }
.notice.warn { border-color: rgba(251,191,36,.3); background: rgba(251,191,36,.1); color: #ffe6a3; }

.card { position: relative; overflow: hidden; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.035)); border-radius: 8px; padding: 20px; box-shadow: var(--shadow); }
.card::before { content: ""; position: absolute; inset: 0 0 auto; height: 1px; background: linear-gradient(90deg, transparent, rgba(66,217,232,.45), transparent); opacity: .72; }
.cards, .grid { display: grid; gap: 16px; margin-bottom: 18px; }
.cards.three, .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.two-wide { grid-template-columns: minmax(260px, .8fr) minmax(0, 1.6fr); }
.split-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.device-form-wrap { max-width: 980px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat b { display: block; font-size: 34px; margin: 8px 0 4px; color: #fff; }
.stat em { color: var(--muted); font-style: normal; font-size: 13px; }
.stat:nth-child(1) b { color: var(--cyan); }
.stat:nth-child(2) b { color: var(--green); }
.stat:nth-child(3) b { color: var(--amber); }
.stat:nth-child(4) b { color: var(--violet); }
.access-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.access-grid div { padding: 14px; border-radius: 8px; background: rgba(6,13,25,.68); border: 1px solid var(--line); box-shadow: inset 3px 0 0 rgba(66,217,232,.5); }
.access-grid strong { display: block; margin-bottom: 6px; color: var(--text); }
.access-grid span { display: block; color: var(--muted); font-size: 12px; }

.form-grid { display: grid; gap: 13px; }
.form-grid.columns { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
.form-grid h2, .form-grid p, .wide { grid-column: 1 / -1; }
.form-title { grid-column: 1 / -1; display: grid; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.form-title h2, .form-title p { margin: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.device-account-form { gap: 15px; }
.device-type-fields { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: rgba(6,13,25,.3); }
.toggle-row { display: flex; align-items: center; gap: 10px; color: var(--text); }
.toggle-row input { width: 42px; height: 22px; accent-color: var(--cyan); }
label { display: grid; gap: 7px; color: #dbe8f7; font-size: 14px; }
.checkline { display: inline-flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; min-height: 38px; }
.checkline input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--cyan); flex: 0 0 auto; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: rgba(6,13,25,.76); color: var(--text); border-radius: 8px; padding: 12px 13px; outline: none; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.compact-select, .plan-form select { max-width: 132px; min-width: 112px; padding: 7px 9px; font-size: 12px; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(53,213,232,.13); }

.btn { border: 0; border-radius: 8px; padding: 12px 15px; cursor: pointer; font-weight: 800; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; min-height: 42px; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, var(--cyan), var(--blue)); color: #06111f; box-shadow: 0 12px 28px rgba(66,217,232,.16); }
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.secondary:hover { border-color: rgba(66,217,232,.32); background: rgba(66,217,232,.08); }
.btn.danger { background: linear-gradient(135deg, var(--red), var(--rose)); color: #fff; }
.btn.warn { background: linear-gradient(135deg, #a16207, #d99028); color: #06111f; }
.btn.tiny { min-height: 32px; padding: 7px 10px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 7px; min-width: 300px; }
.actions form { margin: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.inline-form input, .inline-form select { width: auto; min-width: 130px; padding: 8px 9px; font-size: 12px; }
.inline-form select[multiple] { min-width: 210px; min-height: 86px; }
.actions select { width: auto; min-width: 170px; padding: 7px 9px; font-size: 12px; }
.panel-headline { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.panel-headline h2, .panel-headline p { margin: 0; }
.panel-headline p { color: var(--muted); margin-top: 6px; }
.info-box { border: 1px solid rgba(66,217,232,.2); background: rgba(66,217,232,.08); color: #dff8ff; border-radius: 8px; padding: 14px 16px; margin-bottom: 18px; }
.search-row { margin: 0 0 16px; }
.search-row input { width: min(430px, 100%); font-size: 14px; padding: 11px 12px; }
.bulk-actions { display: flex; justify-content: flex-end; margin: 0 0 10px; }
.inline-edit { position: relative; display: inline-block; }
.inline-edit summary { list-style: none; color: #67d7ea; cursor: pointer; border-bottom: 1px dashed rgba(103,215,234,.55); }
.inline-edit summary::-webkit-details-marker { display: none; }
.inline-edit-form { position: absolute; left: 0; top: 28px; z-index: 88; width: min(300px, 82vw); display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: #0d1828; box-shadow: var(--shadow); }
.inline-edit-form input { min-width: 0; }

.dns-panel { margin-bottom: 18px; }
.dns-table-head { display: grid; gap: 6px; margin-bottom: 16px; }
.dns-table-head h2, .dns-table-head p { margin: 0; }
.dns-table { border-color: var(--line); background: rgba(6,13,25,.32); }
.dns-table table { min-width: 940px; }
.dns-table td, .dns-table th { padding: 14px 16px; }
.dns-table th { color: #aeeaf4; }
.dns-url { color: #67d7ea; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.dns-row-number { width: 48px; color: var(--muted); font-weight: 900; }
.dns-order-form { display: inline-flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.dns-order-form input, .dns-order-input { width: 64px; max-width: 64px; min-height: 38px; padding: 7px 8px; text-align: center; }
.dns-order-form .btn.tiny { min-height: 38px; padding: 7px 13px; }
.status-badge { display: inline-flex; min-width: 94px; justify-content: center; border-radius: 5px; padding: 8px 11px; font-size: 12px; font-weight: 900; }
.status-badge.enabled { background: #39a84d; color: #fff; }
.status-badge.disabled { background: #d9414b; color: #fff; }
.status-pill { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 6px 10px; background: rgba(66,217,232,.12); border: 1px solid rgba(66,217,232,.24); color: #dff8ff; font-size: 12px; font-weight: 800; white-space: nowrap; }
.assigned-summary { max-width: 280px; margin-bottom: 8px; color: #dce9fa; line-height: 1.45; }
.dns-actions { display: flex; gap: 8px; align-items: center; min-width: 128px; }
.dns-actions form { margin: 0; }
.icon-btn, .action-icon { position: relative; width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; background: rgba(6,13,25,.42); color: #dff8ff; font-size: 0; font-weight: 900; text-decoration: none; transition: background .15s ease, border-color .15s ease, transform .15s ease; padding: 0; flex: 0 0 auto; }
.icon-btn:hover { transform: translateY(-1px); border-color: rgba(66,217,232,.36); background: rgba(66,217,232,.1); }
.action-icon:hover { transform: translateY(-1px); border-color: rgba(66,217,232,.36); background: rgba(66,217,232,.1); }
.action-icon span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.action-icon::before, .action-icon::after { content: ""; position: absolute; display: block; }
.action-icon.theme::before { width: 15px; height: 12px; border: 2px solid var(--violet); border-radius: 3px; box-shadow: inset 0 3px 0 rgba(167,139,250,.28); }
.action-icon.theme::after { width: 8px; height: 2px; background: var(--violet); transform: translateY(9px); border-radius: 2px; }
.action-icon.dns::before, .action-icon.assign::before { width: 15px; height: 11px; border: 2px solid var(--cyan); border-radius: 3px; }
.action-icon.dns::after, .action-icon.assign::after { width: 6px; height: 6px; border-right: 2px solid var(--cyan); border-bottom: 2px solid var(--cyan); transform: translate(5px, -5px) rotate(-45deg); }
.action-icon.power::before { width: 14px; height: 14px; border: 2px solid var(--green); border-top-color: transparent; border-radius: 50%; }
.action-icon.power::after { width: 2px; height: 10px; background: var(--green); transform: translateY(-6px); border-radius: 2px; }
.action-icon.cache::before { width: 17px; height: 8px; border: 2px solid var(--cyan); border-radius: 50%; transform: translateY(-5px); }
.action-icon.cache::after { width: 17px; height: 14px; border: 2px solid var(--cyan); border-top: 0; border-radius: 0 0 50% 50%; transform: translateY(2px); }
.action-icon.upload::before { width: 15px; height: 2px; background: var(--cyan); transform: translateY(8px); border-radius: 2px; }
.action-icon.upload::after { width: 10px; height: 10px; border-left: 2px solid var(--cyan); border-top: 2px solid var(--cyan); transform: rotate(45deg) translate(-1px, 2px); }
.action-icon.refresh::before, .action-icon.restart::before { width: 16px; height: 16px; border: 2px solid var(--cyan); border-left-color: transparent; border-radius: 50%; }
.action-icon.refresh::after, .action-icon.restart::after { width: 6px; height: 6px; border-top: 2px solid var(--cyan); border-right: 2px solid var(--cyan); transform: translate(7px, -7px) rotate(25deg); }
.action-icon.restart::before { border-color: var(--amber); border-left-color: transparent; }
.action-icon.restart::after { border-color: var(--amber); }
.action-icon.uninstall::before, .action-icon.delete::before { width: 11px; height: 13px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 3px 3px; }
.action-icon.uninstall::after, .action-icon.delete::after { width: 15px; height: 2px; background: currentColor; transform: translateY(-8px); border-radius: 2px; }
.action-icon.approve::before { width: 16px; height: 16px; border: 2px solid var(--green); border-radius: 50%; }
.action-icon.approve::after { width: 9px; height: 5px; border-left: 2px solid var(--green); border-bottom: 2px solid var(--green); transform: rotate(-45deg) translate(1px, 0); }
.action-icon.danger { color: #ff6f73; border-color: rgba(255,85,92,.75); }
.icon-btn.toggle { border-radius: 999px; width: 38px; height: 22px; background: rgba(66,217,232,.14); border-color: rgba(66,217,232,.32); padding: 2px; justify-content: flex-start; }
.icon-btn.toggle span { width: 16px; height: 16px; border-radius: 50%; background: #61e5f2; box-shadow: 0 0 0 3px rgba(66,217,232,.1); }
.icon-btn.toggle.is-off { justify-content: flex-end; background: rgba(251,113,133,.11); border-color: rgba(251,113,133,.35); }
.icon-btn.toggle.is-off span { background: var(--red); box-shadow: 0 0 0 3px rgba(251,113,133,.1); }
.icon-btn.edit::before { content: ""; width: 12px; height: 12px; border: 2px solid #8ee8db; border-top: 0; border-right: 0; transform: rotate(-45deg); }
.icon-btn.edit::after { content: ""; width: 10px; height: 2px; margin-left: -3px; background: #8ee8db; transform: rotate(-45deg); border-radius: 2px; }
.icon-btn.refresh::before { content: ""; width: 14px; height: 14px; border: 2px solid var(--cyan); border-left-color: transparent; border-radius: 50%; }
.icon-btn.refresh::after { content: ""; position: absolute; width: 6px; height: 6px; border-top: 2px solid var(--cyan); border-right: 2px solid var(--cyan); transform: translate(6px, -6px) rotate(25deg); }
.icon-btn.delete { border-color: rgba(255,85,92,.75); color: #ff6f73; }
.icon-btn.delete::before { content: ""; width: 11px; height: 13px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 3px 3px; }
.icon-btn.delete::after { content: ""; position: absolute; width: 15px; height: 2px; background: currentColor; transform: translateY(-8px); border-radius: 2px; }
.dns-edit { position: relative; }
.dns-edit summary { list-style: none; }
.dns-edit summary::-webkit-details-marker { display: none; }
.dns-edit-form { position: absolute; right: 0; top: 44px; z-index: 5; width: min(480px, 88vw); display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #11283a; box-shadow: var(--shadow); }
.dns-url-edit { position: relative; width: max-content; }
.dns-url-edit summary { list-style: none; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(66,217,232,.32); border-radius: 8px; background: rgba(66,217,232,.1); cursor: pointer; }
.dns-url-edit summary::-webkit-details-marker { display: none; }
.dns-url-edit summary span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.dns-url-edit summary::before { content: ""; width: 16px; height: 16px; border: 2px solid var(--cyan); border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(66,217,232,.08); }
.dns-url-edit summary::after { content: ""; position: absolute; width: 7px; height: 2px; background: var(--cyan); transform: translate(8px, 8px) rotate(45deg); border-radius: 2px; }
.dns-url-edit summary:hover { border-color: rgba(66,217,232,.62); background: rgba(66,217,232,.16); }
.dns-url-edit-form { position: absolute; left: 0; top: 42px; z-index: 70; width: min(520px, 76vw); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; padding: 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: #0d1828; box-shadow: var(--shadow); }
.dns-url-edit-form label { min-width: 0; }
.dns-url-edit-form input { min-width: 0; width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.dns-visibility select { min-width: 190px; min-height: 64px; }
.dns-editor { max-width: 920px; margin: 28px auto; }

.confirm-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.62); backdrop-filter: blur(2px); }
.confirm-modal { width: min(560px, 100%); position: relative; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 8px; background: linear-gradient(180deg, rgba(20,36,58,.98), rgba(12,23,39,.98)); box-shadow: 0 30px 100px rgba(0,0,0,.55); text-align: center; }
.confirm-modal::before { content: ""; display: block; height: 74px; border-bottom: 1px solid var(--line); }
.confirm-close { position: absolute; top: 16px; right: 18px; border: 0; background: transparent; color: #d5eee5; font-size: 34px; cursor: pointer; line-height: 1; }
.confirm-icon { width: 72px; height: 72px; margin: 36px auto 18px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(248,84,84,.45); color: #ff625f; font-weight: 900; }
.confirm-modal h2 { margin: 0; font-size: 28px; }
.confirm-modal p { max-width: 450px; margin: 16px auto 34px; color: #d5eee5; font-size: 17px; line-height: 1.45; }
.confirm-actions { display: flex; justify-content: center; gap: 16px; padding: 24px; border-top: 1px solid var(--line); }
.confirm-cancel, .confirm-delete { border: 0; border-radius: 8px; min-height: 48px; padding: 0 24px; cursor: pointer; font-weight: 900; font-size: 16px; }
.confirm-cancel { background: transparent; color: var(--cyan); }
.confirm-delete { background: #d74751; color: #fff; }

.ui-modal { position: fixed; inset: 0; z-index: 90; display: none; place-items: center; padding: 22px; background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
.ui-modal.is-open { display: grid; }
.ui-modal__panel { width: min(620px, 100%); position: relative; border: 1px solid var(--line-strong); border-radius: 8px; background: linear-gradient(180deg, rgba(17,29,45,.98), rgba(12,23,39,.98)); box-shadow: 0 30px 100px rgba(0,0,0,.54); padding: 20px; }
.ui-modal__close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: rgba(6,13,25,.42); color: var(--text); cursor: pointer; font-weight: 900; }
.ui-modal select[multiple] { min-height: 190px; }
.connected-card { overflow: visible; }
.connected-table { overflow: visible; }
.connected-table table { min-width: 980px; }
.device-group-row td { background: rgba(66,217,232,.08); color: #8feeff; font-weight: 900; letter-spacing: .02em; text-transform: uppercase; }
.account-cell { display: grid; gap: 4px; min-width: 180px; color: var(--text); }
.account-cell b { color: var(--muted); }
.compact-actions { min-width: 132px; gap: 8px; flex-wrap: nowrap; align-items: center; }
.mac-cell { display: flex; align-items: center; gap: 8px; min-width: 180px; }
.mac-refresh-form { margin: 0; }
.mac-refresh-form .icon-btn { width: 26px; height: 26px; border-radius: 6px; }
.mac-edit { position: relative; display: inline-block; }
.mac-edit summary { list-style: none; }
.mac-edit summary::-webkit-details-marker { display: none; }
.mac-edit .icon-btn { width: 26px; height: 26px; border-radius: 6px; }
.mac-edit-form { position: absolute; right: 0; top: 34px; z-index: 85; width: min(320px, 82vw); display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: #0d1828; box-shadow: var(--shadow); }
.mac-edit-form input { min-width: 0; width: 100%; }
.server-link { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 7px; border: 1px solid rgba(66,217,232,.28); background: rgba(66,217,232,.08); }
.server-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-link:hover { border-color: rgba(66,217,232,.5); background: rgba(66,217,232,.13); }
.server-link i { display: inline-grid; place-items: center; width: 22px; height: 22px; color: transparent; position: relative; font-size: 0; flex: 0 0 auto; }
.server-link i::before { content: ""; width: 9px; height: 9px; border: 2px solid var(--cyan); border-left: 0; border-bottom: 0; transform: rotate(45deg); }
.server-link i::after { content: ""; width: 10px; height: 2px; background: var(--cyan); position: absolute; transform: rotate(-45deg); border-radius: 2px; }
.tool-menu { position: relative; display: inline-block; }
.tool-menu summary { list-style: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; border: 1px solid rgba(66,217,232,.28); background: rgba(66,217,232,.1); cursor: pointer; color: var(--text); }
.tool-menu summary::-webkit-details-marker { display: none; }
.tool-menu summary span { font-size: 0; width: 14px; height: 14px; position: relative; border: 2px solid var(--cyan); border-radius: 50%; }
.tool-menu summary span::before { content: ""; position: absolute; inset: -5px; border: 1px dashed var(--cyan); border-radius: 50%; opacity: .75; }
.tool-menu summary span::after { content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; background: var(--cyan); transform: translate(-50%, -50%); border-radius: 50%; }
.tool-menu-panel { position: absolute; right: 0; top: 36px; z-index: 80; width: 244px; display: grid; grid-template-columns: repeat(5, 30px); justify-content: start; gap: 7px; padding: 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: #0d1828; box-shadow: var(--shadow); }
.tool-menu-panel form { margin: 0; display: grid; gap: 8px; }
.tool-menu-panel .assign-dns-form { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) 30px; align-items: end; gap: 7px; }
.tool-menu-panel .assign-dns-form label { min-width: 0; }
.tool-menu-panel .assign-dns-form select { min-width: 0; width: 100%; }
.tool-menu-panel .btn { width: 100%; justify-content: flex-start; }
.tool-menu-panel form:not(.assign-dns-form) { width: 30px; }
.security-tile { min-height: 160px; }
.theme-modal { width: min(1040px, 100%); }
.theme-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.theme-option { border: 1px solid var(--line-strong); border-radius: 8px; padding: 14px; background: rgba(6,13,25,.34); cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.theme-option:hover { border-color: rgba(66,217,232,.38); transform: translateY(-1px); }
.theme-option input { width: auto; position: absolute; opacity: 0; pointer-events: none; }
.theme-option:has(input:checked) { border-color: rgba(66,217,232,.68); box-shadow: 0 0 0 3px rgba(66,217,232,.12); }
.theme-option strong { display: block; margin: 12px 0 4px; color: var(--text); font-size: 16px; }
.theme-option em { display: block; color: var(--muted); font-style: normal; font-size: 13px; line-height: 1.45; }
.theme-preview { height: 150px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-items: end; padding: 18px; border-radius: 8px; border: 1px solid rgba(255,255,255,.1); background: linear-gradient(135deg, #143765, #0a1830); overflow: hidden; }
.theme-preview b { grid-column: 1 / -1; align-self: start; justify-self: start; border-radius: 999px; padding: 5px 9px; background: rgba(255,255,255,.12); color: #fff; font-size: 13px; }
.theme-preview i { min-height: 72px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.1); color: rgba(255,255,255,.78); font-style: normal; font-size: 13px; }
.theme-2 { background: linear-gradient(135deg, #0b0913, #2b183d); }
.theme-3 { background: linear-gradient(135deg, #11314d, #0a5261); }
.theme-1 { background: linear-gradient(135deg, #1a1436, #4b173d); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: rgba(6,13,25,.32); }
table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: #aebed3; font-size: 12px; text-transform: uppercase; background: rgba(6,13,25,.86); position: sticky; top: 0; z-index: 1; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
td { color: #d7e3f2; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: rgba(66,217,232,.045); }
tr:last-child td { border-bottom: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 9px; font-size: 12px; background: rgba(251,191,36,.12); color: #ffe6a3; white-space: nowrap; border: 1px solid rgba(251,191,36,.18); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: rgba(74,222,128,.12); color: #c9fadd; }
.pill.warn { background: rgba(251,191,36,.12); color: #ffe6a3; }

.qr-preview { text-align: center; }
.fake-qr { width: 210px; height: 210px; margin: 12px auto 18px; padding: 14px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; background: #fff; border-radius: 8px; box-shadow: 0 22px 50px rgba(0,0,0,.28); }
.fake-qr i { border-radius: 3px; background: #fff; }
.fake-qr i.on { background: #06111f; }
.qr-actions-cell { min-width: 330px; width: 330px; }
.qr-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; min-width: 310px; }
.qr-action-form { display: grid; grid-template-columns: minmax(118px, 1fr) auto; align-items: end; gap: 10px; margin: 0; }
.qr-plan { gap: 5px; min-width: 0; margin: 0; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.qr-plan select { width: 100%; min-width: 118px; padding: 8px 10px; }
.qr-approve, .qr-delete { min-height: 38px; white-space: nowrap; }
.qr-actions form { margin: 0; }

.login-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: min(430px, 100%); border: 1px solid var(--line); border-radius: 8px; padding: 26px; background: linear-gradient(180deg, rgba(17,29,45,.96), rgba(12,23,39,.96)); box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.login-card h1 { font-size: 30px; }
.login-card .logo-mark { margin-bottom: 14px; }

.sidebar-toggle { width: 100%; min-height: 38px; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.045); color: var(--text); display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; font-weight: 900; }
.sidebar-toggle span { width: 18px; height: 12px; border-top: 2px solid var(--cyan); border-bottom: 2px solid var(--cyan); position: relative; flex: 0 0 auto; }
.sidebar-toggle span::before { content: ""; position: absolute; left: 0; right: 0; top: 3px; border-top: 2px solid var(--cyan); }
.side-nav { display: grid; gap: 8px; }
.nav-group { border: 1px solid transparent; border-radius: 8px; }
.nav-group summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; color: var(--muted); font-weight: 900; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: rgba(255,255,255,.055); color: #bfd0e7; font-size: 10px; flex: 0 0 auto; }
.nav-group-links { display: grid; gap: 5px; padding: 0 6px 6px; }
.nav-group-links a em { font-style: normal; }
.shell.sidebar-collapsed { grid-template-columns: 86px minmax(0, 1fr); }
.shell.sidebar-collapsed .sidebar { padding: 14px 10px; }
.shell.sidebar-collapsed .brand { justify-content: center; }
.shell.sidebar-collapsed .brand div:not(.logo-mark), .shell.sidebar-collapsed .user-box, .shell.sidebar-collapsed .sidebar-toggle strong, .shell.sidebar-collapsed .nav-group summary strong, .shell.sidebar-collapsed .nav-group-links a em { display: none; }
.shell.sidebar-collapsed .nav-group summary, .shell.sidebar-collapsed .nav-group-links a { justify-content: center; padding-left: 0; padding-right: 0; }

.action-icon.toggle { border-radius: 999px; width: 38px; height: 22px; justify-content: flex-start; padding: 2px; background: rgba(66,217,232,.14); border-color: rgba(66,217,232,.32); }
.action-icon.toggle::before { width: 16px; height: 16px; border-radius: 50%; background: #61e5f2; box-shadow: 0 0 0 3px rgba(66,217,232,.1); position: static; }
.action-icon.toggle::after { display: none; }
.action-icon.toggle.is-off { justify-content: flex-end; background: rgba(251,113,133,.11); border-color: rgba(251,113,133,.35); }
.action-icon.toggle.is-off::before { background: var(--red); box-shadow: 0 0 0 3px rgba(251,113,133,.1); }
.action-icon.edit::before { width: 12px; height: 12px; border: 2px solid #8ee8db; border-top: 0; border-right: 0; transform: rotate(-45deg); }
.action-icon.edit::after { width: 10px; height: 2px; background: #8ee8db; transform: rotate(-45deg); border-radius: 2px; }

td.actions { min-width: 220px; }
.actions { min-width: 0; align-items: flex-start; }
.device-actions { min-width: 320px; max-width: 430px; display: grid; gap: 8px; }
.device-actions form { margin: 0; }
.device-actions .assign-dns-form, .device-actions .move-device-form { display: grid; grid-template-columns: minmax(150px, 1fr) auto; gap: 7px; align-items: end; }
.device-actions select { width: 100%; min-width: 0; }
.device-edit-details { position: relative; }
.device-edit-details summary { list-style: none; width: max-content; cursor: pointer; }
.device-edit-details summary::-webkit-details-marker { display: none; }
.device-edit-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(6,13,25,.45); }
.device-edit-form .wide { grid-column: 1 / -1; }
.device-edit-note { color: var(--muted); font-size: 12px; margin: 0; }
.device-edit-form input, .device-edit-form select { padding: 8px 9px; font-size: 12px; }
.visibility-form { display: grid; gap: 7px; }
.visibility-form select { min-width: 180px; min-height: 82px; }
.service-manager-card { overflow: visible; }
.service-manager-layout { display: block; }
.service-manager-main { min-width: 0; }
.service-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 10px; margin-bottom: 26px; border: 1px solid var(--line); border-radius: 8px; background: rgba(6,13,25,.34); }
.service-tabs a { min-height: 50px; display: flex; align-items: center; justify-content: center; gap: 12px; border-radius: 8px; background: rgba(255,255,255,.035); color: #aebed3; text-decoration: none; font-weight: 900; }
.service-tabs a b { display: inline-grid; place-items: center; min-width: 32px; height: 28px; padding: 0 9px; border-radius: 999px; background: rgba(66,217,232,.13); color: #9ee8f1; font-size: 13px; }
.service-tabs a.active { background: linear-gradient(135deg, var(--cyan), var(--blue)); color: #06111f; }
.service-tabs a.active b { background: rgba(6,17,31,.18); color: #06111f; }
.service-type-panel, .service-snapshot { padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: rgba(12,23,39,.64); }
.service-type-panel h2, .service-type-panel p, .service-snapshot h2 { margin-top: 0; }
.service-table { overflow: auto; }
.service-table table { min-width: 1020px; }
.service-actions { min-width: 132px; max-width: 180px; }
.service-actions-compact { display: table-cell; }
.device-action-trigger { white-space: nowrap; }
.service-action-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(6,13,25,.34); }
.service-actions .assign-dns-form { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(6,13,25,.28); }
.service-actions .assign-dns-form label:first-of-type { grid-column: 1 / -1; }
.service-actions .assign-dns-form button { grid-column: 1 / -1; width: max-content; justify-self: end; }
.service-actions .move-device-form { grid-template-columns: minmax(0, 1fr) auto; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(6,13,25,.24); }
.service-actions .device-edit-details { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(6,13,25,.24); }
.service-actions > form[data-confirm] { justify-self: end; }
.device-action-panel { width: 214px; grid-template-columns: repeat(4, 30px); }
.device-action-modal { width: min(980px, 96vw); max-height: 88vh; overflow: auto; }
.device-action-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.device-action-section { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: rgba(6,13,25,.34); }
.device-action-section h3 { margin: 0 0 12px; font-size: 16px; color: var(--text); }
.modal-action-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.modal-action-form label:first-of-type, .modal-action-form .wide { grid-column: 1 / -1; }
.modal-action-form button { justify-self: start; }
.modal-action-form [data-assign-field].is-hidden { display: none; }
.device-action-modal .assign-dns-form { padding: 0; border: 0; background: transparent; }
.device-action-modal .assign-dns-form button { grid-column: auto; width: max-content; justify-self: start; }
.command-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.command-grid form { margin: 0; }
.command-grid .action-icon { width: 100%; height: 42px; justify-content: flex-start; gap: 10px; padding: 0 12px 0 42px; font-size: 13px; }
.command-grid .action-icon span { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: nowrap; }
.command-grid .action-icon::before, .command-grid .action-icon::after { left: 15px; }
.device-action-section-inline { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.device-action-section-inline .move-device-form { min-width: min(420px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.theme-action-section { grid-column: 1 / -1; }
.theme-action-form { display: grid; gap: 12px; }
.compact-theme-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.compact-theme-grid .theme-option { min-height: 86px; display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 12px; padding: 12px; border-color: rgba(145,163,190,.22); background: linear-gradient(180deg, rgba(15,28,47,.72), rgba(8,17,31,.62)); }
.compact-theme-grid .theme-option:hover { transform: none; border-color: rgba(66,217,232,.45); background: rgba(17,34,56,.78); }
.compact-theme-grid .theme-option:has(input:checked) { border-color: rgba(66,217,232,.85); box-shadow: inset 4px 0 0 var(--cyan), 0 0 0 1px rgba(66,217,232,.18); }
.compact-theme-grid .theme-preview { width: 64px; height: 52px; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 7px; border-radius: 8px; }
.compact-theme-grid .theme-preview b { grid-column: 1 / -1; padding: 3px 6px; font-size: 11px; }
.compact-theme-grid .theme-preview i { min-height: 18px; border-radius: 5px; font-size: 0; }
.compact-theme-grid .theme-option strong { min-width: 0; margin: 0; color: #e9f2ff; font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.theme-action-row { display: flex; justify-content: flex-end; }
.theme-action-row .btn { min-width: 150px; justify-content: center; }
.service-url-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.service-snapshot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 28px; }
.mini-table { display: grid; gap: 2px; }
.mini-table div { display: grid; grid-template-columns: 120px minmax(0, 1fr) 90px; gap: 14px; align-items: center; min-height: 42px; padding: 0 14px; border-radius: 8px; background: rgba(6,13,25,.42); }
.mini-table div:first-child { min-height: 36px; background: rgba(6,13,25,.8); color: #aebed3; text-transform: uppercase; font-size: 12px; letter-spacing: .04em; }
.mini-table span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connected-card .table-wrap, .connected-table.table-wrap { overflow: visible; }
.tool-menu-panel { width: min(280px, 80vw); grid-template-columns: repeat(4, 30px); max-height: 70vh; overflow: auto; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .shell.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-nav { grid-template-columns: 1fr; }
  .cards.four, .cards.three, .grid.three, .grid.two, .grid.two-wide, .split-grid { grid-template-columns: 1fr; }
  .service-snapshot-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .panel-headline { flex-direction: column; }
  .head-actions { justify-content: flex-start; min-width: 0; }
}

@media (max-width: 640px) {
  .content, .sidebar { padding: 14px; }
  nav { grid-template-columns: 1fr; }
  .form-grid.columns, .access-grid { grid-template-columns: 1fr; }
  .device-type-fields { grid-template-columns: 1fr; }
  .service-tabs { grid-template-columns: 1fr; gap: 8px; }
  .mini-table div { grid-template-columns: 1fr; gap: 4px; padding: 10px; }
  .card { padding: 15px; }
  .page-head { display: block; }
}
