:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --line: #dfe4ea;
  --text: #17202b;
  --muted: #6b7685;
  --blue: #2563eb;
  --green: #15966a;
  --amber: #a96708;
  --red: #c4313e;
  --radius: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.shell { width: min(100% - 32px, 500px); margin: 0 auto; padding: 34px 0 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #e8efff; color: var(--blue); font-size: 18px; font-weight: 800; }
.brand strong { font-size: 16px; letter-spacing: -.02em; }
.status-badge { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 11px; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #9aa4b2; }
.status-valid { border-color: #b9e7d4; background: #f2fbf6; color: #137a55; }
.status-valid .status-dot { background: var(--green); }
.status-invalid { border-color: #f1c8cc; background: #fff7f7; color: var(--red); }
.status-invalid .status-dot { background: var(--red); }
.panel, .preview-card, .progress-section { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 5px 18px rgba(25, 40, 60, .045); }
.token-panel { padding: 20px; }
.input-label { display: block; margin: 0 0 7px; color: #485465; font-size: 12px; font-weight: 650; }
.token-input-wrap { display: flex; align-items: center; gap: 5px; min-height: 48px; padding: 0 7px 0 12px; border: 1px solid #cfd6df; border-radius: 9px; background: #fff; }
.token-input-wrap:focus-within { border-color: #75a0f8; box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.token-input-wrap input { min-width: 0; flex: 1; height: 46px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; }
.token-input-wrap input::placeholder { color: #98a1ad; }
.icon-button { display: grid; place-items: center; flex: 0 0 auto; border: 0; border-radius: 7px; background: transparent; color: #687587; cursor: pointer; }
.icon-button { width: 34px; height: 34px; }
.icon-button svg { width: 19px; height: 19px; }
.icon-button:hover { background: #f1f4f8; color: var(--text); }
.token-note { margin: 6px 1px 0; color: #7b8796; font-size: 10px; }
.action-menu { display: grid; gap: 10px; margin-top: 18px; }
.menu-group { display: grid; gap: 8px; padding: 13px; border: 1px solid #e7ebf1; border-radius: 14px; background: linear-gradient(145deg, #fff 0%, #fbfcfe 100%); box-shadow: 0 4px 14px rgba(25, 40, 60, .035); transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.menu-group:hover { border-color: #d7e0ee; box-shadow: 0 8px 22px rgba(25, 40, 60, .06); transform: translateY(-1px); }
.menu-group-heading { display: flex; align-items: flex-start; gap: 10px; padding: 1px 1px 4px; }
.menu-group-index { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 auto; border: 1px solid #dbe5f6; border-radius: 9px; background: #f2f6ff; color: #4167b4; font-size: 10px; font-weight: 800; letter-spacing: .02em; }
.menu-group-sdn .menu-group-index { border-color: #f0dce0; background: #fff5f6; color: #a04350; }
.menu-group-inventory .menu-group-index { border-color: #f1e5ca; background: #fffaf1; color: #946b19; }
.menu-group-utility .menu-group-index { border-color: #dce8e6; background: #f2faf8; color: #3c7d70; }
.menu-group-heading>div { display: grid; gap: 2px; padding-top: 1px; }
.menu-group-label { color: #334155; font-size: 11px; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.menu-group-hint { color: #8490a0; font-size: 10px; line-height: 1.4; }
.menu-group-utility { padding-bottom: 13px; }
.menu-copy { display: grid; min-width: 0; gap: 2px; text-align: left; }
.menu-copy small { color: #8490a0; font-size: 10px; font-weight: 450; line-height: 1.35; }
.menu-group .primary-button, .menu-group .secondary-button { min-height: 54px; padding: 9px 12px; }
.menu-group .primary-button { background: linear-gradient(125deg, #2563eb, #3d76ed); box-shadow: 0 4px 10px rgba(37, 99, 235, .14); }
.menu-group .primary-button:hover { background: linear-gradient(125deg, #1f54cc, #3269dc); box-shadow: 0 7px 16px rgba(37, 99, 235, .2); transform: translateY(-1px); }
.danger-menu-button { border-color: #efdcde; color: #8e3c45; }
.danger-menu-button .menu-copy small { color: #9b7276; }
.danger-menu-button:hover { border-color: #e9c0c4; background: linear-gradient(110deg, #fff9f9, #fff 85%); }
.menu-group-sdn #detachSdnButton { border-color: #e8cbd0; background: #fffafa; }
.menu-group-inventory #deleteNetworkButton { border-style: dashed; }
.menu-group .button-arrow { display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 auto; border: 1px solid rgba(120, 137, 158, .18); border-radius: 9px; background: rgba(255,255,255,.72); color: #64748b; font-size: 17px; transition: transform .18s ease, background .18s ease; }
.menu-group .primary-button .button-arrow { border-color: rgba(255,255,255,.26); background: rgba(255,255,255,.14); color: #fff; }
.menu-group button:hover .button-arrow { background: rgba(255,255,255,.92); transform: translateX(2px); }
.menu-group .primary-button:hover .button-arrow { background: rgba(255,255,255,.22); }
.primary-button, .secondary-button, .run-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 47px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.primary-button, .run-button { background: var(--blue); color: #fff; }
.primary-button:hover, .run-button:hover { background: #1f54cc; }
.secondary-button { border-color: #d9dfe7; background: #fff; color: #283445; }
.secondary-button:hover { border-color: #aebbd0; background: #f8faff; }
.button-arrow { color: currentColor; font-size: 18px; font-weight: 400; }
button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible { outline: 3px solid rgba(37, 99, 235, .27); outline-offset: 2px; }

.preview-section { margin-top: 18px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-heading h2 { margin: 0; font-size: 16px; }
.panel-kicker, .card-label { color: #7b8796; font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.ready-pill, .verified-chip, .cidr-safe { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-size: 11px; }
.ready-pill { padding: 5px 8px; border: 1px solid #cdebdc; border-radius: 999px; background: #f3fbf6; }
.ready-check { font-size: 13px; }
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.preview-card { min-width: 0; padding: 14px; box-shadow: none; }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.verified-chip span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.essentials-pill { padding: 3px 6px; border-radius: 5px; background: #eff8f3; color: var(--green); font-size: 9px; font-weight: 700; }
.preview-card h3 { margin: 10px 0 4px; overflow-wrap: anywhere; font-size: 14px; }
.server-meta { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.meta-divider { width: 3px; height: 3px; border-radius: 50%; background: #9aa4b2; }
.server-ips { margin-top: 7px; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.plan-row { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 8px; }
.plan-row h3 { margin: 0; font-size: 16px; }
.plan-features { color: var(--muted); font-size: 10px; }
.price { text-align: right; white-space: nowrap; }
.price strong { display: block; color: #167d58; font-size: 22px; }
.price span, .billing-note { color: var(--muted); font-size: 10px; }
.billing-note { margin: 7px 0 0; }
.resources-card { margin-top: 9px; }
.resources-heading h3 { margin: 3px 0 0; font-size: 13px; }
.resource-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 11px; }
.resource-item { min-width: 0; padding: 9px; border: 1px solid #e7ebf0; border-radius: 7px; background: #fbfcfd; }
.resource-item>div { display: grid; gap: 3px; min-width: 0; }
.resource-item>div>span { color: #7b8796; font-size: 9px; font-weight: 700; }
.resource-item strong { overflow: hidden; color: #334155; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.cidr-row { display: flex; align-items: center; gap: 9px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #edf0f3; }
.cidr-row>div { display: grid; gap: 3px; }
.cidr-row>div strong { color: #334155; font: 600 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.cidr-arrow { color: #8a95a3; }
.cidr-safe { margin-left: auto; white-space: nowrap; }
.cidr-safe span { font-weight: 800; }
.impact-card { display: grid; gap: 3px; margin-top: 9px; padding: 12px 14px; border: 1px solid #f0dfbd; border-radius: 9px; background: #fffaf0; color: #7c570d; font-size: 12px; }
.impact-card p { margin: 0; color: #665f50; font-size: 11px; }
.confirm-bar { display: flex; align-items: center; gap: 10px; margin-top: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.confirm-bar>strong { flex: 1; color: var(--muted); font-size: 11px; font-weight: 550; }
.run-button { width: auto; min-height: 41px; gap: 12px; font-size: 12px; }

.progress-section { margin-top: 12px; padding: 16px; }
.progress-heading { display: flex; align-items: center; gap: 9px; }
.progress-copy { display: grid; gap: 2px; }
.progress-heading h2 { margin: 0; font-size: 15px; }
.progress-status { color: var(--blue); font-size: 10px; font-weight: 700; letter-spacing: .02em; }
.spinner { position: relative; width: 24px; height: 24px; flex: 0 0 auto; border: 2px solid #dce7fa; border-top-color: var(--blue); border-right-color: #90b2fb; border-radius: 50%; box-shadow: 0 0 0 4px rgba(37,99,235,.06); animation: spin .9s cubic-bezier(.55,.15,.45,.85) infinite; }
.spinner::after { position: absolute; top: 7px; left: 7px; width: 6px; height: 6px; border-radius: 50%; background: #80a8fb; content: ""; animation: pulse .9s ease-in-out infinite alternate; }
.progress-section>p { margin: 10px 0; color: #556274; font-size: 12px; }
.progress-track { height: 4px; overflow: hidden; border-radius: 4px; background: #e9edf2; }
.progress-track span { position: relative; display: block; width: 4%; height: 100%; overflow: hidden; border-radius: inherit; background: linear-gradient(90deg, #2563eb, #5b8df2); transition: width .35s ease; }
.progress-track span::after { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 0%, rgba(255,255,255,.65) 48%, transparent 100%); content: ""; animation: shimmer 1.2s ease-in-out infinite; }
.progress-stages { display: flex; justify-content: space-between; gap: 6px; margin-top: 12px; }
.progress-stage { display: inline-flex; align-items: center; gap: 5px; color: #98a2b0; font-size: 9px; font-weight: 600; }
.progress-stage::before { width: 6px; height: 6px; border: 1px solid #c8d0db; border-radius: 50%; background: #fff; content: ""; }
.progress-stage.is-active { color: #285bb5; }
.progress-stage.is-active::before { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.progress-stage.is-complete { color: #16845e; }
.progress-stage.is-complete::before { border-color: #2aab7d; background: #2aab7d; box-shadow: inset 0 0 0 1px #fff; }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 7px; color: var(--muted); font-size: 10px; }
.result-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.result-item { padding: 5px 7px; border: 1px solid #d6ebdf; border-radius: 6px; background: #f3fbf6; color: #18734f; font-size: 10px; }

.swal2-popup { border: 1px solid var(--line) !important; border-radius: 14px !important; background: #fff !important; color: var(--text) !important; box-shadow: 0 14px 48px rgba(15, 23, 42, .18) !important; }
.swal2-title { color: var(--text) !important; font-size: 19px !important; }
.swal2-html-container { color: #5f6b7a !important; font-size: 12px !important; line-height: 1.5 !important; }
.swal2-actions { gap: 8px !important; }
.swal2-confirm, .swal2-cancel { border-radius: 8px !important; font-size: 12px !important; font-weight: 650 !important; }
.swal2-confirm { background: var(--blue) !important; }
.swal2-cancel { background: #eef1f5 !important; color: #394558 !important; }
.plan-choice-popup .swal2-radio { display: flex !important; flex-direction: column; gap: 8px; width: 100%; margin: 14px 0 4px !important; text-align: left !important; }
.plan-choice-popup .swal2-radio label { display: flex !important; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid #dfe4ea; border-radius: 9px; background: #fff; color: var(--text) !important; font-size: 13px !important; font-weight: 600; }
.plan-choice-popup .swal2-radio label:has(input:checked) { border-color: #82a9fa; background: #f4f7ff; }
.plan-choice-popup .swal2-radio input[type=radio] { width: 16px; height: 16px; margin: 0 !important; accent-color: var(--blue); }
.server-choice-popup { width: min(480px, calc(100vw - 28px)) !important; }
.server-choice-popup .swal2-html-container { max-height: min(60vh, 520px); overflow-y: auto !important; }
.server-choice-intro { margin: 0 0 10px; text-align: left; }
.server-choice-list { display: grid; gap: 8px; margin: 0; text-align: left; }
.server-choice { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 11px 12px; border: 1px solid #dfe4ea; border-radius: 9px; background: #fff; color: var(--text); text-align: left; cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.server-choice:hover { border-color: #a9c3fb; background: #f8faff; transform: translateY(-1px); }
.server-choice.selected { border-color: #6d99f4; background: #f2f6ff; box-shadow: 0 0 0 2px rgba(37, 99, 235, .08); }
.server-choice-copy { display: grid; min-width: 0; gap: 4px; }
.server-choice-copy strong { overflow-wrap: anywhere; color: #253246; font-size: 12px; }
.server-choice-copy small { overflow-wrap: anywhere; color: #687587; font-size: 10px; line-height: 1.4; }
.server-choice:disabled { border-color: #e7d9da; background: #faf7f7; color: #7d7374; cursor: not-allowed; opacity: .86; }
.server-choice:disabled:hover { transform: none; }
.server-choice:disabled .server-choice-copy strong, .server-choice:disabled .server-choice-mark { color: #8d555a; }
.delete-blocked { color: #9c3d45; font-size: 10px; font-style: normal; line-height: 1.4; }
.server-choice-mark { flex: 0 0 auto; color: var(--blue); font-size: 10px; font-weight: 700; white-space: nowrap; }
.server-choice-hint { margin: 9px 0 0; color: #647286; font-size: 10px; text-align: left; }
.plan-detail-list { display: grid; gap: 6px; margin: 12px 0; text-align: left; }
.plan-detail-list>div, .confirm-summary>div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 9px; border: 1px solid #e8ecf1; border-radius: 7px; background: #fafbfc; }
.plan-detail-list span, .confirm-summary span { color: #677385; font-size: 11px; }
.plan-detail-list strong, .confirm-summary strong { color: #263244; font-size: 11px; text-align: right; }
.plan-detail-note { color: #6b7685 !important; font-size: 11px !important; text-align: left; }
.manual-command { margin: 10px 0; padding: 11px; overflow-wrap: anywhere; border: 1px solid #dfe4ea; border-radius: 8px; background: #f5f7fa; color: #1d4ed8; text-align: left; white-space: pre-wrap; font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.manual-command code { font: inherit; }
.confirm-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 12px 0; text-align: left; }
.confirm-long { grid-column: 1 / -1; }
.confirm-warning { padding: 9px; border: 1px solid #f0dfbd; border-radius: 8px; background: #fffaf0; color: #75520e; font-size: 11px; text-align: left; }
.delete-target-heading { margin: 0; color: #253246; font-size: 13px; font-weight: 700; text-align: left; }
.resource-inventory { display: grid; gap: 8px; margin: 10px 0; text-align: left; }
.resource-inventory-section { padding: 9px; border: 1px solid #e8ecf1; border-radius: 8px; background: #fafbfc; }
.resource-inventory-section h4 { margin: 0 0 6px; color: #394558; font-size: 11px; }
.resource-inventory-item { display: grid; gap: 3px; padding: 6px 0; border-top: 1px solid #e8ecf1; }
.resource-inventory-item:first-of-type { border-top: 0; }
.resource-inventory-item strong { overflow-wrap: anywhere; color: #263244; font-size: 11px; }
.resource-inventory-item small { overflow-wrap: anywhere; color: #687587; font-size: 9px; line-height: 1.4; }
.resource-id { color: #687587; font: 9px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.inventory-status { display: inline-flex; align-items: center; gap: 4px; color: #18734f; font-size: 9px; font-weight: 700; }
.inventory-status.missing { color: #8a6414; }
.cleanup-blockers { margin: 8px 0 0; padding: 8px 10px 8px 24px; border: 1px solid #f0d6d8; border-radius: 8px; background: #fff7f7; color: #91363e; font-size: 10px; text-align: left; }
.cleanup-impact-note { margin: 9px 0 0; color: #6b7685; font-size: 10px; text-align: left; }
.action-loading-popup { width: min(360px, calc(100vw - 36px)) !important; padding: 26px 22px 22px !important; overflow: hidden !important; }
.action-loading-popup::before { position: absolute; inset: -35% -25% auto; height: 145px; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(73, 125, 235, .12), transparent 70%); content: ""; pointer-events: none; }
.action-loading-popup .swal2-title { position: relative; margin: 8px 0 0 !important; font-size: 17px !important; }
.action-loading-popup .swal2-html-container { position: relative; margin: 5px 0 0 !important; }
.action-loader { display: grid; justify-items: center; gap: 12px; padding: 12px 0 2px; }
.loading-orbit { position: relative; display: grid; place-items: center; width: 68px; height: 68px; border: 1px solid #e2eaf8; border-radius: 50%; background: radial-gradient(circle, #fff 45%, #f5f8ff); box-shadow: 0 6px 20px rgba(37, 99, 235, .08); }
.loading-orbit::before, .loading-orbit::after { position: absolute; inset: 5px; border: 2px solid transparent; border-top-color: #3471e8; border-right-color: rgba(52, 113, 232, .24); border-radius: 50%; content: ""; animation: orbit 1.05s cubic-bezier(.55,.15,.45,.85) infinite; }
.loading-orbit::after { inset: 14px; border-top-color: #97b6f3; border-right-color: transparent; animation: orbit-reverse 1.7s linear infinite; }
.loading-orbit-core { width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(145deg, #5390f7, #245fd4); box-shadow: 0 0 0 6px rgba(57, 117, 230, .1), 0 0 18px rgba(57, 117, 230, .35); animation: loading-breathe 1.2s ease-in-out infinite alternate; }
.loading-caption { max-width: 270px; margin: 0 !important; color: #748196 !important; font-size: 11px !important; line-height: 1.5 !important; text-align: center; }
.loading-dots { display: flex; gap: 5px; }
.loading-dots span { width: 5px; height: 5px; border-radius: 50%; background: #9db7e9; animation: dot-hop .8s ease-in-out infinite alternate; }
.loading-dots span:nth-child(2) { animation-delay: .15s; }
.loading-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { to { transform: scale(.65); opacity: .45; } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes orbit-reverse { to { transform: rotate(-360deg); } }
@keyframes loading-breathe { to { transform: scale(.78); opacity: .7; } }
@keyframes dot-hop { to { transform: translateY(-4px); opacity: .5; } }

@media (max-width: 560px) {
  .shell { width: min(100% - 24px, 500px); padding-top: 22px; }
  .token-panel { padding: 13px; }
  .menu-group { padding: 11px; border-radius: 12px; }
  .menu-group .primary-button, .menu-group .secondary-button { min-height: 52px; }
  .preview-grid { grid-template-columns: 1fr; }
  .confirm-bar { align-items: stretch; flex-direction: column; }
  .run-button { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
