/* ==========================================================================
   Blank Store — control panel theme.
   Dark, modern, no framework. Logical properties throughout so the whole
   layout mirrors automatically for Arabic (dir="rtl").
   ========================================================================== */

:root {
    --bg: #080d18;
    --bg-2: #0b1220;
    --panel: rgba(20, 29, 48, .72);
    --panel-solid: #141d30;
    --panel-2: rgba(255, 255, 255, .04);
    --line: rgba(255, 255, 255, .09);
    --line-2: rgba(255, 255, 255, .14);
    --text: #eaf0fb;
    --muted: #8d9bb5;
    --accent: #4d8bff;
    --accent-2: #2f6ae0;
    --accent-glow: rgba(77, 139, 255, .35);
    --cyan: #22d3ee;
    --ok: #2ee6a8;
    --bad: #ff5f6d;
    --warn: #ffb020;
    --radius: 18px;
    --radius-sm: 12px;
    --sidebar-w: 248px;
    --font: 'Inter', -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-ar: 'Noto Kufi Arabic', 'Segoe UI', Tahoma, sans-serif;
    --shadow: 0 24px 60px -30px rgba(0, 0, 0, .95);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1200px 620px at 12% -10%, rgba(77, 139, 255, .16), transparent 62%),
        radial-gradient(900px 520px at 100% 0%, rgba(34, 211, 238, .09), transparent 58%),
        radial-gradient(800px 600px at 50% 110%, rgba(46, 230, 168, .06), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Arabic: Noto Kufi Arabic everywhere, with a little extra line-height. */
html[lang="ar"] body,
html[lang="ar"] button,
html[lang="ar"] input,
html[lang="ar"] select,
html[lang="ar"] textarea { font-family: var(--font-ar); line-height: 1.85; }
html[lang="ar"] .mono,
html[lang="ar"] code { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 4px; }
h2 { letter-spacing: -.01em; }

.mono { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; }
.tiny { font-size: 12px; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.warn { color: var(--warn); }
.right { text-align: end; }
.link { cursor: pointer; }
.link-quiet { color: var(--muted); }
.link-quiet:hover { color: var(--accent); text-decoration: none; }
/* Flags keep their own emoji font so they render in colour on every OS. */
.flag, .flag-big {
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    font-style: normal;
}

/* ==========================================================================
   Sidebar + shell
   ========================================================================== */
.sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 22px 14px;
    background: linear-gradient(180deg, rgba(14, 22, 38, .96), rgba(9, 14, 26, .96));
    border-inline-end: 1px solid var(--line);
    backdrop-filter: blur(14px);
    z-index: 40;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 18px;
    color: var(--text);
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -.02em;
}
.brand:hover { text-decoration: none; }
/* Logo sizing depends on its shape: a wide wordmark gets the full sidebar
   width and stands alone; a square mark is an icon that sits beside the name. */
.brand-logo { object-fit: contain; display: block; }
.brand-logo.is-wide { max-width: 100%; max-height: 46px; }
.brand-logo.is-mark { width: 40px; height: 40px; flex: none; border-radius: 9px; }
.brand-text { font-weight: 800; letter-spacing: -.02em; }
.brand-mark {
    width: 30px; height: 30px; flex: none; border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), var(--cyan));
    box-shadow: 0 8px 20px -8px var(--accent-glow);
    position: relative;
}
.brand-mark::after {
    content: ""; position: absolute; inset: 0; margin: auto;
    width: 0; height: 0;
    border-inline-start: 9px solid #fff;
    border-block: 6px solid transparent;
    inset-inline-start: 11px;
}
html[dir="rtl"] .brand-mark::after { transform: scaleX(-1); }

.sidenav { display: flex; flex-direction: column; gap: 3px; }
.sidenav a {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--muted); font-weight: 600; font-size: 14.5px;
    border: 1px solid transparent;
    transition: background .16s, color .16s, border-color .16s;
}
.sidenav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.sidenav a.active {
    background: linear-gradient(90deg, rgba(77, 139, 255, .18), rgba(77, 139, 255, .05));
    color: #fff; border-color: rgba(77, 139, 255, .32);
}
.sidenav .ico { width: 18px; height: 18px; flex: none; opacity: .95; }
html[dir="rtl"] .sidenav a.active {
    background: linear-gradient(270deg, rgba(77, 139, 255, .18), rgba(77, 139, 255, .05));
}

.side-foot { margin-block-start: auto; display: flex; flex-direction: column; gap: 10px; padding: 10px; }
.side-domain { font-size: 11.5px; color: var(--muted); word-break: break-all; }
.logout button {
    width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
    background: var(--panel-2); border: 1px solid var(--line);
    color: var(--muted); cursor: pointer; font: inherit; font-size: 13.5px;
}
.logout button:hover { color: var(--text); border-color: var(--line-2); }

.lang-switch { display: inline-flex; gap: 3px; padding: 3px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.lang-switch a {
    padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
    color: var(--muted); line-height: 1.5;
}
.lang-switch a:hover { color: var(--text); text-decoration: none; }
.lang-switch a.on { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -8px var(--accent-glow); }
.lang-switch-float { position: fixed; inset-block-start: 18px; inset-inline-end: 18px; z-index: 50; }

.wrap { max-width: 1140px; margin: 30px auto; padding: 0 26px; }
body.has-sidebar .wrap { margin-inline-start: var(--sidebar-w); }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 34px 0; }
body.has-sidebar .foot { margin-inline-start: var(--sidebar-w); }

/* Mobile top bar + drawer */
.navtoggle, .nav-scrim, .mobile-bar { display: none; }

/* ==========================================================================
   Flash / cards / buttons
   ========================================================================== */
.flash {
    padding: 13px 17px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px;
    border: 1px solid; backdrop-filter: blur(8px);
}
.flash-success { background: rgba(46, 230, 168, .1); border-color: rgba(46, 230, 168, .35); color: #86f5cd; }
.flash-error { background: rgba(255, 95, 109, .1); border-color: rgba(255, 95, 109, .38); color: #ffb3b9; }
.flash ul { margin: 0; padding-inline-start: 18px; }

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 18px;
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
    transition: border-color .2s;
}
.card.empty { text-align: center; }
.card-h { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--panel-2);
    color: var(--text); cursor: pointer; font: inherit; font-size: 14px; font-weight: 600;
    transition: border-color .15s, background .15s, transform .06s, box-shadow .2s;
}
.btn:hover { border-color: var(--line-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent; color: #fff;
    box-shadow: 0 12px 26px -12px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-danger { color: #ffb3b9; border-color: rgba(255, 95, 109, .35); background: rgba(255, 95, 109, .08); }
.btn-danger:hover { border-color: rgba(255, 95, 109, .6); }
.btn-ghost { background: transparent; border: 1px dashed var(--line-2); color: var(--muted); align-self: flex-start; }
.btn-ghost:hover { border-style: solid; border-color: var(--accent); color: var(--text); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }

/* ==========================================================================
   Live dot
   ========================================================================== */
.live-dot {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    background: var(--ok); box-shadow: 0 0 0 0 rgba(46, 230, 168, .6);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(46, 230, 168, .55); }
    70% { box-shadow: 0 0 0 7px rgba(46, 230, 168, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 230, 168, 0); }
}
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ==========================================================================
   Server heartbeat — radial dials
   ========================================================================== */
.hb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.state-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 13px; border-radius: 999px; font-size: 12px; font-weight: 700;
    border: 1px solid;
}
.state-chip.ok { background: rgba(46, 230, 168, .1); border-color: rgba(46, 230, 168, .32); color: #86f5cd; }
.state-chip.bad { background: rgba(255, 95, 109, .1); border-color: rgba(255, 95, 109, .38); color: #ffb3b9; }
.state-chip.bad .live-dot { background: var(--bad); animation: none; }

.hb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(146px, 1fr)); gap: 14px; }

.dial { text-align: center; position: relative; padding: 6px 0 2px; }
.dial-svg { width: 104px; height: 104px; display: block; margin: 0 auto; transform: rotate(-90deg); }
html[dir="rtl"] .dial-svg { transform: rotate(-90deg) scaleY(-1); }
.dial-bg { fill: none; stroke: rgba(255, 255, 255, .07); stroke-width: 7; }
.dial-fg {
    fill: none; stroke-width: 7; stroke-linecap: round;
    transition: stroke-dashoffset .7s cubic-bezier(.4, 0, .2, 1), stroke .3s;
}
.dial-fg.tone-ok { stroke: var(--ok); filter: drop-shadow(0 0 6px rgba(46, 230, 168, .45)); }
.dial-fg.tone-warn { stroke: var(--warn); filter: drop-shadow(0 0 6px rgba(255, 176, 32, .45)); }
.dial-fg.tone-bad { stroke: var(--bad); filter: drop-shadow(0 0 6px rgba(255, 95, 109, .5)); }
.dial-mid {
    position: absolute; inset-block-start: 34px; inset-inline: 0;
    font-variant-numeric: tabular-nums;
}
.dial-mid b { font-size: 25px; font-weight: 800; letter-spacing: -.03em; }
.dial-mid i { font-style: normal; font-size: 12px; color: var(--muted); margin-inline-start: 1px; }
.dial-label { font-size: 13px; font-weight: 700; margin-top: 6px; }
.dial-sub { margin-top: 2px; }

.tile {
    display: flex; flex-direction: column; justify-content: center;
    background: var(--panel-2); border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: 14px 16px; text-align: start;
}
.tile-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.tile-value { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile-value i { font-style: normal; font-size: 12px; color: var(--muted); font-weight: 600; }
.tile-sub { margin-top: 2px; }
html[lang="ar"] .tile-label { text-transform: none; letter-spacing: 0; }

/* Connected clients table */
.clients-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.clients-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.detail-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
html[lang="ar"] .detail-label { text-transform: none; letter-spacing: 0; font-size: 12px; }
.ctable { width: 100%; border-collapse: collapse; font-size: 13px; }
.ctable td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.ctable tr:last-child td { border-bottom: 0; }
.ctable td.right { white-space: nowrap; }
.ctable .mono { color: #cdd9f2; }
.pill {
    display: inline-block; padding: 2px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 700; background: rgba(77, 139, 255, .15); color: #a6c4ff;
}

/* ==========================================================================
   Top countries — flag tiles
   ========================================================================== */
.flag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.flag-tile {
    display: flex; flex-direction: column; gap: 3px;
    padding: 14px 12px; border-radius: var(--radius-sm);
    background: var(--panel-2); border: 1px solid var(--line);
    transition: border-color .18s, transform .18s;
}
.flag-tile:hover { border-color: var(--line-2); transform: translateY(-2px); }
.flag-big { font-size: 30px; line-height: 1.15; }
.flag-name { font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flag-req { font-size: 18px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.flag-bar { display: block; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-top: 4px; }
.flag-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--cyan)); transition: width .6s; }
html[dir="rtl"] .flag-bar i { background: linear-gradient(270deg, var(--accent), var(--cyan)); }

/* ==========================================================================
   Stat row + proxy cards
   ========================================================================== */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 13px; margin-bottom: 22px; }
.stat {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px 18px; display: flex; flex-direction: column;
    backdrop-filter: blur(12px); transition: border-color .2s, transform .2s;
}
.stat:hover { border-color: var(--line-2); transform: translateY(-2px); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
html[lang="ar"] .stat-label { text-transform: none; letter-spacing: 0; font-size: 12px; }
.stat-value { font-size: 28px; font-weight: 800; margin-top: 5px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-value.small { font-size: 16px; }
.stat-value.accent { text-shadow: 0 0 26px var(--accent-glow); }
.stat-hint { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.card.proxy:hover { border-color: var(--line-2); }
.proxy-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.proxy-title { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.proxy-title h2 { margin: 0; font-size: 18px; font-weight: 700; }
.proxy-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.proxy-actions form { margin: 0; }

.badge { font-size: 11.5px; font-weight: 700; padding: 4px 11px; border-radius: 999px; }
.badge-ok { background: rgba(46, 230, 168, .13); color: #86f5cd; }
.badge-bad { background: rgba(255, 95, 109, .13); color: #ffb3b9; }
.badge-off { background: rgba(141, 155, 181, .13); color: var(--muted); }
.badge-wait { background: rgba(255, 176, 32, .13); color: #ffd68a; }
.badge-live { background: rgba(77, 139, 255, .16); color: #a6c4ff; }

.proxy-info { display: grid; grid-template-columns: 148px 1fr; gap: 6px 14px; margin: 18px 0 0; font-size: 14px; }
.proxy-info dt { color: var(--muted); }
.proxy-info dd { margin: 0; }
.url { display: block; font-size: 13px; font-weight: 600; color: #a6c4ff; user-select: all; word-break: break-all; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.metric { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.metric span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
html[lang="ar"] .metric span { text-transform: none; letter-spacing: 0; font-size: 11.5px; }
.metric b { display: block; font-size: 19px; margin-top: 4px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.chip-2 { color: #86f5cd; } .chip-3 { color: #a6c4ff; } .chip-4 { color: #ffd68a; } .chip-5 { color: #ffb3b9; }
.paths { list-style: none; margin: 8px 0 0; padding: 0; }
.paths li { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.paths li:last-child { border-bottom: 0; }
.week { margin: 16px 0 0; font-size: 12.5px; }

/* ==========================================================================
   Guard banner
   ========================================================================== */
.guard-banner {
    background: linear-gradient(135deg, rgba(255, 95, 109, .16), rgba(255, 95, 109, .07));
    border: 1px solid rgba(255, 95, 109, .45); color: #ffb3b9;
    border-radius: var(--radius); padding: 15px 18px; margin-bottom: 18px; font-size: 14px;
}
.guard-banner strong { color: #ffd5d9; }

/* ==========================================================================
   Forms
   ========================================================================== */
.form { display: flex; flex-direction: column; gap: 17px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 13.5px; font-weight: 700; }
.field-hint { font-size: 12.5px; color: var(--muted); }
.reco { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(46, 230, 168, .13); color: #86f5cd; margin-inline-start: 6px; }

input[type=text], input[type=number], input[type=password], select, textarea {
    background: rgba(8, 13, 24, .8); border: 1px solid var(--line); color: var(--text);
    border-radius: var(--radius-sm); padding: 11px 13px; font: inherit; font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(77, 139, 255, .16);
}
input::placeholder { color: rgba(141, 155, 181, .6); }
label { display: block; }

.host-input { display: flex; align-items: stretch; }
.host-input input { border-start-end-radius: 0; border-end-end-radius: 0; }
.host-suffix {
    display: flex; align-items: center; padding: 0 13px; font-size: 13.5px; color: var(--muted);
    background: var(--panel-2); border: 1px solid var(--line); border-inline-start: 0;
    border-start-end-radius: var(--radius-sm); border-end-end-radius: var(--radius-sm);
}
.advanced { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 15px; background: var(--panel-2); }
.advanced summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.advanced summary:hover { color: var(--text); }
.advanced > .field { margin-top: 14px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

.switch-row {
    display: flex; align-items: center; gap: 14px; padding: 15px 17px;
    background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer;
    transition: border-color .18s;
}
.switch-row:hover { border-color: var(--line-2); }
.switch-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.switch-row > span { display: flex; flex-direction: column; gap: 2px; }
.gate-state { margin-inline-start: auto; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; padding: 4px 11px; border-radius: 999px; white-space: nowrap; }
.gate-state.on { background: rgba(46, 230, 168, .14); color: #86f5cd; }
.gate-state.off { background: rgba(141, 155, 181, .14); color: var(--muted); }

/* Settings: API rows */
.settings-intro { margin-bottom: 20px; }
.settings-intro p { margin: 8px 0 0; }
.settings-intro code { background: rgba(255, 255, 255, .07); padding: 2px 7px; border-radius: 6px; font-size: 12px; }
.apis-head { display: flex; flex-direction: column; gap: 3px; }
.apis { display: flex; flex-direction: column; gap: 11px; }
.api-row { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.api-grid { display: grid; grid-template-columns: 1fr 1.7fr 1.7fr auto auto; gap: 11px; align-items: end; }
.field.mini { gap: 4px; }
.row-enable { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.row-enable input { width: 18px; height: 18px; accent-color: var(--ok); }
.row-del { padding: 9px 12px; color: #ffb3b9; }

/* Whitelist */
.wl-add { display: flex; gap: 10px; align-items: center; }
.wl-add input { flex: 1; }
.table-scroll { overflow-x: auto; }
.wtable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.wtable th {
    text-align: start; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); font-weight: 700; padding: 0 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
html[lang="ar"] .wtable th { text-transform: none; letter-spacing: 0; font-size: 12px; }
.wtable th.right { text-align: end; }
.wtable td { padding: 10px; border-bottom: 1px solid var(--line); }
.wtable tr:last-child td { border-bottom: 0; }
.wtable tbody tr:hover { background: rgba(255, 255, 255, .02); }
.wtable form { margin: 0; }

/* Login */
.login-card {
    max-width: 400px; margin: 14vh auto; padding: 34px;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    backdrop-filter: blur(16px); box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.login-brand h1 { margin: 0; font-size: 23px; }
.login-logo { object-fit: contain; display: block; }
.login-logo.is-mark { width: 60px; height: 60px; border-radius: 14px; flex: none; }
.login-logo.is-wide { max-width: 240px; max-height: 66px; }
.login-card form { display: flex; flex-direction: column; gap: 9px; margin-top: 22px; }
.login-card label { font-size: 13px; font-weight: 700; }
.login-card .btn { justify-content: center; margin-top: 10px; padding: 12px; }

/* ==========================================================================
   Statistics page
   ========================================================================== */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.chart-scroll { overflow-x: auto; margin-top: 14px; }
.chart { width: 100%; height: 210px; display: block; }
.chart-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.chart-legend i { display: inline-block; width: 13px; height: 3px; border-radius: 2px; margin-inline-end: 6px; vertical-align: middle; }
.empty-line { padding: 22px 0; text-align: center; color: var(--muted); }
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { margin-bottom: 11px; }
.bar-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.bar-track { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--cyan)); transition: width .5s; }
html[dir="rtl"] .bar-fill { background: linear-gradient(270deg, var(--accent), var(--cyan)); }
.tone-ok { background: var(--ok); } .tone-warn { background: var(--warn); } .tone-bad { background: var(--bad); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: 0; }

/* ==========================================================================
   Responsive — sidebar becomes a drawer
   ========================================================================== */
@media (max-width: 980px) {
    .sidebar {
        transform: translateX(calc(var(--sidebar-w) * -1));
        transition: transform .25s ease;
        box-shadow: var(--shadow);
    }
    html[dir="rtl"] .sidebar { transform: translateX(var(--sidebar-w)); }
    .navtoggle:checked ~ .sidebar { transform: translateX(0); }
    .navtoggle:checked ~ .nav-scrim {
        display: block; position: fixed; inset: 0; z-index: 35;
        background: rgba(3, 6, 12, .65); backdrop-filter: blur(2px);
    }
    .mobile-bar {
        display: flex; align-items: center; gap: 12px;
        padding: 12px 16px; position: sticky; top: 0; z-index: 30;
        background: rgba(10, 16, 28, .9); border-bottom: 1px solid var(--line);
        backdrop-filter: blur(12px);
    }
    .burger { display: flex; padding: 6px; cursor: pointer; color: var(--text); }
    .burger svg { width: 22px; height: 22px; }
    .mobile-title { font-weight: 700; font-size: 15px; }
    body.has-sidebar .wrap, body.has-sidebar .foot { margin-inline-start: 0; }
    .wrap { margin: 20px auto; padding: 0 16px; }
    .two-col, .detail-grid { grid-template-columns: 1fr; }
    .api-grid { grid-template-columns: 1fr 1fr; }
    .proxy-info { grid-template-columns: 1fr; gap: 2px 0; }
    .proxy-info dt { margin-top: 8px; font-size: 12px; }
}

@media (max-width: 560px) {
    h1 { font-size: 22px; }
    .card { padding: 17px; }
    .hb-grid { grid-template-columns: repeat(2, 1fr); }
    .dial-svg { width: 92px; height: 92px; }
    .dial-mid { inset-block-start: 29px; }
    .dial-mid b { font-size: 22px; }
    .flag-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .api-grid { grid-template-columns: 1fr; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { justify-content: center; }
}

@media print { .sidebar, .mobile-bar, .lang-switch { display: none; } body.has-sidebar .wrap { margin: 0; } }

/* ==========================================================================
   Real flag images.
   Windows has no country-flag glyphs (Chrome renders the emoji as two plain
   letters), so flags are SVG images served from this box, with a 2-letter
   badge as the fallback when an image is missing.
   ========================================================================== */
img.flag {
    width: 21px; height: 15px; border-radius: 3px; object-fit: cover;
    vertical-align: -2px; display: inline-block;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .14), 0 1px 3px rgba(0, 0, 0, .45);
    background: rgba(255, 255, 255, .06);
}
.flag-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 25px; height: 16px; padding: 0 5px; border-radius: 4px;
    font-size: 9.5px; font-weight: 800; letter-spacing: .04em;
    background: rgba(77, 139, 255, .18); color: #a6c4ff;
    border: 1px solid rgba(77, 139, 255, .3);
    vertical-align: -2px; font-family: var(--font);
}
.flag-unknown { background: rgba(141, 155, 181, .16); color: var(--muted); border-color: var(--line); }

/* Bigger flag inside a country tile */
.flag-big img.flag { width: 44px; height: 31px; border-radius: 5px; }
.flag-big .flag-badge { min-width: 44px; height: 31px; font-size: 14px; border-radius: 5px; }
.flag-big { line-height: 1; display: block; margin-bottom: 4px; }

/* the "no heartbeat" chip */
.state-chip.unknown { background: rgba(141, 155, 181, .13); border-color: var(--line-2); color: var(--muted); }
.state-chip.unknown .live-dot { background: var(--muted); animation: none; }
/* live dot goes grey when the poller cannot reach the server */
.live-dot.stale { background: var(--muted); animation: none; }

/* ==========================================================================
   Background tasks (start/stop the collectors)
   ========================================================================== */
.task-row {
    display: flex; align-items: flex-start; gap: 16px;
    padding: 15px 0; border-top: 1px solid var(--line);
}
.task-row:first-of-type { border-top: 0; }
.task-main { flex: 1; min-width: 0; }
.task-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 3px; }
.task-main p { margin: 3px 0 0; }
.task-action { flex: none; margin: 0; }
.task-off {
    font-size: 12.5px; color: #ffd68a;
    background: rgba(255, 176, 32, .1); border: 1px solid rgba(255, 176, 32, .28);
    border-radius: var(--radius-sm); padding: 8px 11px; margin-top: 8px !important;
}
@media (max-width: 560px) {
    .task-row { flex-direction: column; gap: 10px; }
    .task-action .btn { width: 100%; justify-content: center; }
}
.flag-req .flag-unit {
    font-style: normal; font-size: 10.5px; font-weight: 600;
    color: var(--muted); margin-inline-start: 5px; letter-spacing: 0;
}

/* ==========================================================================
   Pro polish — tighter hierarchy, quieter chrome, sharper numbers
   ========================================================================== */

/* Numbers are the content here: keep them aligned and prominent. */
.stat-value, .tile-value, .dial-mid b, .flag-req, .metric b, .wtable td {
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: "tnum" 1, "lnum" 1;
}

/* Cards: a touch more depth, a cleaner edge, and a hairline top highlight
   so they read as raised surfaces rather than flat blocks. */
.card {
    position: relative;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0) 120px),
        var(--panel);
}
.card::before {
    content: ""; position: absolute; inset-inline: 18px; inset-block-start: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .16), transparent);
    pointer-events: none;
}

/* Section headings sit quieter so the figures lead. */
.card-h {
    font-size: 12.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .09em; color: var(--muted);
}
html[lang="ar"] .card-h { text-transform: none; letter-spacing: 0; font-size: 14px; }
.hb-head { margin-bottom: 20px; }

/* Dials: thinner ring, softer track, larger figure. */
.dial-bg { stroke-width: 6; stroke: rgba(255, 255, 255, .06); }
.dial-fg { stroke-width: 6; }
.dial-mid b { font-size: 27px; }
.dial-label { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
html[lang="ar"] .dial-label { text-transform: none; letter-spacing: 0; font-size: 13px; }

/* Tiles line up with the dials instead of floating in their own boxes. */
.tile { background: transparent; border: 0; border-inline-start: 1px solid var(--line); border-radius: 0; padding-inline: 20px; }
html[dir="rtl"] .tile { border-inline-start: 1px solid var(--line); }
.tile-value { font-size: 27px; line-height: 1.15; }
.tile-value i { font-size: 12px; margin-inline-start: 3px; }
@media (max-width: 720px) { .tile { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; } }

/* Headline stats: bigger, with a quiet uppercase label. */
.stat-value { font-size: 32px; }
.stat { padding: 18px 20px; }

/* Country tiles: image-forward, with the flag framed. */
.flag-tile { padding: 16px 14px; }
.flag-big img.flag { width: 46px; height: 33px; border-radius: 6px; }
.flag-req { font-size: 22px; }
.flag-name { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
html[lang="ar"] .flag-name { text-transform: none; letter-spacing: 0; font-size: 13px; }

/* Sidebar: a clearer active state. */
.sidenav a.active { box-shadow: inset 3px 0 0 var(--accent); }
html[dir="rtl"] .sidenav a.active { box-shadow: inset -3px 0 0 var(--accent); }

/* Tables read better with a little more air. */
.wtable td, .ctable td { padding-block: 11px; }
.wtable thead th { padding-bottom: 12px; }

/* Focus visibility for keyboard users. */
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px;
}

/* Accounts-watching-now is its own card now; the inner wrapper no longer
   needs the divider it had inside the server card. */
.accounts-card .ctable { margin-top: 4px; }
.clients-inner { margin: 0; padding: 0; border: 0; }

/* Per-host verification state */
.badge-verified { background: rgba(46, 230, 168, .13); color: #86f5cd; }
.badge-open { background: rgba(255, 176, 32, .14); color: #ffd68a; }
.badge-masked { background: rgba(34, 211, 238, .14); color: #8ee7f5; }

/* ==========================================================================
   Modern layer.
   Refines the components above rather than replacing them: elevation, focus,
   icon alignment, and the pieces the newer pages need. Everything here is a
   single-class selector at the same specificity as the base, so it layers by
   order rather than by an escalating specificity war.
   ========================================================================== */

:root {
    /* One elevation scale, so a raised thing is raised by the same amount
       everywhere instead of each component inventing its own shadow. */
    --lift-1: 0 1px 2px rgba(0, 0, 0, .28);
    --lift-2: 0 6px 18px -8px rgba(0, 0, 0, .55);
    --lift-3: 0 22px 48px -24px rgba(0, 0, 0, .8);
    --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 38%, transparent);
    --ease: cubic-bezier(.2, .7, .3, 1);
}

/* ---- icons --------------------------------------------------------------
   Sized in em so an icon always matches the text it sits beside, and never
   squashed by a flex parent. */
.ico {
    width: 1.15em;
    height: 1.15em;
    flex: none;
    vertical-align: -.18em;
}
.ico-lg { width: 1.5em; height: 1.5em; }
.ico-xl { width: 2.1em; height: 2.1em; }
.ico-muted { color: var(--muted); }
.ico-ok { color: var(--ok); }
.ico-bad { color: var(--bad); }
.ico-warn { color: var(--warn); }

/* A glyph in a soft tinted tile — used to head a card or mark a statistic. */
.ico-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    flex: none;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
}
.ico-tile.is-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); border-color: color-mix(in srgb, var(--ok) 26%, transparent); }
.ico-tile.is-bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); border-color: color-mix(in srgb, var(--bad) 26%, transparent); }
.ico-tile.is-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 26%, transparent); }

/* ---- cards --------------------------------------------------------------- */
.card {
    box-shadow: var(--lift-3);
    transition: border-color .2s var(--ease);
}

/* The newer pages wrap the heading in .card-h with a trailing action, so it
   has to work as a row as well as a title. */
.card-h {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
    flex-wrap: wrap;
}
.card-h h2 {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.01em;
}
.card-h h2 .ico { color: var(--accent); }
.card-h > .ico { color: var(--accent); }


/* ---- buttons ------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    box-shadow: var(--lift-1);
}
.btn:focus-visible,
.host-input:focus-visible,
select.host-input:focus-visible,
.lang-switch a:focus-visible,
.sidenav a:focus-visible,
summary:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}
.btn-primary { box-shadow: var(--lift-2), 0 12px 26px -12px var(--accent-glow); }
.btn:disabled,
.btn[disabled] {
    opacity: .45;
    cursor: not-allowed;
    box-shadow: none;
}

/* ---- badges -------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
/* A coloured dot ahead of a state word reads faster than the word alone, and
   still works for anyone who cannot separate the hues. */
.badge-ok::before,
.badge-bad::before,
.badge-off::before,
.badge-wait::before,
.badge-live::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}
.badge-live::before { animation: pulse-dot 1.8s var(--ease) infinite; }
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .45; transform: scale(.72); }
}

/* ---- callout ------------------------------------------------------------- */
.callout {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 13px 16px;
    margin: 0 0 18px;
    border-radius: var(--radius-sm);
    border: 1px solid color-mix(in srgb, var(--warn) 34%, transparent);
    background: color-mix(in srgb, var(--warn) 9%, transparent);
    border-inline-start: 3px solid var(--warn);
    color: var(--text);
    font-size: 13.5px;
}
.callout strong { color: var(--warn); }
.callout ul { margin: 0; padding-inline-start: 18px; }

/* ---- lists ---------------------------------------------------------------- */
.tight { margin: 0; padding-inline-start: 18px; }
.tight li { margin-bottom: 4px; }

/* A numbered sequence. Numbered because these steps genuinely run in order —
   step 5 cannot happen before step 4. */
.steps {
    counter-reset: step;
    list-style: none;
    margin: 0 0 6px;
    padding: 0;
    display: grid;
    gap: 9px;
}
.steps li {
    counter-increment: step;
    position: relative;
    padding-inline-start: 38px;
    min-height: 26px;
    font-size: 13.5px;
    color: var(--muted);
}
.steps li::before {
    content: counter(step);
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    width: 26px;
    height: 26px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 13%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
}

/* ---- bars ---------------------------------------------------------------- */
.bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 9px;
}
.bar-label {
    flex: none;
    width: 132px;
    font-size: 13px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bar-value {
    flex: none;
    min-width: 58px;
    text-align: end;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.bar-track {
    flex: 1;
    min-width: 0;
    height: 8px;
    border-radius: 999px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    overflow: hidden;
}
.bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent-2), var(--accent));
    transition: width .5s var(--ease);
}
@media (max-width: 560px) {
    .bar-label { width: 92px; }
}

/* ---- forms ---------------------------------------------------------------- */
.host-input-wrap {
    display: flex;
    align-items: stretch;
    gap: 0;
}
.host-input-wrap .host-input {
    border-start-end-radius: 0;
    border-end-end-radius: 0;
}
.host-suffix {
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    font-size: 13px;
    color: var(--muted);
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-inline-start: 0;
    border-start-end-radius: var(--radius-sm);
    border-end-end-radius: var(--radius-sm);
    white-space: nowrap;
}

.switch-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 0;
    cursor: pointer;
}
.switch-row input { flex: none; width: 16px; height: 16px; accent-color: var(--accent); }

/* The set of servers an action applies to. */
.scope-pick {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
    padding: 11px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--line-2);
    background: var(--panel-2);
}
.chip-2 {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel-solid);
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s var(--ease);
}
.chip-2:hover { border-color: var(--line-2); }
.chip-2 input { accent-color: var(--accent); }
.chip-2:has(input:checked) {
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.api-row {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}
.api-row .host-input { flex: 1; min-width: 8rem; }

/* ---- detail / misc -------------------------------------------------------- */
details > summary {
    cursor: pointer;
    padding: 6px 0;
    font-size: 13px;
    list-style: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    margin-inline-end: 8px;
    border-inline-start: 5px solid currentColor;
    border-block: 4px solid transparent;
    transition: transform .18s var(--ease);
    vertical-align: middle;
}
details[open] > summary::before { transform: rotate(90deg); }
html[dir="rtl"] details > summary::before { transform: rotate(180deg); }
html[dir="rtl"] details[open] > summary::before { transform: rotate(90deg); }

.empty-line {
    text-align: center;
    color: var(--muted);
    padding: 22px 12px;
    font-size: 13.5px;
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ---- the build page ------------------------------------------------------
   A build is a sequence of eight stages that either have run, are running, or
   have not started. A single bar cannot say which — the stepper below can, so
   a stall is visible at the stage it stalled on. */
.build-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.build-title { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.build-title strong { font-size: 15px; }
.build-head .badge { margin-inline-start: auto; }
.build-msg { margin: 10px 0 16px; font-size: 13.5px; color: var(--muted); }

.stepper {
    list-style: none;
    counter-reset: st;
    margin: 0 0 6px;
    padding: 0;
    display: grid;
    gap: 2px;
}
.stepper li {
    counter-increment: st;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 7px 2px;
    font-size: 13px;
    color: var(--muted);
    position: relative;
}
/* The rail joining one stage to the next, so it reads as a run rather than a
   list of unrelated rows. */
.stepper li::after {
    content: "";
    position: absolute;
    inset-inline-start: 13px;
    top: 34px;
    bottom: -2px;
    width: 2px;
    background: var(--line);
}
.stepper li:last-child::after { display: none; }

.stepper-dot {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: none;
    border-radius: 50%;
    border: 1px solid var(--line-2);
    background: var(--panel-solid);
    color: var(--muted);
}
.stepper li.is-done { color: var(--text); }
.stepper li.is-done .stepper-dot {
    color: var(--ok);
    border-color: color-mix(in srgb, var(--ok) 55%, transparent);
    background: color-mix(in srgb, var(--ok) 14%, transparent);
}
.stepper li.is-done::after { background: color-mix(in srgb, var(--ok) 45%, transparent); }

.stepper li.is-now { color: var(--text); font-weight: 600; }
.stepper li.is-now .stepper-dot {
    color: var(--accent);
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
    animation: step-breathe 1.8s var(--ease) infinite;
}
@keyframes step-breathe {
    0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
    50%      { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 6%, transparent); }
}

.stepper li.is-failed { color: var(--bad); font-weight: 600; }
.stepper li.is-failed .stepper-dot {
    color: var(--bad);
    border-color: var(--bad);
    background: color-mix(in srgb, var(--bad) 16%, transparent);
}

.build-log {
    max-height: 260px;
    overflow: auto;
    margin: 8px 0 0;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, .28);
    border: 1px solid var(--line);
    font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    direction: ltr;
    text-align: left;
}

/* ---- what you need before starting --------------------------------------- */
.reqs { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 10px; }
.reqs li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
    background: color-mix(in srgb, var(--warn) 7%, transparent);
    font-size: 13px;
    color: var(--muted);
}
.reqs li strong { color: var(--text); font-size: 13.5px; }

/* ---- grouped form -------------------------------------------------------- */
.group-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 22px 0 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}
.group-label .ico { color: var(--accent); }
html[lang="ar"] .group-label { letter-spacing: 0; font-size: 13px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

.btn-lg { padding: 12px 22px; font-size: 14.5px; margin-top: 8px; }

/* ---- form controls, whatever their type ----------------------------------
   The base rule above lists input types explicitly, and an attribute selector
   only matches an element that actually CARRIES that attribute: an <input>
   with no type behaves as text but matches none of them, so it came out
   completely unstyled beside a type="password" field that matched. These two
   rules close that gap.

   The element-qualified selectors also beat the bare `.host-input` wrapper
   rule (a flex row used elsewhere for an input plus a suffix), so putting that
   class on a real control gives a field rather than a flex container. */
input:not([type]),
input[type=email],
input[type=url],
input[type=search],
input[type=tel],
input[type=date] {
    background: rgba(8, 13, 24, .8);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    font: inherit;
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}

input.host-input,
select.host-input,
textarea.host-input {
    display: block;
    width: 100%;
    background: rgba(8, 13, 24, .8);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    font: inherit;
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
}
input.host-input:focus,
select.host-input:focus,
textarea.host-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(77, 139, 255, .16);
}
select.host-input {
    appearance: none;
    -webkit-appearance: none;
    padding-inline-end: 34px;
    /* A caret drawn in the box, since removing the native arrow removes the
       only hint that this control opens a list. */
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                      linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    background-position: right 15px center, right 9px center;
}
html[dir="rtl"] select.host-input {
    background-position: left 9px center, left 15px center;
}

/* ---- subscriptions --------------------------------------------------------
   Two reseller keys on one endpoint are two different accounts with different
   customers, packages and credit. Which one you are working in has to be
   unmissable, so it is a row of cards at the top rather than a dropdown. */
.acct-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin-bottom: 20px; }
.acct {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--panel);
    text-decoration: none;
    color: var(--text);
    transition: border-color .18s var(--ease), transform .06s var(--ease);
}
.acct:hover { border-color: var(--line-2); text-decoration: none; }
.acct:active { transform: translateY(1px); }
.acct.is-on {
    border-color: color-mix(in srgb, var(--accent) 60%, transparent);
    background: color-mix(in srgb, var(--accent) 10%, var(--panel));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}
.acct-body { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.acct-body strong { font-size: 14.5px; }
.acct-credits { margin-inline-start: auto; text-align: end; line-height: 1.15; }
.acct-credits b {
    display: block;
    font-size: 20px;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
}
.ico-tile.is-muted { color: var(--muted); background: var(--panel-2); border-color: var(--line); }

/* the term chooser: a segmented control, not a dropdown, because there are
   only four choices and they are the most important decision on the form */
.terms { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.term { position: relative; }
.term input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.term span {
    display: block;
    padding: 9px 18px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s var(--ease), background .15s var(--ease);
}
.term input:checked + span {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--text);
}
.term input:focus-visible + span { box-shadow: var(--ring); }

.credit-note {
    display: flex; align-items: center; gap: 8px;
    margin: 0 0 16px; padding: 10px 13px;
    border-radius: var(--radius-sm);
    background: var(--panel-2);
    border: 1px solid var(--line);
    font-size: 13px; color: var(--muted);
}
.credit-note .ico { color: var(--accent); }

/* a freshly created line: the one moment the password is visible */
.made { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 14px 0 4px; }
.kv > div {
    padding: 11px 13px; border-radius: var(--radius-sm);
    background: var(--panel-2); border: 1px solid var(--line);
}
.kv-k { display: block; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
html[lang="ar"] .kv-k { letter-spacing: 0; font-size: 12.5px; text-transform: none; }
.kv-v { font-size: 15px; }

/* anything click-to-copy */
[data-copy] { cursor: pointer; position: relative; }
[data-copy]:hover { color: var(--accent); }
[data-copy].copied::after {
    content: "✓";
    margin-inline-start: 8px;
    color: var(--ok);
    font-weight: 700;
}
.copyline {
    display: flex; align-items: center;
    padding: 12px 14px; border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, .3); border: 1px solid var(--line);
    overflow-x: auto;
}
.copyline code {
    font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
    font-size: 12.5px; white-space: nowrap; direction: ltr;
}

/* one line's figures */
.line-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 4px 0 14px; }
.line-stat { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--line); }
.line-k { display: block; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
html[lang="ar"] .line-k { letter-spacing: 0; font-size: 12.5px; text-transform: none; }
.line-v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.line-v.is-warn { color: var(--warn); }
.line-v.is-bad { color: var(--bad); }
.line-actions { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin-top: 18px; }
.term-form { display: flex; flex-direction: column; gap: 8px; }

/* the package catalogue */
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.pkg {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 13px; border-radius: var(--radius-sm);
    background: var(--panel-2); border: 1px solid var(--line);
    transition: border-color .15s var(--ease);
}
.pkg:hover { border-color: var(--line-2); }
.pkg-id {
    flex: none; padding: 3px 8px; border-radius: 6px;
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent); font-size: 11.5px; font-weight: 600;
}
.pkg-name { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }

/* ---- proxies page ---------------------------------------------------------
   The fleet-wide proxy table is scanned, not read, so state belongs in form as
   well as in words: a coloured rail per row and chips for the switches. */
.ctable tbody tr { transition: background .15s var(--ease); }
.ctable tbody tr:hover { background: var(--panel-2); }

.badge-verified {
    color: var(--ok);
    background: color-mix(in srgb, var(--ok) 13%, transparent);
    border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
}
.badge-open {
    color: var(--warn);
    background: color-mix(in srgb, var(--warn) 13%, transparent);
    border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}
.badge-masked {
    color: var(--cyan);
    background: color-mix(in srgb, var(--cyan) 13%, transparent);
    border: 1px solid color-mix(in srgb, var(--cyan) 30%, transparent);
}
.badge-verified::before,
.badge-open::before,
.badge-masked::before {
    content: "";
    width: 6px; height: 6px; border-radius: 50%;
    background: currentColor; flex: none;
}

/* the node a proxy lives on, as a labelled chip rather than bare text */
.node-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 4px 10px; border-radius: 999px;
    background: var(--panel-2); border: 1px solid var(--line);
    font-size: 12.5px; font-weight: 600;
}
.node-chip .ico { color: var(--accent); width: 1em; height: 1em; }

.addr-stack { display: flex; flex-direction: column; gap: 3px; }
.addr-stack .addr-main { font-size: 12.5px; }
.addr-stack .addr-port {
    align-self: flex-start;
    padding: 1px 7px; border-radius: 5px;
    background: var(--panel-2); border: 1px solid var(--line);
    font-size: 11px; color: var(--muted);
}
.up-arrow { color: var(--muted); margin-inline-end: 5px; }

/* ---- the servers page -----------------------------------------------------
   Cards rather than rows: each server carries four figures, a share bar and
   three controls, which a table cannot hold without becoming unreadable. The
   left edge is coloured by state so the one that needs attention is findable
   without reading a word. */
.node-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; margin-bottom: 22px; }

.node {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--lift-2);
    overflow: hidden;
    transition: border-color .18s var(--ease), transform .08s var(--ease);
}
.node:hover { border-color: var(--line-2); }
.node::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 3px;
    background: var(--line-2);
}
.node.is-ok::before { background: var(--ok); }
.node.is-bad::before { background: var(--bad); }
.node.is-held::before { background: var(--warn); }
.node.is-off::before { background: var(--muted); }
.node.is-off { opacity: .72; }

.node-head { display: flex; align-items: center; gap: 11px; }
.node-id { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.node-id strong { font-size: 15px; }
.node-id .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-head .badge { margin-inline-start: auto; flex: none; }

.node-warn {
    display: flex; align-items: flex-start; gap: 8px;
    margin: 0; padding: 9px 11px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--bad) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--bad) 28%, transparent);
    font-size: 12.5px; color: var(--text);
}
.node-warn .ico { color: var(--bad); margin-top: 1px; }
.node-warn.is-soft {
    background: color-mix(in srgb, var(--warn) 10%, transparent);
    border-color: color-mix(in srgb, var(--warn) 28%, transparent);
}
.node-warn.is-soft .ico { color: var(--warn); }

.node-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 420px) { .node-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.node-figs > div {
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    background: var(--panel-2);
    border: 1px solid var(--line);
    min-width: 0;
}
.fig-k {
    display: block;
    font-size: 10.5px;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
html[lang="ar"] .fig-k { letter-spacing: 0; font-size: 12px; text-transform: none; }
.fig-v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fig-sub { font-size: 12px; font-weight: 400; color: var(--muted); margin-inline-start: 3px; }

.node-share { display: flex; align-items: center; gap: 10px; }
.node-share .bar-track { flex: 1; height: 6px; }

.node-foot {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding-top: 12px; border-top: 1px solid var(--line);
}
.weight-form { display: flex; align-items: center; gap: 7px; }
.weight-input { width: 4.6rem; padding: 7px 9px !important; font-size: 13px !important; text-align: center; }
.node-btns { display: flex; gap: 7px; margin-inline-start: auto; }

/* ---- a plain text button, for an in-table switch -------------------------- */
.linkbtn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--muted);
    font: inherit; font-size: 12.5px; font-weight: 600;
    cursor: pointer;
    transition: border-color .15s var(--ease), color .15s var(--ease);
}
.linkbtn:hover { border-color: var(--line-2); color: var(--text); }
.linkbtn.is-on {
    color: var(--ok);
    border-color: color-mix(in srgb, var(--ok) 40%, transparent);
    background: color-mix(in srgb, var(--ok) 12%, transparent);
}
.linkbtn:focus-visible { outline: none; box-shadow: var(--ring); }
