/* Shared colors keep every screen in the selected theme. */
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f7f8fb;
  --surface-hover: #f0f3f9;
  --input-bg: #ffffff;
  --sidebar-bg: #f0f2f6;
  --sidebar-hover: #e7ebf2;
  --text: #252b38;
  --text-secondary: #505d71;
  --muted: #5f6d82;
  --placeholder: #788497;
  --line: #dfe4ec;
  --line-strong: #c8d0dc;
  --accent: #4f5bd5;
  --accent-hover: #404cc3;
  --accent-text: #4352c3;
  --accent-on: #ffffff;
  --accent-soft: #edf0ff;
  --accent-line: #ccd4ff;
  --focus: #6776ed;
  --success: #237452;
  --success-bg: #edf7f1;
  --success-line: #bfdfcd;
  --warning: #8a5c17;
  --warning-bg: #fff7e8;
  --warning-line: #ebd4a7;
  --danger: #b9364b;
  --danger-hover: #a1283c;
  --danger-bg: #fff1f3;
  --danger-line: #efc8d0;
  --danger-on: #ffffff;
  --purple: #7150ad;
  --purple-bg: #f1ecfa;
  --overlay: rgb(15 20 32 / 44%);
  --shadow: 0 10px 35px rgb(24 33 54 / 6%);
  --dialog-shadow: -16px 0 60px rgb(15 22 40 / 14%);
  --toast-bg: #293247;
  --toast-text: #f8faff;
  --toast-line: #424f6b;
  --sidebar-width: 224px;
  --radius: 24px;
  --radius-control: 14px;
  --radius-small: 8px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101318;
  --surface: #191d26;
  --surface-soft: #161a22;
  --surface-hover: #222835;
  --input-bg: #141820;
  --sidebar-bg: #14181f;
  --sidebar-hover: #222834;
  --text: #e8edf6;
  --text-secondary: #c0c9d8;
  --muted: #9ba7bb;
  --placeholder: #8591a6;
  --line: #303744;
  --line-strong: #465165;
  --accent: #8995ff;
  --accent-hover: #a0aaff;
  --accent-text: #acb6ff;
  --accent-on: #11162e;
  --accent-soft: #252c46;
  --accent-line: #414e7a;
  --focus: #a5b0ff;
  --success: #8bdfb7;
  --success-bg: #172c24;
  --success-line: #2c5744;
  --warning: #e5be79;
  --warning-bg: #2d2518;
  --warning-line: #605033;
  --danger: #f195a7;
  --danger-hover: #ffacbb;
  --danger-bg: #32202a;
  --danger-line: #67404e;
  --danger-on: #2a1018;
  --purple: #c5acf2;
  --purple-bg: #2b2440;
  --overlay: rgb(3 6 12 / 68%);
  --shadow: 0 10px 35px rgb(0 0 0 / 16%);
  --dialog-shadow: -16px 0 60px rgb(0 0 0 / 35%);
  --toast-bg: #edf0ff;
  --toast-text: #20283c;
  --toast-line: #cdd6f2;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
form { min-width: 0; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 27px; font-weight: 650; line-height: 1.35; letter-spacing: -.65px; }
h2 { margin-bottom: 14px; font-size: 19px; font-weight: 650; line-height: 1.45; }
h3 { font-size: 16px; }
p { margin-bottom: 16px; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.required { color: var(--danger); }
.word-break { overflow-wrap: anywhere; }
[hidden] { display: none !important; }

:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
input, select, textarea {
  max-width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--input-bg);
  color: var(--text);
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--placeholder); opacity: 1; }
input:disabled, select:disabled, textarea:disabled { color: var(--muted); background: var(--surface-soft); cursor: not-allowed; }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
input[type="checkbox"], input[type="radio"] {
  width: 17px;
  min-height: 0;
  height: 17px;
  margin: 3px 4px 0 0;
  padding: 0;
  vertical-align: middle;
  accent-color: var(--accent);
  flex-shrink: 0;
}
input[type="file"] { padding: 8px; }
input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--surface-soft);
  color: var(--text-secondary);
  cursor: pointer;
}
textarea { resize: vertical; }
::selection { background: var(--accent-soft); color: var(--text); }

.icon { display: inline-block; width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 1000; top: -80px; left: 16px; padding: 12px 20px; background: var(--surface); border: 1px solid var(--accent-line); border-radius: var(--radius-control); }
.skip-link:focus { top: 16px; }

/* Navigation and workspace. */
.app-layout { display: flex; min-height: 100dvh; }
.sidebar {
  position: fixed;
  inset: 12px auto 12px 12px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  padding: 25px 14px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sidebar-bg);
  color: var(--text-secondary);
}
.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; margin: 0 0 32px; padding: 0 10px; color: var(--text); font-size: 21px; font-weight: 650; line-height: 1.3; letter-spacing: -.3px; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; }
.brand-logo { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: .2px; }
.nav-label { display: flex; justify-content: space-between; margin: 0 12px 9px; color: var(--muted); font-size: 12px; font-weight: 550; }
.main-nav { display: flex; flex-direction: column; gap: 4px; }
.main-nav a { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 9px 12px; border: 1px solid transparent; border-radius: var(--radius-control); color: var(--text-secondary); font-size: 14px; }
.main-nav a > span:first-child { display: inline-flex; justify-content: center; width: 18px; flex-shrink: 0; }
.main-nav a:hover { background: var(--sidebar-hover); color: var(--text); text-decoration: none; }
.main-nav a[aria-current="page"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.sidebar-groups { margin: 25px 0 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.group-nav { display: flex; flex-direction: column; gap: 3px; }
.group-nav button { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 8px 12px; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; color: var(--text-secondary); font-size: 13px; text-align: left; }
.group-nav button > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-nav button.active, .group-nav button:hover { background: var(--sidebar-hover); color: var(--text); }
.group-nav small { margin-left: auto; padding-left: 4px; color: var(--muted); }
.group-dot { width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: var(--muted); }
.group-nav button.active .group-dot { background: var(--accent); }
.sidebar-bottom { margin-top: auto; padding: 22px 8px 0; font-size: 12px; color: var(--muted); }
.status-dot { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: var(--success); vertical-align: 1px; }
.sidebar-user { display: flex; align-items: center; gap: 9px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: var(--accent-text); font-size: 13px; font-weight: 600; }
.user-name { min-width: 0; flex: 1; color: var(--text); font-size: 13px; overflow-wrap: anywhere; }
.user-name small { display: block; color: var(--muted); }
.logout-button { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 7px; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; color: var(--muted); font-size: 20px; }
.logout-button:hover { background: var(--sidebar-hover); color: var(--text); }
.workspace { width: calc(100% - var(--sidebar-width) - 12px); min-width: 0; margin-left: calc(var(--sidebar-width) + 12px); }
.topbar { position: sticky; top: 12px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 68px; margin: 12px 28px 0; padding: 0 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text-secondary); font-size: 13px; }
.topbar > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumb-separator { margin: 0 10px; color: var(--muted); }
.topbar-note { color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar > .topbar-actions { flex: 1; }
.topbar-actions > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar > .theme-switch { flex-shrink: 0; }
.mobile-user-actions { display: none; }
.mobile-nav-toggle.icon-button { display: none; }
.nav-backdrop { display: none; }
.main-content { width: 100%; max-width: 1900px; min-width: 0; margin: 0 auto; padding: 28px; }
.page-heading, .section-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 0 22px; }
.page-heading > div:first-child, .section-header > div:first-child { min-width: 0; }
.page-heading p:last-child, .section-header p:last-child { margin-bottom: 0; color: var(--muted); font-size: 14px; }
.page-heading h1, .section-header h1 { overflow-wrap: anywhere; }
.eyebrow { margin-bottom: 8px; color: var(--accent-text); font-size: 12px; font-weight: 600; letter-spacing: .8px; }
.heading-actions, .form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.heading-actions { flex-shrink: 0; }
.form-actions { margin-top: 20px; }

.theme-switch { display: inline-flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface-soft); }
.theme-switch button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 34px; min-height: 32px; padding: 5px 9px; border: 1px solid transparent; border-radius: var(--radius-small); background: transparent; color: var(--muted); font-size: 12px; }
.theme-switch button:hover { background: var(--surface-hover); color: var(--text); }
.theme-switch button[aria-pressed="true"] { border-color: var(--line-strong); background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 6%); }
.theme-switch .icon { width: 16px; height: 16px; }

/* Buttons and compact account overview. */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 9px 15px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--surface); color: var(--text-secondary); font-size: 13px; font-weight: 550; line-height: 1.5; text-align: center; text-decoration: none; }
.button:hover { background: var(--surface-hover); text-decoration: none; }
.button-primary { border-color: var(--accent); background: var(--accent); color: var(--accent-on); }
.button-primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.button-secondary, .button.secondary { border-color: var(--line-strong); background: var(--surface); color: var(--text-secondary); }
.button-secondary:hover, .button.secondary:hover { background: var(--surface-hover); color: var(--text); }
.button-danger { border-color: var(--danger); background: var(--danger); color: var(--danger-on); }
.button-danger:hover { border-color: var(--danger-hover); background: var(--danger-hover); }
.button-compact { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.button-link { min-height: 30px; padding: 4px 3px; border: 0; border-radius: var(--radius-small); background: transparent; color: var(--accent-text); font-size: 12px; white-space: nowrap; }
.button-link:hover { background: var(--accent-soft); text-decoration: none; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 32px; min-height: 32px; padding: 5px 7px; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; color: var(--text-secondary); font-size: 14px; line-height: 1.3; }
.icon-button:hover { background: var(--surface-hover); color: var(--accent-text); }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 20px; padding: 0 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.summary-card { display: flex; align-items: center; min-width: 0; min-height: 40px; margin: 12px 0; padding: 0 20px; border-right: 1px solid var(--line); }
.summary-card:last-child { border-right: 0; }
.summary-card > div { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.summary-card .muted { font-size: 13px; white-space: nowrap; }
.summary-card strong { color: var(--text); font-size: 22px; font-weight: 650; line-height: 1.4; }
.summary-card strong.summary-text { font-size: 15px; }
.summary-icon, .summary-caption { display: none; }

/* Table sizes stay inside the horizontal scroll container. */
.table-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 55px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.view-tabs { display: flex; align-items: center; gap: 8px; }
.view-tab { margin: 8px 0; padding: 7px 12px; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; color: var(--muted); font-size: 13px; font-weight: 550; white-space: nowrap; }
.view-tab.active { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-text); }
.view-tab:hover { color: var(--text); }
.view-tab span { display: inline-block; margin-left: 5px; padding: 0 6px; border-radius: var(--radius-small); background: var(--surface-hover); color: var(--text-secondary); font-size: 12px; }
.view-tab.active span { background: var(--accent-soft); color: var(--accent-text); }
.table-subtitle { color: var(--muted); font-size: 12px; }
.filter-bar { display: flex; align-items: center; gap: 9px; padding: 15px 18px; }
.filter-bar > label { min-width: 0; }
.search-field { position: relative; flex: 1; min-width: 200px; }
.search-field > .icon, .search-field > span:first-child:not(.sr-only) { position: absolute; top: 50%; left: 12px; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field input { width: 100%; min-height: 40px; padding-left: 39px; font-size: 13px; }
.filter-bar select { width: 135px; min-height: 40px; padding: 8px 26px 8px 10px; font-size: 13px; }
.filter-bar #reveal-page { min-height: 40px; font-size: 12px; white-space: nowrap; }
.table-scroll, .table-wrapper, .table-wrap { width: 100%; max-width: 100%; min-width: 0; border-radius: var(--radius-control); overflow: auto; overscroll-behavior-x: contain; scrollbar-color: var(--line-strong) var(--surface-soft); }
.entry-table { width: 100%; min-width: 1120px; border-collapse: separate; border-spacing: 0; table-layout: fixed; text-align: left; font-size: 14px; }
.entry-table th { padding: 11px 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-soft); color: var(--muted); font-size: 12px; font-weight: 550; white-space: nowrap; }
.entry-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.entry-table th:nth-child(1) { width: 19%; }
.entry-table th:nth-child(2) { width: 10%; }
.entry-table th:nth-child(3) { width: 15%; }
.entry-table th:nth-child(4) { width: 13%; }
.entry-table th:nth-child(5) { width: 17%; }
.entry-table th:nth-child(6) { width: 13%; }
.entry-table th:nth-child(7) { width: 13%; }
.entry-table th:first-child, .entry-table td:first-child { padding-left: 18px; }
.entry-table th:last-child, .entry-table td:last-child { padding-right: 18px; }
.entry-table tr:last-child td { border-bottom: 0; }
.entry-table tbody tr:hover { background: var(--surface-hover); }
.entry-table .account-name { max-width: 100%; padding: 0; border: 0; border-radius: var(--radius-small); background: transparent; color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.5; text-align: left; overflow-wrap: anywhere; }
.entry-table .account-name:hover { color: var(--accent-text); text-decoration: underline; }
.account-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.badge { display: inline-block; padding: 1px 6px; border-radius: var(--radius-small); background: var(--accent-soft); color: var(--accent-text); font-size: 12px; line-height: 1.65; white-space: nowrap; vertical-align: middle; }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-orange { background: var(--warning-bg); color: var(--warning); }
.badge-neutral { background: var(--surface-hover); color: var(--muted); }
.account-asset { max-width: 140px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.group-chip { display: inline-block; max-width: 100%; padding: 2px 6px; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--surface-soft); color: var(--text-secondary); font-size: 12px; overflow-wrap: anywhere; }
.mono, code, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.host-value { max-width: 100%; color: var(--text-secondary); font-size: 13px; overflow-wrap: anywhere; }
.port-value, .update-author { margin-top: 3px; color: var(--muted); font-size: 12px; }
.cell-line { display: flex; align-items: flex-start; flex-direction: column; gap: 2px; min-width: 0; }
.username-value { min-width: 0; color: var(--text-secondary); font-size: 13px; overflow-wrap: anywhere; }
.copy-button { min-height: 28px; padding: 3px 5px; flex-shrink: 0; border: 1px solid transparent; border-radius: var(--radius-small); background: transparent; color: var(--accent-text); font-size: 12px; white-space: nowrap; }
.copy-button:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.password-cell { min-width: 0; }
.password-value { display: block; max-width: 100%; color: var(--text-secondary); font-size: 14px; letter-spacing: 2px; overflow-wrap: anywhere; white-space: pre-wrap; }
.password-value.revealed { padding: 2px 0; color: var(--text); font-size: 14px; letter-spacing: 0; user-select: all; }
.password-actions { display: flex; align-items: center; gap: 9px; margin-top: 1px; }
.password-actions button { color: var(--accent-text); font-size: 12px; }
.update-date { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.actions-heading { text-align: right; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; white-space: nowrap; }
.row-actions .button-link { font-size: 12px; }
.row-actions .danger-link { color: var(--danger); }
.row-actions .danger-link:hover { background: var(--danger-bg); }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 59px; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.table-footer p { margin: 0; }
.pagination { display: flex; align-items: center; gap: 10px; }
.pagination label { display: flex; align-items: center; gap: 7px; }
.pagination select { min-height: 32px; padding: 4px 23px 4px 8px; font-size: 12px; }
.pagination button { min-width: 32px; min-height: 32px; padding: 3px 8px; font-size: 18px; line-height: 1; }
.pagination > span { white-space: nowrap; }
.pagination-links { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 20px; font-size: 13px; }
.privacy-footnote { display: flex; align-items: flex-start; gap: 7px; margin: 14px 2px 0; color: var(--muted); font-size: 12px; }
.privacy-footnote .icon { width: 15px; height: 15px; margin-top: 2px; }
.empty-state { padding: 48px 20px 54px; color: var(--muted); text-align: center; }
.empty-state h2 { margin: 15px 0 7px; color: var(--text-secondary); font-size: 17px; }
.empty-state p { max-width: 460px; margin: 0 auto; font-size: 13px; line-height: 1.8; }
.empty-state .button { margin-top: 18px; }
.empty-icon { display: grid; place-items: center; width: 44px; height: 44px; margin: auto; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface-soft); color: var(--muted); font-size: 25px; }
.loading-dot { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Shared forms, management pages, and feedback. */
.card { min-width: 0; margin-bottom: 20px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.card h2 { font-size: 18px; }
.card > p:last-child { margin-bottom: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid > * { min-width: 0; }
.host-fields { grid-template-columns: minmax(0, 1fr) 100px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack > .field, .stack > p { margin-bottom: 0; }
.field, .form-field { display: block; margin-bottom: 18px; color: var(--text-secondary); font-size: 13px; font-weight: 500; }
.field > input, .field > select, .field > textarea, .form-field > input, .form-field > select, .form-field > textarea { display: block; width: 100%; margin-top: 7px; font-size: 14px; font-weight: 400; }
.form-label { display: block; margin-bottom: 7px; color: var(--text-secondary); font-size: 13px; font-weight: 550; }
.form-field input, .auth-form input { width: 100%; }
.field-help, .form-hint, .helptext { display: block; margin: 7px 0 0; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.75; }
.form-hint ul, .helptext ul { margin: 5px 0 0; padding-left: 18px; }
.form-error, .errorlist { margin: 7px 0 0; color: var(--danger); font-size: 12px; font-weight: 400; line-height: 1.7; }
.errorlist { padding-left: 18px; }
.form-error ul { margin: 0; padding-left: 18px; }
.card form p > label { display: block; margin-bottom: 7px; color: var(--text-secondary); font-size: 13px; }
.card form p > input, .card form p > select, .card form p > textarea { width: 100%; }
.card form p > input[type="checkbox"], .card form p > input[type="radio"], .auth-form input[type="checkbox"], .auth-form input[type="radio"] { width: 17px; min-height: 0; }
.checkbox, .checkbox-label { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 16px; color: var(--text-secondary); font-size: 14px; font-weight: 400; }
.section-divider { height: 1px; margin: 6px 0 22px; background: var(--line); }
.form-section-title { margin-bottom: 15px; color: var(--text); font-size: 13px; font-weight: 650; }
.secret-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.password-input { position: relative; margin-top: 7px; }
.password-input input { width: 100%; padding-right: 61px; font-family: "SFMono-Regular", Consolas, monospace; }
.password-input button { position: absolute; top: 5px; right: 5px; font-size: 12px; }
.table-wrapper table, .table-wrap table, .data-table { width: 100%; min-width: 640px; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table-wrapper th, .table-wrap th, .data-table th { padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-soft); color: var(--muted); font-size: 12px; font-weight: 550; text-align: left; }
.table-wrapper td, .table-wrap td, .data-table td { max-width: 380px; padding: 13px 14px; border-bottom: 1px solid var(--line); color: var(--text-secondary); overflow-wrap: anywhere; }
.table-wrapper tr:last-child td, .table-wrap tr:last-child td, .data-table tr:last-child td { border-bottom: 0; }
.table-wrapper tbody tr:hover, .table-wrap tbody tr:hover, .data-table tbody tr:hover { background: var(--surface-hover); }
.table-wrapper td form { display: inline-flex; align-items: center; gap: 7px; }
.table-wrapper input, .table-wrapper select { min-height: 36px; padding: 6px 9px; font-size: 13px; }
.table-wrapper .button { min-height: 36px; padding: 6px 11px; font-size: 12px; }
table thead tr:first-child th:first-child { border-top-left-radius: var(--radius-control); }
table thead tr:first-child th:last-child { border-top-right-radius: var(--radius-control); }
table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius-control); }
table tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius-control); }
.card.table-wrapper { border-radius: var(--radius); }
.table-wrap + form { margin-top: 22px; }
.audit-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.audit-filter select { min-width: 160px; }
.audit-action { font-weight: 550; }
details { margin-bottom: 18px; }
summary { color: var(--accent-text); font-size: 14px; cursor: pointer; }
pre, .recovery-codes { padding: 16px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface-soft); color: var(--text-secondary); font-size: 13px; }
.recovery-codes { white-space: pre-wrap; overflow-wrap: anywhere; }
code { font-size: 13px; overflow-wrap: anywhere; }
.alert { margin: 0 0 18px; padding: 12px 15px; border: 1px solid var(--accent-line); border-radius: var(--radius-control); background: var(--accent-soft); color: var(--accent-text); font-size: 13px; overflow-wrap: anywhere; }
.alert-error, .alert.error { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger); }
.alert-success, .alert.success { border-color: var(--success-line); background: var(--success-bg); color: var(--success); }
.alert-warning, .alert.warning { border-color: var(--warning-line); background: var(--warning-bg); color: var(--warning); }
.alert p:last-child, .alert ul:last-child { margin-bottom: 0; }
.inset-alert { margin: 0 18px 15px; }
.messages { margin-bottom: 18px; }
.messages .alert:last-child { margin-bottom: 0; }
.toast { position: fixed; z-index: 100; bottom: 24px; left: 50%; max-width: min(90vw, 650px); padding: 12px 18px; transform: translateX(-50%); border: 1px solid var(--toast-line); border-radius: var(--radius-control); background: var(--toast-bg); color: var(--toast-text); box-shadow: var(--shadow); font-size: 13px; text-align: center; }

/* Native dialogs preserve keyboard focus and scroll their own content. */
.drawer { width: 540px; max-width: calc(100% - 24px); height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); margin: 12px 12px 12px auto; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--dialog-shadow); }
.drawer::backdrop, .confirm-dialog::backdrop { background: var(--overlay); }
.drawer > form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.drawer-header { display: flex; align-items: flex-start; justify-content: space-between; flex-shrink: 0; gap: 14px; padding: 24px 26px 19px; border-bottom: 1px solid var(--line); }
.drawer-header h2 { margin: 0; color: var(--text); font-size: 21px; }
.drawer-header .icon-button { font-size: 23px; }
.drawer-content { min-height: 0; flex: 1; padding: 23px 26px; overflow-y: auto; overscroll-behavior: contain; }
.drawer-footer { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 10px; padding: 17px 26px; border-top: 1px solid var(--line); background: var(--surface-soft); }
#load-edit-secrets { margin: 12px 0 18px; }
#secret-editor-note { margin-bottom: 0; }
.confirm-dialog { width: 430px; max-width: calc(100vw - 32px); padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.confirm-dialog p { color: var(--text-secondary); font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.details-list { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 16px; margin: 0 0 20px; font-size: 14px; }
.details-list dt { color: var(--muted); }
.details-list dd { margin: 0; color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap; }
.details-list a { word-break: break-all; }
#detail-secrets { margin-top: 23px; }
#details-dialog { display: none; }
#details-dialog[open] { display: flex; flex-direction: column; }

/* Authentication uses the same controls, with a quieter two-column shell. */
.auth-layout { display: flex; flex-direction: column; min-height: 100dvh; padding: 28px 40px 20px; background: var(--bg); }
.auth-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; width: 100%; max-width: 1160px; margin: 0 auto; }
.auth-brand { justify-content: flex-start; margin: 0; padding: 0; }
.auth-shell { display: grid; grid-template-columns: minmax(0, 1fr) 420px; align-items: center; gap: 90px; width: 100%; max-width: 1050px; flex: 1; margin: 0 auto; padding: 60px 0; }
.auth-intro { padding: 12px 0; }
.auth-intro h1, .auth-intro h2 { max-width: 460px; margin-bottom: 20px; color: var(--text); font-size: clamp(30px, 3vw, 40px); font-weight: 600; line-height: 1.45; letter-spacing: -1px; }
.auth-intro > p:not(.eyebrow) { max-width: 410px; color: var(--muted); font-size: 15px; line-height: 1.9; }
.auth-benefits { display: flex; flex-direction: column; gap: 21px; margin: 32px 0 0; padding: 0; list-style: none; }
.auth-benefits li { display: flex; align-items: flex-start; gap: 12px; color: var(--text-secondary); font-size: 14px; line-height: 1.6; }
.auth-benefits .icon { width: 20px; height: 20px; margin-top: 2px; color: var(--accent-text); }
.auth-benefits strong { display: block; color: var(--text-secondary); font-size: 14px; font-weight: 550; }
.auth-benefits small, .auth-benefits p, .auth-benefits div > span { display: block; margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.auth-content { width: 100%; max-width: 440px; min-width: 0; margin: 0 auto; padding: 0; }
.auth-card { width: 100%; max-width: 460px; margin: 0 auto 20px; padding: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.auth-content .auth-card { margin-bottom: 0; }
.auth-card h1 { margin-bottom: 9px; font-size: 24px; letter-spacing: -.45px; }
.auth-card-heading { margin-bottom: 25px; }
.auth-card-heading p:last-child { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.auth-form { margin-top: 22px; }
.auth-form .form-field:last-of-type { margin-bottom: 22px; }
.auth-card .button-primary { min-height: 44px; }
.auth-form > .button, .auth-form > button[type="submit"] { width: 100%; }
.auth-card-footer { margin: 24px 0 0; padding-top: 19px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.8; }
.auth-card-footer p:last-child { margin-bottom: 0; }
.auth-card > a { display: inline-block; margin-top: 18px; font-size: 13px; }
.auth-card form p { font-size: 13px; }
.auth-footer { width: 100%; max-width: 1160px; margin: 0 auto; color: var(--muted); font-size: 12px; text-align: center; }
.auth-footer p { margin: 0; }

@media (max-width: 1280px) {
  .main-content { padding: 24px; }
  .topbar { margin-right: 24px; margin-left: 24px; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar .search-field { flex-basis: 100%; }
  .filter-bar > label:not(.search-field) { flex: 1; }
  .filter-bar select { width: 100%; }
  .table-subtitle { display: none; }
  .entry-table { min-width: 900px; }
  .entry-table th:nth-child(1) { width: 20%; }
  .entry-table th:nth-child(2) { width: 12%; }
  .entry-table th:nth-child(3) { width: 19%; }
  .entry-table th:nth-child(4) { width: 17%; }
  .entry-table th:nth-child(5) { width: 18%; }
  .entry-table th:nth-child(6), .entry-table td:nth-child(6) { display: none; }
  .entry-table th:nth-child(7) { width: 14%; }
  .summary-card { min-height: 55px; padding: 0 16px; }
  .summary-card > div { gap: 9px; }
}

@media (max-width: 1000px) {
  .page-heading { align-items: flex-start; flex-direction: column; gap: 15px; }
  .summary-card > div { align-items: flex-start; flex-direction: column; gap: 2px; }
  .summary-card strong { font-size: 21px; }
  .summary-card strong.summary-text { line-height: 1.9; }
  .topbar-note { display: none; }
  .table-footer { flex-wrap: wrap; gap: 10px; }
  .auth-layout { padding-right: 28px; padding-left: 28px; }
  .auth-shell { grid-template-columns: minmax(0, 1fr) 390px; gap: 45px; }
  .auth-intro h1, .auth-intro h2 { font-size: 31px; }
}

@media (max-width: 760px) {
  body.nav-open { overflow: hidden; }
  .app-layout { display: block; }
  .sidebar { inset: 8px auto 8px 8px; z-index: 60; width: min(280px, calc(100vw - 56px)); visibility: hidden; transform: translateX(-100%); transition: transform 160ms ease, visibility 160ms; pointer-events: none; }
  body.nav-open .sidebar { visibility: visible; transform: translateX(0); box-shadow: var(--dialog-shadow); pointer-events: auto; }
  body.nav-open .nav-backdrop { position: fixed; inset: 0; z-index: 50; display: block; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; background: var(--overlay); }
  .workspace { width: 100%; margin: 0; }
  .topbar { height: 64px; margin: 12px 16px 0; gap: 8px; padding: 0 12px; border-radius: 20px; }
  .topbar > span:first-child { font-size: 12px; }
  .topbar-actions { gap: 7px; }
  .mobile-nav-toggle, .mobile-nav-toggle.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0; padding: 7px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); color: var(--text-secondary); }
  .mobile-nav-toggle:hover { background: var(--surface-hover); }
  .mobile-user-actions { display: flex; align-items: center; gap: 5px; }
  .mobile-user-actions > span { display: none; }
  .main-content { padding: 23px 16px; }
  .page-heading, .section-header { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 20px; }
  h1 { font-size: 25px; }
  .page-heading p:last-child { font-size: 13px; }
  .summary-grid { margin-bottom: 18px; }
  .summary-card { min-height: 54px; margin: 11px 0; padding: 0 13px; }
  .summary-card .muted { font-size: 12px; white-space: normal; }
  .summary-card strong { font-size: 21px; }
  .summary-card strong.summary-text { font-size: 14px; }
  .table-heading { padding: 0 14px; }
  .view-tabs { gap: 8px; }
  .filter-bar { gap: 9px; padding: 14px; }
  .filter-bar > label:not(.search-field) { flex-basis: calc(50% - 5px); }
  .filter-bar #reveal-page { flex-basis: calc(50% - 5px); min-height: 43px; }
  .table-footer { justify-content: center; padding: 13px 14px; }
  .table-footer > p { width: 100%; text-align: center; }
  .pagination { gap: 8px; }
  .pagination button { min-height: 36px; min-width: 36px; }
  .pagination select { min-height: 36px; }
  .privacy-footnote { margin-top: 13px; line-height: 1.75; }
  .card { padding: 20px; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .host-fields { grid-template-columns: minmax(0, 1fr) 90px; gap: 12px; }
  .drawer { max-width: calc(100% - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); margin: 8px 8px 8px auto; }
  .drawer-header { padding: 22px 20px 17px; }
  .drawer-content { padding: 22px 20px; }
  .drawer-footer { padding: 16px 20px; }
  .drawer-footer > .muted { display: none; }
  .drawer-footer > .heading-actions { margin-left: auto; }
  .details-list { grid-template-columns: 78px minmax(0, 1fr); gap: 15px 12px; }
  .confirm-dialog { padding: 23px; }
  .toast { bottom: 16px; width: max-content; max-width: calc(100vw - 28px); }
  .auth-layout { padding: 21px 20px 18px; }
  .auth-header { max-width: 440px; }
  .auth-header .brand { font-size: 20px; }
  .auth-header .brand small { display: none; }
  .auth-shell { display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 20px; max-width: 440px; padding: 36px 0; }
  .auth-intro { padding: 0; text-align: center; }
  .auth-intro h1, .auth-intro h2 { margin: 0; font-size: 26px; line-height: 1.45; letter-spacing: -.5px; }
  .auth-intro > p, .auth-benefits { display: none; }
  .auth-card { padding: 25px; }
  .auth-footer { max-width: 440px; }
  input, select, textarea, .field > input, .field > select, .field > textarea, .form-field > input, .form-field > select, .form-field > textarea, .filter-bar input, .filter-bar select, .pagination select, .table-wrapper input, .table-wrapper select { font-size: 16px; }
}

@media (max-width: 380px) {
  .topbar { padding: 0 12px; }
  .topbar .breadcrumb-separator { margin: 0 5px; }
  .topbar .theme-switch button { min-width: 30px; padding: 5px 6px; }
  .theme-switch button > span { display: none; }
  .summary-card { padding: 0 10px; }
  .summary-card .muted { font-size: 12px; }
  .auth-layout { padding-right: 16px; padding-left: 16px; }
  .auth-card { padding: 22px; }
  .pagination { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media print {
  :root, :root[data-theme="dark"] { color-scheme: light; --bg: #fff; --surface: #fff; --surface-soft: #f5f5f5; --text: #222; --text-secondary: #333; --muted: #555; --line: #ccc; }
  .sidebar, .topbar, .heading-actions, .filter-bar, .password-actions, .row-actions, .pagination, .privacy-footnote, .theme-switch { display: none !important; }
  .workspace { width: 100%; margin: 0; }
  .main-content { padding: 0; }
  .table-scroll { overflow: visible; }
  .entry-table { min-width: 0; font-size: 12px; }
  .password-value.revealed { color: transparent !important; }
  .password-value.revealed::before { content: "已隐藏"; color: var(--muted); }
  dialog { display: none !important; }
}
