/* ─── Mocchimochi · Liquid Floppy design system ─────────────────────────────
   Tokens live on :root (light) and [data-theme="dark"]. Components below only
   read tokens, so every view works in both themes.
   Files: application.css (tokens, base, components) · floppy.css (server disks)
          · legacy.css (neu-* aliases kept for older views and specs)
──────────────────────────────────────────────────────────────────────────── */

/* Same layer order Tailwind uses, declared first so it wins regardless of file order:
   Tailwind preflight (base) < these components < Tailwind utilities. */
@layer theme, base, components, utilities;

@layer components {


:root {
  --bg: #F4F2FB;
  --tile: #FFFFFF;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --line: #E7E3F4;
  --ink: #1B1A2E;
  --muted: #625F7A;
  --chip: #F1EEFA;
  --accent: #5B5BF0;
  --accent-deep: #3B3BC9;
  --accent-ink: #FFFFFF;
  --gold: #F5C451;
  --ok: #136B45;
  --ok-dot: #22B573;
  --ok-soft: #DDF5EA;
  --warn: #8A5A00;
  --warn-dot: #E6A11F;
  --warn-soft: #FFF1D6;
  --danger: #D83A52;
  --danger-soft: #FFE1E6;
  --shadow: rgba(60, 50, 140, 0.10);
  --scrim: rgba(27, 26, 46, 0.28);
  --blob1: #C9C4FF;
  --blob2: #FFD9C2;
  --blob3: #BFEBDD;
  --paper: #FFFDF8;
  --paper-loan: #FFF1C2;
  --paper-ink: #1B1A2E;
  --paper-muted: #625F7A;
  --paper-line: #E4E0F0;
  --console: #15132A;

  --font-display: "Unbounded", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0F0E1A;
  --tile: #1A1830;
  --glass: rgba(26, 24, 48, 0.72);
  --glass-strong: rgba(26, 24, 48, 0.92);
  --line: #2B2847;
  --ink: #F2F0FF;
  --muted: #A9A5C7;
  --chip: #24213D;
  --accent: #8B8BFF;
  --accent-deep: #B0B0FF;
  --accent-ink: #0F0E1A;
  --ok: #8FE3BD;
  --ok-soft: #12352B;
  --warn: #F5C451;
  --warn-soft: #3A2E12;
  --danger: #FF8A9C;
  --danger-soft: #3A1A22;
  --shadow: rgba(0, 0, 0, 0.45);
  --scrim: rgba(0, 0, 0, 0.55);
  --blob1: #221F40;
  --blob2: #2A2026;
  --blob3: #16282A;
  --paper: #EDEAF5;
  --paper-loan: #F2E6B8;
  color-scheme: dark;
}

/* ─── Base ──────────────────────────────────────────────────────────────── */
html, body { background: var(--bg); color: var(--ink); }
body {
  font-family: var(--font-body);
  font-weight: 500;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ─── Scrollbars ────────────────────────────────────────────────────────────
   Thin rounded thumb on a clear track, from the theme's muted ink. Firefox and
   Chrome 121+ read scrollbar-color (and then ignore ::-webkit-scrollbar); Safari
   only has the pseudo-elements. Containers retune via --scroll-thumb(-hover). */
:root { --scroll-thumb: color-mix(in srgb, var(--muted) 38%, transparent); --scroll-thumb-hover: color-mix(in srgb, var(--muted) 62%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); background-clip: padding-box; border: 3px solid transparent; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-thumb-hover); }
/* The console stays dark in both themes */
.panel--dark { --scroll-thumb: rgba(233, 230, 255, 0.22); --scroll-thumb-hover: rgba(233, 230, 255, 0.4); }
/* Keep the thumb clear of the editor's rounded corners */
.file-editor::-webkit-scrollbar-track { margin-block: 18px; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.display { font-family: var(--font-display); letter-spacing: -0.04em; }
.h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1; letter-spacing: -0.04em; margin: 0; overflow-wrap: anywhere; }
.h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; letter-spacing: -0.02em; margin: 0; }
.section-title { font-size: 0.95rem; font-weight: 800; color: var(--muted); margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ─── Ambient background ────────────────────────────────────────────────── */
.ambient { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.blob { position: absolute; filter: blur(40px); opacity: .8; animation: morph 14s ease-in-out infinite alternate; }
[data-theme="dark"] .blob { opacity: .55; }
.blob--1 { left: -120px; top: -140px; width: 520px; height: 480px; background: var(--blob1); }
.blob--2 { right: -160px; top: 80px; width: 560px; height: 500px; background: var(--blob2); animation-delay: -5s; }
.blob--3 { left: 40%; bottom: -220px; width: 600px; height: 460px; background: var(--blob3); animation-delay: -9s; }
@keyframes morph {
  0%   { border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%; transform: translate(0, 0) rotate(0); }
  50%  { border-radius: 63% 37% 38% 62% / 58% 63% 37% 42%; transform: translate(40px, -30px) rotate(30deg); }
  100% { border-radius: 37% 63% 51% 49% / 37% 45% 55% 63%; transform: translate(-30px, 20px) rotate(-20deg); }
}

/* ─── Page shell ────────────────────────────────────────────────────────── */
.page { position: relative; z-index: 1; max-width: 1392px; margin: 0 auto; padding: 24px 24px 64px; display: flex; flex-direction: column; gap: 20px; }
.page--narrow { max-width: 720px; }
/* Empty Turbo Stream targets (e.g. a status with nothing to report) must not add a layout gap */
main > div:empty { display: none; }

.topbar {
  position: relative; z-index: 20;
  height: 72px; box-sizing: border-box; padding: 0 12px 0 20px;
  border-radius: 999px; background: var(--glass); backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; flex-grow: 1; }
.brand__name { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em; }

.balance-pill {
  height: 48px; box-sizing: border-box; padding: 0 6px;
  border-radius: 999px; background: var(--tile); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.balance-pill__icon { width: 40px; height: 40px; border-radius: 50%; background: var(--tile); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.balance-pill__label { display: flex; flex-direction: column; line-height: 1.15; }
.balance-pill__label small { font-size: 11px; font-weight: 800; color: var(--muted); }
.balance-pill__label strong { font-family: var(--font-mono); font-size: 16px; }

.theme-switch { position: relative; width: 84px; height: 48px; border-radius: 999px; background: var(--chip); border: none; cursor: pointer; padding: 0; flex-shrink: 0; }
.theme-switch__knob {
  position: absolute; left: 4px; top: 4px; width: 40px; height: 40px; border-radius: 50%;
  background: var(--tile); box-shadow: 0 4px 10px var(--shadow); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: transform .55s var(--spring);
}
[data-theme="dark"] .theme-switch__knob { transform: translateX(36px); }
.theme-switch .icon-sun { color: var(--warn-dot); }
.theme-switch .icon-moon, [data-theme="dark"] .theme-switch .icon-sun { display: none; }
[data-theme="dark"] .theme-switch .icon-moon { display: block; }

.avatar {
  position: relative; width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  background: var(--gold); color: #1B1A2E; border: none; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .55s var(--spring);
}
.avatar:hover { transform: scale(1.06); }
.avatar--lg { width: 64px; height: 64px; font-size: 26px; cursor: default; }
.avatar__dot { position: absolute; top: 0; right: 0; width: 12px; height: 12px; border-radius: 50%; background: #F0566B; border: 2px solid var(--tile); }
/* Profile photo inside any avatar circle (.avatar, .sticker__avatar) */
.avatar__img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
/* Settings: the avatar opens the photo editor; hovering shows what a click does */
.avatar--editable { cursor: pointer; overflow: hidden; box-shadow: 0 0 0 3px var(--tile), 0 0 0 5px var(--line); }
.avatar__edit {
  position: absolute; inset: 0; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: rgba(27, 26, 46, .78); color: #fff; font-family: var(--font-body); font-size: 9px; font-weight: 800;
  letter-spacing: .02em; text-transform: uppercase; text-align: center; line-height: 1.1; padding: 6px;
  opacity: 0; transform: scale(1.15); transition: opacity .25s ease, transform .45s var(--spring);
}
.avatar--editable:hover .avatar__edit, .avatar--editable:focus-visible .avatar__edit { opacity: 1; transform: none; }
.avatar--editable:hover, .avatar--editable:focus-visible { color: transparent; }
/* Photo editor dialog */
.avatar-editor__stage {
  position: relative; width: 168px; height: 168px; border-radius: 50%; padding: 0; overflow: hidden; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; border: none;
  background: var(--gold); color: #1B1A2E; font-family: var(--font-display); font-weight: 700; font-size: 64px;
  box-shadow: 0 0 0 6px var(--tile), 0 0 0 8px var(--line), 0 24px 48px var(--shadow);
  transition: transform .55s var(--spring), box-shadow .3s ease;
}
.avatar-editor__stage:hover { transform: scale(1.03) rotate(-2deg); }
.avatar-editor__stage--empty { background: var(--chip); color: var(--muted); box-shadow: 0 0 0 6px var(--tile), 0 0 0 8px var(--line); outline: 2px dashed color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -14px; }
.avatar-editor__stage--over { transform: scale(1.06); box-shadow: 0 0 0 6px var(--tile), 0 0 0 9px var(--accent), 0 24px 48px var(--shadow); }
.avatar-editor__image { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-editor__drop {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: rgba(27, 26, 46, .55); color: #fff; font-family: var(--font-body); font-size: 13px; font-weight: 800;
  opacity: 0; transition: opacity .25s ease;
}
.avatar-editor__stage:hover .avatar-editor__drop, .avatar-editor__stage:focus-visible .avatar-editor__drop, .avatar-editor__stage--over .avatar-editor__drop { opacity: 1; }
.avatar-editor__confirm { display: flex; flex-direction: column; gap: 14px; margin-top: -4px; padding: 16px 18px; border-radius: 28px; background: color-mix(in srgb, var(--danger) 8%, transparent); border: 1.5px solid color-mix(in srgb, var(--danger) 30%, transparent); animation: pop-center .45s var(--spring); }

/* Dropdown menu */
.menu {
  position: absolute; top: 60px; right: 0; width: 280px; padding: 8px; z-index: 50;
  border-radius: 28px; background: var(--tile);
  border: 1px solid var(--line); box-shadow: 0 24px 48px var(--shadow);
  display: flex; flex-direction: column;
  transform-origin: top right; animation: pop .45s var(--spring);
}
.menu.hidden { display: none; }
.menu__who { padding: 12px 14px; margin-bottom: 4px; border-radius: 20px; background: var(--chip); display: flex; flex-direction: column; gap: 2px; }
.menu__who small { font-size: 13px; font-weight: 700; color: var(--muted); }
.menu__who span { font-family: var(--font-mono); font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.menu__item, .menu form button {
  width: 100%; min-height: 46px; padding: 0 14px; box-sizing: border-box; border-radius: 16px;
  background: transparent; border: none; color: var(--ink); cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 700;
  transition: background .2s ease, transform .35s var(--spring);
}
.menu__item:hover, .menu form button:hover { background: var(--chip); transform: translateX(4px); }
.menu__item--danger, .menu form button.menu__item--danger { color: var(--danger); }
.menu__sep { height: 1px; background: var(--line); margin: 6px 10px; }
.menu__badge { margin-left: auto; min-width: 24px; height: 24px; padding: 0 8px; box-sizing: border-box; border-radius: 999px; background: #F0566B; color: #fff; font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.menu__note { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

/* ─── Surfaces ──────────────────────────────────────────────────────────── */
.panel {
  position: relative; box-sizing: border-box; padding: 24px;
  border-radius: 32px; background: var(--glass); backdrop-filter: blur(18px);
  border: 1px solid var(--line);
}
.panel--lg { border-radius: 40px; padding: 28px 32px; }
.panel--tight { padding: 12px; }
.panel--dark { background: var(--console); color: #E9E6FF; border-color: transparent; backdrop-filter: none; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel__sub { font-size: 14px; font-weight: 600; color: var(--muted); margin: 4px 0 0; }
.chip-box { padding: 16px 20px; border-radius: 24px; background: var(--chip); }

/* Rows written like lines on paper / lists */
.line-row { min-height: 40px; display: flex; align-items: center; gap: 12px; border-bottom: 1.5px solid var(--line); }
.line-row:last-child { border-bottom: none; }
.line-row__key { width: 120px; flex-shrink: 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.line-row__value { font-size: 14px; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.list-row {
  min-height: 60px; padding: 0 12px; border-radius: 20px;
  display: flex; align-items: center; gap: 14px;
  transition: background .2s ease, transform .5s var(--spring);
}
a.list-row:hover, button.list-row:hover, .list-row--hover:hover { background: var(--chip); }
.list-row__icon { width: 40px; height: 40px; flex-shrink: 0; border-radius: 14px; background: var(--chip); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.list-row__text { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-row__title { font-size: 15px; font-weight: 800; }
.list-row__desc { font-size: 13px; font-weight: 600; color: var(--muted); }

/* ─── Buttons (liquid fill on hover, idle is still) ─────────────────────── */
.btn {
  --fill: rgba(0, 0, 0, .14);
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; box-sizing: border-box;
  border-radius: 999px; border: none; cursor: pointer; white-space: nowrap;
  font-weight: 800; font-size: 15px; line-height: 1; text-decoration: none;
  background: var(--chip); color: var(--ink);
  transition: transform .45s var(--spring), background .3s ease, opacity .2s ease;
}
.btn::before {
  content: ""; position: absolute; left: 50%; top: 140%; width: 170%; aspect-ratio: 1; margin-left: -85%;
  border-radius: 40%; background: var(--fill); z-index: -1;
  transition: top .8s var(--ease-out); animation: spin 6s linear infinite; animation-play-state: paused;
}
.btn:hover::before { top: -40%; animation-play-state: running; }
.btn:hover { transform: scale(1.04); }
.btn:active { transform: scale(.95); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn:disabled::before { display: none; }
.btn--primary { background: var(--accent); color: var(--accent-ink); --fill: var(--accent-deep); }
.btn--dark { background: var(--paper-ink); color: #fff; --fill: #3B3BC9; }
.btn--success { background: #1E9E63; color: #fff; --fill: rgba(0,0,0,.18); }
.btn--stop { background: #D83A52; color: #fff; --fill: rgba(0,0,0,.18); }
.btn--ghost { background: transparent; border: 1.5px solid var(--line); --fill: var(--chip); }
.btn--glass { background: var(--glass); backdrop-filter: blur(18px); border: 1px solid var(--line); --fill: var(--line); }
.btn--danger { background: transparent; border: 1.5px solid color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); --fill: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: 13px; }
.btn--lg { min-height: 60px; padding: 0 28px; font-size: 17px; }
.btn--block { width: 100%; }
.btn--icon { width: 44px; min-height: 44px; height: 44px; padding: 0; border-radius: 50%; flex-shrink: 0; }
.btn--icon::before { border-radius: 50%; }
.btn--busy { cursor: progress; }
.btn--busy::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent; animation: spin .8s linear infinite;
}
form.button_to { display: contents; }

/* ─── Forms ─────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 8px; }
.label { margin-left: 10px; font-size: 14px; font-weight: 800; color: var(--ink); }
.hint { margin-left: 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.error { margin-left: 10px; font-size: 13px; font-weight: 700; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; min-height: 54px; box-sizing: border-box; padding: 0 22px;
  border-radius: 999px; background: var(--chip); border: none; color: var(--ink);
  font-size: 15px; font-weight: 600; outline: none; appearance: none;
  transition: box-shadow .25s ease;
}
.textarea { border-radius: 24px; padding: 14px 20px; min-height: 120px; }
.input:focus, .select:focus, .textarea:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.input--mono { font-family: var(--font-mono); font-weight: 700; }
.select {
  cursor: pointer; padding-right: 48px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23625F7A' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 20px center;
}
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .input { padding-left: 46px; }
input[type="range"] { accent-color: var(--accent); width: 100%; }

/* Language picker: a .select that opens a .menu of flags */
.language-select { display: flex; align-items: center; gap: 12px; text-align: left; }
.language-menu { top: calc(100% + 8px); left: 0; right: 0; width: auto; transform-origin: top center; }
.language-select--compact { gap: 6px; padding: 0 12px; }
.language-menu--compact { left: auto; width: 220px; transform-origin: top right; }
/* .panel's backdrop-filter traps the menu's z-index inside it: lift the whole panel while it's open. */
.panel:has(.language-menu:not(.hidden)) { z-index: 20; }
.flag { flex-shrink: 0; border-radius: 4px; box-shadow: 0 0 0 1px var(--line); }

/* Segmented control — radios styled as pills; the checked one is raised */
.segmented { display: flex; gap: 4px; padding: 6px; border-radius: 999px; background: var(--chip); }
.segmented label { flex: 1 1 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 12px;
  border-radius: 999px; font-weight: 800; font-size: 14px; cursor: pointer;
  transition: background .3s ease, box-shadow .3s ease, transform .5s var(--spring);
}
.segmented input:checked + span { background: var(--tile); box-shadow: 0 6px 14px var(--shadow); }
.segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); }

/* ─── File manager (server Files tab) ───────────────────────────────────── */
/* Path on the left, an optional centered action, the toolbar on the right */
.file-header { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; }
.file-header > .file-path { grid-column: 1; }
.file-header__center { grid-column: 2; }
.file-header__end { grid-column: 3; justify-self: end; }
.sftp-row { display: none; }
.file-path { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; font-family: var(--font-mono); font-size: 14px; font-weight: 700; }
.file-path a { color: var(--muted); transition: color .15s ease; }
.file-path a:hover { color: var(--ink); }
.file-path__root { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 10px; background: var(--chip); }
.file-path__separator { color: var(--muted); }
.file-path__current { color: var(--ink); overflow-wrap: anywhere; }
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.file-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 6rem 9.5rem 9.5rem; align-items: center; gap: 12px;
  min-height: 52px; padding: 0 8px 0 14px; border-top: 1px solid var(--line); border-radius: 16px; transition: background .2s ease;
}
.file-row:first-child { border-top: none; }
.file-row:hover { background: var(--chip); }
.file-row__name { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; font-weight: 700; }
.file-row__name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row__name > svg { flex-shrink: 0; }
.file-row__icon { color: var(--accent); flex-shrink: 0; }
.file-row__meta { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--muted); text-align: right; white-space: nowrap; }
.file-row__actions { display: flex; justify-content: flex-end; gap: 4px; }
.file-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
/* Follows the theme (unlike the console): light paper by day, dark tile by night */
.file-editor {
  width: 100%; min-height: 60vh; box-sizing: border-box; resize: vertical; padding: 18px 20px;
  border-radius: 24px; border: 1.5px solid var(--line); background: var(--chip); color: var(--ink);
  caret-color: var(--accent); font-family: var(--font-mono); font-size: 13px; line-height: 1.6; tab-size: 4; outline: none;
}
.file-editor::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.file-editor:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }

/* ─── Status ────────────────────────────────────────────────────────────── */
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; }
.led { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: #9A96B0; }
.led--on { background: var(--ok-dot); animation: ping 1.8s ease-out infinite; }
.led--busy { background: var(--warn-dot); animation: ping-warn 1.8s ease-out infinite; }
.led--fail { background: var(--danger); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(34,181,115,.55); } 100% { box-shadow: 0 0 0 10px rgba(34,181,115,0); } }
@keyframes ping-warn { 0% { box-shadow: 0 0 0 0 rgba(230,161,31,.55); } 100% { box-shadow: 0 0 0 10px rgba(230,161,31,0); } }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--chip); color: var(--ink); }
.pill--ok { background: var(--ok-soft); color: var(--ok); }
.pill--warn { background: var(--warn-soft); color: var(--warn); }
.pill--danger { background: var(--danger-soft); color: var(--danger); }
.pill--accent { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.count { min-width: 28px; height: 28px; padding: 0 9px; box-sizing: border-box; border-radius: 999px; background: var(--chip); font-family: var(--font-mono); font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

/* ─── Flash ─────────────────────────────────────────────────────────────── */
.flash {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px 14px 22px; border-radius: 24px; font-weight: 700; font-size: 15px;
  background: var(--glass-strong); border: 1px solid var(--line); box-shadow: 0 12px 24px var(--shadow);
  animation: pop .45s var(--spring);
}
.flash--notice { border-left: 6px solid var(--ok-dot); }
.flash--alert { border-left: 6px solid var(--danger); color: var(--danger); }
.flash a { text-decoration: underline; }
/* Saved file: the server's Restart button (and its live Restarting state) sized for the toast */
.flash--saved { flex-wrap: wrap; }
.flash--saved .btn--lg { min-height: 40px; padding: 0 16px; font-size: 13px; }

/* ─── Modal (display toggled by confirm/modal/resize controllers) ───────── */
.modal { display: none; position: fixed; inset: 0; z-index: 200; align-items: center; justify-content: center; padding: 24px; background: var(--scrim); backdrop-filter: blur(6px); }
.modal--open { display: flex; }
/* Native dialogs: full-viewport transparent box, the scrim is the ::backdrop */
dialog.modal { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0; background: transparent; box-sizing: border-box; backdrop-filter: none; }
dialog.modal[open] { display: flex; }
dialog.modal::backdrop { background: var(--scrim); backdrop-filter: blur(6px); }
[hidden] { display: none !important; }
.modal__dialog {
  width: 100%; max-width: 560px; max-height: 85vh; overflow-y: auto; box-sizing: border-box;
  padding: 28px; border-radius: 40px; background: var(--glass-strong); backdrop-filter: blur(24px);
  border: 1px solid var(--line); box-shadow: 0 40px 80px rgba(20, 16, 60, .25);
  display: flex; flex-direction: column; gap: 18px; color: var(--ink); text-align: left;
  animation: pop-center .55s var(--spring);
}
.modal__dialog--sm { max-width: 420px; }
.modal__title { font-family: var(--font-display); font-weight: 700; font-size: 24px; letter-spacing: -0.03em; margin: 0; }
.modal__body { font-size: 15px; font-weight: 600; line-height: 1.55; color: var(--muted); margin: 0; }
.modal__body strong { color: var(--ink); }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
dialog.modal__dialog { margin: auto; }
dialog.modal__dialog:not([open]) { display: none; }
dialog.modal__dialog::backdrop { background: var(--scrim); backdrop-filter: blur(6px); }

/* ─── Breadcrumbs ───────────────────────────────────────────────────────── */
.breadcrumbs { padding-left: 12px; }
/* Page trail (not the admin one): a little air between the top bar and the content */
main > .breadcrumbs { margin: 8px 0; }
.breadcrumbs__list { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; font-size: 14px; font-weight: 700; }
.breadcrumbs__item { display: inline-flex; align-items: center; }
.breadcrumbs__link { color: var(--muted); transition: color .15s ease; }
.breadcrumbs__link:hover { color: var(--ink); }
.breadcrumbs__separator { color: var(--muted); display: inline-flex; }
.breadcrumbs__current { color: var(--ink); }

/* ─── Data tables (admin, billing) ──────────────────────────────────────── */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 800; color: var(--muted); }
.table td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .2s ease; }
.table tbody tr:hover td { background: var(--chip); }
.table tbody tr td:first-child { border-top-left-radius: 16px; border-bottom-left-radius: 16px; }
.table tbody tr td:last-child { border-top-right-radius: 16px; border-bottom-right-radius: 16px; }
.table .actions { display: flex; justify-content: flex-end; gap: 6px; }
.table .num { text-align: right; font-family: var(--font-mono); font-weight: 700; }

/* ─── Liquid orb meters (--level: 0–100) ────────────────────────────────── */
.orb { --level: 0; --orb-color: var(--accent); position: relative; overflow: hidden; isolation: isolate; width: 96px; height: 96px; border-radius: 50%; background: var(--chip); flex-shrink: 0; }
.orb__wave { position: absolute; left: 50%; width: 240%; aspect-ratio: 1; margin-left: -120%; border-radius: 43%; background: var(--orb-color); top: calc(96% - var(--level) * 1%); animation: spin 8s linear infinite; transition: top 1.2s var(--ease-out); }
.orb__wave--back { opacity: .45; border-radius: 39%; animation-duration: 13s; top: calc(92% - var(--level) * 1%); }

/* ─── Helpers & motion ──────────────────────────────────────────────────── */
.float { animation: float 5s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); } 50% { transform: translateY(-10px) rotate(calc(var(--r, 0deg) + 3deg)); } }
.twinkle { animation: twinkle 2.8s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { transform: scale(.55) rotate(0); opacity: .4; } 50% { transform: scale(1) rotate(45deg); opacity: 1; } }
.lift { transition: transform .6s var(--spring); }
.lift:hover { transform: translateY(-8px) rotate(-1.2deg); }
.lift:active { transform: translateY(-2px) scale(.97); }
.shimmer { background-image: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%); background-size: 200% 100%; animation: shimmer 1.8s linear infinite; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: scale(.85) translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes pop-center { from { opacity: 0; transform: translateY(24px) scale(.94); } to { opacity: 1; transform: none; } }
.progress { height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--paper-ink) 8%, transparent); overflow: hidden; }
.progress__bar { height: 100%; border-radius: 999px; background-color: var(--gb, var(--accent)); }
[data-theme="dark"] .progress__bar { background-color: color-mix(in srgb, var(--gb, var(--accent)) 68%, #0F0E1A); }

/* Admin shell */
.admin-shell { display: flex; gap: 20px; align-items: flex-start; }
.admin-content { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.side-nav { width: 264px; flex-shrink: 0; position: sticky; top: 24px; box-sizing: border-box; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.side-nav__group { padding: 12px 12px 8px; font-size: 12px; font-weight: 800; letter-spacing: .1em; color: var(--muted); }
.side-nav__item { min-height: 60px; padding: 8px 10px; border-radius: 20px; display: flex; align-items: center; gap: 12px; transition: background .2s ease, transform .45s var(--spring); }
.side-nav__item:hover { background: var(--chip); transform: translateX(3px); }
.side-nav__item[aria-current="page"] { background: var(--tile); box-shadow: 0 8px 18px var(--shadow); }
.side-nav__item[aria-current="page"] .list-row__icon { background: var(--accent); color: var(--accent-ink); }
.flow { display: flex; align-items: center; gap: 10px; }
.flow__step { flex: 1 1 0; min-height: 60px; padding: 10px 14px; box-sizing: border-box; border-radius: 22px; background: var(--tile); display: flex; align-items: center; gap: 12px; }
.flow__step--muted { background: transparent; }
.flow__n { width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-family: var(--font-mono); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.flow__step--muted .flow__n { background: var(--chip); color: var(--ink); }

/* Servers the viewer pays for (Funds), as a mosaic of compact tiles. */
.spend-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.spend-tile { min-width: 0; padding: 12px 14px; border-radius: 20px; background: var(--chip); display: flex; flex-direction: column; gap: 6px;
  transition: background .2s ease, transform .5s var(--spring); }
.spend-tile:hover { background: var(--line); transform: translateY(-2px); }
.spend-tile__head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.spend-tile__name { flex-grow: 1; min-width: 0; font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spend-tile__state { height: 22px; padding: 0 9px; font-size: 11px; flex-shrink: 0; background: var(--tile); }
.spend-tile__rates { display: flex; flex-wrap: wrap; column-gap: 10px; font-size: 12px; font-weight: 600; color: var(--muted); }

/* Spending donut (Funds). Categorical slots in fixed order; "Other" stays neutral. */
.spend-pie { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4; --series-other: #9a97ad;
  display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
[data-theme="dark"] .spend-pie { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-other: #6d6a85; }
.spend-pie .series-1 { --slice: var(--series-1); }
.spend-pie .series-2 { --slice: var(--series-2); }
.spend-pie .series-3 { --slice: var(--series-3); }
.spend-pie .series-4 { --slice: var(--series-4); }
.spend-pie .series-5 { --slice: var(--series-5); }
.spend-pie .series-other { --slice: var(--series-other); }
.spend-pie__chart { position: relative; width: 168px; height: 168px; margin: 0 auto; flex-shrink: 0; }
.spend-pie__chart svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.spend-pie__track { fill: none; stroke: var(--chip); stroke-width: 14; }
.spend-pie__slice { fill: none; stroke: var(--slice); stroke-width: 14; cursor: default; outline: none; transition: opacity .2s ease, stroke-width .2s ease; }
.spend-pie__chart svg:hover .spend-pie__slice:not(:hover), .spend-pie__chart svg:focus-within .spend-pie__slice:not(:focus) { opacity: .35; }
.spend-pie__slice:hover, .spend-pie__slice:focus { stroke-width: 17; }
.spend-pie__center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.spend-pie__legend { flex: 1 1 200px; min-width: 0; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.spend-pie__item { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; }
.spend-pie__swatch { width: 12px; height: 12px; flex-shrink: 0; border-radius: 4px; background: var(--slice); }
.spend-pie__label { flex-grow: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spend-pie__percent { width: 3.2em; text-align: right; color: var(--muted); font-size: 12px; }

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

/* Calm drifting waves (Funds balance) */
.calm-waves { position: absolute; inset: 0; pointer-events: none; }
.calm-wave {
  position: absolute; left: 0; width: 200%; bottom: -10px; height: 42%;
  background: #5B5BF0; opacity: .55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 100' preserveAspectRatio='none'%3E%3Cpath d='M0 30 Q150 0 300 30 T600 30 T900 30 T1200 30 V100 H0 Z'/%3E%3C/svg%3E") top / 100% 60px no-repeat, linear-gradient(#000, #000) 0 58px / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 100' preserveAspectRatio='none'%3E%3Cpath d='M0 30 Q150 0 300 30 T600 30 T900 30 T1200 30 V100 H0 Z'/%3E%3C/svg%3E") top / 100% 60px no-repeat, linear-gradient(#000, #000) 0 58px / 100% 100% no-repeat;
  animation: calm-drift 26s linear infinite, calm-bob 7s ease-in-out infinite alternate;
}
.calm-wave--back { opacity: .3; height: 50%; animation-duration: 38s, 9s; }
@keyframes calm-drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes calm-bob { from { translate: 0 0; } to { translate: 0 -8px; } }

}

@layer components {
  .balance-amount { font-size: 4.5rem; line-height: 1; overflow-wrap: anywhere; }
  .power-bar { padding: 20px; }
}

/* Legal pages and the footer that links them. */
@layer components {
  .site-footer { display: flex; justify-content: center; padding: 8px 16px; font-size: 13px; font-weight: 700; color: var(--ink); text-align: center; }
  .site-footer__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin: 0; padding: 0; list-style: none; }
  .site-footer a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
  .site-footer a:hover { color: var(--accent); }
  .legal-link { color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

  .legal-prose { line-height: 1.65; font-weight: 500; overflow-wrap: anywhere; }
  .legal-prose h1 { font-family: "Unbounded", var(--font-sans); font-size: 1.9rem; line-height: 1.2; margin: 0 0 16px; }
  .legal-prose h2 { font-size: 1.2rem; font-weight: 800; margin: 28px 0 8px; }
  .legal-prose h3 { font-size: 1rem; font-weight: 800; margin: 20px 0 6px; }
  .legal-prose p, .legal-prose ul, .legal-prose ol { margin: 0 0 12px; }
  .legal-prose ul, .legal-prose ol { padding-left: 22px; }
  .legal-prose ul { list-style: disc; }
  .legal-prose ol { list-style: decimal; }
  .legal-prose a { color: var(--accent); text-decoration: underline; }
  .legal-prose table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 14px; display: block; overflow-x: auto; }
  .legal-prose th, .legal-prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
}
