:root {
  color-scheme: dark;
  --bg: #121619;
  --surface: #1a2024;
  --surface-raised: #222b30;
  --control: #151b1f;
  --ink: #e7ecea;
  --muted: #a8b5b1;
  --line: #384740;
  --control-line: #75867f;
  --accent: #9cd7b8;
  --accent-hover: #b6e4cd;
  --accent-ink: #10241a;
  --accent-soft: #203a2d;
  --danger: #ffabb0;
  --danger-soft: #3a2329;
  --danger-hover: #492a31;
  --danger-line: #be747d;
  --notice: #20312b;
  --notice-line: #496d59;
  --sidebar: #0e1215;
  --disabled: #2b3334;
  --focus: #b4d8fa;
  --selection: #244b3a;
  --pending: #e8c77d;
  scrollbar-color: var(--control-line) var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 13px; line-height: 1.45; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, .button { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: 6px; padding: 5px 12px; font-weight: 600; cursor: pointer; min-height: 32px; }
button:hover:not(:disabled) { background: var(--accent-hover); }
button.secondary { color: var(--ink); background: var(--surface); border-color: var(--control-line); }
button.secondary:hover:not(:disabled) { background: var(--surface-raised); border-color: var(--accent); }
button.danger { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }
button.danger:hover:not(:disabled) { background: var(--danger-hover); border-color: var(--danger); }
button.compact { padding: 4px 10px; min-height: 32px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
::selection { background: var(--selection); color: var(--ink); }
input, select, textarea { display: block; width: 100%; min-width: 0; min-height: 32px; margin-top: 4px; padding: 5px 8px; border: 1px solid var(--control-line); border-radius: 5px; color: var(--ink); background: var(--control); font-weight: 400; }
textarea { min-height: 52px; max-height: 360px; field-sizing: content; resize: vertical; line-height: 1.45; }
option { color: var(--ink); background: var(--control); font-weight: 400; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:autofill, input:-webkit-autofill { -webkit-text-fill-color: var(--ink); caret-color: var(--ink); box-shadow: 0 0 0 1000px var(--control) inset; }
input::file-selector-button { color: var(--ink); background: var(--surface-raised); border: 1px solid var(--control-line); border-radius: 4px; padding: 6px 10px; margin-right: 10px; font: inherit; cursor: pointer; }
input::file-selector-button:hover { border-color: var(--accent); }
input[readonly] { background: var(--surface-raised); font-size: 13px; }
input[type="file"] { padding: 4px; font-size: 12px; }
input[type="checkbox"] { width: auto; display: inline-block; margin: 0; accent-color: var(--accent); }
label { display: block; font-weight: 600; font-size: 12px; }
label .help, .field-help { display: block; font-size: 11px; font-weight: 400; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(25px, 3vw, 32px); line-height: 1.2; letter-spacing: -.7px; margin-bottom: 8px; }
h2 { font-size: 15px; letter-spacing: -.2px; margin-bottom: 5px; }
h3 { font-size: 14px; margin-bottom: 10px; }
p { margin-bottom: 12px; }
/* Workbench shell: icon rail, sticky 48px top bar, per-view context column and pane. */
.app-shell { display: grid; grid-template-columns: 64px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--ink); padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 6; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); }
.brand { display: grid; place-items: center; color: var(--ink); text-decoration: none; border-radius: 8px; }
.brand-mark { background: var(--accent-soft); color: var(--accent); border-radius: 8px; width: 36px; height: 36px; display: grid; place-items: center; font-size: 17px; font-weight: 800; }
.sidebar nav { display: grid; gap: 4px; width: 100%; }
.sidebar nav button, .sidebar nav .nav-link { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%; min-height: 52px; padding: 7px 2px 6px; background: transparent; border-color: transparent; color: var(--muted); font-size: 10px; line-height: 1.15; text-align: center; overflow-wrap: normal; hyphens: none; }
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar nav .nav-link { box-sizing: border-box; border: 1px solid transparent; border-radius: 6px; font-weight: 600; text-decoration: none; }
.sidebar nav button:hover:not(:disabled), .sidebar nav .nav-link:hover { color: var(--ink); background: var(--surface-raised); }
.sidebar nav button[aria-current="page"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.sidebar .count { position: absolute; top: 3px; right: 3px; min-width: 16px; padding: 0 4px; border-radius: 8px; background: var(--surface-raised); color: var(--ink); font-size: 10px; line-height: 16px; }
main { width: 100%; max-width: none; margin: 0; padding: 0; min-width: 0; }
.top-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; min-height: 48px; padding: 0 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.account { display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0; font-size: 12px; }
#session-email { color: var(--muted); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-link { text-align: left; width: fit-content; padding: 0 6px; min-height: 32px; color: var(--ink); background: transparent; border: 0; text-decoration: underline; text-underline-offset: 4px; font-size: 12px; white-space: nowrap; }
.sidebar-link:hover:not(:disabled) { background: var(--surface-raised); }
.page-header { display: flex; align-items: center; justify-content: flex-start; gap: 10px; flex-shrink: 0; margin: 0; }
.page-header h1 { font-size: 16px; line-height: 1.2; letter-spacing: -.2px; margin: 0; white-space: nowrap; }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 1.4px; margin-bottom: 10px; }
.muted { color: var(--muted); }
.save-status { display: flex; flex: 1 1 auto; gap: 8px; align-items: center; min-width: 0; font-size: 12px; color: var(--muted); }
.save-status p { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#revision { margin-left: auto; font-size: 11px; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; flex-shrink: 0; }
.section-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 32px; margin-bottom: 12px; }
.section-tools p { font-size: 12px; margin: 0; }
.section-tools.end { justify-content: flex-end; }
.text-link { display: inline-flex; align-items: center; min-height: 32px; white-space: nowrap; font-size: 12px; }
.notice { background: var(--notice); border: 1px solid var(--notice-line); border-radius: 7px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }
main > .notice, main > noscript > .notice { margin: 12px 20px; }
.notice.error { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.notice p:last-child { margin-bottom: 0; }
#error-banner button, #error-banner a { margin-top: 10px; }
.period-form { display: grid; gap: 8px; margin: 0 0 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; min-width: 0; }
.card > h2 { font-size: 13px; margin-bottom: 6px; }
.balance-grid, .debt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
#guita-results > .card { margin-bottom: 12px; }
#guita-results .card > p.muted { font-size: 12px; margin-bottom: 8px; }
.currency-label { color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-size: 10px; font-weight: 700; }
.balance-total { font-size: 20px; font-weight: 650; letter-spacing: -.4px; font-variant-numeric: tabular-nums; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin: 2px 0 8px; overflow-wrap: anywhere; }
.metrics { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; font-size: 12px; }
.metrics > div { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; margin-top: 4px; font-size: 12px; }
.metrics dt { color: var(--muted); }
.metrics dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.debt-grid { margin-bottom: 0; }
.debt-grid p, .debt-value { display: block; margin: 0; font-weight: 650; font-size: 17px; font-variant-numeric: tabular-nums; }

/* Each view is a workbench: a sticky context column beside a padded pane. */
.workbench { display: grid; grid-template-columns: 248px minmax(0, 1fr); align-items: start; min-height: calc(100vh - 48px); }
.context { position: sticky; top: 48px; height: calc(100vh - 48px); overflow-y: auto; min-width: 0; padding: 12px; background: var(--surface); border: 0; border-right: 1px solid var(--line); border-radius: 0; }
.context-title { margin: 0 0 10px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.context .field { grid-template-columns: minmax(0, 1fr); row-gap: 4px; padding: 0; border: 0; }
.context .field > :is(input, select, textarea) { grid-column: 1; max-width: none; }
.context-list { display: grid; gap: 2px; }
.context-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 30px; padding: 4px 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink); font-size: 13px; font-weight: 500; text-align: left; }
.context-item:hover:not(:disabled) { background: var(--surface-raised); }
.context-item[aria-current="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--line); }
.context-item-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.context-dirty { width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: var(--pending); }
.pane { min-width: 0; padding: 16px 20px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 11px; font-weight: 600; }
td:last-child, th:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--surface-raised); }
td small { display: block; margin-top: 3px; color: var(--muted); }
.empty-state { border: 1px dashed var(--control-line); border-radius: 8px; padding: 24px 16px; color: var(--muted); text-align: center; font-size: 14px; margin: 0; }
/* Property rows: label column + control, grouped in cards with a title bar. */
.hub-group, .editor .form-fields, .dev-fields-block, .dev-secondary-fields { margin: 0 0 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.hub-group, .hub-dev-section { scroll-margin-top: 60px; }
.hub-group legend, .dev-block-label { float: left; width: 100%; margin: 0; padding: 8px 12px; background: var(--surface-raised); color: var(--ink); font-size: 12px; font-weight: 650; }
.field-grid, .metadata-fields { display: flex; flex-direction: column; gap: 0; clear: both; }
.field-grid > .metadata-fields { display: contents; }
.field { display: grid; grid-template-columns: 180px minmax(0, 1fr); column-gap: 12px; align-items: start; min-width: 0; padding: 6px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 600; }
.field-grid > :first-child { border-top: 0; }
.field > span:first-child { padding-top: 7px; overflow-wrap: anywhere; }
.field > :is(input, select, textarea) { grid-column: 2; margin: 0; max-width: 26rem; }
.field > .dev-rich-editor { grid-column: 2; margin: 0; max-width: 76ch; }
.field > :is(.help, .field-help, .dev-field-help, p) { grid-column: 2; margin: 4px 0 0; max-width: 76ch; }
.field--short > :is(input, select, textarea) { max-width: 10rem; }
.field--date > :is(input, select, textarea) { max-width: 11rem; }
.field--compact > :is(input, select, textarea) { max-width: 20rem; }
.field--medium > :is(input, select, textarea) { max-width: 26rem; }
.field--long > :is(input, select, textarea) { max-width: 32rem; }
.field--wide > :is(input, select, textarea, .dev-rich-editor) { max-width: 76ch; }
.field-grid > p { margin: 0; padding: 6px 12px 6px 204px; border-top: 1px solid var(--line); font-size: 12px; }
.media-field .field { padding: 0; border: 0; }
.media-field .field > :is(input, select, textarea) { max-width: 76ch; }
.form-actions { position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin: 16px -20px 0; padding: 10px 20px; background: var(--surface); border-top: 1px solid var(--line); }
.form-actions .muted { order: -1; margin-right: auto; font-size: 12px; }
dialog .form-actions, .login-card .form-actions { position: static; margin: 18px 0 0; padding: 0; background: none; border: 0; }
.music-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); align-items: start; min-height: calc(100vh - 48px); }
.music-layout .editor { padding: 0; border: 0; background: none; }
/* Dev copy uses constrained inline formatting, independently of mail documents. */
#view-dev { display: grid; grid-template-columns: 248px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; align-items: start; min-height: calc(100vh - 48px); }
#dev-form, #dev-fields, .dev-editor-layout { display: contents; }
#view-dev > .section-tools { grid-column: 2; grid-row: 1; margin: 0; padding: 16px 20px 12px; }
.dev-section-index { grid-column: 1; grid-row: 1 / -1; position: sticky; top: 48px; height: calc(100vh - 48px); overflow-y: auto; min-width: 0; padding: 12px; background: var(--surface); border-right: 1px solid var(--line); }
.dev-section-workspace, #dev-fields > .empty-state { grid-column: 2; grid-row: 2; min-width: 0; margin: 0 20px; }
#dev-form > .form-actions { grid-column: 2; grid-row: 3; margin: 16px 0 0; }
.dev-index-label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; margin: 0 0 10px; }
.dev-section-button { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; padding: 4px 8px; min-height: 30px; margin-bottom: 2px; background: transparent; color: var(--ink); border: 1px solid transparent; border-radius: 6px; text-align: left; font-size: 13px; font-weight: 500; }
.dev-section-button:hover:not(:disabled) { color: var(--ink); background: var(--surface-raised); }
.dev-section-button[aria-current="page"] { color: var(--accent); background: var(--accent-soft); border-color: var(--line); }
.dev-section-dirty { font-size: 10px; font-weight: 400; color: var(--accent); white-space: nowrap; }
.dev-advanced-index { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.dev-advanced-index > summary { font-size: 12px; color: var(--muted); cursor: pointer; padding: 5px 0; }
.dev-advanced-index > nav { margin-top: 6px; }
.dev-content-section > h2 { font-size: 16px; margin-bottom: 12px; }
.dev-section-status { color: var(--accent); font-size: 12px; margin: -6px 0 12px; }
.dev-fields-block > .dev-secondary-fields { margin: 0; border-width: 1px 0 0; border-radius: 0; }
.dev-secondary-fields > summary { cursor: pointer; padding: 8px 12px; background: var(--surface-raised); color: var(--muted); font-size: 12px; font-weight: 650; }
.dev-secondary-fields > fieldset { padding-top: 0; }
.dev-field-label { display: block; font-size: 12px; font-weight: 600; }
.dev-field-help { font-size: 11px; margin: 6px 0 0; }
.dev-field-help.error-text { color: var(--danger); }
.dev-rich-editor { margin-top: 4px; min-width: 0; }
.dev-format-toolbar { display: flex; flex-wrap: wrap; gap: 3px; padding: 5px; background: var(--surface-raised); border: 1px solid var(--control-line); border-bottom: 0; border-radius: 6px 6px 0 0; }
.dev-format-button { min-height: 28px; min-width: 28px; padding: 3px 6px; background: transparent; color: var(--ink); border: 0; border-radius: 4px; font-size: 12px; }
.dev-format-button:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.dev-format-button[data-dev-command="bold"] { font-weight: 800; }
.dev-format-button[data-dev-command="italic"] { font-style: italic; }
.dev-format-button[data-dev-command="underline"] { text-decoration: underline; }
.dev-editor-body { min-height: 52px; padding: 5px 8px; background: var(--control); color: var(--ink); border: 1px solid var(--control-line); border-radius: 0 0 6px 6px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; font-weight: 400; }
.dev-editor-body[aria-disabled="true"] { background: var(--disabled); color: var(--muted); }
.dev-editor-body[aria-invalid="true"] { border-color: var(--danger); }
.dev-editor-body p, .dev-editor-body div { margin: 0; }
/* Mail chrome stays dark; the isolated message and compose paper retain mail colors. */
#view-mail { display: grid; grid-template-columns: 170px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); align-items: start; min-height: calc(100vh - 48px); }
.mail-workspace { display: contents; }
#view-mail > .mail-connection, .mail-content { grid-column: 2; min-width: 0; margin-inline: 20px; }
#view-mail > .mail-connection { grid-row: 1; }
.mail-content { grid-row: 2; padding: 12px 0 16px; }
.mail-folders.context { grid-column: 1; grid-row: 1 / -1; padding: 10px 8px; }
/* Shown only while the mailbox is disconnected, connecting or failed. */
.mail-connection { padding: 12px 0; border-bottom: 1px solid var(--line); }
.mail-connection > p:first-child { margin: 0; }
.mail-connect-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 10px; max-width: 600px; }
.mail-connect-form .field { display: block; flex: 1 1 260px; min-width: 0; padding: 0; border: 0; }
.mail-connect-form .field > :is(input, select, textarea) { margin-top: 4px; max-width: none; }
.mail-connection .field-help { margin: 8px 0 0; max-width: 76ch; }
.mail-connection .error-text { color: var(--danger); margin-bottom: 0; }
/* Narrow Gmail-style folders column: compact Redactar, icon + short label + count, account at the bottom. */
.mail-folders { display: flex; flex-direction: column; gap: 2px; }
.mail-folders-footer { display: grid; gap: 2px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.mail-account { margin: 0; padding: 0 8px; font-size: 11px; overflow-wrap: anywhere; }
.mail-disconnect { justify-self: start; margin: 0; min-height: 28px; padding: 2px 8px; border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 500; text-decoration: underline; }
.mail-disconnect:hover:not(:disabled) { color: var(--ink); background: transparent; }
.mail-compose-button { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin-bottom: 8px; min-height: 32px; padding: 4px 14px 4px 10px; border-radius: 16px; font-size: 13px; }
.mail-compose-button span { font-size: 15px; line-height: 1; }
.mail-folder { display: flex; align-items: center; gap: 8px; text-align: left; min-height: 30px; padding: 4px 8px; border: 0; background: transparent; color: var(--ink); font-size: 13px; font-weight: 500; border-radius: 6px; }
.mail-folder[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.mail-folder:hover:not(:disabled) { background: var(--surface-raised); color: var(--ink); }
.mail-folder-icon { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mail-folder-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-folder .count { flex-shrink: 0; margin-left: auto; font-size: 11px; color: var(--muted); }
.mail-content { min-width: 0; }
.mail-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 10px; }
.mail-search-label { flex: 0 1 300px; max-width: 300px; min-width: 0; }
.mail-search-label input { margin: 0; min-height: 32px; border-color: var(--line); border-radius: 12px; background: var(--surface-raised); font-weight: 400; }
.mail-icon-button { min-width: 32px; min-height: 32px; padding: 2px 8px; font-size: 16px; line-height: 1; }
.mail-paging, .hub-inquiries-paging { display: flex; align-items: center; gap: 4px; }
.mail-paging { margin-left: auto; }
.mail-count { font-size: 11px; white-space: nowrap; margin-right: 2px; }
/* One main area: #mail-library (full-width list) or #mail-message-view, never both. */
.mail-layout { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; min-height: max(450px, calc(100vh - 160px)); }
.mail-library { max-height: calc(100vh - 160px); overflow-y: auto; min-width: 0; }
.mail-library .mail-row { display: grid; grid-template-columns: minmax(0, 190px) minmax(0, max-content) minmax(0, 1fr) auto; align-items: baseline; gap: 2px 12px; width: 100%; margin: 0; padding: 8px 14px; border: 0; border-radius: 0; font-size: 13px; min-height: 40px; }
.mail-row-sender, .mail-row-subject, .mail-row-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mail-row-sender { grid-column: 1; grid-row: 1; font-weight: 500; }
.mail-row-subject { grid-column: 2; grid-row: 1; font-weight: 500; }
.mail-row-snippet { grid-column: 3; grid-row: 1; color: var(--muted); font-weight: 400; }
.mail-row-snippet::before { content: "— "; }
.mail-row-date { grid-column: 4; grid-row: 1; color: var(--muted); font-size: 11px; white-space: nowrap; text-align: right; }
.mail-row-duplicate { grid-column: 2 / -1; color: var(--muted); font-size: 10px; font-weight: 400; }
/* Row = selection checkbox | row button that opens the message | quick actions on hover or focus. */
.mail-row-item { display: flex; align-items: center; position: relative; min-width: 0; border-bottom: 1px solid var(--line); }
.mail-row-item:is(:hover, :focus-within) { background: var(--surface-raised); }
.mail-row-item.mail-row-selected { background: var(--accent-soft); }
.mail-row-item > .mail-row { flex: 1 1 auto; min-width: 0; background: transparent; }
.mail-row-check, .mail-row-check-spacer { flex: 0 0 auto; width: 16px; height: 16px; min-height: 0; margin: 0 0 0 14px; }
.mail-row-quick { display: none; position: absolute; top: 50%; right: 8px; transform: translateY(-50%); gap: 2px; padding-left: 8px; background: var(--surface-raised); }
.mail-row-item:is(:hover, :focus-within) .mail-row-quick { display: flex; }
.mail-row-selected .mail-row-quick { background: var(--accent-soft); }
.mail-quick-button { display: grid; place-items: center; min-width: 30px; min-height: 30px; padding: 4px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.mail-quick-button:hover:not(:disabled) { background: var(--surface); color: var(--ink); }
/* Always-visible star toggle between the checkbox and the row; filled while starred. */
.mail-star, .mail-star-spacer { flex: 0 0 auto; width: 30px; min-width: 30px; min-height: 30px; margin: 0 0 0 4px; }
.mail-star { display: grid; place-items: center; padding: 4px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.mail-star:hover:not(:disabled) { background: var(--surface); color: var(--ink); }
.mail-star.is-starred { color: var(--pending); }
.mail-star[aria-pressed="true"] .mail-action-icon { fill: currentColor; }
.mail-empty-trash { white-space: nowrap; }
.mail-action-icon { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mail-select-all { display: flex; align-items: center; min-height: 32px; padding: 0 8px 0 6px; }
.mail-select-all input { width: 16px; height: 16px; min-height: 0; padding: 0; }
.mail-bulk-actions { display: flex; align-items: center; gap: 4px; }
.mail-bulk-actions .mail-icon-button { display: grid; place-items: center; padding: 2px 6px; }
#mail-bulk-delete-confirmation { margin-bottom: 12px; }
.mail-meta { font-size: 12px; overflow-wrap: anywhere; margin-bottom: 8px; }
.mail-detail { min-width: 0; padding: 22px; }
/* The reader's own children join the Volver bar: actions share its row, the body takes the full width. */
.mail-message-view { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0 10px; min-width: 0; padding: 12px 22px 22px; }
.mail-message-bar { flex: 0 0 auto; margin-bottom: 12px; }
.mail-back { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.mail-message-view > .mail-detail { display: contents; }
.mail-message-view > .mail-detail > * { flex: 1 1 100%; min-width: 0; }
.mail-message-view > .mail-detail > button { flex: 0 0 auto; }
.mail-message-view > .mail-detail > .mail-reader-tools { flex: 1 1 0; margin-bottom: 12px; }
.mail-message-view .mail-reader-heading { padding-top: 14px; border-top: 1px solid var(--line); }
.mail-message-view .mail-body { max-width: 80ch; }
.mail-message-view .mail-document { height: calc(100vh - 240px); min-height: 420px; }
.mail-reader-heading { display: flex; gap: 12px; align-items: start; justify-content: space-between; }
.mail-reader-heading h2 { font-size: 20px; overflow-wrap: anywhere; margin-bottom: 20px; }
.mail-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.65; border-block: 1px solid var(--line); padding-block: 16px; margin-block: 16px; }
.mail-document { display: block; width: 100%; height: 460px; border: 0; border-radius: 7px; background: #f7f8fa; color-scheme: light; margin-block: 14px; }
.mail-plain-fallback { margin: 14px 0; font-size: 12px; }
.mail-plain-fallback summary { color: var(--accent); cursor: pointer; padding: 8px 0; }
.mail-empty-reader { border: 0; padding: 80px 12px; }
.mail-drafts-title { font-size: 11px; color: var(--muted); padding: 14px; margin: 0; }
.mail-draft-row { padding: 12px 14px; border-bottom: 1px solid var(--line); border-radius: 0; }
.mail-detail .notice { font-size: 12px; }
.mail-composer { position: fixed; z-index: 20; right: 24px; bottom: 0; width: min(600px, calc(100vw - 230px)); max-height: min(780px, calc(100dvh - 32px)); overflow-y: auto; border: 1px solid var(--control-line); border-bottom: 0; border-radius: 12px 12px 0 0; background: var(--surface); box-shadow: 0 10px 46px #00000070; }
.mail-compose-heading { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--surface-raised); border-radius: 12px 12px 0 0; }
.mail-compose-heading h2 { margin: 0; font-size: 14px; }
.mail-window-control { color: var(--muted); background: transparent; border: 0; font-size: 22px; min-width: 36px; min-height: 36px; padding: 0; }
.mail-window-control:hover:not(:disabled) { color: var(--ink); background: var(--surface); }
.mail-compose-from { padding: 12px 18px 0; }
.mail-composer form { padding: 0 18px 14px; }
.mail-composer .field-grid { display: block; }
.mail-composer .field { display: block; width: 100%; max-width: 100%; margin-bottom: 10px; padding: 0; border: 0; }
.mail-composer .field > :is(input, select, textarea) { max-width: none; }
.mail-address-fields .field { font-size: 11px; }
.mail-address-fields input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface); padding: 7px 0; margin: 0; min-height: 34px; font-weight: 400; }
.mail-composer .mail-cc-toggle { display: block; width: auto; margin: -4px 0 10px auto; min-height: 28px; padding: 2px 10px; font-size: 11px; }
.mail-recipient-errors { margin: 0 0 10px; font-size: 12px; }
.mail-composer textarea { min-height: 210px; }
.mail-compose-actions { position: static; margin: 14px 0 0; padding: 0; gap: 8px; justify-content: flex-start; background: none; border: 0; }
.mail-compose-actions button { font-size: 12px; }
.mail-operation-note { padding: 0 18px 14px; margin: 0; font-size: 11px; }
.mail-format-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 6px; border: 1px solid var(--line); border-bottom: 0; border-radius: 7px 7px 0 0; background: var(--surface-raised); }
.mail-format-button { min-height: 34px; min-width: 30px; padding: 5px; border: 0; border-radius: 4px; background: transparent; color: var(--ink); font-size: 13px; }
.mail-format-button:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.mail-format-button[data-mail-command="bold"] { font-weight: 800; }
.mail-format-button[data-mail-command="italic"] { font-style: italic; }
.mail-format-button[data-mail-command="underline"] { text-decoration: underline; }
.mail-format-select select { width: auto; margin: 0; min-height: 34px; padding: 3px 6px; font-size: 11px; max-width: 106px; }
.mail-editor-paper { color-scheme: light; background: #f7f8fa; color: #17231f; padding: 18px; min-height: 210px; max-height: 34vh; overflow-y: auto; border-radius: 0 0 7px 7px; font-family: Arial, sans-serif; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; outline-offset: -3px; }
.mail-editor-paper a { color: #2364aa; }
.mail-editor-paper p, .mail-editor-paper div { margin: 0; }
.mail-editor-paper [data-mail-align="center"] { text-align: center; }
.mail-editor-paper [data-mail-align="right"] { text-align: right; }
.mail-editor-paper [data-mail-align="left"] { text-align: left; }
.mail-editor-paper [data-mail-align="justify"] { text-align: justify; }
.mail-editor-paper[aria-readonly="true"] { opacity: .85; }
.mail-editor-paper::selection, .mail-editor-paper *::selection { background: #c5dbf3; color: #17231f; }
.mail-editor-help { margin: 6px 0 0; font-size: 10px; color: var(--muted); }
.mail-link-fields { padding: 8px; background: var(--surface-raised); border: 1px solid var(--line); }
.mail-link-fields button { font-size: 11px; margin-top: 8px; }
.mail-link-fields input { margin: 0; }
.mail-link-fields .error-text { display: block; font-size: 11px; color: var(--danger); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 720px) {
  .mail-search-label { flex: 1 1 100%; max-width: none; }
  .mail-paging { margin-left: 0; }
  .mail-folders-footer { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; padding-top: 6px; }
  .mail-folders { flex-direction: row; flex-wrap: wrap; gap: 5px; align-items: center; }
  .mail-folder { border-radius: 18px; font-size: 12px; }
  .mail-folder-label { flex: 0 1 auto; }
  .mail-compose-button { margin: 0; }
  .mail-library { max-height: none; }
  .mail-library .mail-row { grid-template-columns: minmax(0, 1fr) auto; }
  .mail-row-subject, .mail-row-snippet, .mail-row-duplicate { grid-column: 1 / -1; grid-row: auto; }
  .mail-row-snippet::before { content: none; }
  /* Touch screens use the bulk bar; hover-only quick actions stay hidden. */
  .mail-row-item:is(:hover, :focus-within) .mail-row-quick { display: none; }
  .mail-message-view { padding: 10px 14px 16px; }
  .mail-detail { padding: 16px; }
  .mail-composer { width: 100%; max-width: 100vw; right: 0; bottom: 0; max-height: 100dvh; border-radius: 12px 12px 0 0; }
  .mail-composer form { padding-inline: 12px; }
  .mail-format-toolbar { gap: 1px; }
  .mail-format-select select { max-width: 90px; }
  .mail-editor-paper { min-height: 160px; max-height: 30dvh; }
  .mail-message-view .mail-document { height: calc(100vh - 200px); min-height: 340px; }
}
.library { padding: 12px; }
.library-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.library-toolbar button { padding: 4px 6px; font-size: 12px; }
.search-label { margin-bottom: 10px; }
.album-list-item { margin-bottom: 13px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.library-item { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; text-align: left; width: 100%; min-height: 30px; border: 0; border-radius: 5px; background: none; color: var(--ink); font-size: 13px; padding: 5px 8px; font-weight: 500; overflow-wrap: anywhere; }
.library-item.album { font-weight: 650; }
.library-item.track { padding-left: 20px; font-size: 12px; color: var(--muted); }
.library-item.album:not(:first-child) { margin-top: 6px; }
.library-item:hover:not(:disabled) { color: var(--ink); background: var(--surface-raised); }
.library-item[aria-current="true"] { color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.library-item[aria-current="true"]:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); }
.library-item small { flex-shrink: 0; font-size: 10px; color: var(--muted); font-weight: 400; }
.editor h2 { font-size: 17px; margin: 0 0 12px; }
.editor-header { display: flex; justify-content: space-between; gap: 15px; }
.editor-header .danger { align-self: flex-start; font-size: 12px; }
.editor .form-fields > h3 { margin: 0; padding: 8px 12px; background: var(--surface-raised); border-top: 1px solid var(--line); color: var(--ink); font-size: 12px; font-weight: 650; }
.order-list { margin: 0; padding: 0; list-style: none; }
.order-list li { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding: 4px 12px; font-size: 13px; }
.order-list li > span { flex: 1; overflow-wrap: anywhere; }
.order-list button { min-width: 36px; }
.media-field { padding: 8px 12px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: var(--surface-raised); }
.media-field > :not(.field) { margin: 6px 0 0 192px; max-width: 76ch; font-size: 12px; }
#view-trash { padding: 16px 20px; }
.trash-card { margin-bottom: 6px; padding: 6px 12px; border-radius: 6px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.trash-card > div { display: flex; flex: 1; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; min-width: 0; }
.trash-card h2 { font-size: 13px; margin: 0; overflow-wrap: anywhere; }
.trash-card p { font-size: 12px; margin-bottom: 0; }
.trash-card button { flex-shrink: 0; }
dialog { border: 1px solid var(--line); border-radius: 12px; width: min(480px, calc(100vw - 32px)); max-height: 85vh; padding: 26px; color: var(--ink); background: var(--surface); box-shadow: 0 24px 80px #00000066; }
dialog::backdrop { background: #050a0dd9; }
dialog h2 { margin-bottom: 14px; }
dialog p { font-size: 14px; line-height: 1.6; }
.check-label { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; margin-top: 20px; }
.check-label input { margin-top: 4px; }
.skip-link { position: fixed; left: 12px; top: -80px; z-index: 10; color: var(--accent); background: var(--surface); border: 1px solid var(--control-line); border-radius: 6px; padding: 12px; }
.skip-link:focus { top: 12px; }
button:disabled, .button[aria-disabled="true"], input:disabled, select:disabled, textarea:disabled { color: var(--muted); background: var(--disabled); border-color: var(--line); cursor: not-allowed; opacity: 1; }
input:disabled::file-selector-button { color: var(--muted); background: var(--disabled); border-color: var(--line); cursor: not-allowed; }
.login-page { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: 24px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
/* Owner-only entry: a macOS Terminal window (public/login.js signs in on `ingresar`)
   over a CSS-only cyberpunk backdrop. Only transform and opacity are animated. */
.login-stage { position: relative; z-index: 1; display: grid; gap: 18px; justify-items: center; width: 100%; max-width: 680px; }
.terminal { width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--sidebar); box-shadow: 0 30px 90px #000000b3, 0 0 0 1px #ff3cac2e, 0 0 48px -12px #2de2e680; }
.terminal-bar { position: relative; display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; background: var(--surface-raised); border-bottom: 1px solid var(--line); }
.terminal-light { width: 12px; height: 12px; border-radius: 50%; }
.terminal-close { background: #ff5f57; }
.terminal-minimize { background: #febc2e; }
.terminal-zoom { background: #28c840; }
.terminal-title { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; pointer-events: none; }
.terminal-body { min-height: 300px; max-height: 60vh; max-height: 60svh; overflow-y: auto; padding: 12px 14px; color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
/* Only text lines keep spaces; the markup indentation inside the body must not render. */
.terminal-row, .terminal-line { white-space: pre-wrap; }
/* Decorative NAHUER banner at the top of the login console. */
.terminal-banner { margin: 0 0 10px; color: var(--accent); font: inherit; line-height: 1; white-space: pre; overflow: hidden; }
/* Blank rows (table separators) keep one line of height. */
.terminal-row:empty { min-height: 1.5em; }
.terminal-prompt { color: var(--accent); }
.terminal-cursor { display: inline-block; width: .6em; height: 1.2em; vertical-align: text-bottom; background: var(--ink); animation: login-cursor 1.05s steps(1) infinite; }
.js .login-fallback { display: none; }
.terminal-keyboard { display: grid; gap: 6px; padding: 10px 8px; background: var(--surface); border-top: 1px solid var(--line); user-select: none; -webkit-user-select: none; }
.terminal-keyboard-row { display: flex; gap: 5px; justify-content: center; }
.terminal-key { flex: 1 1 0; min-width: 0; max-width: 56px; min-height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-raised); color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 16px; font-weight: 500; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.terminal-key:hover:not(:disabled) { background: var(--selection); }
.terminal-key:active:not(:disabled) { background: var(--accent-soft); }
.terminal-key-action { flex-grow: 1.6; max-width: 96px; font-size: 14px; }
/* Same intensity as the pressed-key green, in the panel's danger red. */
.terminal-key-esc { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.terminal-key-esc:hover:not(:disabled), .terminal-key-esc:active:not(:disabled) { background: var(--danger-soft); }
.terminal-key-space { flex-grow: 5; max-width: none; }
/* Login games (public/login.js): a fixed 48×20 text grid that shrinks to fit narrow screens, and a touch game pad. */
.terminal-game { width: max-content; max-width: 100%; margin: 0 auto; overflow: hidden; color: var(--accent); font: inherit; font-size: min(14px, calc((100vw - 64px) / 29)); line-height: 1.15; white-space: pre; }
/* Family Game style joypad, shown below the console on touch screens while a game runs. */
.terminal-pad { --pad-shell: #c9c6c0; --pad-face: #2b2a2e; --pad-red: #c8102e; --pad-ink: #8c1020; --cell: clamp(34px, 10.5vw, 44px); --ball: clamp(40px, 12vw, 52px); --pill: clamp(32px, 9.5vw, 44px); --label: clamp(8px, 2.4vw, 10px); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: clamp(6px, 2vw, 10px); width: 100%; max-width: 460px; padding: 14px clamp(10px, 3vw, 16px) 12px; border-radius: 22px; background: linear-gradient(to bottom, var(--pad-shell) 0 30%, var(--pad-face) 30% 100%); box-shadow: 0 18px 50px #000000b3, inset 0 0 0 2px #00000066, inset 0 3px 0 #ffffff59; user-select: none; -webkit-user-select: none; touch-action: none; }
.joypad-key { padding: 0; border: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; touch-action: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; cursor: pointer; }
.joypad-dpad { display: grid; grid-template: repeat(3, var(--cell)) / repeat(3, var(--cell)); }
.joypad-dpad .joypad-key { background: #111114; color: #6b6b72; font-size: 15px; box-shadow: inset 0 -3px 0 #000, 0 2px 0 #ffffff1a; }
/* Touch screens keep :hover after a tap, so the global button hover must not repaint the joypad. */
.terminal-pad .joypad-dpad .joypad-key:hover:not(:disabled) { background: #111114; }
.terminal-pad .joypad-pill:hover:not(:disabled), .terminal-pad .joypad-round:hover:not(:disabled) { background: none; }
.terminal-pad .joypad-dpad .joypad-key:active:not(:disabled) { background: #000; color: var(--pad-shell); box-shadow: inset 0 2px 0 #000; }
.joypad-up { grid-area: 1 / 2; border-radius: 6px 6px 0 0; }
.joypad-left { grid-area: 2 / 1; border-radius: 6px 0 0 6px; }
.joypad-right { grid-area: 2 / 3; border-radius: 0 6px 6px 0; }
.joypad-down { grid-area: 3 / 2; border-radius: 0 0 6px 6px; }
.joypad-dpad::after { content: ""; grid-area: 2 / 2; background: radial-gradient(circle, #1b1b1f 30%, #111114 32%); }
.joypad-center { display: flex; gap: clamp(4px, 2vw, 10px); justify-content: center; align-self: end; padding-bottom: 6px; }
.joypad-pill, .joypad-round { display: grid; justify-items: center; gap: 6px; background: none; color: var(--pad-red); font-size: var(--label); font-weight: 700; letter-spacing: .04em; }
.joypad-pill::before { content: ""; width: var(--pill); height: 14px; border-radius: 7px; background: #111114; box-shadow: inset 0 -2px 0 #000, 0 0 0 3px #3a393f; }
.joypad-pill:active::before { background: #000; box-shadow: inset 0 2px 0 #000, 0 0 0 3px #3a393f; }
.joypad-face { display: flex; gap: 8px; align-items: center; padding: 8px 6px; border-radius: 14px; background: #3a393f; }
.joypad-round { font-size: 13px; }
.joypad-round::before { content: ""; order: -1; width: var(--ball); height: var(--ball); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff5a6e, var(--pad-red) 55%, var(--pad-ink)); box-shadow: 0 4px 0 #5a0a14, 0 6px 10px #0000008c; }
.joypad-round:active::before { transform: translateY(3px); box-shadow: 0 1px 0 #5a0a14, 0 2px 4px #0000008c; }
.joypad-key:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.login-backdrop { --neon-magenta: #ff3cac; --neon-cyan: #2de2e6; position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; perspective: 260px; perspective-origin: 50% 44%; background: linear-gradient(to bottom, var(--sidebar) 0%, #1b0f2e 40%, #2b0f3d 44%, var(--sidebar) 46%, var(--bg) 100%); }
.login-backdrop::before { content: ""; position: absolute; left: 0; right: 0; top: 14%; height: 44%; background: radial-gradient(ellipse 60% 50% at 50% 70%, color-mix(in srgb, var(--neon-magenta) 35%, transparent), transparent 70%), radial-gradient(ellipse 35% 25% at 50% 72%, color-mix(in srgb, var(--neon-cyan) 25%, transparent), transparent 70%); animation: login-pulse 7s ease-in-out infinite alternate; }
.login-backdrop::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, transparent 0 2px, #00000059 2px 3px); opacity: .55; }
.login-grid { position: absolute; left: -100%; right: -100%; bottom: 0; height: 400vh; background-image: linear-gradient(to right, color-mix(in srgb, var(--neon-magenta) 70%, transparent) 2px, transparent 2px), linear-gradient(to bottom, color-mix(in srgb, var(--neon-cyan) 60%, transparent) 2px, transparent 2px); background-size: 70px 70px; transform-origin: 50% 100%; transform: rotateX(76deg); -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 70%); mask-image: linear-gradient(to top, #000 10%, transparent 70%); animation: login-grid 1.6s linear infinite; }
.login-streak { position: absolute; top: 22%; left: 0; width: 38vw; height: 2px; background: linear-gradient(to right, transparent, var(--neon-cyan), transparent); opacity: 0; animation: login-streak 9s linear infinite; }
.login-streak + .login-streak { top: 64%; width: 26vw; background: linear-gradient(to right, transparent, var(--neon-magenta), transparent); animation-duration: 13s; animation-delay: -5s; }
/* `ingresar` breaks the window like a damaged display for 1 s (public/login.js), then signs in:
   RGB split, horizontal tearing, flicker, then a CRT power-off collapse. */
.terminal { position: relative; }
.terminal.is-breaking { animation: login-break 1s linear forwards; pointer-events: none; }
.terminal.is-breaking::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: repeating-linear-gradient(to bottom, #2de2e64d 0 3px, transparent 3px 11px, #ff3cac40 11px 14px, transparent 14px 29px); mix-blend-mode: screen; animation: login-tear .1s steps(2) infinite; }
@keyframes login-break {
  0% { transform: none; filter: none; opacity: 1; box-shadow: 0 30px 90px #000000b3; }
  8% { transform: translate(-8px, 3px) skewX(-8deg); filter: saturate(3) hue-rotate(80deg); clip-path: inset(0 0 55% 0); box-shadow: -10px 0 0 #ff3cac, 10px 0 0 #2de2e6; }
  14% { transform: translate(10px, -2px) skewX(6deg); filter: hue-rotate(180deg) contrast(2); clip-path: inset(30% 0 20% 0); }
  20% { transform: translate(-4px, 0); filter: none; clip-path: inset(0); opacity: .35; }
  26% { transform: translate(6px, 1px) scaleY(1.04); filter: contrast(2.5) saturate(4); opacity: 1; clip-path: inset(60% 0 0 0); box-shadow: 8px 0 0 #ff3cac, -8px 0 0 #2de2e6; }
  34% { transform: translate(-12px, -3px) skewX(-12deg); filter: hue-rotate(-90deg) contrast(1.8); clip-path: inset(10% 0 40% 0); }
  42% { transform: none; filter: none; clip-path: inset(0); opacity: .2; }
  48% { transform: translate(4px, 0) skewX(4deg); filter: hue-rotate(200deg) saturate(3); opacity: 1; clip-path: inset(45% 0 35% 0); }
  56% { transform: translate(-6px, 2px); filter: saturate(5) hue-rotate(140deg); clip-path: inset(0 0 70% 0); box-shadow: -14px 0 0 #ff3cac, 14px 0 0 #2de2e6; }
  64% { transform: none; filter: contrast(2); clip-path: inset(0); opacity: .6; box-shadow: none; }
  78% { transform: scale(1, .03); filter: saturate(0) contrast(4); opacity: 1; background: var(--ink); }
  90% { transform: scale(.25, .01); filter: saturate(0) contrast(6); opacity: 1; background: var(--ink); }
  100% { transform: scale(0, .01); filter: saturate(0) contrast(8); opacity: 0; background: var(--ink); }
}
@keyframes login-tear { 0% { transform: translateX(-14px); opacity: .9; } 100% { transform: translateX(16px); opacity: .5; } }
@keyframes login-cursor { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes login-grid { from { transform: rotateX(76deg) translateY(0); } to { transform: rotateX(76deg) translateY(70px); } }
@keyframes login-pulse { from { opacity: .55; } to { opacity: 1; } }
@keyframes login-streak { 0% { transform: translateX(-40vw); opacity: 0; } 15%, 85% { opacity: .75; } 100% { transform: translateX(110vw); opacity: 0; } }
/* Phones: the console takes exactly the visible height (dvh excludes the browser
   bars), with a fixed title bar and keyboard and the text scrolling in between,
   so output never pushes the keyboard off screen. Same condition login.js uses
   to show the on-screen keyboard. */
@media (max-width: 720px), (pointer: coarse) {
  .login-page { height: 100vh; height: 100dvh; min-height: 0; padding: 12px; place-items: stretch; grid-template: minmax(0, 1fr) / minmax(0, 1fr); overflow: hidden; }
  .login-stage { height: 100%; max-width: none; display: flex; flex-direction: column; align-items: center; gap: 10px; }
  .terminal { width: 100%; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .terminal-body { flex: 1 1 auto; min-height: 0; max-height: none; font-size: 13px; }
  .terminal-bar, .terminal-keyboard, .terminal-pad { flex: none; }
}
/* Local operator tools (apps/panel/tools) keep the card layout. */
.login-card { width: 100%; max-width: 440px; padding: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 70px #00000033; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; color: var(--ink); font-size: 20px; font-weight: 700; }
.login-card h1 { font-size: 26px; margin-bottom: 14px; }
.login-card p { color: var(--muted); font-size: 14px; }
.login-card form { margin-top: 26px; }
.login-card button { width: 100%; }
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; flex-direction: row; padding: 6px 8px; gap: 8px; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand-mark { width: 32px; height: 32px; font-size: 15px; }
  .sidebar nav { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; flex: 1; width: auto; min-width: 0; }
  .sidebar nav button, .sidebar nav .nav-link { min-height: 48px; padding: 5px 1px; }
  .top-bar { position: static; flex-wrap: wrap; gap: 4px 12px; padding: 8px 16px; }
  .save-status { order: 3; flex-basis: 100%; flex-wrap: wrap; }
  .save-status p { white-space: normal; }
  #session-email { display: none; }
  .account { margin-left: auto; }
  .account .sidebar-link { min-height: 32px; }
  #hub-index { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
  #hub-index .context-item { width: auto; flex: 0 0 auto; white-space: nowrap; border-color: var(--line); }
  main > .notice, main > noscript > .notice { margin: 10px 16px; }
  .workbench, .music-layout, #view-dev, #view-mail { display: flex; flex-direction: column; align-items: stretch; min-height: 0; }
  .context, .dev-section-index { order: -1; position: static; height: auto; max-height: 45vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .pane, #view-trash { padding: 12px 16px; }
  #view-dev > .section-tools { padding: 12px 16px 8px; }
  .dev-section-workspace, #dev-fields > .empty-state, #view-mail > .mail-connection, .mail-content { margin-inline: 16px; }
  .dev-section-index > nav, .dev-advanced-index > nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
  .dev-index-label { grid-column: 1 / -1; }
  .dev-advanced-index { margin-top: 8px; }
  .dev-section-button { flex-wrap: wrap; }
  .form-actions { margin-inline: -16px; padding: 8px 16px; }
  #dev-form > .form-actions { margin-inline: 0; }
  .balance-grid, .debt-grid { grid-template-columns: 1fr; }
  .field-grid { flex-direction: column; }
  .field { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
  .field > :is(input, select, textarea, .dev-rich-editor, .help, .field-help, .dev-field-help, p) { grid-column: 1; }
  .field > span:first-child { padding-top: 0; }
  .field-grid > .field, .metadata-fields > .field { max-width: 100%; }
  .field-grid > p { padding-left: 12px; }
  .media-field > :not(.field) { margin-left: 0; }
  .section-tools { flex-wrap: wrap; gap: 8px; }
  .trash-card { align-items: flex-start; flex-wrap: wrap; }
  .trash-card button { width: 100%; }
}
@media (max-width: 480px) { .login-page { padding: 18px; } .login-card { padding: 26px 22px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }

.mail-row-unread .mail-row-sender, .mail-row-unread .mail-row-subject { font-weight: 700; color: var(--ink); }
.mail-row-unread .mail-row-sender::before { content: "•"; color: var(--accent); margin-right: 6px; }
.mail-reader-tools { display: flex; flex-wrap: wrap; gap: 7px; align-items: flex-start; margin-bottom: 14px; }
.mail-reader-tools > button, .mail-message-actions button { font-size: 11px; }
.mail-reader-tools > .mail-meta { width: 100%; margin: 0; }
.mail-message-actions { display: flex; flex: 1; flex-wrap: wrap; gap: 7px; }
.mail-delete-confirmation { width: 100%; padding: 12px; background: var(--danger-soft); border: 1px solid var(--danger-line); border-radius: 8px; font-size: 12px; }
.mail-delete-confirmation button { margin: 8px 5px 0 0; }
.mail-delete-confirmation .check-label { display: flex; gap: 8px; align-items: flex-start; }
.mail-action-history { border: 1px solid var(--notice-line); background: var(--notice); border-radius: 7px; padding: 10px; margin-bottom: 12px; }
.mail-action-result { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mail-action-result p { flex: 1 1 250px; margin: 4px 0; }
.mail-action-result button { font-size: 11px; }
.mail-recent-activity > summary, .mail-action-identity > summary { cursor: pointer; font-size: 11px; color: var(--muted); }
.mail-recent-activity[open] > summary { margin-bottom: 8px; }
.mail-action-identity { flex-basis: 100%; margin-bottom: 4px; }
.mail-action-identity code { display: block; padding-top: 5px; font-size: 10px; overflow-wrap: anywhere; }
.mail-action-history .error-text { color: var(--danger); margin: 8px 0 0; }
.mail-filing-status { padding: 0 18px 14px; }
.mail-filing-status button { margin: 0 6px 6px 0; font-size: 11px; }

.hub-dev-section { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.hub-dev-preview { width: min(100%, 460px); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-top: 20px; background: var(--surface-raised); }
.hub-dev-preview h3 { font-size: 15px; }
.hub-dev-preview select { width: 100%; margin-bottom: 16px; }
.hub-dev-preview-text { display: block; min-height: 54px; height: 54px; margin: 0; white-space: pre; font: 12px/18px monospace; overflow: hidden; }
.hub-dev-preview-controls { display: flex; gap: 8px; }
.hub-dev-preview-controls button { min-height: 44px; }

.hub-inquiry-badge { display: inline-block; font-size: 10px; font-weight: 600; line-height: 1.5; padding: 2px 6px; margin-left: 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--accent); background: var(--surface-raised); }
.mail-row-subject .hub-inquiry-badge { margin: 0 0 0 8px; }

/* Torrents: a compact table on wide screens, one card per torrent on phones. */
.torrents-add { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.torrents-add-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; flex: 1 1 320px; min-width: 0; }
.torrents-field { flex: 1 1 220px; min-width: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.torrents-status { font-size: 12px; min-height: 18px; margin: 8px 0; }
.torrents-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.torrents-table th { color: var(--muted); font-size: 11px; font-weight: 650; white-space: nowrap; }
.torrents-table td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.torrents-table td.torrents-name { white-space: normal; }
.torrents-name { min-width: 14rem; max-width: 32rem; overflow-wrap: anywhere; }
.torrents-progress { display: flex; align-items: center; gap: 6px; }
.torrents-progress progress { width: 6rem; height: 8px; accent-color: var(--accent); }
.torrents-actions { display: flex; gap: 4px; }
@media (max-width: 720px) {
  .torrents-scroll { overflow-x: visible; border: 0; background: none; }
  .torrents-table thead { display: none; }
  .torrents-table, .torrents-table tbody, .torrents-table tr, .torrents-table td { display: block; width: 100%; }
  .torrents-table tr { margin-bottom: 10px; padding: 6px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
  .torrents-table td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 12px; border-bottom: 0; white-space: normal; text-align: right; }
  .torrents-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 650; text-align: left; flex: none; }
  .torrents-name { min-width: 0; max-width: none; font-weight: 600; }
  .torrents-progress progress { width: 5rem; }
  .torrents-actions button { min-height: 40px; }
}
