/* Library Manager web page: Windows 11 (Fluent) look, matching the app. No inline styles. */

:root {
  --bg: #f3f3f3;
  --layer: #f9f9f9;
  --surface: #ffffff;
  --stroke: #e5e5e5;
  --stroke-strong: #d1d1d1;
  --control-bottom: #8a8a8a;
  --combo-bottom: #c2c2c2;
  --text: #1a1a1a;
  --text-2: #5d5d5d;
  --text-3: #8a8a8a;
  --accent: #005fb8;
  --accent-hover: #1a6fc0;
  --accent-pressed: #2a7cc7;
  --accent-text: #003e92;
  --accent-subtle: #eaf2fb;
  --on-accent: #ffffff;
  --hover: #f0f0f0;
  --row-hover: #f5f5f5;
  --pressed: #eaeaea;
  --selected: #eaeaea;
  --avatar: #d7e8f7;
  --success: #107c10;
  --success-bg: #dff6dd;
  --success-stroke: #c7e9c4;
  --error: #c42b1c;
  --error-bg: #fde7e9;
  --error-stroke: #f4c7cb;
  --warning: #9d5d00;
  --warning-bg: #fff4ce;
  --warning-stroke: #f5e3a3;
  --info-bg: #eaf2fb;
  --info-stroke: #cfe0f4;
  --folder-back: #f2be42;
  --folder-front: #ffd467;
  --pill-ssh-bg: #e6f4ea; --pill-ssh: #0b5a0b;
  --pill-rdp-bg: #eaf2fb; --pill-rdp: #003e92;
  --pill-vnc-bg: #fdf0e6; --pill-vnc: #8a3b00;
  --pill-telnet-bg: #f3eafb; --pill-telnet: #5c2e91;
  --pill-other-bg: #f0f0f0; --pill-other: #3d3d3d;
  --overlay: rgba(0, 0, 0, 0.3);
  --flyout-shadow: 0 8px 16px rgba(0, 0, 0, 0.14);
  --dialog-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  --fast: 120ms;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #202020;
    --layer: #272727;
    --surface: #2b2b2b;
    --stroke: #3a3a3a;
    --stroke-strong: #4a4a4a;
    --control-bottom: #9a9a9a;
    --combo-bottom: #5a5a5a;
    --text: #ffffff;
    --text-2: #c5c5c5;
    --text-3: #9a9a9a;
    --accent: #60cdff;
    --accent-hover: #5abce9;
    --accent-pressed: #52abd4;
    --accent-text: #99ebff;
    --accent-subtle: #1f3a4d;
    --on-accent: #000000;
    --hover: #323232;
    --row-hover: #303030;
    --pressed: #383838;
    --selected: #383838;
    --avatar: #1f3a4d;
    --success: #6ccb5f;
    --success-bg: #393d1b;
    --success-stroke: #4a5226;
    --error: #ff99a4;
    --error-bg: #442726;
    --error-stroke: #5c3534;
    --warning: #fce100;
    --warning-bg: #433519;
    --warning-stroke: #5a4720;
    --info-bg: #1f3a4d;
    --info-stroke: #2c4f67;
    --pill-ssh-bg: #1f3d24; --pill-ssh: #8fdc8f;
    --pill-rdp-bg: #1f3a4d; --pill-rdp: #99ebff;
    --pill-vnc-bg: #4a2f1a; --pill-vnc: #ffc58f;
    --pill-telnet-bg: #3a2a4d; --pill-telnet: #d8b8ff;
    --pill-other-bg: #383838; --pill-other: #e0e0e0;
    --overlay: rgba(0, 0, 0, 0.5);
    --flyout-shadow: 0 8px 16px rgba(0, 0, 0, 0.36);
    --dialog-shadow: 0 8px 32px rgba(0, 0, 0, 0.42);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/20px "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}

button, input, select, textarea { font: inherit; color: inherit; }
svg { flex: none; }

/* typography: title 28, subtitle 20, body 14, caption 12 */
.title { margin: 0; font-size: 28px; line-height: 36px; font-weight: 600; }
.subtitle { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; }
.section-title { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; }
.caption { font-size: 12px; line-height: 16px; color: var(--text-2); }
p.caption { margin: 0; }
.secondary { color: var(--text-2); }
.strong { font-weight: 600; }
.stack { display: flex; flex-direction: column; }
.gap-12 { gap: 12px; }
.gap-20 { gap: 20px; }
.grow { flex-grow: 1; }
.min0 { min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* keyboard focus: a 2px outer ring, only when using the keyboard */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; border-radius: 4px; }

/* ---------- buttons ---------- */
.button {
  height: 32px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--stroke); border-bottom-color: var(--stroke-strong); border-radius: 4px;
  cursor: pointer; white-space: nowrap;
  transition: background-color var(--fast), color var(--fast), border-color var(--fast);
}
.button:hover { background: var(--layer); }
a.button { text-decoration: none; }
.button:active { background: var(--hover); color: var(--text-2); border-bottom-color: var(--stroke); }
.button svg { width: 14px; height: 14px; }
.button.accent { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.button.accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button.accent:active { background: var(--accent-pressed); border-color: var(--accent-pressed); opacity: 0.9; }
.button.danger { color: var(--error); }
.button.danger-accent { background: var(--error); border-color: var(--error); color: var(--on-accent); }
.button.tall { height: 40px; }
.button:disabled { opacity: 0.45; cursor: default; pointer-events: none; }

.icon-button {
  width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 4px; background: transparent; color: var(--text-2); cursor: pointer;
  transition: background-color var(--fast);
}
.icon-button:hover { background: var(--hover); color: var(--text); }
.icon-button:active { background: var(--pressed); }
.icon-button svg { width: 16px; height: 16px; }
.icon-button.small { width: 28px; height: 28px; }
.icon-button.small svg { width: 12px; height: 12px; }

/* ---------- text boxes, combo boxes, radios, checkboxes, toggles ---------- */
.textbox, select.combo-select, textarea.textbox {
  height: 32px; padding: 0 10px; min-width: 0;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--stroke); border-bottom-color: var(--control-bottom); border-radius: 4px;
  transition: background-color var(--fast);
}
textarea.textbox { height: auto; padding: 6px 10px; resize: vertical; }
.textbox:hover, select.combo-select:hover { background: var(--layer); }
/* the accent underline on focus: 2px at the bottom, without moving the text */
.textbox:focus, select.combo-select:focus, textarea.textbox:focus {
  outline: none; border-bottom-color: var(--accent); box-shadow: inset 0 -1px 0 var(--accent); background: var(--surface);
}
.textbox[readonly] { background: var(--layer); }
/* placeholders like "Any" and "Top level" carry meaning, so they get readable contrast */
.textbox::placeholder, .searchbox input::placeholder { color: var(--text-2); opacity: 1; }

select.combo-select {
  appearance: none; padding-right: 32px; cursor: pointer; border-bottom-color: var(--combo-bottom);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235D5D5D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
@media (prefers-color-scheme: dark) {
  select.combo-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23C5C5C5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  }
}
select.combo-select option { background: var(--surface); color: var(--text); }

.combo {
  height: 40px; width: 100%; padding: 0 10px 0 12px; display: flex; align-items: center; gap: 8px; text-align: left;
  background: var(--surface); border: 1px solid var(--stroke); border-bottom-color: var(--combo-bottom); border-radius: 4px;
  cursor: pointer; transition: background-color var(--fast);
}
.combo:hover { background: var(--layer); }
.combo:active { background: var(--hover); }
.combo-text { flex-grow: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-chevron { display: inline-flex; color: var(--text-2); }
.combo-chevron svg { width: 12px; height: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field .caption { margin-top: -2px; }

input[type="radio"], input[type="checkbox"]:not([role="switch"]) {
  appearance: none; margin: 0; flex: none; width: 20px; height: 20px; display: inline-grid; place-content: center;
  background: var(--surface); border: 1px solid var(--control-bottom); cursor: pointer;
  transition: background-color var(--fast), border-color var(--fast);
}
input[type="radio"] { border-radius: 50%; }
input[type="radio"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--on-accent); transform: scale(0); transition: transform var(--fast); }
input[type="radio"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="radio"]:checked::before { transform: scale(1); }
input[type="radio"]:hover:not(:checked) { background: var(--hover); }
input[type="checkbox"]:not([role="switch"]) { border-radius: 4px; }
input[type="checkbox"]:not([role="switch"])::before {
  content: ""; width: 10px; height: 6px; border-left: 2px solid var(--on-accent); border-bottom: 2px solid var(--on-accent);
  transform: rotate(-45deg) scale(0); margin-top: -2px; transition: transform var(--fast);
}
input[type="checkbox"]:not([role="switch"]):checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:not([role="switch"]):checked::before { transform: rotate(-45deg) scale(1); }

.radio-option { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.radio-option input { margin-top: 0; }
.radio-option .stack { gap: 2px; }

.toggle { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; position: relative; }
.toggle input { position: absolute; opacity: 0; width: 40px; height: 20px; margin: 0; cursor: pointer; }
.toggle-track {
  width: 40px; height: 20px; border-radius: 10px; border: 1px solid var(--control-bottom); background: var(--surface);
  display: inline-flex; align-items: center; padding: 0 3px; transition: background-color var(--fast), border-color var(--fast);
}
.toggle-thumb { width: 12px; height: 12px; border-radius: 6px; background: var(--text-2); transition: transform var(--fast), background-color var(--fast); }
.toggle:hover .toggle-track { background: var(--hover); }
.toggle input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(20px); background: var(--on-accent); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--text); outline-offset: 2px; }
.toggle-label { min-width: 24px; }

.segmented { display: inline-flex; padding: 2px; gap: 2px; background: var(--bg); border: 1px solid var(--stroke); border-radius: 6px; width: max-content; }
.segmented button {
  height: 28px; padding: 0 14px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--text-2);
  cursor: pointer; transition: background-color var(--fast), color var(--fast);
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-checked="true"] { background: var(--surface); border-color: var(--stroke); color: var(--text); }

.file-input { max-width: 100%; }
.file-input::file-selector-button {
  height: 32px; margin-right: 10px; padding: 0 12px; border: 1px solid var(--stroke); border-bottom-color: var(--stroke-strong);
  border-radius: 4px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit;
}

/* ---------- pages ---------- */
.center-page { min-height: 100vh; padding: 64px 16px; display: flex; align-items: center; justify-content: center; }
.signin-card {
  width: 400px; max-width: 100%; padding: 32px; background: var(--surface); border: 1px solid var(--stroke); border-radius: 8px;
  display: flex; flex-direction: column; gap: 20px;
}
.signin-head { display: flex; align-items: center; gap: 12px; }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 12px; }
.divider-text span { flex-grow: 1; height: 1px; background: var(--stroke); }

.app-tile {
  width: 32px; height: 32px; border-radius: 6px; background: var(--accent); color: var(--on-accent); flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.app-tile svg { width: 18px; height: 18px; }
.app-tile.large { width: 40px; height: 40px; border-radius: 8px; }
.app-tile.large svg { width: 22px; height: 22px; }

.shell { min-height: 100vh; display: flex; }

/* navigation pane */
.nav-pane {
  flex: 0 1 280px; min-width: 240px; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.nav-toggle { display: none; }
.app-title { display: flex; align-items: center; gap: 12px; padding: 4px 8px 16px; }
.library-picker { display: flex; flex-direction: column; gap: 2px; padding: 0 4px 12px; }
.picker-label { padding: 0 4px; }
.nav-items { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  position: relative; height: 36px; padding: 0 12px; display: flex; align-items: center; gap: 12px; width: 100%;
  border: 0; border-radius: 4px; background: transparent; color: var(--text); text-align: left; cursor: pointer;
  transition: background-color var(--fast);
}
.nav-item svg { width: 16px; height: 16px; }
.nav-item:hover { background: var(--hover); }
.nav-item:active { background: var(--pressed); color: var(--text-2); }
.nav-item[aria-current="page"] { background: var(--selected); }
.nav-item[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 10px; width: 3px; height: 16px; border-radius: 2px; background: var(--accent);
}
.nav-separator { height: 1px; background: var(--stroke); margin: 12px 8px; }
.nav-group { padding: 0 12px 4px; }
.nav-spacer { flex-grow: 1; min-height: 16px; }
.account { display: flex; align-items: center; gap: 10px; padding: 8px; }
/* the account menu's button: the person, with Connect your PC, Privacy and retention and Sign out behind it */
button.account {
  width: 100%; border: 0; border-radius: 4px; background: transparent; color: var(--text); font: inherit; text-align: left;
  cursor: pointer; transition: background-color var(--fast);
}
button.account:hover { background: var(--hover); }
button.account:active, button.account[aria-expanded="true"] { background: var(--pressed); }
.account-more { display: inline-flex; color: var(--text-2); }
.account-more svg { width: 16px; height: 16px; }

/* pages that share a navigation item (a library's settings, the server's status), as tabs under the title */
.view-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--stroke); }
.view-tab {
  position: relative; height: 36px; padding: 0 12px; border: 0; border-radius: 4px 4px 0 0; background: transparent;
  color: var(--text-2); font: inherit; cursor: pointer; transition: background-color var(--fast);
}
.view-tab:hover { background: var(--hover); color: var(--text); }
.view-tab[aria-selected="true"] { color: var(--text); font-weight: 600; }
.view-tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 2px; background: var(--accent);
}
.avatar {
  width: 32px; height: 32px; border-radius: 16px; background: var(--avatar); color: var(--accent-text); flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; text-transform: uppercase;
}
.avatar.neutral { background: var(--hover); color: var(--text-2); }
.avatar svg { width: 16px; height: 16px; }

/* content */
.content { flex: 1 1 0; min-width: 0; padding: 28px 40px 40px; display: flex; flex-direction: column; gap: 16px; }
.page-header { display: flex; flex-direction: column; gap: 4px; }
.view { display: flex; flex-direction: column; gap: 16px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.section-gap { margin-top: 16px; }
.narrow { max-width: 760px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.searchbox {
  flex: 1 1 280px; max-width: 360px; height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 10px;
  background: var(--surface); border: 1px solid var(--stroke); border-bottom-color: var(--control-bottom); border-radius: 4px;
  transition: background-color var(--fast);
}
.searchbox:hover { background: var(--layer); }
.searchbox:focus-within { border-bottom-color: var(--accent); box-shadow: inset 0 -1px 0 var(--accent); background: var(--surface); }
.searchbox input { flex-grow: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); }
.search-icon { display: inline-flex; color: var(--text-2); }
.search-icon svg { width: 14px; height: 14px; }

/* cards */
.card, .list-card { background: var(--surface); border: 1px solid var(--stroke); border-radius: 8px; }
.list-card { padding: 6px; display: flex; flex-direction: column; }
.settings-stack { display: flex; flex-direction: column; gap: 4px; }
.setting-card {
  min-height: 68px; padding: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px;
  background: var(--surface); border: 1px solid var(--stroke); border-radius: 6px;
}
.setting-card.column { flex-direction: column; align-items: stretch; }
.setting-text { flex: 1 1 280px; display: flex; flex-direction: column; gap: 2px; }
.setting-card .textbox { flex: 0 1 260px; }

/* rows: sessions, folders, members, libraries */
.row {
  min-height: 40px; padding: 4px 10px; display: flex; align-items: center; gap: 12px; border-radius: 4px; width: 100%;
  border: 0; background: transparent; text-align: left; color: var(--text); cursor: default;
  transition: background-color var(--fast);
}
.row.clickable { cursor: pointer; }
.row:hover { background: var(--row-hover); }
.row.clickable:active { background: var(--pressed); }
.row.tall { min-height: 48px; }
.row-main {
  flex: 1 1 auto; min-width: 0; min-height: 40px; padding: 0; display: flex; align-items: center; gap: 12px;
  border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer;
}
.row.member { min-height: 56px; padding: 6px 10px; flex-wrap: wrap; }
.row .more { opacity: 0; transition: opacity var(--fast); }
.row:hover .more, .row:focus-within .more, .row .more[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .row .more { opacity: 1; } }
.row-text { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.row-text .caption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.caption.maintenance { display: inline-flex; align-items: center; gap: 6px; color: var(--warning); }
.caption.maintenance svg { width: 12px; height: 12px; flex-shrink: 0; }
/* something an administrator should look at: a library nobody manages, a leaver's space, an old backup */
.caption.flag { display: inline-flex; align-items: center; gap: 6px; color: var(--warning); }
.caption.flag svg { width: 12px; height: 12px; flex-shrink: 0; }
#privacy-items p { margin: 0; }
/* a version with its commit, a database path: long words that must wrap on a narrow window */
#status-rows .setting-card > * { min-width: 0; overflow-wrap: anywhere; }
#app-rows td { vertical-align: middle; }
#app-rows .textbox { width: 110px; }
.cell-field { display: flex; flex-direction: column; gap: 4px; }
.field-error { font-size: 12px; line-height: 16px; color: var(--error); }
.field-error:empty { display: none; }
.textbox[aria-invalid="true"] { border-bottom-color: var(--error); box-shadow: inset 0 -1px 0 var(--error); }
.plain-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.name-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pin-mark { display: inline-flex; color: var(--accent); flex: none; }
.pin-mark svg { width: 12px; height: 12px; }

/* a session's details (Local Libraries) */
.details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
.details dt { color: var(--text-2); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.row-chevron { display: inline-flex; color: var(--text-2); transition: transform var(--fast); }
.row-chevron svg { width: 12px; height: 12px; }
.row-chevron.open { transform: rotate(90deg); }
.folder-name { font-weight: 600; }
.folder-icon { width: 20px; height: 16px; }
.folder-icon .back { fill: var(--folder-back); }
.folder-icon .front { fill: var(--folder-front); }
.count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--selected); font-size: 12px; line-height: 20px;
  text-align: center; color: var(--text-2);
}
.member-role { width: 160px; }

.pill {
  min-width: 44px; height: 20px; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 600; line-height: 20px;
  text-align: center; flex: none; background: var(--pill-other-bg); color: var(--pill-other);
}
.pill.SSH, .pill.SSH2, .pill.SSHNet { background: var(--pill-ssh-bg); color: var(--pill-ssh); }
.pill.RDP { background: var(--pill-rdp-bg); color: var(--pill-rdp); }
.pill.VNC { background: var(--pill-vnc-bg); color: var(--pill-vnc); }
.pill.Telnet { background: var(--pill-telnet-bg); color: var(--pill-telnet); }
.pill.role { min-width: 0; font-weight: 400; font-size: 12px; background: var(--selected); color: var(--text-2); }

/* history table */
.table-card { padding: 0; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 10px 16px; vertical-align: top; }
th { height: 40px; font-size: 12px; font-weight: 600; color: var(--text-2); border-bottom: 1px solid var(--stroke); white-space: nowrap; }
td { border-bottom: 1px solid var(--stroke); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color var(--fast); }
tbody tr:hover { background: var(--row-hover); }
td.when { white-space: nowrap; color: var(--text-2); }
.list-note { padding: 8px 10px; }
.list-end-content { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
tbody tr.list-end:hover { background: transparent; }
td.detail { color: var(--text-2); }

/* empty states and loading */
.empty-state { padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.empty-state p { margin: 0; max-width: 520px; }
.empty-icon { display: inline-flex; color: var(--text-3); margin-bottom: 8px; }
.empty-icon svg { width: 40px; height: 40px; }
.list-empty { padding: 32px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-2); text-align: center; }
.list-empty .empty-icon svg { width: 32px; height: 32px; }

.progress-ring { display: inline-block; width: 24px; height: 24px; flex: none; }
.progress-ring.large { width: 40px; height: 40px; }
.progress-ring::before {
  content: ""; display: block; width: 100%; height: 100%; border-radius: 50%;
  border: 3px solid transparent; border-top-color: var(--accent); border-right-color: var(--accent);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.list-loading { padding: 32px; display: flex; justify-content: center; }

/* InfoBars */
.infobars { display: flex; flex-direction: column; gap: 8px; }
.infobars:empty { display: none; }
.infobar {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 8px 10px 16px; border-radius: 4px; border: 1px solid var(--info-stroke);
  background: var(--info-bg); animation: appear var(--fast) ease-out;
}
.infobar.success { background: var(--success-bg); border-color: var(--success-stroke); }
.infobar.error { background: var(--error-bg); border-color: var(--error-stroke); }
.infobar.warning { background: var(--warning-bg); border-color: var(--warning-stroke); }
.infobar-icon { display: inline-flex; margin-top: 2px; }
.infobar-icon svg { width: 16px; height: 16px; }
.infobar-icon .disc { fill: var(--accent); }
.infobar.success .infobar-icon .disc { fill: var(--success); }
.infobar.error .infobar-icon .disc { fill: var(--error); }
.infobar.warning .infobar-icon .disc { fill: var(--warning); }
.infobar-icon .glyph { stroke: var(--surface); }
.infobar-text { flex-grow: 1; min-width: 0; white-space: pre-line; padding-top: 2px; }
.infobar-text b { font-weight: 600; }
.infobar-text ul { margin: 6px 0 0; padding-left: 18px; }
.infobar .icon-button { margin-top: -4px; color: var(--text); }
.infobar-action { margin-top: -4px; }

@keyframes appear { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* flyouts (menus) */
.flyout {
  position: fixed; z-index: 20; min-width: 200px; max-width: 320px; padding: 4px; max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--stroke); border-radius: 8px; box-shadow: var(--flyout-shadow);
  animation: appear var(--fast) ease-out;
}
.menu-item {
  width: 100%; min-height: 36px; padding: 6px 12px; display: flex; align-items: center; gap: 12px; text-align: left;
  border: 0; border-radius: 4px; background: transparent; color: var(--text); cursor: pointer;
  transition: background-color var(--fast);
}
.menu-item svg { width: 16px; height: 16px; color: var(--text-2); }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item:active { background: var(--pressed); }
.menu-item.danger, .menu-item.danger svg { color: var(--error); }
.menu-item .grow { min-width: 0; }
.menu-item[aria-checked="true"] { background: var(--selected); }
.menu-separator { height: 1px; background: var(--stroke); margin: 4px 0; }

/* content dialogs */
dialog.content-dialog {
  padding: 0; width: 480px; max-width: calc(100vw - 32px); max-height: calc(100vh - 64px);
  background: var(--surface); color: var(--text); border: 1px solid var(--stroke); border-radius: 8px; box-shadow: var(--dialog-shadow);
  overflow: hidden;
}
dialog.content-dialog.wide { width: 640px; }
dialog.content-dialog[open] { display: flex; flex-direction: column; animation: appear var(--fast) ease-out; }
dialog.content-dialog::backdrop { background: var(--overlay); }
.dialog-body { padding: 24px 24px 20px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.dialog-footer { padding: 20px 24px; background: var(--bg); border-top: 1px solid var(--stroke); display: flex; gap: 8px; }
.dialog-footer .button { flex: 1 1 0; }
.dialog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; }
.dialog-grid .wide { grid-column: 1 / -1; }
.dialog-body fieldset { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 10px; }
.dialog-body legend { padding: 0 0 6px; }
.dialog-body details summary { cursor: pointer; color: var(--text-2); margin-bottom: 10px; }

/* connect */
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.app-steps { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.copy-row { display: flex; gap: 8px; margin-top: 8px; }
.copy-row .textbox { flex: 1; }

/* the server's version, quietly under the account and the sign-in form */
.app-version { user-select: text; overflow-wrap: anywhere; }
.nav-pane .app-version { padding: 0 8px 4px; }

/* import preview: what an import would add, change and delete, by folder */
.preview-warning { margin: 0; color: var(--warning); }
.preview-groups { display: flex; flex-direction: column; gap: 4px; }
.dialog-body details.preview-group summary {
  display: flex; align-items: center; gap: 10px; min-height: 36px; margin: 0; padding: 4px 8px; border-radius: 4px; color: var(--text);
}
.dialog-body details.preview-group summary:hover { background: var(--row-hover); }
.dialog-body details.preview-group summary .caption { white-space: nowrap; }
.dialog-body details.preview-group summary::-webkit-details-marker { display: none; }
.preview-group[open] > summary .row-chevron { transform: rotate(90deg); }
.preview-list { margin: 0 0 8px; padding: 0 0 0 38px; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.preview-item { display: flex; align-items: flex-start; gap: 10px; }
.preview-item .pill { margin-top: 2px; }
.preview-item .row-text .caption { white-space: normal; overflow-wrap: anywhere; }
.pill.add { background: var(--success-bg); color: var(--success); }
.pill.update { background: var(--info-bg); color: var(--accent-text); }
.pill.delete { background: var(--error-bg); color: var(--error); }
.preview-problems { color: var(--text-2); }

/* snippets: grouped by folder, each command as text with its blanks marked */
.snippet-card { padding: 6px 6px 10px; gap: 6px; }
.snippet-folder { margin: 6px 10px 2px; display: flex; align-items: center; gap: 10px; font-size: 14px; line-height: 20px; font-weight: 400; }
.snippet-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.snippet { padding: 8px 10px; border-radius: 4px; display: flex; flex-direction: column; gap: 6px; transition: background-color var(--fast); }
.snippet:hover { background: var(--row-hover); }
.snippet .more { opacity: 0; transition: opacity var(--fast); }
.snippet:hover .more, .snippet:focus-within .more, .snippet .more[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .snippet .more { opacity: 1; } }
.snippet-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.snippet-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.snippet-description { white-space: pre-line; }
.snippet-command, textarea.snippet-input {
  font-family: "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace; font-size: 13px; line-height: 19px;
}
.snippet-command {
  margin: 0; padding: 8px 12px; border-radius: 4px; background: var(--layer); border: 1px solid var(--stroke);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.snippet-command .blank { padding: 0 2px; border-radius: 3px; background: var(--accent-subtle); color: var(--accent-text); font-weight: 600; }
/* team credentials: who has access, with key fingerprints to compare */
.credential-people { margin: 4px 0 0; padding-left: 18px; }
.credential-people code { font-size: 12px; overflow-wrap: anywhere; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 24px; }

/* a library's rules, and its recordings with their player */
#rules-form .setting-text { flex: none; }
.rule-controls { display: flex; flex-direction: column; gap: 10px; }
.toolbar.filters { align-items: flex-end; margin-bottom: 12px; }
.toolbar.filters .field { flex: 0 1 200px; }
.link-button { padding: 2px 0; border: 0; background: none; color: var(--accent-text); text-align: left; cursor: pointer; font: inherit; }
.link-button:hover { text-decoration: underline; }
dialog.content-dialog.wide:has(.player-screen) { width: 960px; }
.player-screen {
  margin: 0; padding: 8px 12px; height: 420px; max-height: 55vh; overflow: auto; border-radius: 4px; background: var(--layer);
  border: 1px solid var(--stroke); font-family: "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace; font-size: 13px; line-height: 18px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.player-controls { display: flex; align-items: center; gap: 12px; }
.player-controls .button { flex: none; min-width: 80px; }
.player-seek { flex: 1 1 auto; min-width: 0; accent-color: var(--accent); }
.player-time { flex: none; font-variant-numeric: tabular-nums; }
.player-typed { margin: 0; padding-left: 20px; max-height: 160px; overflow: auto; font-family: "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace; font-size: 12px; }
.player-typed .link-button { white-space: pre-wrap; overflow-wrap: anywhere; }

/* narrow windows (a half-screen window on a laptop, a phone): the navigation goes above the content and folds away */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .nav-pane { position: static; flex: none; height: auto; min-width: 0; padding: 8px 12px; }
  .app-title { padding: 4px 4px 4px 8px; }
  .nav-toggle { display: inline-flex; }
  .shell:not(.nav-open) .nav-pane > :not(.app-title) { display: none; }
  .shell.nav-open .nav-pane { border-bottom: 1px solid var(--stroke); }
  .nav-spacer { display: none; }
  .content { padding: 16px 20px 32px; }
}
@media (max-width: 720px) {
  .content { padding: 16px; }
  .row-meta { display: none; }
}

/* Windows High Contrast (forced colours) replaces backgrounds, which is how checked radios, checkboxes, the toggle and
   the selected nav item show: they draw with system colours instead */
@media (forced-colors: active) {
  input[type="radio"], input[type="checkbox"]:not([role="switch"]), .toggle-track { forced-color-adjust: none; background: Canvas; border-color: CanvasText; }
  input[type="radio"]:checked, input[type="checkbox"]:not([role="switch"]):checked { background: Highlight; border-color: Highlight; }
  input[type="radio"]::before { background: HighlightText; }
  input[type="checkbox"]:not([role="switch"])::before { border-color: HighlightText; }
  .toggle-thumb { forced-color-adjust: none; background: CanvasText; }
  .toggle input:checked + .toggle-track { background: Highlight; border-color: Highlight; }
  .toggle input:checked + .toggle-track .toggle-thumb { background: HighlightText; }
  .nav-item[aria-current="page"] { outline: 2px solid Highlight; outline-offset: -2px; }
  .nav-item[aria-current="page"]::before { forced-color-adjust: none; background: Highlight; }
  .segmented button[aria-checked="true"], .menu-item[aria-checked="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
  .infobar, .card, .list-card, .setting-card, dialog.content-dialog, .flyout { border: 1px solid CanvasText; }
  .count, .pill { border: 1px solid CanvasText; }
  .snippet-command, .player-screen { border: 1px solid CanvasText; }
  .link-button { color: LinkText; }
  .snippet-command .blank { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  .button:disabled { color: GrayText; border-color: GrayText; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before { transition: none !important; animation-duration: 1ms !important; }
  .progress-ring::before { animation: spin 1.5s linear infinite !important; }
}
