/* ---------------------------------------------------------------------------
   ACS Client Dashboard
   Palette (from ACS Technology logo): navy #002838 · blues #025B77 / #0480A5 / #06B1E1
            paper #F3F6F7 · amber #B97C1F · danger #B3402F · green reserved for done/unlocked
   Type:    IBM Plex Sans (UI) · IBM Plex Mono (credentials, labels)
--------------------------------------------------------------------------- */
:root {
  --ink: #002838;
  --ink-2: #0d3a4d;
  --paper: #f3f6f7;
  --panel: #ffffff;
  --line: #d9e1e4;
  --text: #1d3340;
  --muted: #647984;
  --accent: #0480a5;
  --accent-deep: #025b77;
  --brand-cyan: #06b1e1;
  --done: #1e7a63;
  --done-bg: #e4f1ec;
  --amber: #b97c1f;
  --amber-bg: #f7ecd8;
  --danger: #b3402f;
  --radius: 6px;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
/* Author display rules (flex/block on labels, rows, etc.) must never defeat
   the hidden attribute. */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--text);
  background: var(--paper);
  display: grid;
  grid-template-columns: 220px 1fr;
}

/* ---- Sidebar ---- */
.sidebar {
  background: var(--ink);
  color: #c6dbe4;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  min-height: 100vh;
}
.brand { padding: 0 16px 18px; border-bottom: 1px solid var(--ink-2); }
.brand a { display: block; border-radius: var(--radius); }
.brand a:hover .brand-logo { opacity: 0.88; }
.brand-logo {
  display: block;
  width: 100%;
  background: #fff;
  border-radius: var(--radius);
  padding: 10px 12px;
}
nav { padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #6d95a5;
  padding: 6px 10px;
}
.nav-future { margin-top: auto; color: #4a7284; }
nav a {
  color: #c6dbe4;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: var(--radius);
  border-left: 3px solid transparent;
}
nav a:hover { background: var(--ink-2); }
nav a.active {
  background: var(--ink-2);
  border-left-color: var(--brand-cyan);
  color: #fff;
}
.sidebar-foot { padding: 12px 20px 0; font-family: var(--mono); font-size: 11.5px; }
.sidebar-foot .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.locked { background: var(--amber); }
.dot.unlocked { background: #3ccf9b; }

/* ---- Main ---- */
/* No width cap. Every machine here is 1920x1080 or wider, and capping the page
   at 1100px left roughly a third of the screen empty while the tables were
   squeezed — which is what pushed the password column out of sight in the
   first place. Tables take the whole window. */
main { padding: 16px 36px 40px; }
/* Forms and text blocks keep a readable measure instead. A 1600px-wide input
   or paragraph is harder to use, not easier — the eye loses the line. */
.card:not(.card-wide), .settings-band { max-width: 1100px; }
.page-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.page-head .spacer { flex: 1; }
.count-chip { font-family: var(--mono); font-size: 12px; color: var(--muted); }

input[type="search"] {
  font: inherit;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  min-width: 240px;
}
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---- Buttons ---- */
.btn {
  font: inherit;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 8px 14px;
  cursor: pointer;
  background: var(--panel);
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-deep); }
.btn.ghost { border-color: var(--line); color: var(--text); }
.btn.ghost:hover { background: #eceee9; }
.btn.danger { color: var(--danger); border-color: var(--line); }
.btn.danger:hover { background: #f6e8e5; }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: default; }
/* A toggle that is currently on (the Recent filter). Filled rather than
   outlined, so "the list you are looking at is filtered" is obvious at a
   glance and not carried by a subtle border alone. */
.btn.ghost.active,
.btn.ghost.active:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
/* An <a> carrying .btn needs what a <button> gets for free: no underline,
   inherited colour, and box alignment. Used by Save on an attachment, where a
   real link is right — it can be middle-clicked, and the browser handles the
   download itself. */
a.btn { display: inline-flex; align-items: center; text-decoration: none; color: var(--text); }
a.btn:hover { text-decoration: none; }

/* ---- Tables ---- */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th {
  background: var(--panel);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbf8; }
td.mono, .mono { font-family: var(--mono); font-size: 13.5px; }
td .row-actions { display: flex; gap: 6px; justify-content: flex-start; }
td.actions-cell { width: 1%; white-space: nowrap; }
a.row-link { color: var(--accent-deep); font-weight: 500; text-decoration: none; }
a.row-link:hover { text-decoration: underline; }
.empty {
  padding: 36px;
  text-align: center;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ---- Dashboard ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s;
}
a.stat-card:hover { border-color: var(--accent); box-shadow: 0 1px 4px rgba(2, 91, 119, 0.12); }
.stat-card.stat-plain { cursor: default; }
.stat-num { font-family: var(--mono); font-size: 26px; font-weight: 500; line-height: 1; color: var(--ink-2); }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-card.st-link-not_started .stat-num { color: #55636c; }
.stat-card.st-link-in_progress .stat-num { color: var(--amber); }
.stat-card.st-link-waiting_client .stat-num { color: #6b3f86; }
.stat-card.st-link-waiting_supplier .stat-num { color: #8a4b12; }
.stat-card.st-link-completed .stat-num { color: var(--done); }
.stat-card.st-link-invoiced .stat-num { color: #0a4767; }

.filter-chip {
  font-size: 13px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.filter-clear { color: var(--danger); text-decoration: none; font-weight: 600; }
.filter-clear:hover { text-decoration: underline; }

/* ---- Client detail ---- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.card h2 { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
.card-wide { margin-top: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.card-wide .vault-bar { margin-bottom: 12px; }
dl.kv { margin: 0; display: grid; grid-template-columns: 110px 1fr; row-gap: 8px; }
dl.kv dt {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-top: 2px;
}
dl.kv dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Actions at the front, matching the tables elsewhere in the app. */
.contact-item { border-top: 1px solid var(--line); padding: 12px 0; display: flex; gap: 12px; align-items: flex-start; }
.contact-item:first-of-type { border-top: none; padding-top: 0; }
.contact-actions { flex: none; }
.contact-body { flex: 1; min-width: 0; }
.contact-name { font-weight: 600; }
.contact-role { color: var(--muted); font-size: 13px; margin-left: 6px; }
.contact-lines { font-size: 13.5px; color: var(--text); margin-top: 4px; font-family: var(--mono); }
.breadcrumb { font-family: var(--mono); font-size: 12px; margin-bottom: 6px; }
.breadcrumb a { color: var(--accent-deep); text-decoration: none; }

/* ---- Vault ---- */
.vault-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-family: var(--mono);
  font-size: 13px;
  border: 1px solid;
}
.vault-bar.locked { background: var(--amber-bg); border-color: #e3cfa4; color: #6e4a10; }
.vault-bar.unlocked { background: var(--done-bg); border-color: #bcd9cd; color: var(--done); }
.vault-bar form { display: flex; gap: 8px; flex: 1; }
.vault-bar input[type="password"] {
  font: inherit;
  flex: 1;
  max-width: 320px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.vault-bar .spacer { flex: 1; }
.pw-cell { display: flex; align-items: center; gap: 8px; }
.pw-dots { letter-spacing: 2px; color: var(--muted); }

.page-scroll { display: flex; flex-direction: column; gap: 18px; }
.setup-card { max-width: 480px; }
.setup-card p { color: var(--muted); font-size: 14px; }
.setup-card label { display: block; margin: 12px 0; }
.setup-card input { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); margin-top: 4px; }
.warn-note {
  background: var(--amber-bg);
  border: 1px solid #e3cfa4;
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  color: #6e4a10;
  margin-top: 12px;
}

/* ---- Dialogs ---- */
dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  width: min(520px, 92vw);
  box-shadow: 0 18px 50px rgba(22, 35, 44, 0.25);
}
dialog::backdrop { background: rgba(22, 35, 44, 0.45); }
#job-dialog { width: min(760px, 94vw); }
#job-dialog textarea[name="details"] { min-height: 160px; }
.dlg-form { padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; }
.dlg-form h2 { margin: 0 0 4px; font-size: 17px; }
.dlg-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; font-weight: 500; }
.dlg-form input, .dlg-form textarea, .dlg-form select {
  font: inherit;
  font-weight: 400;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 100%;
}
.dlg-form textarea { resize: vertical; }

/* Inline edit form on the client Overview — same field styling as the dialog,
   without the dialog's padding. */
.detail-form { display: flex; flex-direction: column; gap: 9px; }
.detail-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; font-weight: 500; }
.detail-form input, .detail-form textarea, .detail-form select {
  font: inherit;
  font-weight: 400;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 100%;
}
.detail-form textarea { resize: vertical; }
.detail-form-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
#details-dirty { color: var(--amber); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.dlg-note { font-size: 13px; color: var(--muted); margin: 0; }

/* The group field: a text box you type in, with an optional shortcut list
   beside it. The box takes the space because it is the field; the list is a
   convenience and is capped so a long path cannot squeeze the thing being
   edited down to nothing. */
.group-field { display: flex; gap: 6px; align-items: stretch; }
.group-field input { flex: 1 1 auto; min-width: 0; }
.group-field select { flex: 0 1 auto; max-width: 38%; min-width: 0; }
.time-fields {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px 14px;
  margin: 0;
}
.time-fields legend {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 0 6px;
}
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 0.6fr; gap: 12px; }
.grid-4 { display: grid; grid-template-columns: 0.9fr 1fr 1fr 0.5fr; gap: 12px; }
.time-row { display: flex; gap: 6px; }
.time-row input { flex: 1; min-width: 0; }
.time-row select { width: auto; }
.pw-input-row { display: flex; gap: 6px; }
.pw-input-row input { flex: 1; font-family: var(--mono); }

/* ---- Jobs ---- */
.type-tag {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
}
.type-tag.newjob { background: #ddf2fa; color: var(--accent-deep); }
.type-tag.maint { background: var(--amber-bg); color: #6e4a10; }
.status-tag {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
}
.st-not_started { background: #e9ebe7; color: #55636c; }
.st-in_progress { background: var(--amber-bg); color: #6e4a10; }
.st-waiting_client { background: #f1e7f6; color: #6b3f86; }
.st-waiting_supplier { background: #fdeee1; color: #8a4b12; }
.st-completed { background: var(--done-bg); color: var(--done); }
.st-invoiced { background: #dceaf2; color: #0a4767; }
/* The status select carries its own colour, in TEXT rather than as a fill.
   A filled control would read as a button and compete with Save; what is
   wanted is only that the field stop looking identical whatever it holds.
   The colours are the text half of the .st-* pairs above, so the field and the
   pill on the job list agree without a second set of values to keep in step. */
#job-status { font-weight: 600; }
#job-status.sv-not_started { color: #55636c; }
#job-status.sv-in_progress { color: #6e4a10; }
#job-status.sv-waiting_client { color: #6b3f86; }
#job-status.sv-waiting_supplier { color: #8a4b12; }
#job-status.sv-completed { color: var(--done); }
#job-status.sv-invoiced { color: #0a4767; }

/* The line under the status band while a job is Not started. It sits in its
   own full-width row rather than inside the Status cell: that band is
   align-items:end, so growing one cell would drop the maintenance checkbox and
   the invoice field out of line with it. Amber, not red — a job left on Not
   started is sometimes deliberate. */
.status-hint {
  margin: -4px 0 0;
  font-size: 13px;
  color: #6e4a10;
  background: var(--amber-bg);
  border-left: 3px solid var(--amber);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 6px 10px;
}

.invoice-no { font-size: 12px; color: var(--muted); margin-top: 3px; }
.open-tag {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--amber);
}
.link-btn {
  font: inherit;
  font-weight: 500;
  color: var(--accent-deep);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.link-btn:hover { text-decoration: underline; }
.details-row td { background: #fafbf8; }
.job-details { white-space: pre-wrap; font-size: 14px; max-width: 900px; }
.time-summary { font-size: 12.5px; color: var(--accent-deep); margin-bottom: 8px; }
.visits-wrap { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.visit-table { width: auto; min-width: 60%; margin-bottom: 10px; }
.visit-table th { padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); }
.visit-table td { padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); display: table-cell; }
.visit-add { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.visit-add input, .visit-add select {
  font: inherit; font-size: 13.5px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.visit-add input[type="number"] { width: 84px; }
.visit-add .techs-in { width: 70px; }
.visit-add .note-in { flex: 1; min-width: 140px; }
/* Edit mode: the add line doubles as the edit form, so make it obvious which
   row is being amended and that Save will not create a new visit. */
.visit-add.editing {
  background: var(--amber-bg);
  border: 1px solid #e3cfa4;
  border-radius: var(--radius);
  padding: 8px;
  margin: -8px -8px 0;
}
.visit-edit-flag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6e4a10;
  flex-basis: 100%;
}
.visit-table tr.row-editing td { background: var(--amber-bg); }
.visit-table td.actions-cell { white-space: nowrap; }

/* Checkbox/radio rows: the control sits at the front, label text beside it.
   display is !important (like the two below) because container rules such as
   `.setup-card label { display: block }` are more specific and would otherwise
   flatten the row — which is what broke the Settings radios. */
.check-row { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px !important; }
.check-row input[type="checkbox"], .check-row input[type="radio"] {
  width: auto;
  flex: none;
  margin: 0;
  padding: 0;
  border: none;
  accent-color: var(--accent);
}

/* ---- Auth & account ---- */
.auth-wrap { display: flex; justify-content: center; padding-top: 8vh; }
.auth-card { width: min(420px, 92vw); }
.auth-card label { display: block; margin: 12px 0; font-size: 13.5px; font-weight: 500; }
.auth-card input {
  width: 100%; font: inherit; font-weight: 400; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius); margin-top: 4px;
}
.own-tag {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.1em; padding: 3px 8px; border-radius: 3px;
  background: var(--ink); color: #7fd4f2; vertical-align: middle;
}
/* Badges are single objects, not phrases to be wrapped. They live in cells
   that wrap (the name column), so without this "Our company" breaks at the
   space and draws as two stacked half-pills, which reads as a rendering fault
   rather than a label. The badge moves to the next line whole instead. */
.own-tag, .pill-archived { display: inline-block; white-space: nowrap; }
tr.own-row td { background: #eef6fa; }
.login-chip {
  font-size: 12px; color: var(--accent-deep); background: #ddf2fa;
  padding: 2px 7px; border-radius: 3px; margin-left: 8px;
}
.account-name { color: #e7f1f5; font-family: var(--sans); font-weight: 500; margin-bottom: 8px; }
.account-name.muted { color: #6d95a5; font-weight: 400; }
.account-actions { display: flex; gap: 6px; }
.account-actions .btn { background: transparent; color: #c6dbe4; border-color: #35586b; }
.account-actions .btn:hover { background: var(--ink-2); }

/* ---- Client page tabs: prominent segmented buttons ---- */
.tab-bar {
  display: flex;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  margin-bottom: 20px;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 13px 20px;
  text-decoration: none;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
}
.tab:hover { background: #e8f0f3; }
.tab.active {
  background: var(--accent);
  color: #fff;
}
.tab.active:hover { background: var(--accent-deep); }
/* Tabs for records that need a saved parent first (new client). */
.tab.disabled { color: var(--muted); opacity: 0.55; cursor: not-allowed; }
.tab.disabled:hover { background: transparent; }
.tab-count {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  background: #e4ecef;
  color: var(--muted);
  padding: 2px 9px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: 1px;
}
.tab.active .tab-count { background: rgba(255, 255, 255, 0.22); color: #fff; }
.tab-tools {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}
.tab-tools input[type="search"] { flex: 1; max-width: 380px; }

/* ---- Attachments ---- */
.att-head { display: flex; align-items: center; gap: 10px; margin: 12px 0 10px; border-top: 1px solid var(--line); padding-top: 10px; flex-wrap: wrap; }
.att-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.att-upload { cursor: pointer; }
.att-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.att-card {
  width: 160px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.att-check { position: absolute; top: 12px; left: 12px; z-index: 2; width: 18px; height: 18px; accent-color: var(--accent); }
.att-thumb { width: 100%; height: 100px; object-fit: cover; border-radius: 4px; display: block; background: #eef1f0; }
.att-file-chip {
  display: flex; align-items: center; justify-content: center;
  height: 100px; border-radius: 4px; background: #eef1f0;
  color: var(--muted); font-size: 15px; letter-spacing: 0.1em;
}
.att-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.att-tags { display: flex; flex-wrap: wrap; gap: 3px; margin: 3px 0; }
.tag-chip {
  font-family: var(--mono); font-size: 10.5px;
  background: #ddf2fa; color: var(--accent-deep);
  padding: 1px 7px; border-radius: 8px;
}
/* Three controls in a 160px card: let them wrap rather than overflow, and
   trim the padding so Save and Tags usually share a line. */
.att-actions { justify-content: flex-start !important; flex-wrap: wrap; gap: 4px; }
.att-actions .btn.small { padding: 4px 7px; font-size: 12.5px; }
.att-filter {
  font: inherit; font-size: 13.5px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: var(--radius);
  min-width: 170px;
}
.att-meta { display: flex; flex-direction: column; min-width: 0; }
.field-label { font-size: 13.5px; font-weight: 500; display: block; margin-bottom: 4px; }
.recipients-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; max-height: 200px; overflow-y: auto; }
/* Checkbox at the front, name beside it. The width reset matters: without it
   `.dlg-form input { width: 100% }` stretches each box and every row's control
   lands in a different place. */
.recipient-row { display: flex; flex-direction: row !important; align-items: center; gap: 8px; padding: 4px 0; font-weight: 400; cursor: pointer; }
.recipient-row input[type="checkbox"] {
  width: auto;
  flex: none;
  margin: 0;
  padding: 0;
  border: none;
  accent-color: var(--accent);
}
.recipient-row:hover { background: var(--paper); }
.recipient-group + .recipient-group { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.recipient-group-title {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 4px;
}
.att-sel-count { font-size: 12px; color: var(--muted); }
.settings-sep { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.twofa-input { width: 120px; letter-spacing: 0.25em; text-align: center; }
.twofa-inline { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.twofa-qr { display: block; margin: 10px 0; border: 1px solid var(--line); border-radius: var(--radius); }
.twofa-steps { margin: 8px 0 0 18px; font-size: 14px; }
#prefs-form .check-row { margin: 6px 0; }
.ms-user-code { font-size: 20px; letter-spacing: 0.2em; background: #eef7fa; padding: 3px 10px; border-radius: 6px; }
.ms-admin summary { cursor: pointer; font-weight: 600; font-size: 14px; }
/* ---- Groups (clients and password entries) ---- */
/*
   A heading is a filled BAR and its rows stay on the panel, white like
   ungrouped rows. Belonging is shown by a rail down the row's FIRST cell — the
   row's actual left edge, where the eye already is — and the rail simply stops
   when the group does.

   This replaced a pair of near-identical tints: #f2f7f9 for the heading against
   #f3f6f7 for its rows, one step apart per channel. The whole block read as a
   single flat pale slab with no beginning and no end, and adding a second level
   underneath made that worse rather than better. A finer gradient was never
   going to fix it; what was missing was a boundary. A filled bar cannot be
   mistaken for data, and keeping the rows white leaves credentials on the
   highest-contrast surface there is.
*/
.group-row > td { background: var(--accent-deep); padding: 4px 12px !important; }
.group-toggle {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer;
  font: inherit; font-weight: 600; color: #fff;
  padding: 4px 0; width: 100%; text-align: left;
}
.group-toggle:hover .group-name { text-decoration: underline; }
.group-caret { font-size: 11px; color: #a8d3e2; width: 10px; }
.group-name { font-size: 14px; }
.group-row .tab-count { background: rgba(255, 255, 255, 0.2); color: #fff; }

tbody tr.in-group > td { background: var(--panel); }
tbody tr.in-group:hover > td { background: #f2f8fb; }
tbody tr.in-group > td:first-child { box-shadow: inset 3px 0 0 var(--accent-deep); }
/* A group closes on the deep bar it opened with, not on a grey hairline that
   looks like every other row boundary. */
tbody tr.group-last > td { border-bottom: 2px solid var(--accent-deep); }

/* Levels below the first (password subgroups only — client groups do not
   nest). The bar gets paler as it goes deeper and the text flips to ink, and
   each level adds its own band to the rail, so how deep a row sits is read
   from its left edge rather than from remembering which heading came last.
   Capped at four: past that the rail costs more width than the structure is
   worth.

   The indent belongs on the first cell. Putting it on the name cell — which is
   the FOURTH column — moved the text while the row's left edge, the Edit
   button, stayed exactly where it was, so nothing appeared to move at all. */
.group-row[data-depth="2"] > td { background: #cfe3ec; }
.group-row[data-depth="3"] > td,
.group-row[data-depth="4"] > td { background: #e3eef3; }
.group-row[data-depth="2"] .group-toggle,
.group-row[data-depth="3"] .group-toggle,
.group-row[data-depth="4"] .group-toggle { color: var(--ink); }
.group-row[data-depth="2"] .group-caret,
.group-row[data-depth="3"] .group-caret,
.group-row[data-depth="4"] .group-caret { color: var(--muted); }
.group-row[data-depth="2"] .tab-count,
.group-row[data-depth="3"] .tab-count,
.group-row[data-depth="4"] .tab-count { background: #e4ecef; color: var(--muted); }
.group-row[data-depth="2"] .group-toggle { padding-left: 18px; }
.group-row[data-depth="3"] .group-toggle { padding-left: 36px; }
.group-row[data-depth="4"] .group-toggle { padding-left: 54px; }

tbody tr.grp-d2 > td:first-child { box-shadow: inset 3px 0 0 var(--accent-deep), inset 16px 0 0 #cfe3ec; padding-left: 22px; }
tbody tr.grp-d3 > td:first-child { box-shadow: inset 3px 0 0 var(--accent-deep), inset 16px 0 0 #cfe3ec, inset 29px 0 0 #e3eef3; padding-left: 35px; }
tbody tr.grp-d4 > td:first-child { box-shadow: inset 3px 0 0 var(--accent-deep), inset 16px 0 0 #cfe3ec, inset 29px 0 0 #e3eef3, inset 42px 0 0 #eaf2f6; padding-left: 48px; }
/* A group closes on the deep bar it opened with, not on a grey hairline that
   looks like every other row boundary. */
/* The full path is carried in the markup for the stacked phone layout, where
   there is no room to indent and a bare "SRV-DC01" would not say what it sits
   under. One of the two is always hidden. */
.group-path { display: none; }
.sel-cell { width: 1%; }
.row-sel { width: 17px; height: 17px; accent-color: var(--accent); }
.bulk-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px 12px; margin-bottom: 12px;
}
.bulk-bar input, .bulk-bar select {
  font: inherit; font-size: 13.5px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: var(--radius); min-width: 200px;
}
/* ---- Column layout ---- */
/* Fit-to-width: the <colgroup> in layout.js sets percentages that always sum
   to 100, so the table can never be wider than its container and nothing ends
   up off to the right where it cannot be read. That only works under
   table-layout: fixed — under the default auto layout the browser sizes by
   content and treats a width as a suggestion.

   Desktop only. Below the breakpoint the rows stack into cards and the heading
   row is hidden, so column widths mean nothing there. */
@media (min-width: 761px) {
  .table-wrap table { table-layout: fixed; }
  /* Fixed layout will not grow a column to fit its contents, so anything long
     has to be allowed to wrap — a revealed password, a long email address.
     Without this they would spill over the next column. */
  /* One line per row. Under table-layout: fixed a cell cannot grow to fit its
     contents, so the choice is wrap or truncate — and wrapping made rows
     ragged and tall. Anything cut off keeps its full text in a title
     attribute, so hovering still shows it. */
  .table-wrap td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .table-wrap th { text-overflow: ellipsis; }
  /* The exceptions: the entry's own name, and the password itself. A truncated
     password would defeat the point of revealing it. */
  .table-wrap td.cell-wrap,
  .table-wrap td.cell-open {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  /* Long-text cells advertise that there is more to see. Clicking expands the
     cell in place; the Copy button on hover puts the whole thing on the
     clipboard without expanding anything. */
  .table-wrap td[title] { cursor: pointer; position: relative; }
  .table-wrap td.cell-open { cursor: default; }
  /* Row buttons stay on one line. Letting them wrap put Delete underneath
     Edit and made every row in the table taller. */
  .table-wrap td.actions-cell { white-space: nowrap; }
}

/* Hidden columns keep their cells in the markup and are removed from layout,
   which keeps the body cells aligned with the <col> elements. */
.col-hidden { display: none !important; }
.hide-del [data-del] { display: none; }

.col-resize {
  position: absolute; top: 0; right: 0; width: 9px; height: 100%;
  cursor: col-resize; z-index: 2; user-select: none;
}
.col-resize::after {
  content: ""; position: absolute; right: 4px; top: 22%;
  height: 56%; width: 1px; background: var(--line);
}
.col-resize:hover::after { background: var(--accent); width: 2px; }
body.col-resizing { cursor: col-resize; user-select: none; }
body.col-resizing .col-resize::after { background: var(--accent); width: 2px; }

.cols-menu { position: relative; display: none; margin-bottom: 8px; }
@media (min-width: 761px) { .cols-menu { display: inline-block; } }
.cols-menu > summary {
  list-style: none; cursor: pointer; display: inline-block;
  font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--muted);
  padding: 5px 10px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--panel);
}
.cols-menu > summary::-webkit-details-marker { display: none; }
.cols-menu > summary:hover { color: var(--text); border-color: var(--accent); }
.cols-menu[open] > summary { color: var(--text); border-color: var(--accent); }
.cols-panel {
  position: absolute; z-index: 20; margin-top: 4px; min-width: 200px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px;
  box-shadow: 0 4px 14px rgba(0, 40, 56, 0.14);
  display: flex; flex-direction: column; gap: 7px;
}
.cols-panel label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.cols-panel input { accent-color: var(--accent); }
.cols-hint { margin: 0 0 2px; font-size: 12px; color: var(--muted); }
.cols-sep { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
.cols-panel .btn { margin-top: 4px; align-self: flex-start; }

/* Per-cell Copy. Sits over the right-hand end of a truncated cell, so it needs
   an opaque background or the text runs underneath it. The three cases are the
   normal row, the hovered row, and an archived row. */
.cell-copy {
  position: absolute; right: 0; top: 0; height: 100%;
  display: none; align-items: center;
  border: 0; border-left: 1px solid var(--line);
  padding: 0 8px; cursor: pointer;
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
  background: var(--panel);
}
tr:hover .cell-copy { display: inline-flex; background: #fafbf8; }
tr.row-archived:hover .cell-copy { background: var(--paper); }
.cell-copy:hover { color: var(--accent-deep); }
td.cell-open .cell-copy { height: auto; padding-top: 3px; padding-bottom: 3px; }
/* Nothing is truncated on a phone — the rows stack and show everything — so the
   button would just be clutter. */
@media (max-width: 760px) { .cell-copy { display: none !important; } }

/* ---- Archiving ---- */
/* Segmented Active / Archived / All control. */
.seg {
  display: inline-flex; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; background: var(--panel);
}
.seg-btn {
  font: inherit; font-size: 13.5px; padding: 6px 12px; cursor: pointer;
  background: transparent; border: 0; color: var(--muted);
  border-left: 1px solid var(--line);
}
.seg-btn:first-child { border-left: 0; }
.seg-btn:hover { background: var(--paper); color: var(--text); }
.seg-btn.on { background: var(--accent); color: #fff; }
.seg-btn.on:hover { background: var(--accent-deep); color: #fff; }
.seg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* An archived row stays fully legible — it is muted, not hidden. Reveal and
   Copy still work, because retrieval is the whole point of archiving. */
tr.row-archived > td { background: var(--paper); color: var(--muted); }
tr.row-archived a.row-link { color: var(--muted); }
.pill-archived {
  display: inline-block; font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 1px 6px; border-radius: 10px; vertical-align: 1px;
  background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber);
}
.count-muted { color: var(--muted); font-size: 12px; }
.stat-extra { font-size: 0.5em; color: var(--muted); margin-left: 3px; vertical-align: super; }

.ms-admin[open] summary { margin-bottom: 8px; }
.dlg-links { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }
.grid-msi { display: grid; grid-template-columns: auto 1fr 1fr; gap: 12px; align-items: end; }
.check-cell { padding-bottom: 9px; white-space: nowrap; }
#visits-dialog { width: min(820px, 96vw); }
#atts-dialog { width: min(820px, 96vw); }

/* ---- Toast ---- */
#toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: var(--ink);
  color: #fff;
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 16px;
  border-radius: var(--radius);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  max-width: 60vw;
}
#toast.show { opacity: 1; transform: none; }
#toast.error { background: var(--danger); }

/* ---- Desktop: fixed chrome, scrolling lists ---- */
@media (min-width: 761px) {
  body { height: 100dvh; overflow: hidden; }
  .sidebar { height: 100dvh; overflow-y: auto; }
  main {
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  main > * { flex: 0 0 auto; }

  /* Scroll regions: the list wrappers grow to fill, tables scroll inside them
     with sticky column headers. */
  #client-list, #job-list, #pw-list, #tab-content, #client-jobs, #client-passwords {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  #tab-content > .tab-tools { flex: 0 0 auto; }
  #tab-content > .detail-grid {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    align-content: start;
  }
  .auth-wrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .page-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-bottom: 24px; }
  #client-list > .table-wrap, #job-list > .table-wrap, #pw-list > .table-wrap,
  #client-jobs > .table-wrap, #client-passwords > .table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
  }
  thead th { position: sticky; top: 0; z-index: 2; }
}

/* ---- Responsive ---- */
@media (max-width: 760px) {
  body { grid-template-columns: 1fr; }

  /* Rows stack into cards here, so there is no left edge to step in from.
     A subgroup heading shows its full path instead — "Servers / SRV-DC01"
     rather than an indented "SRV-DC01" with nothing to indent against. */
  .group-row[data-depth] .group-toggle { padding-left: 0; }
  tbody tr[class*="grp-d"] > td:first-child { padding-left: 12px; box-shadow: none; }
  .group-row[data-depth="1"] .group-path { display: none; }
  .group-row .group-path { display: inline; font-size: 14px; }
  .group-row[data-depth] .group-name { display: none; }
  .group-row[data-depth="1"] .group-name { display: inline; }

  /* Sidebar becomes a sticky top bar: logo · nav · account */
  .sidebar {
    min-height: 0;
    flex-direction: row;
    align-items: center;
    padding: 8px 10px;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 50;
    flex-wrap: wrap;
  }
  .brand { border: none; padding: 0; }
  .brand-logo { width: auto; height: 38px; padding: 4px 7px; }
  nav { flex-direction: row; padding: 0; gap: 2px; flex: 1; }
  nav a { padding: 8px 10px; border-left: none; border-bottom: 3px solid transparent; }
  nav a.active { border-left: none; border-bottom-color: var(--brand-cyan); }
  .nav-eyebrow, .nav-future { display: none; }
  .sidebar-foot { padding: 0; margin-left: auto; }
  .account-name { display: none; }
  .account-actions { gap: 4px; }

  main { padding: 16px 12px 60px; max-width: 100%; }
  .page-head { gap: 10px; }
  .page-head h1 { font-size: 19px; }
  input[type="search"] { min-width: 0; width: 100%; order: 5; }
  .detail-grid { grid-template-columns: 1fr; }
  dl.kv { grid-template-columns: 90px 1fr; }

  /* Tables become stacked cards with labelled fields */
  .table-wrap { border: none; background: none; overflow: visible; }
  .table-wrap table, .table-wrap tbody { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr {
    display: block;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 10px;
  }
  .table-wrap tr[hidden] { display: none; }
  .table-wrap tr:hover { background: var(--panel); }
  .table-wrap td {
    display: flex;
    gap: 10px;
    padding: 5px 0;
    border-bottom: none;
    align-items: baseline;
  }
  .table-wrap td:empty { display: none; }
  .table-wrap td[data-label]::before {
    content: attr(data-label);
    font-family: var(--mono);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    flex: 0 0 88px;
    padding-top: 2px;
  }
  .table-wrap td.actions-cell { justify-content: flex-start; padding-bottom: 8px; border-bottom: 1px dashed var(--line); margin-bottom: 4px; }
  /* Same idea for contacts: actions first, then the details. */
  .contact-item { flex-direction: column; gap: 8px; }
  .contact-actions { padding-bottom: 8px; border-bottom: 1px dashed var(--line); width: 100%; }
  .table-wrap tr.own-row { border-color: var(--accent); }
  .table-wrap tr.own-row td { background: var(--panel); }
  .table-wrap tr.details-row { margin-top: -8px; border-top: none; border-top-left-radius: 0; border-top-right-radius: 0; }
  .table-wrap tr.details-row td { background: var(--panel); display: block; }

  /* Dialogs near full-screen, scrollable, no-zoom inputs */
  dialog { width: 96vw; max-height: 88dvh; overflow-y: auto; }
  .dlg-form input, .dlg-form textarea, .dlg-form select,
  .detail-form input, .detail-form textarea, .detail-form select,
  .auth-card input, input[type="search"] { font-size: 16px; }
  .grid-2, .grid-3, .grid-4, .grid-msi { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .check-cell { padding-bottom: 0; }

  .tab { padding: 12px 6px; font-size: 15px; }
  .tab-count { margin-left: 4px; padding: 1px 7px; }
  .tab-tools { flex-wrap: wrap; }
  .tab-tools input[type="search"] { max-width: none; order: 2; width: 100%; }

  /* Comfortable touch targets */
  .btn { min-height: 38px; }
  .btn.small { min-height: 34px; }
  .auth-wrap { padding-top: 4dvh; }
}

@media (prefers-reduced-motion: reduce) {
  #toast { transition: none; }
}

/* ---- Settings: personal vs company ---- */
.settings-band {
  margin: 26px 0 2px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}
.settings-band:first-of-type { margin-top: 0; }
.settings-band-note { margin: 0 0 14px; }

/* Company-wide settings are visually separated and folded away, so they are
   not somewhere a technician wanders into by accident. */
.settings-band-global { color: #8a5a12; border-bottom-color: #e3cfa4; }
.global-card {
  border-left: 3px solid var(--amber);
  background: var(--paper);
}
.global-card > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.global-card > summary::-webkit-details-marker { display: none; }
.global-card > summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 12px;
}
.global-card[open] > summary::before { content: "▾"; }
.global-card > summary h2 { display: inline; margin: 0; }
.global-card[open] > summary { margin-bottom: 12px; }

/* ---- Sortable table headings ---- */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { background: #e8f0f3; }
th.sortable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
th.sortable.sorted { color: var(--accent-deep); }
.sort-arrow { font-size: 9px; margin-left: 5px; vertical-align: 1px; }
td.nowrap { white-space: nowrap; }

/* Heading row is hidden when rows stack on a phone, so sorting moves to a
   control above the table. Hidden on desktop, where the headings work. */
.mobile-sort { display: none; }
@media (max-width: 760px) {
  .mobile-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    flex-wrap: wrap;
  }
  .mobile-sort label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
  .mobile-sort select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); }
}

.version-line { margin-top: 26px; text-align: center; opacity: 0.75; }

/* ---- Job detail layout ---- */
/* Two balanced columns instead of two columns plus a full-width band. The
   right column carries the supporting material — attachments, visits, and a
   parts list later — while the left is the notepad. The old arrangement left a
   large empty rectangle where the right column ran out, then started a third
   horizontal band underneath, which is what made the page read as disjointed.

   align-items: stretch (rather than the start used elsewhere) is what lets the
   details card match the right column's height so the notepad can fill it. */
.job-grid { align-items: stretch; }
.job-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.job-details-card { display: flex; flex-direction: column; min-width: 0; }
.job-details-card .detail-form { flex: 1; }
/* The chain that makes the notepad fill whatever height is going: the form is
   a flex column, this label is the only part allowed to grow, and the textarea
   fills it. The min-height is a floor, so a short right column cannot squash
   the notepad to nothing. */
.detail-form label.grow { flex: 1; min-height: 150px; }
.detail-form label.grow textarea { flex: 1; height: 100%; resize: vertical; }

/* The visits table has six columns plus its buttons. That is comfortable in
   half of a 1920 screen and cramped in half of a 1366 one, so narrower
   displays go back to a single column and the full width per card. */
@media (max-width: 1200px) {
  .job-grid { grid-template-columns: 1fr; }
}

/* ---- Job detail: visits ---- */
#visits-body { margin-top: 10px; }
/* Only the table scrolls, not the whole card. Capping the card would push
   "Add visit" out of reach on exactly the jobs where you are most likely to be
   adding one. The header stays put so the columns stay identifiable part-way
   down a long list.

   A row is about 42px: the Edit and Delete buttons set the height, not the
   text. 162px is the header plus three rows — deliberately small, because the
   height it gives up goes to the notepad on the left. */
.visits-scroll { max-height: 162px; overflow-y: auto; margin-bottom: 10px; }
.visits-scroll .visit-table { margin-bottom: 0; }
.visits-scroll thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--panel); box-shadow: inset 0 -1px 0 var(--line);
}

/* ---- Changelog ---- */
.changelog { max-width: 760px; }
.changelog-entry { border-bottom: 1px solid var(--line); }
.changelog-entry:last-of-type { border-bottom: none; }
.changelog-entry > summary {
  list-style: none; cursor: pointer; padding: 10px 2px;
  display: flex; align-items: baseline; gap: 12px;
}
.changelog-entry > summary::-webkit-details-marker { display: none; }
.changelog-entry > summary:hover .changelog-ver { color: var(--accent-deep); }
.changelog-ver {
  font-family: var(--mono); font-size: 14px; font-weight: 600;
  color: var(--text); min-width: 44px;
}
.changelog-date { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.changelog-latest {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.1em; padding: 2px 7px; border-radius: 10px;
  background: var(--accent); color: #fff;
}
.changelog-entry ul { margin: 0 0 12px; padding-left: 20px; }
.changelog-entry li { font-size: 14px; margin-bottom: 6px; line-height: 1.5; }
.changelog-foot { margin: 14px 0 0; font-size: 12.5px; }

/* ---- Last edited (v1.31) --------------------------------------------------
   Deliberately quiet: small, muted, no hover pop-ups. It is there when someone
   goes looking and out of the way when they are not. */
.hist-cell, .hist-old, .hist-foot { font-size: 12.5px; color: var(--muted); }
.hist-btn {
  display: block; max-width: 100%;
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hist-btn:hover, .hist-btn:focus-visible, .hist-btn[aria-expanded="true"] { color: var(--ink); }
.hist-btn:hover > span:first-child, .hist-cell .hist-btn:hover { text-decoration: underline; }
.hist-chev { display: inline-block; margin-left: 6px; font-size: 10px; transition: transform 0.12s; }
.hist-btn[aria-expanded="true"] .hist-chev { transform: rotate(90deg); }

/* The list itself, shared by the row under a record and the footer. Capped so
   a long history scrolls inside itself instead of pushing the page about. */
.hist-items {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 3px;
  max-height: 168px; overflow-y: auto;
  font-size: 12.5px; color: var(--muted);
}
.hist-none { margin: 0; font-size: 12.5px; color: var(--muted); }
.table-wrap tr.hist-row > td {
  background: #f4f7f9; padding: 8px 12px 10px 26px;
  white-space: normal; cursor: default;
}

/* Footer line: last thing in the Details card and in the password dialog. */
.hist-foot { margin-top: 12px; padding-top: 9px; border-top: 1px solid var(--line); }
.hist-foot:empty { display: none; }
.hist-foot .hist-list { margin-top: 7px; }
#password-history:empty { display: none; }
#password-history .hist-foot { margin-top: 0; }
/* The dialog is already nearly full height at 1366x768, so its list is kept
   short and scrolls inside itself. */
#password-history .hist-items { max-height: 92px; }

/* ---- Lock cover (v1.32) -----------------------------------------------------
   While locked the page is hidden, not removed: visibility keeps every form
   field holding what was typed, which is the whole point of covering the page
   rather than going back to the sign-in screen. Other open dialogs are hidden
   too — they sit above the page and would otherwise show through. */
body.locked > *:not(dialog):not(#toast) { visibility: hidden; }
body.locked dialog:not(#lock-dialog):not(#twofa-dialog) { visibility: hidden; }
#lock-dialog { width: min(440px, 92vw); }
.dlg-note.error { color: var(--danger); font-weight: 500; }
