/*
 * arx web UI.
 *
 * Component names follow the Arc loader's web interface, so the two read
 * as one family; the look is firevisor's newer one, in plain CSS: a
 * tinted wash behind the app, the header and the sidebar on it with no
 * surface of their own, the current page a white pill with an accent bar,
 * line icons, round cards with a neutral grey title band, and no
 * hairline on a card, a box, a button, a field, a tag or a callout: each
 * is told apart by its fill, as in Arc Control. See docs/DESIGN.md.
 */

:root {
    /* The accent scale, as "R G B" triples so a shade can take an alpha:
       rgb(var(--accent-500) / 0.3). The theme menu's colour sets it on
       <html> (ACCENTS in app.js); this is its default, red, the logo's
       own -- 600 is the logo's red -- so the first frame is already
       right. The look around it is firevisor's, whose stylesheet keeps
       its accent the same way. --accent-on is what goes on an accent
       surface. */
    --accent-50: 254 242 242;
    --accent-100: 254 226 226;
    --accent-200: 254 202 202;
    --accent-300: 252 165 165;
    --accent-400: 248 113 113;
    --accent-500: 232 68 68;
    --accent-600: 209 43 43;
    --accent-700: 176 32 32;
    --accent-800: 146 28 28;
    --accent-900: 122 28 28;
    --accent-950: 69 10 10;
    --accent-on: 255 255 255;

    /* Tailwind zinc for every surface, as before. The page is a near-
       white with two soft washes of the accent in opposite corners, so
       the white cards have something to lift off; the header and the
       sidebar sit on it with no surface of their own. */
    --bg: #f5f5f7;             /* the page, under the wash */
    --wash-1: rgb(var(--accent-100) / 0.45);
    --wash-2: rgb(var(--accent-200) / 0.22);
    --surface: #ffffff;        /* cards, menus, dialogs */
    --surface-2: #fafafa;      /* gray-50: a row hovered */
    --surface-muted: #f4f4f5;  /* gray-100: hover, wells */
    --band: rgb(228 228 231 / 0.5); /* gray-200/50: a card's title band */
    --band-muted: rgb(244 244 245 / 0.7); /* gray-100/70: a dialog's footer */
    --tile: rgb(244 244 245 / 0.6); /* gray-100/60: a box inside a card */
    --tile-hover: #f4f4f5;     /* gray-100 */
    --fill: rgb(228 228 231 / 0.7);       /* gray-200/70: a secondary button */
    --fill-hover: #e4e4e7;     /* gray-200 */
    --border: rgb(228 228 231 / 0.8); /* gray-200/80: lines inside a card */
    --field: rgb(228 228 231 / 0.6); /* gray-200/60: a field, on a card or a box */
    --fill-strong: #d4d4d8;    /* gray-300: a switch off, the disk tree's lines */
    --text: #18181b;           /* gray-900 */
    --text-2: #52525b;         /* gray-600 */
    --muted: #71717a;          /* gray-500 */
    --primary: rgb(var(--accent-600));       /* buttons */
    --primary-dark: rgb(var(--accent-700));  /* button hover */
    --primary-soft: rgb(var(--accent-500));  /* the active bar, links */
    --primary-text: rgb(var(--accent-700));  /* the current page's label */
    --primary-tint: rgb(var(--accent-50) / 0.8); /* a chosen row */
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --hover-glass: rgb(255 255 255 / 0.7); /* a header button on the wash */
}

/*
 * Zinc rather than slate, as Arc Control does: its Tailwind config aliases
 * gray-* to zinc because slate's dark shades read as blue and fight the
 * accent. The steps are Arc Control's own rather than arc's website, which
 * uses a near-black page: the two loaders' interfaces should look like
 * the same product, and Arc Control is the one people have open next to it.
 */
html.dark {
    /* Arc Control's dark theme. The page and the sidebar are gray-900, the
       header and the cards one step up at gray-800 -- that step is what
       separates a card from the page, so the two must not be the same. */
    --bg: #131316;
    --wash-1: rgb(var(--accent-900) / 0.22);
    --wash-2: rgb(var(--accent-950) / 0.25);
    --surface: #27272a;        /* gray-800 */
    --surface-2: rgb(24 24 27 / 0.3);
    --surface-muted: #3f3f46;  /* gray-700: hover */
    --band: rgb(24 24 27 / 0.3);   /* gray-900/30 */
    --band-muted: rgb(24 24 27 / 0.3);
    --tile: rgb(24 24 27 / 0.4);   /* gray-900/40 */
    --tile-hover: rgb(24 24 27 / 0.6);
    --fill: #3f3f46;           /* gray-700 */
    --fill-hover: #52525b;     /* gray-600 */
    --border: rgb(63 63 70 / 0.7); /* gray-700/70 */
    --field: #3f3f46;          /* gray-700 */
    --fill-strong: #52525b;    /* gray-600 */
    --text: #ffffff;
    --text-2: #d4d4d8;         /* gray-300 */
    --muted: #a1a1aa;          /* gray-400 */
    --primary-soft: rgb(var(--accent-400));
    --primary-text: rgb(var(--accent-300));
    --primary-tint: rgb(var(--accent-950) / 0.5);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --hover-glass: rgb(255 255 255 / 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Every scroller, as Arc Control styles its own: thin, a zinc thumb on no
   track, and no arrow buttons. The platform default on Windows is a wide
   grey track with an arrow at each end, which down the side of the
   sidebar and the page was nothing like the rest of the UI.

   scrollbar-width and scrollbar-color only where the webkit pseudo-
   elements are not: Chrome and Edge take the standard properties over
   them when both are set, and a thin standard bar on Windows keeps its
   arrow buttons. So Firefox gets the standard, the rest these rules.
   Literal colours, since these take a colour and not a token: zinc
   300/400, and 600/500 dark. */
@supports not selector(::-webkit-scrollbar) {
    * {
        scrollbar-width: thin;
        scrollbar-color: #d4d4d8 transparent;
    }

    html.dark,
    html.dark * {
        scrollbar-color: #52525b transparent;
    }
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d4d4d8;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1aa;
}

/* The class is on <html>, so a descendant selector alone would miss the
   page's own scrollbar. */
html.dark::-webkit-scrollbar-thumb,
html.dark ::-webkit-scrollbar-thumb {
    background: #52525b;
}

html.dark::-webkit-scrollbar-thumb:hover,
html.dark ::-webkit-scrollbar-thumb:hover {
    background: #71717a;
}

html, body, #app {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100%;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* The ground behind the whole app and the sign-in page: the near-white
   page with the accent washed into two opposite corners. Low alphas on
   purpose -- a ground, not a colour competing with the tags on it. */
.app-shell,
.login-overlay {
    background-color: var(--bg);
    background-image:
        radial-gradient(60rem 40rem at 0% 0%, var(--wash-1), transparent 60%),
        radial-gradient(50rem 40rem at 100% 100%, var(--wash-2), transparent 60%);
}

/*
 * Glass, One UI's Surface: the same boxes a little see-through, with a
 * soft blur behind and a faint edge so they still read as boxes, over a
 * stronger wash -- glass needs something to see through. Still from the
 * accent, so it follows the colour picker. The class is on <html>, from
 * the theme menu (applyGlass in app.js).
 *
 * The flat boxes on the wash take One UI's edge and shadow; the ones
 * that float -- menus, dialogs, toasts, the current page's pill -- keep
 * their own shadow. A box inside a card keeps its own fill: it is the
 * card that is glass.
 */
html.glass :is(.app-shell, .login-overlay) {
    background-image:
        radial-gradient(50rem 36rem at 0% 0%, rgb(var(--accent-300) / 0.6), transparent 60%),
        radial-gradient(44rem 36rem at 100% 100%, rgb(var(--accent-400) / 0.45), transparent 60%),
        radial-gradient(36rem 28rem at 65% 35%, rgb(var(--accent-200) / 0.5), transparent 60%);
}

html.dark.glass :is(.app-shell, .login-overlay) {
    background-image:
        radial-gradient(50rem 36rem at 0% 0%, rgb(var(--accent-500) / 0.30), transparent 60%),
        radial-gradient(44rem 36rem at 100% 100%, rgb(var(--accent-600) / 0.22), transparent 60%),
        radial-gradient(30rem 24rem at 70% 20%, rgb(var(--accent-400) / 0.12), transparent 60%);
}

html.glass :is(.panel-body, .info-card:not(.panel-body .info-card), .login-card, .handoff,
    .topbar-pill, .nav-item.active, .modal, .toast) {
    background-color: rgb(255 255 255 / 0.5);
    -webkit-backdrop-filter: blur(16px) saturate(1.5);
    backdrop-filter: blur(16px) saturate(1.5);
}

html.dark.glass :is(.panel-body, .info-card:not(.panel-body .info-card), .login-card, .handoff,
    .topbar-pill, .nav-item.active, .modal, .toast) {
    background-color: rgb(39 39 42 / 0.45);
}

/*
 * A menu floats over the page rather than sitting on it, so under glass
 * it is clearer than the boxes, as firevisor's .panel-menu: less fill
 * and a lighter blur let what is underneath show through, softened, with
 * the boxes' faint edge. Its rows mark hover with a tint rather than a
 * grey of their own, which would put an opaque bar back across the glass.
 */
html.glass :is(.power-menu-items, .account-items, .ctx-menu) {
    background-color: rgb(255 255 255 / 0.3);
    -webkit-backdrop-filter: blur(12px) saturate(1.8);
    backdrop-filter: blur(12px) saturate(1.8);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.6),
        0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

html.dark.glass :is(.power-menu-items, .account-items, .ctx-menu) {
    background-color: rgb(39 39 42 / 0.3);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.07), 0 8px 24px rgb(0 0 0 / 0.25);
}

html.glass :is(.power-item, .account-item, .ctx-item):not(.danger):not(.active):hover:not(:disabled) {
    background: rgb(0 0 0 / 0.05);
}

html.dark.glass :is(.power-item, .account-item, .ctx-item):not(.danger):not(.active):hover:not(:disabled) {
    background: rgb(255 255 255 / 0.1);
}

html.glass :is(.panel-body, .info-card:not(.panel-body .info-card), .login-card, .handoff) {
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.6), 0 1px 3px rgb(0 0 0 / 0.06);
}

html.dark.glass :is(.panel-body, .info-card:not(.panel-body .info-card), .login-card, .handoff) {
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.07), 0 8px 24px rgb(0 0 0 / 0.25);
}

/* A line icon: one 24-unit grid and a shared stroke, in the colour of
   the text around it, so it follows the theme and the accent as an
   emoji cannot. */
.icon {
    display: inline-flex;
    flex: none;
    line-height: 0;
}

.icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

button, input, select {
    font: inherit;
}

/* ------------------------------------------------------------- shell --- */

.app-shell {
    --topbar-h: 60px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-h);
    /* No surface of its own: the bar sits on the wash with the sidebar,
       so the cards are the only white on the page. */
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 16px;
    /* Seven clicks in a row switch the expert options; they would select
       the name each time, and drag the image. */
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

/*
 * The mark is the loader's own artwork -- the same glyph as the GRUB
 * banner, cropped square -- so the coloured tile behind it goes. A
 * solid blue square would box in a mark that already has its own
 * shape and colours.
 */
.topbar-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: block;
}

.topbar-label {
    display: grid;
    gap: 2px;
}

.topbar-title {
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
}

.topbar-subtitle {
    color: var(--muted);
    font-size: 14px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Model, address and version on the right of the header, each in a
   bubble as the advanced badge is and as the tags elsewhere are.
   Scoped to .topbar-info: a bare span selector in the header also caught
   the avatar's initial and turned it grey on its blue circle. */
.topbar-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 4px;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.topbar-pill {
    display: inline-flex;
    align-items: baseline;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.topbar-model {
    color: var(--text);
    font-weight: 600;
}

/* What each value is, in front of it and quieter than it. */
.topbar-key {
    margin-right: 5px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.75;
}

@media (max-width: 700px) {
    .topbar-info .topbar-extra {
        display: none;
    }
}

/*
 * The way to DSM in the header: between the logo and the menus where
 * the screen is wide enough, and under them, on a second row the header
 * grows for it, where it is not. A mark and a name each, joined by a
 * line that is green behind a step done. Where it is a squeeze, only the
 * step being looked at keeps its name, and the address and version make
 * room -- System Info and Info have both.
 */
.topbar-steps {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 0 24px;
}

@media (max-width: 1279.98px) {
    .app-shell {
        --topbar-h: 104px;
    }

    .topbar {
        flex-wrap: wrap;
        align-content: flex-start;
    }

    .topbar-logo,
    .topbar-actions {
        height: 60px;
    }

    .topbar-steps {
        order: 3;
        flex: 1 0 100%;
        height: 40px;
        margin: 0;
        padding-bottom: 4px;
    }
}

@media (min-width: 1280px) and (max-width: 1499.98px),
       (max-width: 759.98px) {
    .tstep:not(.here) .tstep-label {
        display: none;
    }
}

@media (min-width: 1280px) and (max-width: 1699.98px) {
    .topbar-info .topbar-extra {
        display: none;
    }
}

.tstep {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 8px 4px 4px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    white-space: nowrap;
}

button.tstep {
    cursor: pointer;
}

button.tstep:hover {
    background: var(--hover-glass);
}

/* Filled, as the step list's marks are: a step still to come is the grey
   of a button, the running one and the one being looked at a tint of the
   accent, and done, warned or failed the status's own colour. The halo
   marks the step being looked at, whatever its state. Each fill sits on
   the surface colour, so a translucent one reads the same on any ground. */
.tstep-mark {
    width: 22px;
    height: 22px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: linear-gradient(var(--fill), var(--fill)), var(--surface);
    font-size: 10px;
    font-weight: 700;
}

.tstep.done .tstep-mark {
    background: var(--success);
    color: #fff;
}

.tstep.warn .tstep-mark {
    background: var(--warning);
    color: #fff;
}

.tstep.failed .tstep-mark {
    background: var(--danger);
    color: #fff;
}

.tstep.busy .tstep-mark {
    background: linear-gradient(rgb(var(--accent-500) / 0.18), rgb(var(--accent-500) / 0.18)), var(--surface);
    color: var(--primary-soft);
    animation: step-pulse 1.4s ease-in-out infinite;
}

.tstep.here .tstep-mark {
    box-shadow: 0 0 0 3px rgb(var(--accent-500) / 0.3);
}

.tstep.here:not(.done):not(.warn):not(.failed) .tstep-mark {
    background: linear-gradient(rgb(var(--accent-500) / 0.18), rgb(var(--accent-500) / 0.18)), var(--surface);
    color: var(--primary-soft);
}

.tstep.done .tstep-label,
.tstep.here .tstep-label {
    color: var(--text);
}

.tstep.here .tstep-label {
    font-weight: 600;
}

.tstep-line {
    flex: 0 1 28px;
    min-width: 8px;
    height: 2px;
    border-radius: 1px;
    background: var(--border);
}

.tstep-line.done {
    background: var(--success);
}

@media (prefers-reduced-motion: reduce) {
    .tstep.busy .tstep-mark {
        animation: none;
    }
}

.topbar-advanced {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgb(var(--accent-100));
    color: rgb(var(--accent-800));
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

html.dark .topbar-advanced {
    background: rgb(var(--accent-900) / 0.45);
    color: rgb(var(--accent-300));
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 0;
    background: none;
    color: var(--text-2);
    font-size: 18px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background-color 0.15s;
}

.theme-toggle:hover {
    background: var(--hover-glass);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* The sun is yellow in dark mode, as in Arc Control's header. */
html.dark .theme-toggle.theme-icon {
    color: #eab308;
}

.main-layout {
    display: flex;
    flex: 1;
    margin-top: var(--topbar-h);
    overflow: hidden;
}

.sidebar {
    width: 264px;
    flex-shrink: 0;
    /* Part of the ground, not a second panel: transparent, no rule down
       its side. */
    background: transparent;
    padding: 12px 12px 16px;
    overflow-y: auto;
}

/* A section heading: small, wide-tracked capitals behind a drawn
   chevron, as firevisor's sidebar has them. */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #a1a1aa;            /* gray-400 */
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 14px 12px 6px;
}

html.dark .sidebar-header {
    color: #71717a;            /* gray-500 */
}

.sidebar-header::before {
    content: "";
    width: 5px;
    height: 5px;
    margin-top: -3px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 6px 12px;
    border: 0;
    border-radius: 12px;
    background: none;
    color: #3f3f46;            /* gray-700 */
    font-size: 15px;
    font-weight: 500;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    margin-bottom: 2px;
    transition: background-color 0.15s, color 0.15s;
}

html.dark .nav-item {
    color: #e4e4e7;            /* gray-200 */
}

.nav-item:hover:not(:disabled):not(.active) {
    background: rgb(255 255 255 / 0.6);
}

html.dark .nav-item:hover:not(:disabled):not(.active) {
    background: rgb(255 255 255 / 0.05);
}

/* The current page: a white pill lifted off the wash, its label and
   glyph in the accent and the accent bar down its left edge -- an inset
   shadow, so it follows the rounded corners and takes no width. */
.nav-item.active {
    background: var(--surface);
    color: var(--primary-text);
    font-weight: 600;
    box-shadow: inset 4px 0 0 0 rgb(var(--accent-500) / 0.65),
        0 0 0 1px rgb(0 0 0 / 0.05), var(--shadow-sm);
}

html.dark .nav-item.active {
    color: var(--primary-text);
    box-shadow: inset 4px 0 0 0 rgb(var(--accent-400) / 0.65),
        0 0 0 1px rgb(255 255 255 / 0.05), var(--shadow-sm);
}

.nav-item:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* An external page: a link dressed as an item, marked as leaving. */
.nav-link {
    text-decoration: none;
}

.nav-external {
    margin-left: auto;
    color: #a1a1aa;
    font-size: 12px;
}

/* The item's glyph: a line icon in grey, turning the accent with the
   label on the current page. */
.nav-step {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    line-height: 1;
    flex-shrink: 0;
    color: var(--muted);
    transition: color 0.15s;
}

.nav-step svg {
    width: 20px;
    height: 20px;
}

.nav-item:hover .nav-step {
    color: var(--text-2);
}

.nav-item.active .nav-step {
    color: rgb(var(--accent-600));
}

html.dark .nav-item.active .nav-step {
    color: rgb(var(--accent-400));
}

.nav-item.done .nav-step {
    background: var(--success);
    color: #fff;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px 24px;
    background: transparent;
}

/* A page: Arc Control's page header (a large icon, the title and a line
   under it) above a card. Full width, as Arc Control's pages are. */
.panel {
    width: 100%;
}

.panel-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

/* The page's glyph on an accent tile, the way an app names itself by
   its icon. */
.panel-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: rgb(var(--accent-on));
    background: linear-gradient(to bottom right, rgb(var(--accent-400)), rgb(var(--accent-600)));
    box-shadow: 0 4px 6px -1px rgb(var(--accent-500) / 0.2),
        0 2px 4px -2px rgb(var(--accent-500) / 0.2);
}

.panel-icon svg {
    width: 22px;
    height: 22px;
}

.panel-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
}

/* A section's heading inside the card: a step under the page's own, as
   a card's title is under the page header. */
.panel-body .panel-title {
    font-size: 16px;
    font-weight: 600;
}

.panel-desc {
    color: var(--text-2);
    font-size: 14px;
    margin-top: 2px;
}

html.dark .panel-desc {
    color: var(--muted);
}

/* The page's card: white on the wash, rounded, with neither a hairline
   nor a shadow -- the fill against the wash is the edge, and a line or a
   shadow around it only made the page busier. */
.panel-body {
    background: var(--surface);
    border-radius: 16px;
    padding: 20px;
}

/* --------------------------------------------------------- components --- */

.field-group {
    margin-bottom: 16px;
}

.field-label {
    display: block;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}

/* Arc Control's inputs and selects: px-2.5 py-1 text-sm rounded-lg, the
   same height as its buttons beside them.

   No outline: a field is told apart by its fill -- a light grey that
   shows on a white card and on a grey box alike, gray-700 in dark mode,
   a step lighter than the gray-800 card -- and the ring marks the one
   being typed in. The padding takes the pixel the border had, so a
   field is as tall as before and still lines up with a button. */
.field-input {
    width: 100%;
    padding: 5px 11px;
    border: 0;
    border-radius: 8px;
    background: var(--field);
    color: var(--text);
    font-size: 14px;
    line-height: 20px;
}

/* A select as wide as what it offers, as Arc Control's are, rather
   than the whole panel. */
select.field-input {
    width: auto;
    max-width: 100%;
}

.field-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgb(var(--accent-500));
}

.button-row {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.button-row.end {
    justify-content: flex-end;
}

/* The Button at its default size, sm: px-2.5 py-1 text-sm. The buttons
   used most set the scale; larger ones made ordinary pages feel
   oversized. */
.primary-button,
.secondary-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 8px;
    border: 0;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    line-height: 20px;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.15s, box-shadow 0.15s;
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.danger-button:focus-visible {
    outline: 2px solid rgb(var(--accent-500));
    outline-offset: 2px;
}

.primary-button {
    background: var(--primary);
    color: rgb(var(--accent-on));
}

.primary-button:hover:not(:disabled) {
    background: var(--primary-dark);
}

/* No button has a border: each is a fill that steps darker on hover.
   A light grey rather than white, which on a white card would leave
   nothing to see without the outline it had -- and a step past gray-100,
   which is what a dialog's footer is. */
.secondary-button {
    background: var(--fill);
    color: #27272a;
    box-shadow: none;
}

html.dark .secondary-button {
    color: #fff;
}

.secondary-button:hover:not(:disabled) {
    background: var(--fill-hover);
}

.danger-button {
    background: var(--danger);
    color: #fff;
}

.danger-button:hover:not(:disabled) {
    background: #b91c1c;
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.button-full {
    width: 100%;
}

/* A callout: the cards' rounder corners, tinted in the accent unless it
   says something worse. The tint is the whole of its edge: a coloured
   line round it only made it read as a form's error box. */
.message-box {
    padding: 13px 17px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
    background: rgb(var(--accent-50));
    color: rgb(var(--accent-900));
}

html.dark .message-box {
    background: rgb(var(--accent-900) / 0.2);
    color: rgb(var(--accent-200));
}

/* Format Disks: a partition sits indented under its disk. */
.row.row-sub {
    padding-left: 40px;
}

/* Addons and tweaks as cards: as many columns as fit, so a wide screen
   is not a handful of very long rows. */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.fold-head + .tiles,
.fold-head + .message-box {
    margin-top: 16px;
}

/* The loader out of date, over every page: what to do, and the way to
   it beside. */
.rebuild-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
}

.rebuild-notice .primary-button {
    flex: none;
}

.message-box + .tiles {
    margin-top: 0;
}

/* A box inside the card: told apart by its fill, not a hairline, and a
   chosen one by a stronger fill in the accent rather than an outline.
   The padding takes the pixel the clear border used to hold, so the
   tiles are the size they were. */
.tile {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px 17px;
    border-radius: 12px;
    background: var(--tile);
    cursor: pointer;
    transition: background-color 0.12s;
}

.tile:hover {
    background: var(--tile-hover);
}

.tile.selected {
    background: rgb(var(--accent-100));
}

html.dark .tile.selected {
    background: rgb(var(--accent-900) / 0.4);
}

.tile.selected .row-title {
    color: var(--primary-text);
}

.tile .row-check {
    margin-top: 2px;
}

.tile .tile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tile.selected .tag:not(.ok):not(.warn):not(.danger) {
    background: var(--surface);
}

/* A folded section on the Extras page: title, summary, Show / Hide. */
.fold + .fold {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.fold-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.fold-head + .row-list {
    margin-top: 16px;
}

/* A fold whose head holds a field rather than Show / Hide: the CPU
   frequency scaling's select. The text gives way to the field, and on a
   phone the field goes under it, across the card -- beside it, the
   select's longest option ran off the card's edge. */
.fold-head-field > div {
    flex: 1 1 auto;
    min-width: 0;
}

.fold-head-field > .field-input {
    flex: none;
}

@media (max-width: 640px) {
    .fold-head-field {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .fold-head-field > select.field-input {
        width: 100%;
    }
}

/* Extras' Command line, in advanced mode: the user's own entries, a
   row each with its Remove, then the field to add more. */
.fold-head + .message-box + .cmdline-list,
.fold-head + .message-box + .cmdline-add {
    margin-top: 12px;
}

.cmdline-list {
    display: grid;
    gap: 8px;
}

.cmdline-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 8px 14px;
    border-radius: 12px;
    background: var(--tile);
}

.cmdline-text {
    min-width: 0;
    font-size: 13px;
}

.cmdline-add {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.cmdline-add + .message-box,
.cmdline-add ~ .info-note {
    margin-top: 8px;
}

/* The Update page's file section, set off from the online update. */
.offline-update {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* Info: arx introducing itself, then cards of label and value rows, as
   arc-control's and arc-vmm's Info tabs. */
.info-hero {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px;
    border-radius: 16px;
    background: var(--tile);
}

.info-hero img {
    width: 64px;
    height: 64px;
    flex: none;
    border-radius: 16px;
}

.info-title {
    font-size: 20px;
    font-weight: 700;
}

/* A card: its title on a neutral grey band, gray-200/50 -- fixed rather
   than the accent, so the headers stay quiet whatever accent is picked --
   the icon in dark grey on a small white tile of its own, then label and
   value rows. No
   hairline: on the wash its white is the edge, and inside the page's
   card it takes a box's fill instead (below). */
.info-card {
    margin-top: 16px;
    padding: 16px;
    border-radius: 16px;
    background: var(--surface);
    display: grid;
    gap: 10px;
    font-size: 14px;
    overflow: hidden;
}

.info-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: -16px -16px 6px;
    padding: 10px 16px;
    background: var(--band);
    font-size: 14px;
    font-weight: 600;
}

/* Inside the page's card a white card has no edge left: it is a box
   there, filled as the others are. */
.panel-body .info-card {
    background: var(--tile);
}

.card-icon {
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--surface);
    color: #27272a;            /* gray-800 */
    box-shadow: 0 0 0 1px rgb(0 0 0 / 0.05), var(--shadow-sm);
}

html.dark .card-icon {
    color: #d4d4d8;            /* gray-300 */
    background: rgb(63 63 70 / 0.7);
    box-shadow: 0 0 0 1px rgb(255 255 255 / 0.05);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
}

.info-label {
    color: var(--muted);
    flex: none;
}

.info-value {
    min-width: 0;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info-warn {
    color: var(--danger);
}

.info-note {
    color: var(--muted);
    font-size: 12px;
}

.info-copyright {
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.info-muted {
    color: var(--muted);
}

/* A value read whole rather than cut off: a CPU name, a command line. */
.info-row.wrap .info-value {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* mono breaks anywhere, which cut "tsc=reliable" in two at the edge of
   a phone; a command line breaks between its entries first. */
.info-row.wrap .info-value.mono {
    word-break: normal;
}

.tag-list {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.stack {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

/* System Info: the numbers asked for first, then Info's cards two to a
   row where there is room, one under the other where there is not. */
.sysinfo-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

/* A headline tile: the label above, the figure on a line of its own
   below and large -- the number is what the tile is for. */
.sysinfo-stat {
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--tile);
}

.sysinfo-stat-value {
    margin-top: 6px;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.sysinfo-stat-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
}

html.dark .sysinfo-stat-label {
    color: var(--muted);
}

.sysinfo-stat-label .icon {
    color: var(--muted);
}

.sysinfo-stat-sub {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

/* System, Loader and DSM in a row where there is room, the three about
   as long; Network and Storage under them, Storage two columns wide for
   its controllers side by side. Two columns: Storage across both. One:
   each under the other. Counted on the page's width, a container, so
   the card's own sidebar and padding are already out of it. */
.sysinfo {
    container-type: inline-size;
    font-variant-numeric: tabular-nums;
}

.sysinfo-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0 16px;
    align-items: stretch;
}

@container (min-width: 736px) {
    .sysinfo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sysinfo-grid > .info-card:last-child {
        grid-column: 1 / -1;
    }
}

@container (min-width: 1112px) {
    .sysinfo-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .sysinfo-grid > .info-card:last-child {
        grid-column: span 2;
    }
}

/* Cards in a row are as tall as the tallest; the rows inside stay at the
   top rather than spreading over the extra height. */
.sysinfo-grid > .info-card {
    align-content: start;
}

/* The NICs, a tile each as the storage controllers are: what it is on
   the left, its speed and address on the right, as a label and its
   value are. */
.sysinfo-nics {
    display: grid;
    gap: 10px;
}

.sysinfo-nic {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--tile);
}

.sysinfo-nic-state {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex: none;
}

.sysinfo-item-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.sysinfo-item-name {
    font-weight: 600;
}

/* A NIC's MAC and PCI ID, each kept whole: one split in the middle reads
   as two different addresses. */
.sysinfo-item-ids {
    display: flex;
    flex-wrap: wrap;
    column-gap: 10px;
    white-space: nowrap;
}

/* Storage: the controllers as tiles, as many to a row as fit -- one on a
   phone -- each with its disks under it. auto-fill, so a machine with one
   controller has a tile its contents' size rather than one stretched
   across a wide screen with its disks in the first third. */
.sysinfo-ctrls {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(520px, 100%), 1fr));
    gap: 12px;
    align-items: start;
}

.sysinfo-ctrl {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--tile);
    container-type: inline-size;
}

/* The controller's name and its disk count after it. */
.sysinfo-ctrl-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
}

/* A disk per row, its columns lined up down the tile: the tree's
   branch, name, size, model, serial. The columns are the list's and
   each row a subgrid of them, so each is as wide as its longest and
   they sit side by side from the left -- the model given the rest of
   the row put the serial and size at the tile's far edge, a screen
   from the disk they belong to. */
.sysinfo-disks {
    display: grid;
    grid-template-columns: 14px max-content max-content minmax(0, max-content) minmax(0, 1fr);
    column-gap: 12px;
    font-size: 13px;
}

.sysinfo-disk {
    --pad: 5px;
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    align-items: baseline;
    row-gap: 2px;
    padding: var(--pad) 0;
}

/* The branch from the controller to the disk: ├ for each, └ for the
   last. Drawn over the row's padding, and on the first row over the
   tile's gap too, so the line runs unbroken up to the controller's
   name. The horizontal stroke is at the first line's middle and runs
   into the column gap, to just short of the disk's name. */
.sysinfo-disk:first-child {
    --up: calc(var(--pad) + 10px);
}

.sysinfo-disk::before {
    --y: calc(var(--up, var(--pad)) + 10px);
    content: '';
    align-self: stretch;
    margin: calc(-1 * var(--up, var(--pad))) -8px calc(-1 * var(--pad)) 0;
    background:
        linear-gradient(var(--fill-strong), var(--fill-strong)) 5px 0 / 1px 100% no-repeat,
        linear-gradient(var(--fill-strong), var(--fill-strong)) 5px var(--y) / calc(100% - 9px) 1px no-repeat;
}

.sysinfo-disk:last-child::before {
    background-size: 1px calc(var(--y) + 1px), calc(100% - 9px) 1px;
}

.sysinfo-disk-name {
    font-weight: 600;
}

.sysinfo-disk-model,
.sysinfo-disk-serial {
    overflow-wrap: anywhere;
}

.sysinfo-disk-serial {
    color: var(--muted);
    font-size: 12px;
}

.sysinfo-disk-size {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* A narrow tile: beside the branch two columns, the size under the
   name and the serial under the model, so neither is broken mid-word
   on a phone. */
@container (max-width: 420px) {
    .sysinfo-disks {
        grid-template-columns: 14px max-content minmax(0, 1fr);
    }

    .sysinfo-disk::before {
        grid-column: 1;
        grid-row: 1 / span 2;
    }

    .sysinfo-disk-name {
        grid-column: 2;
        grid-row: 1;
    }

    .sysinfo-disk-model {
        grid-column: 3;
        grid-row: 1;
    }

    .sysinfo-disk-serial {
        grid-column: 3;
        grid-row: 2;
    }

    .sysinfo-disk-size {
        grid-column: 2;
        grid-row: 2;
        text-align: left;
        color: var(--muted);
        font-size: 12px;
    }
}

/* A disk's model and serial, as tags, on Format Disks under the device
   name. */
.disk-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
}

.row-desc.disk-tags {
    margin-top: 4px;
}

/* Modules loaded: the names as tags, from the left. */
.sysinfo-modules > .tag-list {
    justify-content: flex-start;
}

/* A page's box with a card beside it, outside it: the Model page's
   list, and the chosen platform's features. The card stays in view
   while the list scrolls, and goes under the box where there is no room
   beside it -- the list is what the page is for. */
.panel-beside {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 16px;
    align-items: start;
}

.panel-beside.alone {
    grid-template-columns: minmax(0, 1fr);
}

.panel-beside > .info-card {
    margin-top: 0;
    position: sticky;
    top: 0;
}

@media (max-width: 1000px) {
    .panel-beside {
        grid-template-columns: minmax(0, 1fr);
    }

    .panel-beside > .info-card {
        position: static;
    }
}

.feature-group {
    display: grid;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.feature-group-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.feature-no {
    color: var(--muted);
}

.platform-card a {
    white-space: nowrap;
}

.feature-legend {
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

/* A section of an advanced page, set apart as the file update is. */
.opt-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.panel-body > .opt-section:first-child,
.panel-body > .message-box + .opt-section {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    word-break: break-all;
}

/* Label and value pairs, one per line: the Update page's versions. */
.kv-list {
    display: grid;
    gap: 6px;
    font-size: 14px;
}

/* The status colours stay fixed whatever the accent: red is an error
   and green is done under every theme. Tinted, with no line round them,
   as the accent's callout is. */
.message-error {
    background: #fef2f2;
    color: #991b1b;
}

.message-success {
    background: #f0fdf4;
    color: #166534;
}

.message-warning {
    background: #fffbeb;
    color: #92400e;
}

html.dark .message-error {
    background: rgb(127 29 29 / 0.2);
    color: #fca5a5;
}

html.dark .message-success {
    background: rgb(20 83 45 / 0.2);
    color: #86efac;
}

html.dark .message-warning {
    background: rgb(120 53 15 / 0.2);
    color: #fcd34d;
}

/* -------------------------------------------------------------- table --- */

/* The data tables as one style: a quiet sentence-case header in grey,
   roomy rows and a tint under the row the pointer is on. Shouting column
   names made the header the loudest row of the table. The outer edges
   stay tight, so the table lines up with the text above it. */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
}

.data-table th:first-child,
.data-table td:first-child {
    padding-left: 4px;
}

.data-table th:last-child,
.data-table td:last-child {
    padding-right: 4px;
}

.data-table tbody tr {
    transition: background-color 0.12s;
}

.data-table tbody tr:hover {
    background: var(--surface-2);
}

html.dark .data-table tbody tr:hover {
    background: rgb(255 255 255 / 0.03);
}

/* A badge qualifies what it sits beside, so it is small and has no
   frame: a tinted pill in the status's own colour. */
.tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background: #f4f4f5;
    border: 0;
    color: #3f3f46;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 18px;
}

html.dark .tag {
    background: #3f3f46;
    color: #d4d4d8;
}

/* On a box's gray-100 fill a gray-100 tag is gone: white there. Dark
   mode's tags are a step above its boxes already. */
html:not(.dark) :is(.row, .tile, .panel-body .info-card, .sysinfo-stat, .sysinfo-nic,
    .sysinfo-ctrl, .intro-point, .cmdline-entry) .tag:not(.ok):not(.warn):not(.danger) {
    background: var(--surface);
}

.tag.ok {
    background: #dcfce7;
    color: #166534;
}

.tag.warn {
    background: #fef3c7;
    color: #92400e;
}

.tag.danger {
    background: #fee2e2;
    color: #991b1b;
}

html.dark .tag.ok {
    background: rgb(20 83 45 / 0.35);
    color: #4ade80;
}

html.dark .tag.warn {
    background: rgb(120 53 15 / 0.35);
    color: #fbbf24;
}

html.dark .tag.danger {
    background: rgb(127 29 29 / 0.35);
    color: #f87171;
}

/* A platform in beta: a small flag raised to the top right of its name,
   in the warning tag's colours. */
.beta-flag {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 5px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: super;
}

html.dark .beta-flag {
    background: rgb(120 53 15 / 0.35);
    color: #fbbf24;
}

/* A feature's state on the platform card: a coloured dot where the
   documentation's table has its emoji. */
.feature-mark {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 6px;
    border-radius: 999px;
    vertical-align: 1px;
    background: #a1a1aa;
}

.feature-mark.yes { background: #22c55e; }
/* Not the accent: beside the red of "no", a red accent read as no. */
.feature-mark.part { background: var(--warning); }
.feature-mark.no { background: #ef4444; }

.feature-legend .feature-mark {
    margin: 0 4px 0 0;
}

.feature-legend .feature-mark:not(:first-child) {
    margin-left: 10px;
}

/* A selected row is highlighted in the tags' own colour, which made the
   plain ones vanish into it. */
.row.selected .tag:not(.ok):not(.warn):not(.danger) {
    background: var(--surface);
}

/* ---------------------------------------------------------- build log --- */

.progress {
    height: 8px;
    border-radius: 999px;
    background: var(--surface-muted);
    overflow: hidden;
    margin: 10px 0 16px;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

.progress-bar.failed {
    background: var(--danger);
}

/* ------------------------------------------------------------ journey --- */

/* The way to DSM over the setup pages: the steps in a row, joined by a
   line that fills in green behind each one done. */
.journey-steps {
    display: flex;
}

.journey-step {
    flex: 1;
    min-width: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 12px;
}

button.journey-step {
    cursor: pointer;
}

/* The line from the step before, under the marks. */
.journey-step::before {
    content: '';
    position: absolute;
    top: 11px;
    left: -50%;
    right: 50%;
    height: 2px;
    background: var(--border);
    z-index: 0;
}

.journey-step:first-child::before {
    display: none;
}

.journey-step.done::before {
    background: var(--success);
}

/* Filled like the top bar's steps (see .tstep-mark). The surface colour
   under each fill matters more here: the line between the steps runs
   behind the marks, and would show through a translucent grey. */
.journey-mark {
    /* Above the lines on either side, which run from centre to centre. */
    position: relative;
    z-index: 1;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: linear-gradient(var(--fill), var(--fill)), var(--surface);
    font-size: 11px;
    font-weight: 700;
    transition: box-shadow 0.15s, background-color 0.15s;
}

button.journey-step:hover .journey-mark {
    background: linear-gradient(var(--fill-hover), var(--fill-hover)), var(--surface);
}

.journey-step.done .journey-mark {
    background: var(--success);
    color: #fff;
}

.journey-step.warn .journey-mark {
    background: var(--warning);
    color: #fff;
}

.journey-step.failed .journey-mark {
    background: var(--danger);
    color: #fff;
}

.journey-step.busy .journey-mark {
    background: linear-gradient(rgb(var(--accent-500) / 0.18), rgb(var(--accent-500) / 0.18)), var(--surface);
    color: var(--primary-soft);
    animation: step-pulse 1.4s ease-in-out infinite;
}

/* The step being looked at: a ring, whatever its state. */
.journey-step.here .journey-mark {
    box-shadow: 0 0 0 4px rgb(var(--accent-500) / 0.3);
}

.journey-step.here:not(.done):not(.warn):not(.failed) .journey-mark {
    background: linear-gradient(rgb(var(--accent-500) / 0.18), rgb(var(--accent-500) / 0.18)), var(--surface);
    color: var(--primary-soft);
}

.journey-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.journey-step.done .journey-label {
    color: var(--text);
}

.journey-step.here .journey-label {
    color: var(--text);
    font-weight: 600;
}

/* A phone has room for the marks and one name: the step being looked
   at, which the page's title names again anyway. */
@media (max-width: 560px) {
    .journey-step:not(.here) .journey-label {
        visibility: hidden;
    }
}

@media (prefers-reduced-motion: reduce) {
    .journey-step.busy .journey-mark {
        animation: none;
    }
}

/* ---------------------------------------------------- install progress --- */

.install-progress {
    margin-bottom: 16px;
}

.install-headline {
    font-size: 15px;
    font-weight: 600;
}

.install-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 4px 16px;
    margin-bottom: 16px;
}

/* The build's steps in the way-to-DSM row. Eight longer names than the
   way's six, so they wrap under their mark rather than being cut. */
.install-steps .journey-label {
    white-space: normal;
    text-align: center;
    padding: 0 4px;
}

/* Eight marks leave a phone no room for a name under any of them; the
   headline above says which step is running. */
@media (max-width: 560px) {
    .install-steps .journey-label {
        display: none;
    }
}

/* The steps, two columns where there is room: eight one-line items in a
   single column would push the buttons below the fold for no gain. */
.step-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 6px 24px;
    margin-top: 16px;
}

.step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--muted);
}

.step-mark {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 11px;
    flex-shrink: 0;
    /* A grey dot, not a hairline circle: a step still to come is the
       button's fill, the one running a tint of the accent, and done or
       failed the status's own colour. */
    background: var(--fill);
}

.step-done {
    color: var(--text);
}

.step-done .step-mark {
    background: var(--success);
    color: #fff;
}

.step-current {
    color: var(--text);
    font-weight: 600;
}

.step-current .step-mark {
    background: rgb(var(--accent-500) / 0.18);
    color: var(--primary-soft);
    animation: step-pulse 1.4s ease-in-out infinite;
}

.step-failed {
    color: var(--danger);
    font-weight: 600;
}

.step-failed .step-mark {
    background: var(--danger);
    color: #fff;
}

@keyframes step-pulse {
    50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
    .step-current .step-mark { animation: none; }
}

/* The build log, as a console: near-black in both themes, like Arc
   Control's terminal frame, so it reads as program output rather than
   as another card. The black is its edge; it needs no line round it. */
.logview {
    background: #09090b;
    color: #e4e4e7;
    border-radius: 12px;
    padding: 15px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    height: 260px;
    overflow-y: auto;
    white-space: pre-wrap;
    /* No visible scrollbar. It still scrolls -- wheel, touch, keys -- and
       follows the newest line by itself; the bar only added a bright
       strip down the side of a black console. */
    scrollbar-width: none;
}

.logview::-webkit-scrollbar {
    display: none;
}

.log-stage {
    color: #60a5fa; /* blue-400: readable on the black console */
    font-weight: 700;
}

.log-error {
    color: #f87171; /* red-400 */
}

.log-done {
    color: #4ade80; /* green-400 */
}

/* -------------------------------------------------------------- login --- */

.login-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 2000;
    padding: 16px;
    overflow-y: auto;
}

/* Ignis's sign-in layout: a narrow column of the header row, the card
   and a line of help under it. */
.login-panel {
    width: 100%;
    max-width: 384px;
}

/* The header's own logo block, with the theme switch at the far end. */
.login-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
}

/* The language and the theme button, side by side at the far end. */
.login-tools {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* firevisor's sign-in select: no box until hovered, like the buttons
   beside it. */
.login-lang {
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
    padding: 8px 6px;
    cursor: pointer;
}

.login-lang:hover {
    background: var(--hover-glass);
}

.login-lang option {
    background: var(--surface);
    color: var(--text);
}

/* The header hides its tagline on a narrow screen to make room for the
   actions; here there is room, and it is most of what the page says. */
.login-head .topbar-subtitle {
    display: block;
}

.login-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
}

.login-card .button-full {
    margin-top: 4px;
}

.login-hint {
    margin-top: 16px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

/* ---------------------------------------------------------- handoff --- */

/*
 * Starting DSM: one centred card with a status that moves while DSM is
 * on its way -- a spinner, the running time, the step it is on -- then
 * the address, set large enough to read on a phone at the machine and
 * to tap without aiming.
 */
.handoff {
    max-width: 560px;
    margin: 24px auto 0;
    background: var(--surface);
    border-radius: 16px;
    padding: 32px;
}

.handoff-head {
    display: grid;
    justify-items: center;
    text-align: center;
    gap: 6px;
}

.handoff-icon {
    width: 64px;
    height: 64px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    margin-bottom: 10px;
    font-size: 30px;
    font-weight: 800;
    color: #fff;
}

.handoff-icon-ready {
    background: var(--success);
}

.handoff-icon-late {
    background: var(--warning);
}

.spinner {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    border: 4px solid var(--border);
    border-top-color: var(--primary-soft);
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 3s; }
}

.handoff-headline {
    font-size: 22px;
    font-weight: 800;
}

.handoff-elapsed {
    margin-top: 4px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.handoff-steps {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 24px auto 0;
    width: fit-content;
}

.handoff-address {
    margin-top: 24px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--tile);
}

.handoff-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-bottom: 6px;
}

.handoff-url {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.handoff-url a {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    word-break: break-all;
}

.handoff-url a:hover {
    color: var(--primary-soft);
}

.handoff-copy {
    flex: none;
    padding: 6px 14px;
}

.handoff-open {
    display: flex;
    margin-top: 16px;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.handoff-hint {
    margin-top: 20px;
    font-size: 13px;
    color: var(--muted);
    text-align: center;
}

/* Links in the page's own text, in the accent rather than the browser's
   default blue, which is unreadable on the dark cards. */
.handoff-hint a,
.panel-body p a,
.panel-desc a,
.info-card a,
.kv-list a,
.message-box a {
    color: var(--primary-soft);
    text-decoration: none;
}

.handoff-hint a:hover,
.panel-body p a:hover,
.panel-desc a:hover,
.info-card a:hover,
.kv-list a:hover,
.message-box a:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------- responsive --- */

/*
 * The loader is often driven from a phone while standing at the machine,
 * so this is not optional.
 */
@media (max-width: 900px) {
    .sidebar {
        display: none;
    }

    .content-area {
        padding: 16px;
    }

    .topbar {
        padding: 0 16px;
    }

    .topbar-subtitle {
        display: none;
    }
}

/* ---------------------------------------------------------- step nav --- */

/*
 * Back/next under the panel. Same max-width and centring as .panel, so
 * the buttons line up with its edges rather than with the viewport.
 *
 * space-between with an empty span on the first step keeps "next" on
 * the right whether or not there is a "back" beside it.
 */
.step-nav {
    margin: 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.step-nav .step-nav-arrow {
    font-size: 15px;
    line-height: 1;
}

.step-nav .secondary-button .step-nav-arrow {
    margin-right: 8px;
}

.step-nav .primary-button .step-nav-arrow {
    margin-left: 8px;
}

/* -------------------------------------------------------- disclosure --- */

/*
 * A collapsed section, for things that belong on a page without being
 * what the page is for -- the password form on the overview.
 */
.disclosure {
    border-top: 1px solid var(--border);
    padding-top: 18px;
}

.disclosure > summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* The default triangle differs per browser; draw one that does not. */
.disclosure > summary::-webkit-details-marker {
    display: none;
}

.disclosure > summary::before {
    content: "▸";
    color: var(--muted);
    font-size: 12px;
}

.disclosure[open] > summary::before {
    content: "▾";
}

/* --------------------------------------------------------------- rows --- */

/*
 * A selectable list, for the model and addon pickers.
 *
 * These were a card grid, which is the wrong shape for them: a grid
 * reflows by viewport width, so the models landed three-then-two with a
 * gap, and the addons ran to a dozen tall tiles that pushed the rest of
 * the page below the fold. Both are lists of one-line choices, so they
 * are drawn as lists -- name on the left, facts on the right, aligned
 * down the column where they can be compared.
 */
.row-list {
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
}

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: 0;
    /* Separators between rows, not around them: the list is a box
       inside the card, told apart by its fill, and the lines only divide
       it, as a card's inner lines do. */
    border-top: 1px solid var(--border);
    background: var(--tile);
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.row:first-child {
    border-top: 0;
}

.row:hover {
    background: var(--tile-hover);
}

/*
 * The selected row is marked on its left edge rather than by a border
 * all the way round: in a list the rows share edges, so a full outline
 * reads as a break in the list instead of a highlight in it.
 *
 * inset box-shadow, not border-left, so the row does not shift by 3px
 * when it becomes selected.
 */
.row.selected {
    background: var(--primary-tint);
    box-shadow: inset 4px 0 0 rgb(var(--accent-500) / 0.65);
}

.row.selected .row-title {
    color: var(--primary-text);
}

.row-check {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.row-main {
    flex: 1;
    min-width: 0;
}

/* A row is a div acting as a button where it holds a control of its own;
   the focus ring a <button> would have had, inside its edges. */
.row:focus-visible {
    outline: 2px solid var(--primary-soft);
    outline-offset: -2px;
}

/* The chosen platform's model and DSM version, on a line under it. */
.row.selected {
    flex-wrap: wrap;
}

.row-picks {
    flex-basis: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 20px;
}

.row-pick {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: default;
}

.row-pick-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.row-pick select {
    padding: 3px 9px;
    font-size: 13px;
    cursor: pointer;
}

.row-title {
    font-size: 14px;
    font-weight: 600;
}

.row-desc {
    color: var(--muted);
    font-size: 12.5px;
    margin-top: 2px;
}

.row-meta {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 6px 12px;
    color: var(--muted);
    font-size: 12px;
}

/* Stack on a phone, where a row has no width to put facts beside a name. */
@media (max-width: 560px) {
    .row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .row-meta {
        width: 100%;
        padding-left: 0;
    }
}

/* ---------------------------------------------------------- welcome --- */

/*
 * The introduction: three short answers in columns across the card, on
 * the same grid as the facts under them. A single column held to a
 * reading measure left most of a wide card empty; three columns keep
 * each one's lines about as long, and use the width.
 */
/* Welcome: the three answers as boxes, three to a row where they fit
   and one under the other on a phone, as System Info's tiles are. */
.intro {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.intro-point {
    padding: 16px 18px;
    border-radius: 16px;
    background: var(--tile);
}

.intro-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

/* The point's glyph on a square of the accent's tint. A step past
   accent-50, which on the box's grey left no square without the faint
   ring it had. */
.intro-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgb(var(--accent-100));
    color: rgb(var(--accent-600));
}

html.dark .intro-icon {
    background: rgb(var(--accent-900) / 0.3);
    color: rgb(var(--accent-400));
}

.intro-icon svg {
    width: 18px;
    height: 18px;
}

.intro-title {
    font-size: 15px;
    font-weight: 600;
}

.intro-point p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-2);
    max-width: 48ch;
}

html.dark .intro-point p {
    color: var(--muted);
}

/* What was found on this computer, in the card across the page: four
   facts in a row where they fit, two to a row on a phone. */
.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px 20px;
    padding: 4px 0 2px;
}

.fact-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.fact-value {
    font-size: 18px;
    font-weight: 600;
    margin-top: 4px;
    letter-spacing: -0.01em;
    /* A long CPU name should wrap rather than push the grid wider. */
    overflow-wrap: anywhere;
}

.fact-note {
    color: var(--muted);
    font-size: 12.5px;
    margin-top: 3px;
}

/* That arx is not Synology's: a footnote under the card, set apart by a
   rule. */
.disclaimer {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

/* ------------------------------------------------------------ toasts --- */

/* Notifications: top centre, sliding down from the edge, over the page
   but not in its way -- only the cards themselves take clicks. Each is a
   card with a coloured edge and mark by kind, a title over its text, and
   either a bar running down its three seconds or, for an issue, a close
   button. */
.toasts {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: min(420px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    --toast-accent: var(--primary);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 13px 15px 15px 14px;
    border-left: 4px solid var(--toast-accent);
    border-radius: 12px;
    background: var(--surface);
    /* The shadow and the faint edge a dialog has, not a hairline: it
       floats over the page as a dialog does. The coloured left edge is
       its kind, not an outline, and stays. */
    box-shadow: var(--shadow), 0 0 0 1px rgb(0 0 0 / 0.05);
    color: var(--text);
    opacity: 0;
    transform: translateY(-28px);
    transition: transform 0.25s ease, opacity 0.25s ease;
}

html.dark .toast {
    box-shadow: var(--shadow), 0 0 0 1px rgb(255 255 255 / 0.1);
}

.toast.show {
    opacity: 1;
    transform: none;
}

.toast-success {
    --toast-accent: var(--success);
    cursor: pointer;
}

.toast-info {
    --toast-accent: var(--primary);
    --toast-on: rgb(var(--accent-on));
    cursor: pointer;
}

.toast-error {
    --toast-accent: var(--danger);
}

.toast-mark {
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 800;
    /* White, but on the accent what goes on it: dark on amber. */
    color: var(--toast-on, #fff);
    background: var(--toast-accent);
}

.toast-body {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.toast-title {
    font-size: 14px;
    font-weight: 700;
}

.toast-text {
    margin-top: 2px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

/* An issue's own text, selectable for copying into a question. */
.toast-error .toast-text {
    user-select: text;
}

.toast-close {
    flex: none;
    width: 26px;
    height: 26px;
    margin: -2px -4px 0 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.toast-close:hover {
    background: var(--surface-muted);
    color: var(--text);
}

/* The time left, running down along the bottom edge. */
.toast-timer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--toast-accent);
    opacity: 0.6;
    transform-origin: left;
    animation-name: toast-time;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

@keyframes toast-time {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .toast {
        transform: none;
    }
}

/* ------------------------------------------------------- power menu --- */

.power-menu {
    position: relative;
}

/* The summary IS the button, so it carries .theme-toggle and only needs
   its default marker removed. */
.power-menu > summary {
    list-style: none;
}

.power-menu > summary::-webkit-details-marker {
    display: none;
}

/* The menus: rounder, and a deeper shadow rather than a hairline, the
   entries rounded inside them. */
.power-menu-items {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 170px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    padding: 4px;
    z-index: 1100;
}

/* The dropdown entries: px-2.5 py-1.5 rounded-lg text-sm. */
.power-item {
    display: block;
    width: 100%;
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    line-height: 20px;
    background: none;
    color: var(--text);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.power-item:hover {
    background: var(--surface-muted);
}

.power-item.danger:hover {
    background: var(--danger);
    color: #fff;
}

/* The theme menu: the power menu's dropdown, with light and dark as two
   buttons and the accent colours as swatches under them. */
.theme-menu-items {
    min-width: 200px;
    padding: 8px;
    display: grid;
    gap: 6px;
}

.theme-menu-label {
    padding: 2px 2px 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.theme-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.theme-mode {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 8px;
    border: 0;
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
}

.theme-mode svg {
    width: 16px;
    height: 16px;
}

html.dark .theme-mode {
    background: rgb(63 63 70 / 0.6);
}

.theme-mode:hover {
    background: #e4e4e7;
}

html.dark .theme-mode:hover {
    background: #3f3f46;
}

.theme-mode.active {
    background: rgb(var(--accent-100));
    color: rgb(var(--accent-700));
}

html.dark .theme-mode.active {
    background: rgb(var(--accent-900) / 0.5);
    color: rgb(var(--accent-300));
}

.theme-swatches {
    display: flex;
    gap: 10px;
    padding: 2px;
}

/* A swatch: the colour as a dot, ringed when it is the one in use. */
.theme-swatch {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 1px var(--border);
    cursor: pointer;
    padding: 0;
}

.theme-swatch.active {
    box-shadow: 0 0 0 2px var(--text);
}

/* ----------------------------------------------------- account menu --- */

/*
 * The identity is the control: initials, name, and a menu of the things
 * an account does to itself. Same <details> mechanics as the power
 * menu, so it closes on a second click and on Escape for free.
 */
.account-menu {
    position: relative;
}

.account-menu > summary {
    list-style: none;
}

.account-menu > summary::-webkit-details-marker {
    display: none;
}

/* Borderless until hovered, like the other header buttons -- Arc
   Control's header has no outlined controls. */
.account-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: 10px;
    border: 0;
    background: none;
    cursor: pointer;
    transition: background-color 0.15s;
}

.account-button:hover {
    background: var(--hover-glass);
}

.account-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: linear-gradient(to bottom right, rgb(var(--accent-400)), rgb(var(--accent-600)));
    color: rgb(var(--accent-on));
    font-size: 13px;
    font-weight: 700;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.account-name {
    font-size: 13px;
    color: var(--text);
}

.account-caret {
    color: var(--muted);
}

.account-caret svg {
    width: 14px;
    height: 14px;
}

/* The name is the first thing to go when the header runs out of room;
   the initials still say who is signed in. */
@media (max-width: 560px) {
    .account-name, .account-caret {
        display: none;
    }
}

/* firevisor's account menu: w-72, rows edge to edge (px-3 py-2), the
   head and the way out set off by a rule. */
.account-items {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 288px;
    max-width: calc(100vw - 16px);
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    z-index: 1100;
}

.account-head {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.account-head-name {
    font-size: 14px;
    font-weight: 500;
}

.account-head-note {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.account-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    border-radius: 0;
    line-height: 20px;
    background: none;
    color: var(--text);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.account-item:hover {
    background: var(--surface-muted);
}

/* Advanced mode: the label on the left, the switch on the right. */
.account-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.switch {
    position: relative;
    flex: none;
    width: 34px;
    height: 20px;
    border-radius: 10px;
    background: var(--fill-strong);
    transition: background 0.15s;
}

.switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s;
}

.switch.on {
    background: var(--primary);
}

.switch.on::after {
    transform: translateX(14px);
}

/* A row that opens a face of the menu: the glyph, the label, what is
   chosen, and a chevron; and the face's way back at its top. */
.account-step,
.account-back,
.account-choice {
    display: flex;
    align-items: center;
    gap: 10px;
}

.account-step > .icon,
.account-back > .icon {
    color: var(--muted);
}

.account-step-label {
    flex: 1;
}

.account-step-value {
    color: var(--muted);
    font-size: 12px;
}

.account-back {
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

/* The languages: p-1.5, rounded rows a little in from the edge. */
.account-langs {
    display: grid;
    gap: 2px;
    padding: 6px;
}

.account-langs .account-item {
    padding: 6px 10px;
    border-radius: 8px;
}

.account-choice.active {
    background: rgb(var(--accent-100));
    color: rgb(var(--accent-700));
    font-weight: 500;
}

html.dark .account-choice.active {
    background: rgb(var(--accent-900) / 0.5);
    color: rgb(var(--accent-300));
}

.account-item.danger {
    color: var(--danger);
    border-top: 1px solid var(--border);
}

.account-item.danger:hover {
    background: rgb(0 0 0 / 0.05);
}

html.dark .account-item.danger:hover {
    background: rgb(255 255 255 / 0.1);
}

/* ----------------------------------------------------------- modal --- */

/* Arc Control's Modal.jsx, from its Tailwind classes. */
.modal-backdrop {
    position: fixed;           /* fixed inset-0 z-50 overflow-y-auto */
    inset: 0;
    z-index: 2000;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.4);   /* bg-black/40 backdrop-blur-sm */
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    display: flex;             /* flex min-h-full items-center justify-center p-4 */
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.modal {
    position: relative;        /* rounded-2xl shadow-2xl ring-1 ring-black/5 */
    width: 100%;
    max-width: 672px;          /* size md: max-w-2xl */
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgb(0 0 0 / 0.05);
    overflow: hidden;
}

html.dark .modal {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgb(255 255 255 / 0.1);
}

.modal.modal-sm { max-width: 448px; }  /* max-w-md */
.modal.modal-lg { max-width: 896px; }  /* max-w-4xl */

.modal-head {                  /* flex justify-between px-5 py-3 */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
}

.modal-title {                 /* text-base font-semibold */
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.modal-close {                 /* p-1 -mr-1 rounded-lg hover:bg-gray-100 */
    display: inline-flex;
    padding: 4px;
    margin-right: -4px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: #a1a1aa;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.modal-close:hover { color: var(--text); background: var(--surface-muted); }
.modal-close svg { width: 20px; height: 20px; }

.modal-body {                  /* px-5 py-4 max-h-[32rem] overflow-y-auto */
    padding: 16px 20px;
    max-height: 32rem;
    overflow-y: auto;
    font-size: 14px;
    color: var(--text);
}

.modal-body p { margin: 0 0 12px; }  /* space-y-3 */
.modal-body p:last-child { margin-bottom: 0; }

.modal-foot {                  /* the footer on a tinted band, as a card's title */
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    background: var(--band-muted);
}

/* The success variant: a check, a title, a line, and gone in 2s. */
.modal.modal-success {         /* max-w-sm p-5 text-center */
    max-width: 384px;
    padding: 20px;
    text-align: center;
}

.modal-check {                 /* h-10 w-10 rounded-full bg-green-100 */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border-radius: 999px;
    background: #dcfce7;
    color: #16a34a;
}

html.dark .modal-check {       /* dark:bg-green-900/40 dark:text-green-400 */
    background: rgba(20, 83, 45, 0.4);
    color: #4ade80;
}

.modal-check svg { width: 24px; height: 24px; }
.modal-success .modal-title { margin-top: 12px; }
.modal-success .modal-text {   /* mt-1.5 text-sm text-gray-600 */
    margin-top: 6px;
    font-size: 14px;
    color: var(--muted);
}

/* A table wider than a phone scrolls inside its panel, not the page. */
.table-scroll {
    overflow-x: auto;
}

/* Network: the DHCP or Static choice at the row's end, and a static
   address's fields in a row of their own under the NIC's. */
.data-table .net-mode {
    text-align: right;
    white-space: nowrap;
}

.data-table tbody tr.net-edit:hover {
    background: none;
}

.data-table tr.net-edit td {
    border-top: none;
    padding-top: 0;
    padding-bottom: 16px;
}

.net-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
    gap: 12px;
}

.net-fields .field-group {
    margin-bottom: 0;
}

.net-edit .button-row {
    margin-top: 12px;
    justify-content: flex-end;
}

/* The model step's serial and MACs, in advanced mode, under the
   platform list. */
.identity-fold {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.identity-fields {
    margin-top: 16px;
}

.identity-note {
    margin-top: 8px;
}

.identity-buttons {
    margin-top: 12px;
    justify-content: flex-end;
}

/* --------------------------------------------------------------- files --- */

/* The tools as square icon buttons, the search beside them and the free
   space at the far end, as arc's file manager has them; on a phone the
   search takes a line of its own. */
.files-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    margin-bottom: 12px;
}

.files-tools {
    display: flex;
    align-items: center;
    gap: 6px;
}

.files-tools-sep {
    width: 1px;
    height: 20px;
    margin: 0 4px;
    background: var(--border);
}

.files-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 1 280px;
    min-width: 180px;
}

.files-search > .icon {
    position: absolute;
    left: 10px;
    color: var(--muted);
    pointer-events: none;
}

.files-search .field-input {
    padding-left: 33px;
}

.crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    min-width: 0;
    font-size: 13px;
}

.crumb {
    padding: 2px 6px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--primary-soft);
    font: inherit;
    cursor: pointer;
    word-break: break-all;
}

.crumb:hover {
    background: var(--surface-muted);
}

.crumb-here {
    color: var(--text);
    font-weight: 600;
    cursor: default;
}

.crumb-here:hover {
    background: none;
}

.crumb-sep {
    color: var(--muted);
}

.files-free {
    margin-left: auto;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 560px) {
    .files-search {
        flex: 1 1 100%;
        order: 3;
    }
}

/* Where files can be dropped: outlined while some are dragged over it. */
.files-drop {
    border: 2px dashed transparent;
    border-radius: 12px;
    transition: border-color 0.15s, background-color 0.15s;
}

.files-drop.over {
    border-color: var(--primary-soft);
    background: var(--primary-tint);
}

.files-table td {
    padding-top: 6px;
    padding-bottom: 6px;
    vertical-align: middle;
}

/* A row is chosen by a click anywhere on it, not on its name: the whole
   row is the target, and a double click on it does not select its text. */
.file-row {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.file-row:hover td {
    background: var(--surface-2);
}

html.dark .file-row:hover td {
    background: rgb(255 255 255 / 0.03);
}

.file-row.selected td {
    background: var(--primary-tint);
}

.file-check {
    width: 1%;
    padding-right: 0 !important;
}

.file-check input {
    display: block;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.file-name {
    width: 100%;
    min-width: 160px;
}

.file-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 2px 0;
    word-break: break-all;
}

.file-icon {
    flex: none;
    color: var(--muted);
}

.file-icon.dir {
    color: rgb(var(--accent-500));
}

.file-icon svg {
    width: 18px;
    height: 18px;
}

.file-link {
    display: block;
    margin-left: 28px;
    color: var(--muted);
    font-size: 12px;
}

.file-size,
.file-extra {
    white-space: nowrap;
    color: var(--muted);
}

.data-table .file-size {
    text-align: right;
}

/* A square action button, an icon on its own: the accent's light tint,
   no ring, a step darker on hover. */
.file-action {
    width: 30px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: rgb(var(--accent-100));
    color: rgb(var(--accent-700));
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s;
}

html.dark .file-action {
    background: rgb(var(--accent-900) / 0.3);
    color: rgb(var(--accent-400));
}

.file-action:hover:not(:disabled) {
    background: rgb(var(--accent-200) / 0.7);
}

html.dark .file-action:hover:not(:disabled) {
    background: rgb(var(--accent-900) / 0.5);
}

.file-action:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* A row's own actions: ghost buttons, quiet until pointed at, so a long
   list is not a grid of outlines. Delete turns red under the pointer. */
.file-action.ghost {
    width: 28px;
    height: 28px;
    background: transparent;
    box-shadow: none;
    color: var(--muted);
}

html.dark .file-action.ghost {
    background: transparent;
    color: var(--muted);
}

.file-action.ghost:hover:not(:disabled),
html.dark .file-action.ghost:hover:not(:disabled) {
    background: var(--surface-muted);
    color: var(--text);
}

.file-action.danger:hover:not(:disabled),
html.dark .file-action.danger:hover:not(:disabled) {
    color: var(--danger);
}

.file-acts {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.file-acts .file-action + .file-action {
    margin-left: 2px;
}

/* The headings over the right-aligned columns are right-aligned too. */
.data-table th.file-acts,
.data-table th.file-size {
    text-align: right;
}

.data-table th.file-acts {
    padding-right: 8px;
}

.file-row.dir .file-text {
    font-weight: 600;
}

/* A heading that sorts: its arrow faint until it is the column sorted. */
.files-sort {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.files-sort-icon {
    opacity: 0.35;
}

.files-sort.on .files-sort-icon {
    opacity: 1;
}

.files-sort-icon svg {
    width: 12px;
    height: 12px;
}

.files-empty {
    padding: 16px 12px !important;
}

/* The folder's path, and what is chosen with its tools, between the
   toolbar and the list. Always there, so choosing a row does not move
   the list under the pointer. */
.files-selbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 46px;
    margin-bottom: 8px;
    padding: 6px 8px 6px 8px;
    border-radius: 12px;
    background: var(--tile);
    font-size: 13px;
}

.files-selbar.active {
    background: var(--primary-tint);
}

.files-sel-count {
    margin-right: 4px;
    font-weight: 600;
    word-break: break-all;
}

.files-sel-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* What was cut and is to be pasted elsewhere, faded until it is. */
.file-row.cut td {
    opacity: 0.5;
}

/* What is to paste, beside the search: what and how many, Paste here,
   and a way to paste nothing. A pill in the accent's tint, with no line
   round it -- accent-100 rather than the chosen rows' paler tint, which
   on the white card was barely there once the line was gone. The
   padding takes the pixel the line had. */
.files-clip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 3px 3px 11px;
    border-radius: 999px;
    background: rgb(var(--accent-100));
    font-size: 13px;
    white-space: nowrap;
}

html.dark .files-clip {
    background: rgb(var(--accent-900) / 0.4);
}

.files-clip > .icon {
    color: var(--primary-soft);
}

/* The right button's menu, at the pointer, over a backdrop that closes
   it on any click beside it. */
.ctx-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1500;
}

.ctx-menu {
    position: fixed;
    min-width: 220px;
    padding: 4px;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 34px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.ctx-item > .icon {
    color: var(--muted);
}

.ctx-item:hover:not(:disabled) {
    background: var(--surface-muted);
}

.ctx-item.danger,
.ctx-item.danger > .icon {
    color: var(--danger);
}

.ctx-item:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ctx-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ctx-key {
    color: var(--muted);
    font-size: 12px;
}

.ctx-rule {
    height: 1px;
    margin: 4px 6px;
    background: var(--border);
}

/* The editor: the file whole, in a fixed-width font, lines not wrapped. */
.file-editor-path {
    margin-bottom: 8px;
    word-break: break-all;
}

.file-editor {
    display: block;
    height: min(60vh, 26rem);
    resize: vertical;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre;
    tab-size: 4;
}

.file-editor + .message-box {
    margin-top: 10px;
}

/* A phone has room for the box, the name and its size; what a row can
   do is on the bar above once it is chosen. */
@media (max-width: 560px) {
    .file-extra,
    .file-acts {
        display: none;
    }

    .file-name {
        min-width: 120px;
    }
}

/* ------------------------------------------------------------ terminal --- */

/* A terminal is dark in either theme, as a console is, and the dark is
   its edge. It takes typing as a field does, so it is marked as a field
   is while the typing comes here: the accent's ring, outside it. */
.term {
    --term-bg: #18181b;
    --term-fg: #e4e4e7;
    position: relative;
    border-radius: 12px;
    background: var(--term-bg);
    overflow: hidden;
    transition: box-shadow 0.15s;
}

.term.focused {
    box-shadow: 0 0 0 2px rgb(var(--accent-500));
}

.term-scroll {
    height: clamp(320px, calc(100vh - 300px), 900px);
    padding: 8px 10px;
    overflow-x: hidden;
    overflow-y: scroll;
    color: var(--term-fg);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.3;
    cursor: text;
}

.term-row {
    height: 1.3em;
    white-space: pre;
    overflow: hidden;
}

/* Hollow while the typing goes elsewhere, solid while it comes here. */
.term-cursor {
    outline: 1px solid var(--term-fg);
    outline-offset: -1px;
}

.term.focused .term-cursor {
    background: var(--term-fg) !important;
    color: var(--term-bg) !important;
}

/* The field that takes the typing: in the box, so a phone opens its
   keyboard there, and not seen. */
.term-input {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
    resize: none;
    font-size: 16px; /* below that, a phone zooms in on it */
}

.term-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.term-state {
    font-size: 13px;
    color: var(--muted);
}

.term-state.open {
    color: var(--success);
}

.term-keys {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.term-key {
    min-width: 36px;
    padding: 2px 8px;
    font-size: 12px;
}
