:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --white: #fff;
  --ink: #18263e;
  --muted: #58667b;
  --line: #dce3ed;
  --blue: #0759e8;
  --pale: #eaf1ff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.6; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
[hidden] { display: none !important; }
a { color: var(--blue); text-underline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 36px; line-height: 1.2; letter-spacing: -.03em; font-weight: 650; }
h2 { font-size: 21px; line-height: 1.3; font-weight: 650; }
h3 { font-size: 17px; font-weight: 650; }
.header, main, footer { width: min(1240px, calc(100% - 64px)); margin: auto; }
.header { min-height: 80px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 650; color: var(--ink); text-decoration: none; }
.brand svg { width: 30px; height: 30px; stroke: var(--blue); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.brand-route { font-size: 12px; font-weight: 500; color: var(--muted); border-left: 1px solid var(--line); padding-left: 12px; }
main { min-height: calc(100svh - 156px); padding: 38px 0 56px; }
.lead { color: var(--muted); font-size: 16px; max-width: 65ch; margin-top: 10px; }
.muted, .fine, .list-help { color: var(--muted); }
.fine { font-size: 12px; line-height: 1.7; margin-top: 18px; }
.list-help { font-size: 13px; margin: 0 0 18px; max-width: 85ch; }
label { display: block; margin: 18px 0 7px; font-size: 13px; font-weight: 600; }
input, textarea { display: block; width: 100%; border: 1px solid #bac7d9; border-radius: 7px; background: var(--white); color: var(--ink); padding: 11px 14px; min-height: 46px; caret-color: var(--blue); }
input::placeholder { color: #64738a; }
textarea { font: 12px/1.7 ui-monospace, Consolas, monospace; resize: vertical; overflow-wrap: anywhere; margin-top: 16px; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 18px; border-radius: 7px; font-size: 14px; font-weight: 600; text-decoration: none; transition: background .15s ease; }
.primary { background: var(--blue); color: white; border: 1px solid var(--blue); }
.primary:hover { background: #0448c0; }
.secondary { background: white; color: var(--ink); border: 1px solid #b8c7db; }
.secondary:hover { background: var(--pale); }
.text-button { padding: 10px 7px; min-height: 44px; background: transparent; color: var(--muted); font-size: 13px; border: 0; }
.text-button:hover { color: var(--blue); }
.full { width: 100%; margin-top: 24px; }
.notice { padding: 14px 18px; border: 1px solid #e9b6b4; border-radius: 8px; background: #fff2f0; color: #8c302e; margin-bottom: 24px; max-width: 75ch; }
.loading { padding: 90px 0; color: var(--muted); }
.login-layout { display: grid; grid-template-columns: 1.18fr 1fr; gap: 100px; align-items: center; min-height: 540px; }
.welcome h1 { max-width: 15ch; font-size: 44px; }
.login-panel { background: white; padding: 36px; border: 1px solid var(--line); border-radius: 14px; }
.login-panel > p { margin-top: 10px; }
.login-panel form { margin-top: 26px; }
.password-field { position: relative; }
.password-field input { padding-right: 91px; }
.password-field button { position: absolute; right: 10px; top: 10px; border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 4px; }
.route-map { margin: 32px 0 24px; font-size: 14px; }
.route-origin { color: var(--muted); }
.route-stem { width: 1px; height: 24px; background: #c4d2e8; margin: 8px 0 8px 20px; }
.route-hub, .route-next { display: flex; align-items: center; gap: 15px; }
.route-hub > span, .route-next > span:not(.route-line) { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 8px; background: var(--blue); color: white; font-size: 12px; font-weight: 700; }
.route-hub small { display: block; color: var(--muted); font-size: 12px; }
.route-next { margin: 12px 0 0 20px; }
.route-next .route-line { width: 20px; height: 21px; border-left: 1px solid #c4d2e8; border-bottom: 1px solid #c4d2e8; align-self: flex-start; }
.route-next > span:not(.route-line) { background: #e3eafa; color: #244573; }
.quiet { color: var(--muted); font-size: 12px; }
.manager-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.create-access { display: flex; align-items: flex-end; gap: 16px; margin: 28px 0 34px; padding: 22px 24px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.create-access > div { flex: 1; max-width: 540px; }
.create-access label { margin-top: 0; }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 12px; }
.list-toolbar h2 span { font-size: 15px; font-weight: 400; color: var(--muted); margin-left: 8px; font-variant-numeric: tabular-nums; }
.list-toolbar input { max-width: 280px; }
.accounts-table { border-collapse: collapse; width: 100%; table-layout: fixed; text-align: left; font-size: 14px; }
.accounts-table th { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.accounts-table th span { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 2px; }
.accounts-table th:first-child { width: 25%; }
.accounts-table th:nth-child(2) { width: 31%; }
.accounts-table th:nth-child(3) { width: 27%; }
.accounts-table th:nth-child(4) { width: 17%; }
.accounts-table td { padding: 17px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.user-row:hover { background: var(--white); }
.user-name { display: block; font-size: 15px; overflow-wrap: anywhere; font-weight: 600; }
.user-meta, .row-feedback { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.row-feedback:empty { display: none; }
.row-error { color: #a02d26; overflow-wrap: anywhere; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.row-action { min-height: 38px; padding: 7px 10px; background: white; border: 1px solid #bac7d9; border-radius: 6px; color: var(--ink); font-size: 13px; white-space: nowrap; }
.row-action:hover, .row-action[aria-expanded=true] { background: var(--pale); border-color: #8da9d2; color: #0348be; }
.user-row[aria-busy=true] { background: var(--pale); }
.protocol-cell::before { display: none; }
.inline-row > td { padding: 24px; background: white; }
.inline-panel { max-width: 650px; margin: auto; }
.inline-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 18px; }
.inline-heading h3 { overflow-wrap: anywhere; }
.inline-qr { display: block; width: 500px; max-width: 100%; height: auto; margin: auto; image-rendering: pixelated; }
.inline-panel > .fine { text-align: center; }
.empty-state { padding: 32px 0; color: var(--muted); }
footer { border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; padding: 22px 0 30px; color: var(--muted); font-size: 11px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: white; border-radius: 7px; padding: 12px 22px; font-size: 13px; max-width: 90vw; z-index: 10; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
::selection { background: #dce9ff; color: var(--ink); }
:focus-visible { outline: 3px solid #91baff; outline-offset: 3px; }
input:focus-visible, textarea:focus-visible { outline-offset: 1px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c2cddd; border-radius: 6px; border: 2px solid var(--bg); }
@media (max-width: 1050px) {
  .accounts-table th:first-child { width: 24%; }
  .accounts-table th:nth-child(2) { width: 28%; }
  .accounts-table th:nth-child(3) { width: 28%; }
  .accounts-table th:nth-child(4) { width: 20%; }
  .login-layout { gap: 40px; }
}
@media (max-width: 720px) {
  .header, main, footer { width: calc(100% - 32px); }
  .header { min-height: 72px; }
  .brand { font-size: 14px; gap: 8px; }
  .brand-route { display: none; }
  main { padding-top: 28px; }
  h1 { font-size: 30px; }
  .manager-heading { align-items: flex-start; }
  .manager-heading .secondary { padding: 8px 10px; font-size: 12px; }
  .manager-heading .lead { font-size: 14px; }
  .create-access { flex-direction: column; align-items: stretch; padding: 18px; margin: 24px 0 28px; }
  .create-access > div { max-width: none; }
  .list-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .list-toolbar input { max-width: none; }
  .accounts-table, .accounts-table tbody { display: block; }
  .accounts-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .accounts-table .user-row { display: block; padding: 18px 0; border-top: 1px solid var(--line); }
  .accounts-table td { display: block; padding: 5px 0; border: 0; }
  .accounts-table .user-cell { padding-bottom: 10px; }
  .protocol-cell::before { display: block; color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: 6px; content: attr(data-label); }
  .row-action { min-height: 42px; padding: 8px 13px; }
  .accounts-table .inline-row { display: block; }
  .inline-row > td { padding: 18px 12px; }
  .inline-heading { align-items: flex-start; gap: 8px; }
  .login-layout { grid-template-columns: 1fr; gap: 30px; min-height: 0; }
  .welcome h1 { font-size: 34px; }
  .login-panel { padding: 24px; }
  footer { flex-direction: column; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

.accounts-table th:nth-child(1){width:28%}.accounts-table th:nth-child(2){width:37%}.accounts-table th:nth-child(3){width:35%}
.rename-trigger { border:0; padding:4px 0; background:transparent; color:var(--ink); text-align:left; text-decoration:underline; text-decoration-style:dotted; text-underline-offset:4px; cursor:pointer; }
.rename-trigger:hover { color:var(--blue); text-decoration-style:solid; }
.rename-form { display:grid; grid-template-columns:minmax(0,1fr) 38px; gap:6px; align-items:center; }
.rename-input { margin:0; min-width:0; width:100%; padding:8px; font-size:14px; }
.rename-save { width:38px; height:38px; border:1px solid #bac7d9; border-radius:6px; background:white; color:#174e37; display:grid; place-items:center; }
.rename-save:hover { background:#edf5ef; }
.rename-save svg { width:21px; height:21px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.rename-cancel { grid-column:1/-1; justify-self:start; border:0; padding:3px 0; color:var(--muted); background:transparent; font-size:12px; text-decoration:underline; text-underline-offset:3px; }
.rename-error { grid-column:1/-1; color:#a02d26; font-size:12px; }
.rename-error:empty { display:none; }
.activity-state { display:flex; gap:6px; align-items:center; margin-top:8px; font-size:12px; color:var(--muted); }
.activity-state::before { content:''; width:7px; height:7px; border-radius:50%; background:currentColor; flex-shrink:0; }
.activity-online { color:#1a643c; }
.activity-unknown { color:#82531b; }
.activity-last { display:block; color:var(--muted); margin-top:3px; font-size:12px; font-variant-numeric:tabular-nums; }

/* Dark surfaces preserve the existing blue action hierarchy. */
:root[data-theme=dark] { color-scheme:dark; --bg:#11151c; --white:#1b222c; --ink:#edf1f7; --muted:#a9b5c5; --line:#364252; --blue:#8bb6ff; --pale:#253854; }
[data-theme=dark] input, [data-theme=dark] textarea { border-color:#62748b; }
[data-theme=dark] input::placeholder { color:#a9b5c5; }
[data-theme=dark] .secondary, [data-theme=dark] .row-action, [data-theme=dark] .rename-save, [data-theme=dark] .login-panel, [data-theme=dark] .inline-row>td { background:var(--white); color:var(--ink); border-color:#62748b; }
[data-theme=dark] .primary, [data-theme=dark] .route-hub>span { color:#111b2c; }
[data-theme=dark] .primary:hover { background:#b0ceff; }
[data-theme=dark] .secondary:hover, [data-theme=dark] .row-action:hover, [data-theme=dark] .row-action[aria-expanded=true], [data-theme=dark] .rename-save:hover { background:var(--pale); color:var(--blue); }
[data-theme=dark] .notice { background:#382326; border-color:#97565e; color:#ffb5b5; }
[data-theme=dark] .row-error, [data-theme=dark] .rename-error { color:#ffb5b5; }
[data-theme=dark] .activity-online { color:#83d9a5; }
[data-theme=dark] .activity-unknown { color:#efc17e; }
[data-theme=dark] #toast { background:#dce8fc; color:#162136; }
[data-theme=dark] ::selection { background:#385e91; color:#fff; }
[data-theme=dark] ::-webkit-scrollbar-thumb { background:#62748b; }
.inline-qr { background:#fff; }
#theme-toggle { margin-left:auto; flex-shrink:0; }
.user-cell { position:relative; }
.accounts-table .user-cell { padding-left:52px; }
.drag-handle { position:absolute; left:4px; top:20px; width:40px; height:44px; padding:10px; border:0; border-radius:6px; background:transparent; color:var(--muted); cursor:grab; touch-action:none; }
.drag-handle svg { width:20px; height:24px; fill:currentColor; }
.drag-handle:hover { background:var(--pale); color:var(--blue); }
.drag-handle:disabled { cursor:default; }
.user-row.dragging { background:var(--pale); outline:2px solid var(--blue); outline-offset:-2px; }
.dragging .drag-handle { cursor:grabbing; }
.icon-action { display:inline-flex; align-items:center; justify-content:center; width:38px; height:38px; padding:8px; }
.icon-action svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.activity-updated { color:var(--muted); font-size:12px; margin-bottom:8px; font-variant-numeric:tabular-nums; }
.accounts-table td { padding-top:10px; padding-bottom:10px; }
.activity-state { display:inline-flex; margin-top:2px; margin-right:10px; }
.activity-last { display:inline; font-size:12px; }
.drag-handle { top:10px; }
@media(max-width:720px) { .accounts-table .user-row { padding:10px 0; } .row-action.icon-action { width:44px; height:44px; padding:10px; } .protocol-cell { display:flex !important; align-items:center; gap:8px; } .protocol-cell::before { flex:1; margin-bottom:0; } .row-actions { gap:4px; } .drag-handle { top:4px; } }
@media(max-width:720px) { .brand { max-width:55%; } .header { gap:4px; flex-wrap:wrap; } .accounts-table .user-cell { padding-left:48px; } .drag-handle { top:4px; } }

/* Destructive profile action stays separate from configuration exports. */
.accounts-table .user-cell { padding-right:14px; }
.delete-account { position:static; color:#a02d26; }
.delete-account:hover { color:#8b1f1f; background:#fff0f0; }
[data-theme=dark] .delete-account { color:#ffb5b5; }
[data-theme=dark] .delete-account:hover { color:#ffd1d1; background:#382326; }
.delete-account:focus-visible { outline:2px solid var(--blue); outline-offset:3px; }

/* Separate trailing column: vertically aligned with export controls. */
.accounts-table th:nth-child(1) { width:28%; }
.accounts-table th:nth-child(2) { width:35%; }
.accounts-table th:nth-child(3) { width:32%; }
.accounts-table th:nth-child(4) { width:5%; }
.accounts-table .delete-cell { text-align:right; vertical-align:middle; }
@media(max-width:720px) {
 .accounts-table .user-row { position:relative; }
 .accounts-table .user-cell { padding-right:52px; }
 .accounts-table .delete-cell { position:absolute; right:0; top:10px; padding:0; }
}
