:root { --ax-search-height: 40px; }

.traffic-lines { display:flex; flex-wrap:wrap; align-items:center; gap:10px; color:var(--muted); min-width:0; }
#tower-status .traffic-lines {
    display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); align-items:stretch; gap:12px;
}
#tower-status .traffic-card { min-block-size:150px; }
#tower-status .traffic-heading { min-block-size:32px; align-items:center; }
.traffic-card {
    --traffic-inset:10px;
    --traffic-separator:color-mix(in srgb,var(--muted) 22%,var(--surface));
    display:grid; grid-template-rows:auto minmax(0,1fr);
    flex:0 1 230px; min-width:0; box-sizing:border-box; padding:6px var(--traffic-inset);
    border:1px solid var(--line); border-radius:9px; background:var(--surface);
}
.traffic-heading { display:flex; align-items:baseline; gap:6px; line-height:1.4; }
.traffic-title { color:var(--gold); font-size:14px; font-weight:700; white-space:pre-wrap; overflow-wrap:anywhere; }
.traffic-interface { color:var(--muted); font-size:11px; overflow-wrap:anywhere; }
.traffic-status { flex:0 0 8px; height:8px; align-self:center; border-radius:50%; background:var(--red); }
.traffic-status[data-bound="true"] { background:var(--green); }
.traffic-body {
    display:grid; grid-template-columns:max-content minmax(0,1fr); direction:ltr;
    margin-inline:calc(-1 * var(--traffic-inset));
    border-top:1px dashed var(--traffic-separator);
    font:600 12px/1 Cairo,sans-serif; font-variant-numeric:tabular-nums;
}
.traffic-values {
    display:grid; grid-template-rows:repeat(2,minmax(0,1fr));
    padding-right:2px;
    border-right:1px dotted var(--traffic-separator);
}
.traffic-value {
    display:grid; grid-template-columns:12px 5ch max-content; align-items:center;
    white-space:nowrap;
}
.traffic-number { text-align:right; }
.traffic-unit { margin-left:2px; }
.traffic-graphs { position:relative; min-width:0; overflow:hidden; }
.traffic-graphs svg { position:absolute; inset:0; display:block; width:100%; height:100%; overflow:hidden; }
.traffic-graphs path { stroke:currentColor; fill:none; vector-effect:non-scaling-stroke; }
.traffic-trace { stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
.traffic-grid { stroke-width:1; color:var(--muted); opacity:.16; }
.traffic-grid.base { stroke-width:2; opacity:.26; }
.traffic-grid.minor { opacity:.09; }
.traffic-scale {
    position:absolute; right:2px; color:var(--muted); opacity:.78;
    font-size:10px; line-height:1; pointer-events:none;
}
.traffic-scale.max { top:1px; }
.traffic-scale.half { top:50%; transform:translateY(-50%); }
.traffic-body .rx { color:var(--blue); }
.traffic-body .tx { color:var(--red); }
.traffic-more { flex:none; color:var(--gold); border:1px solid var(--line); border-radius:99px; padding:2px 8px; text-decoration:none; }

.ax-top { gap:clamp(8px,1.2vw,16px); flex-wrap:nowrap; }
.ax-top .ax-brand, .ax-top .ax-tools { flex:none; }
.ax-emblem-slot {
    --ax-emblem-size:calc(66px + var(--traffic-card-top-extension, 18px));
    position:relative; flex:none; inline-size:var(--ax-emblem-size); block-size:54px;
}
@property --ax-emblem-angle {
    syntax:"<angle>";
    inherits:false;
    initial-value:0deg;
}
.ax-emblem {
    --ax-emblem-ink:var(--gold);
    --ax-emblem-bg:#0c0c0d;
    --ax-emblem-glint:#fff2c9;
    position:absolute; inset-inline:0; inset-block-end:-8px;
    display:grid; aspect-ratio:1; border:3px solid transparent; border-radius:10px;
    background:
        linear-gradient(var(--ax-emblem-bg),var(--ax-emblem-bg)) padding-box,
        conic-gradient(from var(--ax-emblem-angle),var(--ax-emblem-ink) 0deg,var(--ax-emblem-glint) 13deg,var(--ax-emblem-ink) 30deg) border-box;
    box-shadow:0 3px 6px #0004;
    animation:ax-emblem-frame 3s linear infinite;
}
:root[data-theme="light"] .ax-emblem {
    --ax-emblem-ink:#000;
    --ax-emblem-bg:#fff;
    --ax-emblem-glint:#f1f1f1;
}
.ax-emblem-face {
    display:grid; grid-template-rows:68% 32%; min-block-size:0;
    border-radius:7px; padding:2px 3px; box-shadow:inset 0 1px 4px #0004;
}
.ax-brand .ax-emblem-image {
    display:block; inline-size:100%; block-size:100%; min-block-size:0; object-fit:contain;
}
.ax-brand .ax-emblem-image.light,
:root[data-theme="light"] .ax-brand .ax-emblem-image.dark { display:none; }
:root[data-theme="light"] .ax-brand .ax-emblem-image.light { display:block; }
.ax-emblem-word {
    display:block; place-self:center; direction:ltr;
    color:var(--ax-emblem-ink); font-size:calc(var(--ax-emblem-size) * .21); font-weight:700; line-height:1;
    background:linear-gradient(110deg,var(--ax-emblem-ink) 40%,var(--ax-emblem-glint) 50%,var(--ax-emblem-ink) 60%) 100% 50% / 300% 100%;
    background-clip:text; -webkit-text-fill-color:transparent;
    animation:ax-emblem-word 3s ease-in-out infinite;
}
@keyframes ax-emblem-frame { to { --ax-emblem-angle:1turn; } }
@keyframes ax-emblem-word { 0% { background-position:100% 50%; } 40%,100% { background-position:0% 50%; } }
@media (prefers-reduced-motion:reduce) {
    .ax-emblem { background:var(--ax-emblem-bg); border-color:var(--ax-emblem-ink); animation:none; }
    .ax-emblem-word { animation:none; background:none; -webkit-text-fill-color:currentColor; }
}
.ax-top .traffic-lines {
    flex:1 1 0; justify-content:center; flex-wrap:nowrap;
    align-self:stretch; margin-block:-4px -8px;
}
.ax-top .traffic-lines:empty { display:none; }
.ax-top .traffic-card {
    --traffic-inset:9px;
    align-self:stretch;
    margin-block-start:calc(-1 * var(--traffic-card-top-extension, 0px));
    padding:1px var(--traffic-inset);
    container-type:inline-size;
}
.ax-top .traffic-heading { line-height:14px; }
.ax-top .traffic-title {
    min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:pre;
    font-size:clamp(9px,8cqi,12px);
}
.ax-top .traffic-body { font-size:11px; }

.ax-search, .ax-warning { box-sizing:border-box; height:var(--ax-search-height); }
.ax-warning:not([hidden]) {
    display:inline-flex; align-items:center; justify-self:center; align-self:center; gap:6px;
    width:max-content; max-width:100%; padding:2px 10px; white-space:nowrap;
    color:var(--ink); border:1px solid var(--red); border-radius:9px;
    font-size:14px; line-height:1.45; background:color-mix(in srgb,var(--red) 10%,var(--surface));
    animation:ax-warning-pulse 2s ease-in-out infinite alternate;
}
.ax-warning strong { color:var(--red); }
.ax-warning::before {
    content:""; display:block; flex:0 0 18px; width:18px; height:18px; background:var(--red);
    mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M12 3 22 21H2z M12 9v5m0 3v.2'/%3E%3C/svg%3E") center/contain no-repeat;
    animation:ax-triangle-pulse 1s ease-in-out infinite alternate;
}
.ax-disconnect:not([hidden]) { display:flex; margin:6px auto; }
.wrap:has(> .ax-disconnect:not([hidden])) > .ax-stats { margin-block-start:6px; }
@keyframes ax-triangle-pulse { from { opacity:.55; } to { opacity:1; } }
@keyframes ax-warning-pulse {
    from { border-color:color-mix(in srgb,var(--red) 45%,var(--line)); background:color-mix(in srgb,var(--red) 5%,var(--surface)); }
    to { border-color:var(--red); background:color-mix(in srgb,var(--red) 17%,var(--surface)); }
}
.ax-tool[data-online],
html.ax-phone-layout[data-theme] .ax-shared-phone-header .ax-tool[data-online] {
    color:var(--green); border-color:currentColor; animation:ax-router-pulse 1.7s ease-in-out infinite alternate;
}
.ax-tool[data-online="false"],
html.ax-phone-layout[data-theme] .ax-shared-phone-header .ax-tool[data-online="false"] { color:var(--red); }
@keyframes ax-router-pulse { to { box-shadow:0 0 10px color-mix(in srgb,currentColor 55%,transparent); } }
.server-dot[data-tone="pending"] { background:var(--muted); }

.ax-table-heading {
    display:grid; grid-template-columns:auto auto minmax(max-content,1fr) auto auto;
    gap:clamp(6px,.9vw,12px);
}
html:not(.ax-phone-layout) .ax-table-heading {grid-template-columns:auto auto minmax(0,1fr) auto auto}
html:not(.ax-phone-layout) .ax-payment:not([hidden]) {height:auto;min-height:var(--ax-search-height);white-space:normal}
.ax-table-heading > * { grid-row:1; }
.ax-table-heading h1 { grid-column:1; margin:0; white-space:nowrap; }
.ax-row-tools { grid-column:2; display:inline-flex; gap:7px; align-items:center; }
.ax-row-tools button { color:var(--gold); }
.ax-row-tools [data-delete] { color:var(--red); }
.ax-row-tools button:disabled { color:var(--muted); opacity:.45; cursor:default; }
.ax-row-tools [role=status] { color:var(--green); font-size:13px; }
.ax-row-tools [role=status]:empty { display:none; }
.ax-payment:not([hidden]) {
    grid-column:3;
    font-size:clamp(12px,1.1vw,14px);
    padding-inline:clamp(6px,.74vw,10px);
}
.ax-search { grid-column:-3; min-width:0; }
.ax-search input { width:clamp(108px,calc(28vw - 166px),280px); }
.ax-fields-link { grid-column:-2; white-space:nowrap; }

#tbl :is(td,th) { padding-inline:clamp(5px,.63vw,12px); }
#tbl :is(.note,.subscriber-username,.subscriber-full-name) { white-space:normal; overflow-wrap:anywhere; }
html:not(.ax-phone-layout) #tbl .subscriber-username { white-space:nowrap; overflow-wrap:normal; }
#tbl .note { min-width:7em; }
#tbl :is(td,th).fup-cell { min-width:8em; width:auto; }
#tbl .ax-pick {
    position:sticky; inset-inline-start:0; z-index:1; background:var(--surface);
    box-sizing:border-box; width:38px; min-width:38px; max-width:38px; padding-inline:0; text-align:center;
}
#tbl .ax-pick input { display:block; margin:auto; }
#tbl th.ax-pick { background:var(--raised); cursor:default; }
#tbl .ax-selected td { background:color-mix(in srgb,var(--gold) 15%,var(--surface)); }
html[data-theme] .ax-message .ax-danger { background:var(--red); border-color:var(--red); color:var(--surface); }

@media (max-width:1100px) {
    .ax-top .ax-brand { gap:14px; }
    .ax-top .ax-tools { gap:6px; }
    .ax-table-heading h1 { font-size:21px; }
    .ax-row-tools { gap:5px; }
    .ax-search, .ax-fields-link { padding-inline:8px; gap:5px; }
}
