/* ============================================================
   Component layer.
   Tailwind utilities handle layout; these are the repeated
   composites (buttons, inputs, cards) so markup stays readable.
   ============================================================ */

/* Nav menus are <details>, so the default disclosure triangle is dropped. */
[data-admin-nav] summary { list-style: none; }
[data-admin-nav] summary::-webkit-details-marker { display: none; }

/* The hidden attribute always wins, even on components that set display. */
[hidden] { display: none !important; }

/* ---------------- buttons ---------------- */

/* Display at zero specificity, so a display utility on a button wins: hidden,
   or hidden sm:inline-flex for one that only fits on a wider screen. This file
   loads after Tailwind, so at full strength it beat them, and a header button
   meant to be hidden on a phone showed and pushed the page sideways. */
:where(.ui-btn, .ui-btn-ghost, .ui-btn-outline, .ui-btn-danger) { display: inline-flex; }

.ui-btn,
.ui-btn-ghost,
.ui-btn-outline,
.ui-btn-danger {
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 2.5rem;
    padding: 0 1rem;
    border-radius: 0.625rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s, color .15s, border-color .15s, transform .15s var(--ease-spring), box-shadow .15s;
}

.ui-btn:active:not(:disabled),
.ui-btn-ghost:active:not(:disabled),
.ui-btn-outline:active:not(:disabled),
.ui-btn-danger:active:not(:disabled) { transform: scale(0.97); }

.ui-btn:disabled,
.ui-btn-ghost:disabled,
.ui-btn-outline:disabled,
.ui-btn-danger:disabled { opacity: .5; cursor: not-allowed; }

.ui-btn {
    background: var(--brand-primary);
    color: #fff;
    box-shadow: 0 1px 2px rgb(15 23 42 / .08);
}
.ui-btn:hover:not(:disabled) { background: var(--brand-primary-dark); }

.ui-btn-ghost { background: transparent; color: rgb(71 85 105); }
.ui-btn-ghost:hover:not(:disabled) { background: rgb(241 245 249); }
.dark .ui-btn-ghost { color: rgb(148 163 184); }
.dark .ui-btn-ghost:hover:not(:disabled) { background: #1f2937; }

.ui-btn-outline {
    background: #fff;
    color: rgb(51 65 85);
    border: 1px solid rgb(226 232 240);
}
.ui-btn-outline:hover:not(:disabled) { background: rgb(248 250 252); border-color: rgb(203 213 225); }
.dark .ui-btn-outline { background: #111827; color: rgb(203 213 225); border-color: #1f2937; }
.dark .ui-btn-outline:hover:not(:disabled) { background: #1f2937; }

.ui-btn-danger { background: var(--brand-danger); color: #fff; }
.ui-btn-danger:hover:not(:disabled) { filter: brightness(.92); }

.ui-btn-sm { height: 2.125rem; padding: 0 .75rem; font-size: .8125rem; }
.ui-btn-lg { height: 2.875rem; padding: 0 1.5rem; font-size: .9375rem; }
.ui-btn-block { width: 100%; }

/* ---------------- form controls ---------------- */

.ui-input,
.ui-select,
.ui-textarea {
    display: block;
    border-radius: 0.625rem;
    border: 1px solid rgb(226 232 240);
    background: #fff;
    color: rgb(15 23 42);
    font-size: 0.875rem;
    transition: border-color .15s, box-shadow .15s;
}
/* Width and padding at element specificity: they beat Tailwind's preflight reset (input { padding: 0 })
   but lose to any utility class, so pl-9, pr-11, py-2 or sm:w-44 on a control take effect. */
:is(input, select, textarea):where(.ui-input, .ui-select, .ui-textarea) { width: 100%; padding: 0.625rem 0.875rem; }
select:where(.ui-select) { padding-right: 2.5rem; }
.ui-input, .ui-select { height: 2.625rem; }
.ui-textarea { min-height: 7rem; resize: vertical; line-height: 1.6; }

/* iOS Safari zooms the page in on any field under 16px when it takes focus,
   and leaves it zoomed. On a phone the fields are 16px. */
@media (max-width: 639px) {
    .ui-input,
    .ui-select,
    .ui-textarea { font-size: 16px; }
}

.ui-input::placeholder,
.ui-textarea::placeholder { color: rgb(148 163 184); }

.ui-input:focus,
.ui-select:focus,
.ui-textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 18%, transparent);
}

.ui-input:disabled,
.ui-select:disabled,
.ui-textarea:disabled { background: rgb(248 250 252); color: rgb(100 116 139); cursor: not-allowed; }

.dark .ui-input,
.dark .ui-select,
.dark .ui-textarea { background: #0f172a; border-color: #1f2937; color: rgb(226 232 240); }
.dark .ui-input:disabled,
.dark .ui-select:disabled,
.dark .ui-textarea:disabled { background: #111827; color: rgb(100 116 139); }

/* The parts of a field the browser paints itself, which do not follow the
   rules above and come out unreadable on a dark page. */

/* Autofill: Chrome paints its own near-white background over ours. */
.dark .ui-input:-webkit-autofill,
.dark .ui-input:-webkit-autofill:hover,
.dark .ui-input:-webkit-autofill:focus,
.dark .ui-select:-webkit-autofill,
.dark .ui-textarea:-webkit-autofill {
    -webkit-text-fill-color: rgb(226 232 240);
    -webkit-box-shadow: 0 0 0 1000px #0f172a inset;
    caret-color: rgb(226 232 240);
}
.ui-input:-webkit-autofill,
.ui-select:-webkit-autofill,
.ui-textarea:-webkit-autofill { -webkit-box-shadow: 0 0 0 1000px #fff inset; }

/* A dropdown's list is drawn by the operating system; on Linux and Windows it
   stays white unless the options say otherwise. */
.dark .ui-select option,
.dark .ui-select optgroup { background: #0f172a; color: rgb(226 232 240); }

/* Date, time and colour fields: the little picker button is a dark glyph. */
.dark .ui-input::-webkit-calendar-picker-indicator { filter: invert(1) brightness(1.6); opacity: .65; }
.dark .ui-input::-webkit-calendar-picker-indicator:hover { opacity: 1; }
.dark .ui-input::-webkit-datetime-edit-fields-wrapper,
.dark .ui-input::-webkit-datetime-edit-text,
.dark .ui-input::-webkit-datetime-edit-month-field,
.dark .ui-input::-webkit-datetime-edit-day-field,
.dark .ui-input::-webkit-datetime-edit-year-field,
.dark .ui-input::-webkit-datetime-edit-hour-field,
.dark .ui-input::-webkit-datetime-edit-minute-field,
.dark .ui-input::-webkit-datetime-edit-ampm-field { color: rgb(226 232 240); }

/* Search fields: Safari's clear button is a dark circle on a dark field. */
.dark .ui-input::-webkit-search-cancel-button { filter: invert(1); opacity: .6; }

.ui-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.125rem;
}
/* A select sized like a small button still needs room for its arrow. */
.ui-select.ui-btn-sm { padding-right: 2.5rem; }

.ui-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgb(51 65 85);
    margin-bottom: 0.375rem;
}
.dark .ui-label { color: rgb(203 213 225); }
.ui-label .req { color: var(--brand-danger); margin-left: .125rem; }

.ui-hint { font-size: 0.75rem; color: rgb(100 116 139); margin-top: 0.375rem; line-height: 1.5; }

/* Toggle switch */
.ui-switch { position: relative; display: inline-block; width: 2.75rem; height: 1.5rem; flex-shrink: 0; }
.ui-switch input { opacity: 0; width: 0; height: 0; }
.ui-switch span {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgb(203 213 225);
    cursor: pointer;
    transition: background-color .2s;
}
.dark .ui-switch span { background: #374151; }
.ui-switch span::before {
    content: "";
    position: absolute;
    height: 1.125rem;
    width: 1.125rem;
    left: 0.1875rem;
    top: 0.1875rem;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 3px rgb(15 23 42 / .2);
    transition: transform .2s var(--ease-spring);
}
.ui-switch input:checked + span { background: var(--brand-primary); }
.ui-switch input:checked + span::before { transform: translateX(1.25rem); }
.ui-switch input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 25%, transparent); }
.ui-switch input:disabled + span { opacity: .5; cursor: not-allowed; }

/* ---------------- surfaces ---------------- */

.ui-card {
    background: #fff;
    border: 1px solid rgb(226 232 240);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgb(15 23 42 / .04);
}
.dark .ui-card { background: #111827; border-color: #1f2937; box-shadow: none; }

.ui-card-hover { transition: border-color .2s, box-shadow .2s, transform .2s var(--ease-spring); }
.ui-card-hover:hover {
    border-color: color-mix(in srgb, var(--brand-primary) 35%, transparent);
    box-shadow: 0 8px 24px -8px rgb(15 23 42 / .12);
    transform: translateY(-2px);
}

.ui-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgb(226 232 240);
}
.dark .ui-card-header { border-color: #1f2937; }

.ui-card-title { font-family: var(--font-heading); font-weight: 600; font-size: 0.9375rem; letter-spacing: -0.01em; }

/* ---------------- tables ---------------- */

.ui-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.ui-table thead th {
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgb(100 116 139);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgb(226 232 240);
    white-space: nowrap;
    background: rgb(248 250 252);
}
.dark .ui-table thead th { color: rgb(100 116 139); border-color: #1f2937; background: rgb(17 24 39 / .6); }

.ui-table tbody td { padding: 0.875rem 1rem; border-bottom: 1px solid rgb(241 245 249); vertical-align: middle; }
.dark .ui-table tbody td { border-color: rgb(31 41 55 / .6); }
.ui-table tbody tr:last-child td { border-bottom: 0; }
.ui-table tbody tr { transition: background-color .12s; }
.ui-table tbody tr:hover { background: rgb(248 250 252); }
.dark .ui-table tbody tr:hover { background: rgb(31 41 55 / .4); }

/* Horizontal scroll container — the page body must never scroll sideways. */
.ui-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------------- misc ---------------- */

.scrollbar-thin { scrollbar-width: thin; scrollbar-color: rgb(203 213 225) transparent; }
.scrollbar-thin::-webkit-scrollbar { width: 6px; height: 6px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: rgb(203 213 225); border-radius: 999px; }
.dark .scrollbar-thin::-webkit-scrollbar-thumb { background: #374151; }

/* Collapsed sidebar hides labels but keeps icons and hit areas. */
html.sidebar-collapsed .sidebar-label { display: none; }
html.sidebar-collapsed #sidebar nav a { justify-content: center; padding-inline: 0; }
html.sidebar-collapsed #sidebar nav p { text-align: center; overflow: hidden; }

.ui-stat-value { font-family: var(--font-heading); font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }

/* A stat card's figure where two cards share a phone's width: a size smaller
   on the narrowest phones, and a long amount wraps instead of leaving its card. */
.ui-stat-fit { overflow-wrap: break-word; }
@media (max-width: 399px) { .ui-stat-fit { font-size: 1.125rem; line-height: 1.75rem; } }

/* Progress meter used by the metrics gauges. */
.ui-meter { height: 0.5rem; border-radius: 999px; background: rgb(241 245 249); overflow: hidden; }
.dark .ui-meter { background: #1f2937; }
.ui-meter > span { display: block; height: 100%; border-radius: 999px; transition: width .4s var(--ease-spring); }

/* Terminal-ish block for console output and log tails. */
.ui-code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.65;
    background: #0b1120;
    color: #cbd5e1;
    border-radius: 0.625rem;
    padding: 0.875rem 1rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---------------- public pages ---------------- */

/* The brand in the header, when a phone leaves it less room than it wants. The
   name gives way first, down to an ellipsis and then to nothing; only after
   that does an uploaded logo shrink, scaled to fit rather than cut. A small
   square logo keeps its size beside a long name, and a wide wordmark gets
   smaller instead of sliding under the buttons on the right. */
.site-brand img { flex-shrink: 1; min-width: 0; }
.site-brand [data-brand-name] { flex-shrink: 1000; }

/* The strip of section links under the header on a phone. The first link's
   words line up with the logo above; from md the header has room for the
   links itself, and the strip goes. */
.mobile-sections-links { margin-left: -0.75rem; }
@media (min-width: 768px) {
    .mobile-sections { display: none; }
}

/* The WhatsApp button on the public and sign-in pages, clear of a phone's home bar. */
.wa-fab { position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 50; }
/* The page's last line, kept clear of that button when the page is scrolled to the end. */
.wa-fab-clear { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }

/* A fact under the landing hero wraps inside its own box rather than run off a narrow phone. */
.trust-chip { max-width: 100%; }

/* ---------------- long-form documents ---------------- */

/* The policy pages: running text, not panels. Section headings are numbered
   here, and the contents list beside them numbers itself the same way. */
.legal-prose {
    counter-reset: legal-section;
    font-size: 0.9375rem;
    line-height: 1.75;
    color: rgb(71 85 105);
}
.dark .legal-prose { color: rgb(203 213 225); }

.legal-prose p,
.legal-prose ul,
.legal-prose ol,
.legal-prose dl,
.legal-prose .legal-table,
.legal-prose .legal-note { margin: 0 0 1rem; }

.legal-prose .lead { font-size: 1.0625rem; line-height: 1.7; color: rgb(51 65 85); }
.dark .legal-prose .lead { color: rgb(226 232 240); }

.legal-prose h2 {
    counter-increment: legal-section;
    font-family: var(--font-heading);
    font-size: 1.3125rem;
    line-height: 1.35;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: rgb(15 23 42);
    margin: 2.5rem 0 1rem;
    padding-top: 2.25rem;
    border-top: 1px solid rgb(226 232 240);
    scroll-margin-top: 5rem;
}
.legal-prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.legal-prose h2::before {
    content: counter(legal-section) ".";
    color: var(--brand-primary);
    margin-right: 0.5rem;
    font-variant-numeric: tabular-nums;
}
.dark .legal-prose h2 { color: #fff; border-color: #1f2937; }

.legal-prose h3 {
    font-family: var(--font-heading);
    font-size: 1.0625rem;
    font-weight: 600;
    color: rgb(30 41 59);
    margin: 1.75rem 0 0.5rem;
    scroll-margin-top: 5rem;
}
.dark .legal-prose h3 { color: rgb(241 245 249); }

.legal-prose ul { list-style: disc; padding-left: 1.25rem; }
.legal-prose ol { list-style: decimal; padding-left: 1.4rem; }
.legal-prose li { margin: 0.375rem 0; padding-left: 0.25rem; }
.legal-prose li::marker { color: rgb(148 163 184); }
.dark .legal-prose li::marker { color: rgb(100 116 139); }
.legal-prose li > ul,
.legal-prose li > ol { margin: 0.375rem 0 0; }

.legal-prose a {
    color: var(--brand-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: color-mix(in srgb, var(--brand-primary) 40%, transparent);
    overflow-wrap: anywhere;
}
.legal-prose a:hover { text-decoration-color: currentColor; }

.legal-prose strong { font-weight: 600; color: rgb(30 41 59); }
.dark .legal-prose strong { color: rgb(241 245 249); }

.legal-prose code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    padding: 0.1rem 0.35rem;
    border-radius: 0.375rem;
    background: rgb(241 245 249);
    color: rgb(30 41 59);
}
.dark .legal-prose code { background: #1f2937; color: rgb(226 232 240); }

/* Definitions: the term on its own line, its meaning indented under it. */
.legal-prose dt { font-weight: 600; color: rgb(30 41 59); margin-top: 0.75rem; }
.legal-prose dd { margin: 0.125rem 0 0 1rem; }
.dark .legal-prose dt { color: rgb(241 245 249); }

/* An aside the reader should not miss: a summary, or the one rule that matters most. */
.legal-prose .legal-note {
    border: 1px solid color-mix(in srgb, var(--brand-primary) 25%, transparent);
    background: color-mix(in srgb, var(--brand-primary) 6%, transparent);
    border-radius: 0.75rem;
    padding: 1rem 1.125rem;
    color: rgb(51 65 85);
}
.dark .legal-prose .legal-note { color: rgb(226 232 240); }
.legal-prose .legal-note > :last-child { margin-bottom: 0; }

.legal-prose .legal-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid rgb(226 232 240);
    border-radius: 0.75rem;
}
.dark .legal-prose .legal-table { border-color: #1f2937; }
.legal-prose table { width: 100%; border-collapse: collapse; font-size: 0.875rem; line-height: 1.55; }
.legal-prose th,
.legal-prose td { text-align: left; vertical-align: top; padding: 0.625rem 0.875rem; border-bottom: 1px solid rgb(226 232 240); }
.legal-prose tbody tr:last-child td { border-bottom: 0; }
.legal-prose thead th {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgb(100 116 139);
    background: rgb(248 250 252);
    white-space: nowrap;
}
.dark .legal-prose th,
.dark .legal-prose td { border-color: #1f2937; }
.dark .legal-prose thead th { background: rgb(17 24 39 / .6); }

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


/* ---------------- proxy maker (Tools) ---------------- */

/* Port chooser: a row of buttons, one picked. */
.pm-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4rem;
    height: 2.5rem;
    padding: 0 0.875rem;
    border-radius: 0.625rem;
    border: 1px solid rgb(226 232 240);
    background: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: rgb(51 65 85);
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}
.pm-pill:hover { border-color: var(--brand-primary); }
.pm-pill.is-active {
    border-color: var(--brand-primary);
    background: var(--brand-primary);
    color: #fff;
}
.dark .pm-pill { background: #111827; border-color: #1f2937; color: rgb(203 213 225); }
.dark .pm-pill.is-active { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }

/* The live SSH session output. */
.pm-term {
    margin: 0;
    max-height: 20rem;
    overflow: auto;
    border-radius: 0.75rem;
    background: #0a0f1d;
    color: #e2e8f0;
    padding: 0.75rem 0.875rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}
.pm-term:empty::before { content: "Waiting…"; color: rgb(100 116 139); }

/* The finished IP:port:user:pass line. */
.pm-result-line {
    display: block;
    width: 100%;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.875rem;
    word-break: break-all;
    -webkit-user-select: all;
    user-select: all;
}

/* ---------------- VPS management: server page and user panel ---------------- */
/* Tool tiles: a coloured icon, a title and a line of help, and a chevron. Each
   tone sets two gradient stops and a soft tint; dark mode lights the border. */

/* Everything here is sized by the space it is given, not by the screen: the
   same tiles sit in a full-width card on one page and a side column on another,
   and a screen-wide rule squeezes them into slivers in the narrow one. */
.vm-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: .875rem; }

.vm-tool {
    --vm-a: #3b82f6; --vm-b: #1d4ed8; --vm-soft: rgb(59 130 246 / .12);
    display: flex; align-items: center; gap: 1rem; width: 100%; text-align: left;
    padding: 1rem 1.125rem; border-radius: 1rem;
    border: 1px solid rgb(226 232 240); background: #fff;
    box-shadow: 0 1px 2px rgb(15 23 42 / .04);
    transition: transform .18s var(--ease-spring), box-shadow .18s, border-color .18s;
}
.vm-tool:hover { transform: translateY(-2px); border-color: var(--vm-a); box-shadow: 0 12px 26px -16px var(--vm-b); }
.vm-tool:focus-visible { outline: 2px solid var(--vm-a); outline-offset: 2px; }
.vm-tool-icon {
    flex: none; display: grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: .95rem;
    background: linear-gradient(135deg, var(--vm-a), var(--vm-b)); color: #fff; font-size: 1.25rem;
    box-shadow: 0 10px 20px -10px var(--vm-b);
}
.vm-tool-body { min-width: 0; flex: 1; }
.vm-tool-title { font-weight: 700; font-size: .9375rem; color: rgb(15 23 42); }
.vm-tool-text { margin-top: .125rem; font-size: .75rem; line-height: 1.45; color: rgb(100 116 139); }
.vm-tool-go {
    flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 999px;
    background: var(--vm-soft); color: var(--vm-a); font-size: .75rem;
}

.vm-tone-blue   { --vm-a: #3b82f6; --vm-b: #1d4ed8; --vm-soft: rgb(59 130 246 / .12); }
.vm-tone-violet { --vm-a: #a855f7; --vm-b: #7c3aed; --vm-soft: rgb(168 85 247 / .12); }
.vm-tone-green  { --vm-a: #22c55e; --vm-b: #15803d; --vm-soft: rgb(34 197 94 / .12); }
.vm-tone-amber  { --vm-a: #f59e0b; --vm-b: #c2410c; --vm-soft: rgb(245 158 11 / .14); }
.vm-tone-indigo { --vm-a: #6366f1; --vm-b: #4338ca; --vm-soft: rgb(99 102 241 / .12); }
.vm-tone-red    { --vm-a: #ef4444; --vm-b: #b91c1c; --vm-soft: rgb(239 68 68 / .12); }

.dark .vm-tool {
    background: linear-gradient(160deg, #101b34, #0a1224);
    border-color: rgb(51 65 85);
    border-color: color-mix(in srgb, var(--vm-a) 45%, transparent);
    box-shadow: 0 12px 30px -20px var(--vm-a);
}
.dark .vm-tool:hover { border-color: var(--vm-a); box-shadow: 0 14px 34px -16px var(--vm-a); }
.dark .vm-tool-title { color: #f1f5f9; }
.dark .vm-tool-text  { color: rgb(148 163 184); }

/* VPS Control: what the server is, and the three big power buttons. */
.vm-control {
    container: vm-control / inline-size;
    border-radius: 1.25rem; border: 1px solid rgb(226 232 240); padding: 1.25rem;
    background: linear-gradient(135deg, #ffffff, #f3f8ff);
}
.dark .vm-control { background: linear-gradient(160deg, #101b34, #0a1122); border-color: rgb(59 130 246 / .35); }
.vm-control-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.vm-control-art {
    flex: none; display: grid; place-items: center; width: 4rem; height: 4rem; border-radius: 1.1rem;
    background: linear-gradient(135deg, #60a5fa, #2563eb); color: #fff; font-size: 1.6rem;
    box-shadow: 0 14px 26px -14px #2563eb;
}
.vm-control-title { font-family: var(--font-heading); font-weight: 800; font-size: 1.25rem; color: rgb(15 23 42); }
.dark .vm-control-title { color: #f8fafc; }
.vm-control-sub { font-size: .8125rem; color: rgb(100 116 139); }
.dark .vm-control-sub { color: rgb(148 163 184); }

.vm-pill {
    display: inline-flex; align-items: center; gap: .375rem; padding: .2rem .65rem; border-radius: 999px;
    font-size: .75rem; font-weight: 600; background: rgb(34 197 94 / .12); color: #16a34a;
}
.vm-pill::before { content: ""; width: .45rem; height: .45rem; border-radius: 999px; background: currentColor; }
.vm-pill.is-off     { background: rgb(239 68 68 / .12); color: #dc2626; }
.vm-pill.is-unknown { background: rgb(100 116 139 / .14); color: rgb(100 116 139); }
.dark .vm-pill        { color: #4ade80; }
.dark .vm-pill.is-off { color: #f87171; }
.dark .vm-pill.is-unknown { color: rgb(148 163 184); }

.vm-stats { margin-top: 1rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; }
@container vm-control (min-width: 33rem) { .vm-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.vm-stat {
    display: flex; align-items: center; gap: .75rem; min-width: 0; padding: .75rem .875rem;
    border-radius: .95rem; border: 1px solid rgb(226 232 240); background: #fff;
}
.dark .vm-stat { background: rgb(15 23 42 / .6); border-color: rgb(51 65 85 / .8); }
.vm-stat > i { color: #2563eb; font-size: 1.25rem; flex: none; }
.dark .vm-stat > i { color: #60a5fa; }
.vm-stat-label { font-size: .6875rem; color: rgb(100 116 139); }
.vm-stat-value { font-weight: 700; font-size: .9375rem; color: rgb(15 23 42); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dark .vm-stat-value { color: #f1f5f9; }

/* One button a row when narrow, three side by side once they fit. In between,
   the three stand as compact tiles: icon above the words, no arrow. */
.vm-power { margin-top: 1rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; }
.vm-power-btn {
    --vm-a: #22c55e; --vm-b: #15803d;
    display: flex; align-items: center; gap: .875rem; width: 100%; padding: .95rem 1rem;
    border-radius: 1rem; color: #fff; text-align: left; overflow: hidden;
    background: linear-gradient(135deg, var(--vm-a), var(--vm-b));
    box-shadow: 0 12px 24px -14px var(--vm-b);
    transition: transform .18s var(--ease-spring), box-shadow .18s, filter .18s, opacity .18s;
}
.vm-power-btn:hover:not(:disabled) { transform: translateY(-2px); filter: saturate(1.12); box-shadow: 0 16px 28px -14px var(--vm-b); }
.vm-power-btn:focus-visible { outline: 2px solid var(--vm-a); outline-offset: 2px; }
.vm-power-btn:disabled { opacity: .45; cursor: not-allowed; }
.vm-power-ico {
    flex: none; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 999px;
    background: rgb(255 255 255 / .94); color: var(--vm-b); font-size: 1.05rem;
    box-shadow: 0 0 0 4px rgb(255 255 255 / .2);
}
.vm-power-title { display: block; font-weight: 800; font-size: 1.05rem; line-height: 1.2; }
.vm-power-text  { display: block; font-size: .75rem; opacity: .9; }
.vm-power-go {
    margin-left: auto; flex: none; display: grid; place-items: center; width: 1.9rem; height: 1.9rem;
    border-radius: 999px; background: rgb(255 255 255 / .2); font-size: .75rem;
}
.vm-power-start  { --vm-a: #22c55e; --vm-b: #16a34a; }
.vm-power-stop   { --vm-a: #f87171; --vm-b: #dc2626; }
.vm-power-reboot { --vm-a: #3b82f6; --vm-b: #2563eb; }
.dark .vm-power-btn { box-shadow: 0 0 0 1px rgb(255 255 255 / .06), 0 14px 30px -14px var(--vm-a); }
@container vm-control (min-width: 28rem) {
    .vm-power { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .vm-power-btn { flex-direction: column; justify-content: center; text-align: center; gap: .5rem; padding: .875rem .5rem; }
    .vm-power-go { display: none; }
}
@container vm-control (min-width: 48rem) {
    .vm-power-btn { flex-direction: row; justify-content: flex-start; text-align: left; gap: .875rem; padding: .95rem 1rem; }
    .vm-power-go { display: grid; }
}

/* The sign-in box: user name and password, with show and copy. */
.vm-login {
    container: vm-login / inline-size;
    border-radius: 1rem; border: 1px solid rgb(253 230 138); background: rgb(255 251 235);
    padding: .875rem 1rem;
}
/* User name and password side by side once the box is wide enough. */
.vm-login-rows { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 1.5rem; }
@container vm-login (min-width: 34rem) { .vm-login-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dark .vm-login { border-color: rgb(245 158 11 / .3); background: rgb(245 158 11 / .06); }
.vm-login-row { display: flex; align-items: center; gap: .5rem; min-width: 0; padding: .3rem 0; }
.vm-login-key {
    width: 5.5rem; flex: none; font-size: .6875rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: rgb(146 64 14);
}
.dark .vm-login-key { color: rgb(251 191 36); }
.vm-login-val { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8125rem; word-break: break-all; }
.vm-login-btn {
    flex: none; display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: .5rem;
    color: rgb(146 64 14); transition: background .15s;
}
.vm-login-btn:hover { background: rgb(245 158 11 / .15); }
.dark .vm-login-btn { color: rgb(251 191 36); }
