:root {
  color-scheme: light;
  --ink: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --soft: #f7f8fa;
  --surface: #ffffff;
  --nav: #111827;
  --nav-soft: #1f2937;
  --green: #0f9f6e;
  --green-dark: #087a55;
  --green-soft: #eafaf4;
  --amber: #d97706;
  --amber-soft: #fff7e8;
  --red: #d92d20;
  --red-soft: #fff0ef;
  --blue: #1570ef;
  --blue-soft: #eef4ff;
  --shadow: 0 18px 48px rgba(16, 24, 40, .12);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--soft); }
body { margin: 0; color: var(--ink); background: var(--soft); font-family: Tahoma, Arial, sans-serif; letter-spacing: 0; }
button, input, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { display: block; margin-bottom: 6px; color: var(--green-dark); font-size: 12px; font-weight: 700; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 560px) 1fr; background: var(--surface); }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(32px, 6vw, 88px); box-shadow: -12px 0 40px rgba(16, 24, 40, .08); z-index: 2; }
.brand-lockup { display: flex; align-items: center; gap: 12px; margin-bottom: 72px; direction: ltr; }
.brand-lockup.compact { margin: 0 0 38px; padding: 0 10px; color: #fff; }
.brand-lockup div { display: flex; flex-direction: column; }
.brand-lockup strong { font-size: 22px; line-height: 1.1; }
.brand-lockup span:not(.brand-mark) { color: #98a2b3; font-size: 11px; margin-top: 4px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: #fff; background: var(--green); border-radius: 8px; }
.brand-mark svg { width: 23px; height: 23px; }
.login-copy h1 { margin: 0; font-size: 34px; }
.login-copy p { color: var(--muted); margin: 12px 0 30px; }
label { display: block; color: #344054; font-size: 13px; font-weight: 700; }
input, textarea { width: 100%; margin-top: 8px; border: 1px solid #d0d5dd; border-radius: 6px; background: var(--surface); color: var(--ink); outline: none; padding: 12px 14px; transition: border-color .18s, box-shadow .18s; }
textarea { resize: vertical; min-height: 88px; }
input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(15, 159, 110, .12); }
#loginForm { display: grid; gap: 18px; }
.form-error { min-height: 18px; margin: 0; color: var(--red); font-size: 12px; }
.login-visual { position: relative; overflow: hidden; background: #101828; }
.login-visual::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 52px 52px; }
.network-map { width: min(620px, 76%); aspect-ratio: 1; position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); }
.node { position: absolute; z-index: 2; width: 68px; height: 68px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; color: #d0d5dd; background: #1d2939; box-shadow: 0 0 0 10px rgba(255,255,255,.025); }
.node svg { width: 27px; }
.node.hub { width: 100px; height: 100px; inset: 50% auto auto 50%; transform: translate(-50%, -50%); color: #fff; background: var(--green); border: 0; box-shadow: 0 0 0 18px rgba(15,159,110,.13); }
.node.n1 { top: 7%; left: 10%; }.node.n2 { right: 5%; bottom: 11%; }.node.n3 { left: 3%; bottom: 12%; }
.route { position: absolute; z-index: 1; height: 1px; transform-origin: right center; background: repeating-linear-gradient(90deg, rgba(52,211,153,.85) 0 8px, transparent 8px 14px); }
.route.r1 { width: 40%; top: 34%; left: 19%; transform: rotate(28deg); }.route.r2 { width: 39%; top: 56%; right: 17%; transform: rotate(36deg); }.route.r3 { width: 42%; left: 15%; bottom: 29%; transform: rotate(-27deg); }

.button { min-height: 42px; border: 1px solid transparent; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 9px 16px; font-weight: 700; color: var(--ink); background: var(--surface); }
.button svg { width: 18px; height: 18px; }
.button.wide { width: 100%; }
.button.primary { color: #fff; background: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { border-color: #d0d5dd; background: var(--surface); }
.button.secondary:hover { background: var(--soft); }
.button.danger { color: #fff; background: var(--red); }
.button:disabled { cursor: wait; opacity: .62; }
.icon-button { width: 40px; height: 40px; padding: 0; display: inline-grid; place-items: center; border: 1px solid #d0d5dd; border-radius: 6px; color: #475467; background: var(--surface); }
.icon-button:hover { color: var(--ink); background: var(--soft); }
.icon-button svg { width: 19px; height: 19px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); direction: ltr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; background: var(--nav); direction: rtl; }
.sidebar nav { display: grid; gap: 6px; }
.nav-item { min-height: 44px; width: 100%; border: 0; border-radius: 6px; padding: 10px 12px; display: flex; align-items: center; gap: 11px; color: #98a2b3; background: transparent; text-decoration: none; text-align: right; }
.nav-item svg { width: 19px; height: 19px; flex: 0 0 auto; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-item.active { color: #fff; background: var(--nav-soft); box-shadow: inset -3px 0 var(--green); }
.nav-tail { margin-right: auto; width: 14px !important; }
.sidebar-foot { margin-top: auto; display: grid; gap: 16px; }
.server-mini { display: flex; align-items: center; gap: 10px; padding: 13px 11px; border-top: 1px solid rgba(255,255,255,.09); border-bottom: 1px solid rgba(255,255,255,.09); color: #fff; direction: ltr; }
.server-mini div { min-width: 0; display: flex; flex-direction: column; }
.server-mini strong { font-size: 12px; }.server-mini small { margin-top: 4px; color: #98a2b3; overflow: hidden; text-overflow: ellipsis; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #98a2b3; flex: 0 0 auto; }
.status-dot.online { background: #12b76a; box-shadow: 0 0 0 4px rgba(18,183,106,.12); }
.status-dot.offline { background: var(--amber); }.status-dot.disabled { background: #98a2b3; }
.main { min-width: 0; direction: rtl; }
.topbar { height: 92px; padding: 0 clamp(22px, 4vw, 54px); display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); }
.topbar h1 { margin: 0; font-size: 25px; }.topbar .eyebrow { margin: 0 0 4px; color: var(--muted); }
.hub-badge { margin-right: auto; display: flex; align-items: center; gap: 11px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.hub-badge div { display: flex; flex-direction: column; }.hub-badge small { color: var(--muted); font-size: 10px; }.hub-badge strong { margin-top: 3px; font-size: 12px; }
.mobile-menu { display: none; }
.content { max-width: 1500px; margin: 0 auto; padding: 28px clamp(18px, 4vw, 54px) 56px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card { min-height: 112px; display: flex; align-items: center; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.stat-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 7px; color: var(--blue); background: var(--blue-soft); }
.stat-icon svg { width: 22px; }.stat-card div { display: flex; flex-direction: column; }.stat-card small { color: var(--muted); }.stat-card strong { margin-top: 7px; font-size: 27px; }
.stat-card.online .stat-icon { color: var(--green); background: var(--green-soft); }.stat-card.offline .stat-icon { color: var(--amber); background: var(--amber-soft); }.stat-card.disabled .stat-icon { color: #667085; background: #f2f4f7; }
.warning-banner { margin-top: 16px; padding: 13px 16px; display: flex; gap: 10px; align-items: center; border: 1px solid #fedf89; border-radius: 6px; color: #92400e; background: var(--amber-soft); font-size: 13px; }
.warning-banner svg { width: 18px; flex: 0 0 auto; }
.router-section, .activity-section { margin-top: 28px; }
.section-head { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 18px; }.section-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.toolbar { display: flex; gap: 8px; }
.search-box { width: min(300px, 30vw); position: relative; font-weight: 400; }
.search-box svg { position: absolute; width: 17px; right: 12px; top: 13px; color: #98a2b3; }.search-box input { height: 42px; margin: 0; padding-right: 39px; }
.table-frame { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
table { width: 100%; min-width: 880px; border-collapse: collapse; }
th, td { padding: 14px 12px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { height: 46px; color: var(--muted); background: #f9fafb; font-size: 11px; font-weight: 700; }
td { color: #344054; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; } tbody tr:hover td { background: #fcfcfd; }
.router-name { display: flex; align-items: center; gap: 11px; }.router-avatar { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; color: var(--green-dark); background: var(--green-soft); }.router-avatar svg { width: 19px; }
.router-name div, .traffic { display: flex; flex-direction: column; }.router-name strong { color: var(--ink); font-size: 13px; }.router-name small, .traffic small { margin-top: 4px; color: var(--muted); }
.mono { direction: ltr; text-align: right; font-family: Consolas, monospace; font-size: 12px; white-space: nowrap; }
.status-pill { width: max-content; display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 999px; color: #027a48; background: var(--green-soft); font-weight: 700; }
.status-pill.offline { color: #b54708; background: var(--amber-soft); }.status-pill.disabled { color: #475467; background: #f2f4f7; }.status-pill.missing { color: var(--red); background: var(--red-soft); }
.row-actions { display: flex; gap: 3px; justify-content: flex-end; direction: rtl; }.row-actions .icon-button { width: 32px; height: 32px; border-color: transparent; }.row-actions .danger-icon { color: var(--red); }.actions-col { width: 146px; }
.empty-state { min-height: 350px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px; }
.empty-state > span { width: 58px; height: 58px; display: grid; place-items: center; color: var(--green); background: var(--green-soft); border-radius: 50%; }.empty-state h3 { margin: 18px 0 5px; }.empty-state p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.activity-list { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.activity-item { min-height: 68px; display: flex; align-items: center; gap: 11px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.activity-item > span { width: 34px; height: 34px; display: grid; place-items: center; color: var(--blue); background: var(--blue-soft); border-radius: 50%; flex: 0 0 auto; }.activity-item svg { width: 16px; }.activity-item div { min-width: 0; display: flex; flex-direction: column; }.activity-item strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }.activity-item small { margin-top: 5px; color: var(--muted); font-size: 10px; }

.modal { width: min(520px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 8px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); overflow: auto; }
.modal::backdrop { background: rgba(16,24,40,.58); backdrop-filter: blur(3px); }
.modal-head { min-height: 82px; padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 20px; }.modal-head .eyebrow { margin-bottom: 4px; }
.modal-body { display: grid; gap: 20px; padding: 24px 22px; }.optional { color: #98a2b3; font-weight: 400; }
.allocation-note { display: flex; gap: 12px; padding: 14px; border: 1px solid #abefc6; border-radius: 6px; color: #05603a; background: var(--green-soft); }.allocation-note > svg { width: 20px; flex: 0 0 auto; }.allocation-note div { display: flex; flex-direction: column; }.allocation-note strong { font-size: 12px; }.allocation-note span { margin-top: 5px; font-size: 11px; line-height: 1.65; }
.modal-actions { padding: 16px 22px; display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--line); background: #fcfcfd; }
.script-modal { width: min(760px, calc(100vw - 28px)); }.script-summary { margin: 20px 22px 0; display: flex; align-items: center; gap: 11px; color: #05603a; }.script-summary > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); }.script-summary svg { width: 20px; }.script-summary div { display: flex; flex-direction: column; }.script-summary small { margin-top: 4px; color: var(--muted); direction: ltr; text-align: right; }
pre { min-height: 300px; max-height: 48vh; margin: 18px 22px 22px; padding: 17px; overflow: auto; border: 1px solid #344054; border-radius: 6px; color: #d1fadf; background: #101828; font: 12px/1.7 Consolas, monospace; white-space: pre; text-align: left; }
.confirm-modal { width: min(420px, calc(100vw - 28px)); padding-top: 25px; text-align: center; }.confirm-modal h2 { margin: 14px 22px 7px; }.confirm-modal p { margin: 0 24px 24px; color: var(--muted); font-size: 13px; line-height: 1.7; }.confirm-icon { width: 50px; height: 50px; margin: auto; display: grid; place-items: center; color: var(--red); border-radius: 50%; background: var(--red-soft); }
.toast { position: fixed; z-index: 20; left: 24px; bottom: 24px; min-width: 250px; max-width: calc(100vw - 48px); min-height: 48px; padding: 11px 14px; display: flex; align-items: center; gap: 10px; border-radius: 6px; color: #fff; background: #101828; box-shadow: var(--shadow); opacity: 0; transform: translateY(16px); pointer-events: none; transition: .2s; }.toast.show { opacity: 1; transform: none; }.toast.error svg { color: #f97066; }.toast svg { width: 18px; color: #32d583; }
.loading-layer { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.42); }.spinner { width: 42px; height: 42px; border: 4px solid #d1fadf; border-top-color: var(--green); border-radius: 50%; animation: spin .7s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }.activity-list { grid-template-columns: 1fr 1fr; } }
@media (max-width: 780px) {
  .login-shell { display: block; background: var(--surface); }.login-panel { min-height: 100vh; padding: 36px 24px; box-shadow: none; }.login-visual { display: none; }.brand-lockup { margin-bottom: auto; }.login-copy { margin-top: 64px; }
  .app-shell { display: block; }.sidebar { position: fixed; z-index: 15; right: 0; width: 248px; transform: translateX(105%); transition: transform .2s; box-shadow: var(--shadow); }.sidebar.open { transform: none; }
  .mobile-menu { display: inline-grid; }.topbar { height: 78px; padding: 0 16px; }.topbar h1 { font-size: 21px; }.hub-badge { padding: 8px 10px; }.hub-badge small { display: none; }
  .content { padding: 20px 14px 40px; }.section-head { align-items: flex-start; flex-direction: column; }.toolbar { width: 100%; flex-wrap: wrap; }.search-box { width: 100%; order: 3; }.toolbar .button.primary { flex: 1; }
  .activity-list { grid-template-columns: 1fr; }.modal-actions .button { flex: 1; }.toast { left: 14px; bottom: 14px; max-width: calc(100vw - 28px); }
  .table-frame { overflow: visible; border: 0; background: transparent; }
  table { min-width: 0; display: block; }
  thead { display: none; }
  tbody { display: grid; gap: 12px; }
  tbody tr { display: grid; grid-template-columns: 1fr 1fr; padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
  tbody tr:hover td { background: transparent; }
  tbody td { min-width: 0; padding: 11px 5px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
  tbody td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 700; }
  tbody td:first-child, tbody td:last-child { grid-column: 1 / -1; }
  tbody td:nth-child(2), tbody td:nth-child(3) { grid-column: 1 / -1; }
  tbody td:first-child { padding-top: 0; }
  tbody td:first-child::before, tbody td:last-child::before { display: none; }
  tbody td:nth-last-child(2) { border-bottom: 0; }
  tbody td:last-child { padding: 11px 0 0; border: 0; }
  .row-actions { width: 100%; justify-content: stretch; gap: 7px; }
  .row-actions .icon-button { width: auto; height: 38px; flex: 1; border-color: var(--line); }
  .traffic { text-align: left; }
  tbody .mono { white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 480px) { .stats-grid { gap: 9px; }.stat-card { min-height: 98px; padding: 14px; gap: 11px; }.stat-icon { width: 38px; height: 38px; }.stat-card strong { font-size: 23px; }.stat-card small { font-size: 10px; }.hub-badge div { display: none; }.modal-head, .modal-body, .modal-actions { padding-left: 16px; padding-right: 16px; } }
