:root {
  --bg: #f3f6f8;
  --surface: #fff;
  --surface-soft: #f8fafb;
  --line: #dfe7ec;
  --line-strong: #cbd8df;
  --text: #15212b;
  --muted: #6b7884;
  --primary: #0f6f7c;
  --blue: #376eb7;
  --gold: #b47a2a;
  --violet: #7560b8;
  --accent: #c7852c;
  --danger: #b4443f;
  --success: #20795f;
  --sidebar: #111b24;
  --sidebar-soft: #1d2b36;
  --shadow: 0 18px 40px rgba(24, 37, 49, 0.08);
  --shadow-soft: 0 8px 22px rgba(24, 37, 49, 0.06);
}

* { box-sizing: border-box; }
html { min-width: 0; width: 100%; }
body {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, #fbfcfd 0, #f5f8fa 260px, var(--bg) 720px),
    var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}
body:not(.login-page) > form {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
}
input, select, textarea, button { font: inherit; }
input, select, textarea { min-width: 0; }
.sidebar {
  width: clamp(230px, 16vw, 300px);
  flex: 0 0 clamp(230px, 16vw, 300px);
  min-height: 100vh;
  padding: clamp(18px, 1.3vw, 26px) clamp(14px, 1.1vw, 20px);
  background: linear-gradient(180deg, #0f1a23 0, var(--sidebar) 100%);
  color: #fff;
  position: sticky;
  top: 0;
  box-shadow: 12px 0 26px rgba(18, 28, 37, 0.14);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 8px; background: #f4f7f8; color: #10202c; font-weight: 900;
}
.brand h1, .brand p, .topbar h2, .panel h3 { margin: 0; }
.brand h1 { font-size: 22px; line-height: 1.22; letter-spacing: 0; }
.brand p, .eyebrow, .muted { color: #8a99a5; font-size: 12px; }
.sidebar .brand p { color: #a9b5bf; }
.nav { display: grid; gap: 6px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; border-radius: 8px; padding: 12px 14px;
  color: #d0d9df; text-decoration: none; font-weight: 700;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.nav-badge {
  min-width: 24px; height: 24px; display: inline-grid; place-items: center;
  padding: 0 7px; border-radius: 999px; background: #d28a2f; color: #101d28;
  font-size: 12px; line-height: 1; font-weight: 900;
}
.nav a.active, .nav a:hover {
  background: var(--sidebar-soft); color: #fff; box-shadow: inset 3px 0 0 var(--accent);
}
.user-panel {
  margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.12);
  display: grid; gap: 8px; color: #c8d4dc; font-size: 13px;
}
.inline-switch {
  display: grid;
  gap: 8px;
  margin: 6px 0;
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,.10);
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.inline-switch span {
  color: #aebcc6;
  font-size: 12px;
  font-weight: 800;
}
.inline-switch select,
.inline-switch input {
  min-height: 38px;
  border-color: rgba(255,255,255,.16);
  background: #162532;
  color: #edf5f8;
  font-size: 13px;
  padding: 9px 10px;
}
.inline-switch select:focus,
.inline-switch input:focus {
  border-color: rgba(199, 133, 44, .72);
  box-shadow: 0 0 0 3px rgba(199, 133, 44, .14);
}
.inline-switch .primary {
  justify-content: center;
  min-height: 38px;
  background: #0f7f8d;
  color: #fff;
}
.inline-switch-targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.switch-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  background: #1c303d;
  color: #e8f0f4;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}
.switch-chip:hover {
  background: #24404f;
  border-color: rgba(199, 133, 44, .55);
  color: #fff;
}
.inline-switch-message {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}
.page-switchbar {
  grid-template-columns: minmax(170px, auto) minmax(180px, 240px) minmax(180px, 240px) auto minmax(260px, 1fr);
  align-items: end;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}
.page-switchbar .switchbar-title {
  display: grid;
  gap: 4px;
  align-self: center;
  grid-row: 1 / span 2;
}
.page-switchbar .switchbar-title span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}
.page-switchbar .switchbar-title strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
}
.page-switchbar label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.page-switchbar select,
.page-switchbar input {
  min-height: 42px;
  border-color: var(--line);
  background: #fff;
  color: var(--text);
  font-size: 14px;
}
.page-switchbar .inline-switch-targets {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-column: 2 / 5;
  align-self: end;
}
.page-switchbar .filter-button {
  align-self: end;
  min-height: 42px;
}
.page-switchbar .switch-chip {
  min-height: 42px;
  border-color: var(--line-strong);
  background: #f7fafb;
  color: var(--text);
  font-size: 13px;
}
.page-switchbar .switch-chip:hover {
  background: #eaf6f7;
  border-color: rgba(15,111,124,.45);
  color: var(--primary);
}
.page-switchbar .primary {
  grid-column: 5 / 6;
  min-width: 160px;
  min-height: 42px;
}
.main {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  max-width: none;
  padding: clamp(18px, 2vw, 36px);
}
.surface-ribbon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}
.surface-ribbon span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}
.surface-ribbon strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
  text-align: right;
}
.surface-boss .surface-ribbon span { background: #9b641f; }
.surface-manage .surface-ribbon span { background: #0f6f7c; }
.surface-developer .surface-ribbon span { background: #263340; }
.surface-company .surface-ribbon span { background: #2f6f55; }
.surface-boss .topbar { border-top: 4px solid #b47a2a; }
.surface-manage .topbar { border-top: 4px solid #0f6f7c; }
.surface-developer .topbar {
  border-top: 4px solid #263340;
  background: linear-gradient(135deg, #f7fafb, #eef3f6);
}
.surface-company .topbar { border-top: 4px solid #2f6f55; }
.surface-developer .nav a.active {
  background: #263340;
  box-shadow: inset 3px 0 0 #8fa6b8;
}
.developer-hero {
  background:
    linear-gradient(135deg, #1c2934 0, #263746 55%, #314758 100%);
  color: #fff;
  border-color: #263746;
}
.developer-hero .eyebrow,
.developer-hero .hero-note {
  color: #d1dde6;
}
.developer-hero h2 {
  color: #fff;
}
.developer-status {
  display: grid;
  gap: 6px;
  min-width: 220px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  background: rgba(255,255,255,.08);
}
.developer-status span {
  color: #b8cad7;
  font-size: 12px;
  font-weight: 900;
}
.developer-status strong {
  color: #fff;
  font-size: 18px;
}
.developer-console {
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(420px, 1.1fr);
  gap: 18px;
  margin-bottom: 20px;
}
.developer-card {
  margin-bottom: 0;
  border-top: 4px solid #263340;
}
.developer-status-card {
  background: #fbfcfd;
}
.tech-list {
  display: grid;
  gap: 10px;
}
.tech-list div,
.developer-metrics div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
}
.tech-list span,
.developer-metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.tech-list strong {
  color: var(--text);
  font-size: 15px;
  overflow-wrap: anywhere;
}
.developer-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.developer-metrics strong {
  color: #263340;
  font-size: 34px;
  line-height: 1;
}
.developer-settings {
  border-top: 4px solid #263340;
}
.developer-jump-nav {
  scroll-margin-top: 16px;
}
.smtp-settings-panel {
  border-top-color: #2f6f55;
  scroll-margin-top: 16px;
}
.developer-setting-block {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.developer-setting-block h4 {
  margin: 0 0 12px;
  color: #263340;
  font-size: 18px;
}
.security-panel {
  border-top: 4px solid #0f6f7c;
}
.security-setup {
  display: grid;
  grid-template-columns: minmax(170px, .55fr) minmax(220px, .75fr) minmax(0, 1fr);
  gap: 12px;
  margin: 12px 0 16px;
}
.security-setup > div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}
.security-setup strong,
.security-setup code,
.totp-secret {
  display: block;
  margin: 4px 0 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  overflow-wrap: anywhere;
  white-space: normal;
}
.security-setup span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.totp-qr {
  display: flex;
  min-height: 274px;
  align-items: center;
  justify-content: center;
}
.totp-qr-canvas {
  width: min(270px, 100%);
  height: auto;
  border: 8px solid #fff;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line), 0 12px 24px rgba(15, 23, 42, .12);
  image-rendering: pixelated;
}
.totp-secret {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  line-height: 1.45;
}
.totp-secret-value {
  overflow-wrap: anywhere;
}
.copy-secret {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #0f6f7c;
  border-radius: 8px;
  background: #fff;
  color: #0f6f7c;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}
.copy-secret:hover {
  background: #e9f6f8;
}
.topbar {
  display: flex; justify-content: space-between; gap: 18px; align-items: center;
  margin-bottom: 22px; padding: 22px 24px; border: 1px solid var(--line);
  border-radius: 8px; background: rgba(255,255,255,.92); box-shadow: var(--shadow-soft);
}
.topbar h2 { font-size: 30px; margin-top: 4px; line-height: 1.15; overflow-wrap: anywhere; }
.return-link {
  flex: 0 0 auto;
}
.eyebrow {
  display: inline-flex;
  margin: 0 0 4px;
  color: var(--primary);
  font-weight: 800;
  text-transform: uppercase;
}
.hero-note {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}
.hero-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.dashboard-hero {
  min-height: 136px;
  background:
    linear-gradient(135deg, rgba(15, 111, 124, .09), rgba(199, 133, 44, .07)),
    #fff;
}
.executive-board {
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) repeat(2, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}
.executive-card {
  margin-bottom: 0;
  min-height: 240px;
}
.executive-card .panel-head {
  margin-bottom: 14px;
}
.score-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 8px 0 10px;
}
.score-row strong {
  font-size: 56px;
  line-height: .95;
  color: var(--primary);
}
.score-row em {
  color: var(--muted);
  font-style: normal;
  font-weight: 900;
}
.insight-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-weight: 700;
}
.health-stack {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.health-stack div {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}
.health-stack span,
.health-stack strong,
.health-stack em {
  position: relative;
  z-index: 1;
}
.health-stack span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.health-stack strong {
  color: var(--text);
}
.health-stack em {
  min-width: 28px;
  color: var(--primary);
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}
.health-stack i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.quality-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 10px;
}
.quality-line span {
  color: var(--muted);
  font-weight: 800;
}
.quality-line strong {
  font-size: 30px;
  color: var(--success);
}
.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6edf1;
  margin-bottom: 14px;
}
.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), var(--primary));
}
.mini-stats,
.focus-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.mini-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.mini-stats div,
.focus-list a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbfc;
}
.mini-stats span,
.focus-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.mini-stats strong,
.focus-list strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  line-height: 1;
}
.focus-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}
.focus-list a:hover {
  border-color: rgba(15, 111, 124, .45);
  background: #f0f8f9;
}
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow-soft); padding: 20px; margin-bottom: 20px;
}
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 16px; }
.panel-head > * { min-width: 0; }
.panel-head h3 { font-size: 19px; line-height: 1.25; }
.panel-head span { color: var(--muted); font-weight: 700; }
.credential-search-head {
  align-items: flex-start;
}
.credential-search-tools {
  display: flex;
  flex: 1 1 520px;
  justify-content: flex-end;
  gap: 8px;
}
.credential-search-tools input[type="text"] {
  flex: 1 1 320px;
  max-width: 640px;
}
.credential-search-tools select {
  flex: 0 1 190px;
  min-width: 150px;
}
.credential-search-tools input[type="submit"] {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 800;
}
.search-result-summary {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}
.credential-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.credential-pager-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}
.credential-pager-link:hover {
  border-color: var(--primary);
}
.credential-pager-link.is-current {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.credential-pager-link.is-disabled {
  color: var(--muted);
  opacity: .55;
}
.credential-pager-ellipsis {
  color: var(--muted);
}
.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.notice-panel {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid #f0d7ad;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fffaf1;
}
.notice-panel span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}
.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.type-hint {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #cfe3e7;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: #f1f9fa;
  color: #35525b;
  font-weight: 800;
  line-height: 1.55;
}
.income-profit-preview {
  margin-top: -6px;
  border-color: #d7e7d1;
  border-left-color: #2f7d5d;
  background: #f3faf4;
  color: #244f3c;
}
.field-title {
  display: inline-block;
}
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 18px; margin-bottom: 22px; }
.dashboard-panel {
  min-height: 300px;
}
.dashboard-panel .table-wrap {
  max-height: 360px;
}
.category-board {
  margin-bottom: 22px;
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 14px;
}
.category-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--primary);
  border-radius: 8px;
  background: #fff;
}
.category-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 92px;
}
.category-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef7f8;
  color: var(--primary);
  font-weight: 900;
}
.category-card h4 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}
.category-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.category-tags a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #f7fafb;
  color: #253441;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}
.category-tags a:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eff8f9;
}
.category-manage { border-top-color: var(--primary); }
.category-accounts { border-top-color: var(--blue); }
.category-work { border-top-color: var(--gold); }
.category-company { border-top-color: var(--violet); }
.category-accounts .category-mark { background: #eef4fb; color: var(--blue); }
.category-work .category-mark { background: #fbf5ec; color: var(--gold); }
.category-company .category-mark { background: #f3f0fb; color: var(--violet); }
.single-hidden {
  display: none !important;
}
.single-editor-panel,
.single-list-panel {
  width: 100%;
}
.single-new-link {
  margin-right: 6px;
}
.narrow-panel {
  max-width: 760px;
}
.wide { grid-column: 1 / -1; }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 700; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 8px; padding: 11px 12px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(15, 111, 124, .55);
  box-shadow: 0 0 0 3px rgba(15, 111, 124, .11);
}
input[readonly] { background: #e8edf1; color: var(--muted); }
.dropzone-lite {
  border: 1px dashed #9bb2c2;
  border-radius: 10px;
  padding: 22px;
  background: #f8fbfc;
  text-align: center;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.dropzone-lite input { margin: 10px auto; max-width: 360px; }
.dropzone-lite input.kept-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  margin: 0;
}
.dropzone-lite span { color: var(--muted); font-size: 13px; font-weight: 600; }
.dropzone-lite strong { display: block; color: var(--text); font-size: 18px; margin-bottom: 8px; }
.dropzone-lite.drag-over {
  border-color: var(--primary);
  background: #eef8fb;
  box-shadow: inset 0 0 0 2px rgba(20, 108, 136, .12);
}
.selected-files {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}
.selected-files.empty {
  color: var(--muted);
  font-weight: 700;
}
.selected-files-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  margin-bottom: 8px;
}
.selected-files-head span {
  color: var(--muted);
  font-size: 13px;
}
.selected-files ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.selected-files li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
}
.selected-files small {
  color: var(--muted);
  white-space: nowrap;
}
.upload-warning {
  margin: 10px 0 0;
  color: var(--danger);
  font-weight: 700;
  font-size: 13px;
}
.download-link { color: var(--primary); font-weight: 800; text-decoration: none; }
.download-link:hover { text-decoration: underline; }
.download-tools {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fafb;
}
.download-tools .fields {
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
}
.download-tools .actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.download-tools .btn {
  justify-content: center;
}
.account-preview {
  margin-top: 18px;
  box-shadow: none;
}
.copy-box {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #f7fafb;
}
.quick-import {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 18px;
  background: #f7fafb;
}
.quick-import .panel-head {
  margin-bottom: 10px;
}
.copy-box textarea,
.copy-textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.55;
  white-space: pre-wrap;
}
.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.preview-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f7fafb;
}
.preview-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 5px;
}
.preview-grid strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}
.preview-qr {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}
.preview-qr span,
.preview-qr strong {
  display: block;
}
.preview-qr span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.preview-qr img {
  display: block;
  width: min(260px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.reminder-mail {
  margin-bottom: 20px;
}
.income-editor-panel.is-active {
  border-color: rgba(15, 111, 124, .45);
  box-shadow: 0 14px 32px rgba(15, 111, 124, .14);
}
.income-editor-panel > .form-message {
  margin-bottom: 14px;
}
.form-message {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
}
p > .muted,
.panel-head > .muted,
#ExchangeMessage > .muted,
#FundMessage > .muted {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  margin: 8px 0 0 8px;
  padding: 8px 12px;
  border: 1px solid #b7dec7;
  border-radius: 8px;
  background: #eaf7ef;
  color: #20795f;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
}
p > .muted::before,
.panel-head > .muted::before,
#ExchangeMessage > .muted::before,
#FundMessage > .muted::before {
  content: "OK";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 18px;
  border-radius: 999px;
  background: #20795f;
  color: #fff;
  font-size: 12px;
  line-height: 1;
}
p > .danger,
.panel-head > .danger,
#ExchangeMessage > .danger,
#FundMessage > .danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  margin: 8px 0 0 8px;
  padding: 8px 12px;
  border: 1px solid #ffd2ce;
  border-radius: 8px;
  background: #fff4f3;
  color: var(--danger);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
}
p > .danger::before,
.panel-head > .danger::before,
#ExchangeMessage > .danger::before,
#FundMessage > .danger::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}
.form-message-success {
  background: #eaf7ef;
  color: #20795f;
  border-color: #b7dec7;
}
.form-message-edit {
  background: #f1f9fa;
  color: #0f6f7c;
  border-color: #b9dce2;
}
.form-message-error {
  background: #fff4f3;
  color: var(--danger);
  border-color: #ffd2ce;
}
.form-message .inline-action-link {
  margin-left: 8px;
  color: inherit;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.edit-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #b9dce2;
  border-radius: 8px;
  background: #f1f9fa;
  color: #0f6f7c;
}
.edit-mode-banner div {
  display: grid;
  gap: 3px;
}
.edit-mode-banner strong {
  font-size: 15px;
}
.edit-mode-banner span {
  color: #44747c;
  font-weight: 800;
}
.editing-row td {
  background: #f1f9fa;
  box-shadow: inset 4px 0 0 var(--primary);
}
.reminder-mail-fields {
  grid-template-columns: minmax(260px, 420px) 1fr;
  align-items: end;
}
button, .btn {
  border: 1px solid transparent; min-height: 40px; border-radius: 8px; padding: 10px 14px;
  cursor: pointer; font-weight: 800; text-decoration: none; display: inline-flex; align-items: center;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(15, 111, 124, .18); }
.ghost { background: #fff; border-color: var(--line-strong); color: var(--text); }
.primary:hover, .ghost:hover { transform: translateY(-1px); }
.danger { background: #fff4f3; color: var(--danger); border-color: #ffd2ce; }
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 13px;
}
.status-success {
  background: #eaf7ef;
  color: #25794a;
}
.status-failure {
  background: #fff0ed;
  color: #b74435;
}
.feedback-total { border-top: 4px solid var(--primary); }
.feedback-success { border-top: 4px solid #2f7d55; }
.feedback-fail { border-top: 4px solid #b74435; }
.feedback-analysis {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
}
.analysis-ring {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(21, 33, 43, .04);
}
.analysis-ring::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}
.analysis-ring strong,
.analysis-ring span {
  position: relative;
  z-index: 1;
  display: block;
  text-align: center;
}
.analysis-ring strong {
  font-size: 22px;
  line-height: 1;
}
.analysis-ring span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.analysis-copy h3 {
  margin: 0 0 8px;
  font-size: 22px;
}
.analysis-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-weight: 700;
}
.analysis-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f5f8fa; color: #41515e; font-size: 13px; }
td { color: #24313b; }
.table-wrap tr:hover td { background: #fbfcfd; }
.table-wrap {
  overflow: auto;
  max-width: 100%;
  max-height: min(620px, 58vh);
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.table-wrap table {
  min-width: 760px;
}
.table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.grid-pager td {
  position: sticky;
  bottom: 0;
  z-index: 1;
  background: #f7fafb;
  padding: 10px;
}
.grid-pager table {
  min-width: 0;
  width: auto;
  margin: 0 auto;
}
.grid-pager a,
.grid-pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 32px;
  margin: 0 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
}
.grid-pager span {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.table-wrap input[type="button"],
.table-wrap input[type="submit"],
.table-wrap .btn {
  min-height: 36px;
  padding: 8px 12px;
  white-space: nowrap;
}
.inline-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 260px;
}
.inline-actions input[type="text"] {
  width: 96px;
  min-height: 36px;
  padding: 6px 8px;
}
.inline-actions input[type="submit"] {
  padding: 6px 10px;
}
.settlement-state {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.settlement-state-done {
  background: #eaf7ef;
  color: #20795f;
}
.settlement-state-partial {
  background: #fff7e8;
  color: #9b6515;
}
.metric {
  border-top: 0;
  min-height: 128px;
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: space-between;
  gap: 10px;
  padding: 20px;
}
.metric::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 4px;
  background: var(--primary);
}
.metric:nth-child(2)::before { background: var(--blue); }
.metric:nth-child(3)::before { background: var(--gold); }
.metric:nth-child(4)::before { background: var(--violet); }
.metric::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 18px;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(15, 111, 124, .12), rgba(15, 111, 124, .03));
}
.metric:nth-child(2)::after { background: rgba(47, 111, 209, 0.09); }
.metric:nth-child(3)::after { background: rgba(185, 118, 24, 0.1); }
.metric:nth-child(4)::after { background: rgba(110, 90, 199, 0.1); }
.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  position: relative;
  z-index: 1;
}
.metric strong {
  display: block;
  font-size: 30px;
  line-height: 1.1;
  position: relative;
  z-index: 1;
}
.metric em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
  position: relative;
  z-index: 1;
}
.metric-positive strong { color: #176f58; }
.metric-alert strong { color: #1c2934; }
.finance-status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.finance-status div {
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 15px;
  background: var(--surface-soft);
}
.finance-status span,
.share-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.finance-status strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  line-height: 1.35;
}
.finance-profit-panel {
  border-top: 4px solid var(--primary);
}
.finance-expense-panel {
  border-top: 4px solid #c9802e;
}
.finance-chart-grid {
  align-items: stretch;
}
.compact-chart-panel {
  padding-bottom: 16px;
}
.compact-chart-panel .panel-head {
  margin-bottom: 10px;
}
.finance-profit-status {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.finance-profit-status div {
  border-left-color: #176f58;
}
.finance-expense-status {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.finance-expense-status div {
  border-left-color: #c9802e;
}
.finance-topbar {
  border-left: 5px solid #263340;
}
.monthly-ledger-panel {
  overflow: hidden;
  padding: 0;
  border-top: 4px solid #263340;
}
.monthly-ledger-header,
.monthly-section-head,
.monthly-focus-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.monthly-ledger-header {
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line);
}
.section-kicker {
  margin: 0 0 5px;
  color: #0f6f7c;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.monthly-ledger-header h3,
.monthly-section-head h4 {
  margin: 0;
  color: var(--text);
}
.monthly-ledger-header h3 {
  font-size: 22px;
}
.monthly-ledger-header > div:first-child > span,
.monthly-section-head > div > span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.monthly-ledger-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(132px, 1fr));
  gap: 10px;
  min-width: 300px;
}
.monthly-ledger-filters label {
  display: grid;
  gap: 5px;
}
.monthly-ledger-filters label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.monthly-ledger-filters select {
  width: 100%;
  min-height: 40px;
  padding: 8px 34px 8px 11px;
  border-color: var(--line-strong);
  background-color: #fff;
  font-weight: 800;
}
.monthly-focus-bar {
  align-items: flex-start;
  padding: 16px 22px;
  background: #263340;
  color: #fff;
}
.monthly-focus-bar > div {
  display: grid;
  gap: 3px;
  min-width: 210px;
}
.monthly-focus-bar span,
.monthly-focus-bar small {
  color: #c7d3da;
  font-size: 12px;
  font-weight: 800;
}
.monthly-focus-bar strong {
  font-size: 20px;
}
.monthly-focus-bar p {
  max-width: 640px;
  margin: 0;
  color: #dce5ea;
  font-size: 13px;
  line-height: 1.65;
  text-align: right;
}
.monthly-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}
.monthly-kpi {
  min-width: 0;
  min-height: 132px;
  padding: 18px;
  border-top: 4px solid #0f6f7c;
  border-right: 1px solid var(--line);
  background: #fff;
}
.monthly-kpi:last-child {
  border-right: 0;
}
.monthly-kpi.profit { border-top-color: #2f6fd1; }
.monthly-kpi.expense-cny { border-top-color: #c9802e; }
.monthly-kpi.expense-usd { border-top-color: #b74435; }
.monthly-kpi.net { border-top-color: #6749a7; }
.monthly-kpi > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.monthly-kpi > span em {
  color: inherit;
  font-size: 10px;
  font-style: normal;
}
.monthly-kpi > strong {
  display: block;
  margin: 9px 0 7px;
  color: var(--text);
  font-size: 28px;
  line-height: 1.1;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.monthly-kpi.income > strong { color: #0f6f7c; }
.monthly-kpi.profit > strong { color: #2f6fd1; }
.monthly-kpi.expense-cny > strong { color: #9b6515; }
.monthly-kpi.expense-usd > strong { color: #b74435; }
.monthly-kpi.net > strong { color: #6749a7; }
.month-change {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.4;
  white-space: normal;
}
.change-good { color: #176f58; }
.change-bad { color: #b74435; }
.change-neutral { color: var(--muted); }
.monthly-chart-block,
.monthly-ledger-table-block,
.expense-difference-block {
  padding: 22px;
  border-bottom: 1px solid var(--line);
}
.expense-difference-block {
  border-bottom: 0;
}
.monthly-section-head {
  margin-bottom: 14px;
}
.monthly-section-head h4 {
  font-size: 17px;
}
.chart-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chart-legend span::before {
  width: 11px;
  height: 11px;
  background: #0f6f7c;
  content: "";
}
.chart-legend .legend-expense::before { background: #c9802e; }
.chart-legend .legend-net::before {
  height: 3px;
  background: #2f6fd1;
}
.monthly-chart-wrap {
  width: 100%;
  min-height: 260px;
}
.monthly-chart-wrap canvas {
  display: block;
  width: 100%;
  height: 260px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.monthly-chart-wrap .empty-note {
  display: none;
  min-height: 180px;
  align-items: center;
  justify-content: center;
}
.monthly-table-wrap,
.expense-difference-table-wrap {
  border-radius: 6px;
}
.monthly-ledger-table {
  min-width: 1080px;
  font-variant-numeric: tabular-nums;
}
.monthly-ledger-table th,
.expense-difference-table th {
  background: #f2f6f7;
  color: #52626c;
  font-size: 11px;
  text-transform: uppercase;
}
.monthly-ledger-table tbody tr.is-selected td {
  background: #edf7f8;
}
.monthly-ledger-table tbody tr.is-selected td:first-child {
  box-shadow: inset 4px 0 0 #0f6f7c;
}
.monthly-ledger-table tbody tr.is-empty td {
  color: #87959d;
  background: #fbfcfc;
}
.month-cell {
  min-width: 150px;
}
.month-cell a,
.month-cell span,
.amount-cell strong {
  display: block;
}
.month-cell a {
  color: #0f6f7c;
  font-weight: 900;
}
.month-cell span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.amount-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.amount-cell > strong {
  color: var(--text);
  font-size: 14px;
}
.net-cell > strong {
  color: #6749a7;
}
.expense-difference-summary {
  display: grid;
  grid-template-columns: minmax(180px, .32fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid #d7e2e6;
  border-left: 4px solid #c9802e;
  border-radius: 6px;
  background: #f8fafb;
}
.expense-difference-summary > div {
  display: grid;
  align-content: start;
  gap: 5px;
}
.expense-difference-summary span {
  color: #9b6515;
  font-size: 11px;
  font-weight: 900;
}
.expense-difference-summary strong {
  color: var(--text);
}
.expense-difference-summary ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 19px;
  color: #43525c;
  font-size: 13px;
  line-height: 1.55;
}
.expense-difference-table {
  min-width: 760px;
}
.expense-difference-table td:first-child {
  min-width: 190px;
}
.currency-tag {
  color: #52626c;
  font-size: 12px;
  font-weight: 900;
}
.income-feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #cfe3e7;
  border-radius: 8px;
  background: #f1f9fa;
}
.income-feedback span {
  color: var(--muted);
  font-weight: 800;
}
.income-feedback strong {
  color: var(--text);
}
.kline-wrap {
  width: 100%;
  min-height: 220px;
}
.kline-wrap canvas {
  display: block;
  width: 100%;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.expense-trend-wrap {
  margin-top: 0;
}
.expense-trend-wrap canvas {
  height: 220px;
}
.share-list {
  display: grid;
  gap: 12px;
}
.fund-balance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.fund-balance-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
}
.fund-balance-item strong,
.fund-balance-item span {
  display: block;
}
.fund-balance-item strong {
  margin-bottom: 8px;
}
.fund-balance-item span {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.6;
}
.share-item {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 14px;
}
.share-item strong {
  display: block;
  margin-bottom: 5px;
}
.progress {
  height: 11px;
  background: #f1f6f8;
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0 0;
  border: 1px solid #dce6eb;
}
.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.section-switch { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow-soft); }
.section-switch a { background: #f7fafb; color: var(--muted); border: 1px solid transparent; border-radius: 8px; padding: 10px 14px; text-decoration: none; font-weight: 800; }
.section-switch a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.section-switch.compact-switch {
  margin-bottom: 14px;
  padding: 8px;
}
.section-switch .switch-filter {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}
.section-switch .switch-filter select {
  width: auto;
  min-width: 150px;
  padding: 9px 12px;
}
.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(320px, 52vh) auto auto;
}
.chat-scroll {
  min-height: 320px;
  max-height: 52vh;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fafb;
  -webkit-overflow-scrolling: touch;
}
.chat-message {
  max-width: min(760px, 92%);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(31, 45, 61, 0.06);
}
.chat-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 8px;
}
.chat-meta span,
.chat-attachments,
.chat-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.chat-text {
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: normal;
}
.chat-attachments {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.contract-files {
  display: grid;
  gap: 10px;
}
.contract-file-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.contract-file-row strong {
  overflow-wrap: anywhere;
}
.contract-file-row span {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
.perm-on,
.perm-off {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.perm-on {
  background: #e8f4f0;
  color: var(--success);
}
.perm-off {
  background: #fff4f3;
  color: var(--danger);
}
.todo-row.todo-open td {
  background: #fffaf0;
}
.todo-row.todo-done td {
  background: #f1faf6;
  color: #586876;
}
.todo-row.todo-review td {
  background: #f5f2ff;
}
.todo-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.todo-status-open {
  background: #fff3cf;
  color: #9a6400;
}
.todo-status-active {
  background: #e8f2ff;
  color: #2f6fd1;
}
.todo-status-review {
  background: #eee9ff;
  color: #6749a7;
}
.todo-status-problem {
  background: #fff0ee;
  color: #b74435;
}
.todo-status-done {
  background: #e8f4f0;
  color: var(--success);
}
.todo-filter-switch a {
  padding: 8px 10px;
  font-size: 12px;
}
.staff-order-grid {
  grid-template-columns: minmax(0, 1fr);
}
.todo-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 210px;
}
.todo-row-actions .btn {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
  white-space: nowrap;
}
.todo-page-message {
  min-height: 0;
  margin: 0 0 14px;
}
.todo-detail-header {
  align-items: center;
}
.todo-summary-panel {
  border-top: 4px solid var(--primary);
}
.todo-summary-grid,
.todo-review-request {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.todo-summary-grid > div,
.todo-review-request > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}
.todo-summary-grid span,
.todo-review-request span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.todo-summary-grid strong,
.todo-review-request strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
.todo-workflow-grid {
  align-items: start;
}
.todo-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.todo-history-table td {
  max-width: 280px;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}
.todo-history-table .btn {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.disabled-action {
  opacity: .45;
  cursor: not-allowed;
}
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-panel { width: min(440px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 28px; box-shadow: var(--shadow); }
.login-surface-select select {
  min-height: 46px;
  border-color: #b8cbd4;
  background: #f8fbfc;
  color: var(--text);
  font-weight: 800;
}
.login-panel input.primary {
  display: block;
  width: 100%;
  min-height: 46px;
  border: 1px solid #0f6f7c;
  border-radius: 8px;
  background: #0f6f7c;
  color: #fff;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}
.login-panel input.primary:hover {
  background: #0b5d68;
  border-color: #0b5d68;
}
@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .monthly-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .monthly-kpi:nth-child(3) { border-right: 0; }
  .monthly-kpi:nth-child(4),
  .monthly-kpi:nth-child(5) { border-bottom: 0; }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .executive-board { grid-template-columns: 1fr; }
  .grid.two { grid-template-columns: 1fr; }
  .developer-console {
    grid-template-columns: 1fr;
  }
  .page-switchbar {
    grid-template-columns: 1fr 1fr;
  }
  .page-switchbar .switchbar-title {
    grid-row: auto;
  }
  .page-switchbar .inline-switch-targets,
  .page-switchbar .primary {
    grid-column: 1 / -1;
  }
}
@media (max-width: 900px) {
  body { display: block; background: var(--bg); padding-bottom: env(safe-area-inset-bottom); }
  .security-setup {
    grid-template-columns: 1fr;
  }
  body:not(.login-page) > form {
    display: block;
    min-height: 100vh;
  }
  .sidebar {
    width: 100%;
    max-width: 100vw;
    min-height: auto;
    position: static;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
    overflow: hidden;
  }
  .brand {
    margin-bottom: 14px;
  }
  .brand-mark {
    width: 44px;
    height: 44px;
  }
  .brand h1 {
    font-size: 24px;
    line-height: 1.15;
  }
  .nav {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar {
    display: none;
  }
  .nav a {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
    padding: 10px 13px;
  }
  .nav a.active,
  .nav a:hover {
    box-shadow: inset 0 -3px 0 var(--accent);
  }
  .user-panel {
    grid-template-columns: 1fr auto;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
  }
  .user-panel span {
    grid-column: 1 / -1;
  }
  .inline-switch {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .inline-switch span,
  .inline-switch input,
  .inline-switch-message {
    grid-column: 1 / -1;
  }
  .main {
    padding: 16px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
    width: 100%;
    max-width: 100vw;
    overflow: visible;
  }
  .page-switchbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    margin-bottom: 16px;
  }
  .page-switchbar .inline-switch-targets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .page-switchbar .primary,
  .page-switchbar .switch-chip {
    width: 100%;
  }
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 16px;
    margin-bottom: 16px;
  }
  .developer-status {
    width: 100%;
  }
  .developer-metrics {
    grid-template-columns: 1fr;
  }
  .topbar h2 {
    font-size: 28px;
  }
  .panel {
    padding: 16px;
    margin-bottom: 16px;
  }
  .monthly-ledger-panel {
    padding: 0;
  }
  .panel-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .monthly-ledger-header,
  .monthly-focus-bar {
    align-items: flex-start;
    flex-direction: column;
  }
  .monthly-ledger-filters {
    width: 100%;
    min-width: 0;
  }
  .monthly-focus-bar p {
    max-width: none;
    text-align: left;
  }
  .monthly-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .monthly-kpi,
  .monthly-kpi:nth-child(3) {
    border-right: 1px solid var(--line);
  }
  .monthly-kpi:nth-child(even),
  .monthly-kpi:last-child {
    border-right: 0;
  }
  .monthly-kpi:last-child {
    grid-column: 1 / -1;
  }
  .expense-difference-summary {
    grid-template-columns: 1fr;
  }
  .credential-search-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .credential-search-tools input[type="text"] {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
  }
  .credential-search-tools select {
    grid-column: 1 / -1;
    width: 100%;
  }
  .download-tools .fields,
  .feedback-analysis,
  .grid.two,
  .fields,
  .preview-grid,
  .reminder-mail-fields {
    grid-template-columns: 1fr;
  }
  .analysis-actions {
    justify-content: flex-start;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .metric strong {
    font-size: 24px;
  }
  .section-switch {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .section-switch::-webkit-scrollbar {
    display: none;
  }
  .section-switch a {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .section-switch .switch-filter {
    flex: 0 0 auto;
    margin-left: 0;
  }
  .download-tools .actions,
  .top-actions {
    justify-content: flex-start;
  }
  .income-feedback {
    align-items: flex-start;
    flex-direction: column;
  }
  .dropzone-lite {
    padding: 18px;
  }
  .chat-panel {
    grid-template-rows: auto minmax(280px, 50vh) auto auto;
  }
  .chat-scroll {
    min-height: 280px;
    max-height: 50vh;
  }
  .chat-message {
    max-width: 100%;
  }
  .contract-file-row {
    grid-template-columns: 1fr;
  }
  .table-wrap {
    max-height: none;
    width: 100%;
  }
  .table-wrap table {
    min-width: 680px;
  }
  .inline-actions {
    min-width: 220px;
  }
  .grid-pager td {
    position: static;
  }
}
@media (max-width: 560px) {
  .sidebar {
    padding: 14px 12px;
  }
  .brand h1 {
    font-size: 22px;
  }
  .main {
    padding: 12px;
  }
  .topbar h2 {
    font-size: 24px;
  }
  .topbar .return-link,
  .hero-actions,
  .hero-actions > *,
  .return-link {
    width: 100%;
  }
  .topbar,
  .panel {
    border-radius: 8px;
    padding: 14px;
  }
  .monthly-ledger-panel {
    padding: 0;
  }
  .monthly-ledger-header,
  .monthly-chart-block,
  .monthly-ledger-table-block,
  .expense-difference-block {
    padding: 14px;
  }
  .monthly-focus-bar {
    padding: 14px;
  }
  .monthly-ledger-filters,
  .monthly-kpi-grid {
    grid-template-columns: 1fr;
  }
  .monthly-kpi,
  .monthly-kpi:nth-child(3),
  .monthly-kpi:nth-child(even) {
    min-height: 112px;
    border-right: 0;
  }
  .monthly-kpi:last-child {
    grid-column: auto;
  }
  .monthly-kpi > strong {
    font-size: 24px;
  }
  .monthly-section-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .chart-legend {
    gap: 10px;
  }
  input, select, textarea {
    min-height: 46px;
    padding: 12px;
  }
  .type-hint {
    padding: 11px 12px;
    font-size: 13px;
  }
  .section-switch {
    margin-left: -2px;
    margin-right: -2px;
  }
  .section-switch a {
    min-height: 42px;
    padding: 10px 12px;
  }
  .table-wrap {
    margin-left: -2px;
    margin-right: -2px;
    border-radius: 8px;
  }
  .table-wrap table {
    min-width: 620px;
  }
  th, td {
    padding: 10px;
    font-size: 13px;
  }
  .grid-pager table {
    min-width: 0;
  }
  .grid-pager a,
  .grid-pager span {
    min-width: 36px;
    min-height: 36px;
  }
  .metrics {
    grid-template-columns: 1fr;
  }
  .category-grid {
    grid-template-columns: 1fr;
  }
  .category-card-head {
    min-height: auto;
    margin-bottom: 12px;
  }
  .metric {
    min-height: 112px;
  }
  .download-tools .actions > *,
  .top-actions > *,
  p > .primary,
  p > .ghost {
    width: 100%;
    justify-content: center;
    margin-top: 6px;
  }
  p > .muted,
  p > .danger,
  .form-message,
  .panel-head > .muted,
  .panel-head > .danger {
    width: 100%;
    justify-content: center;
    margin: 10px 0 0;
    text-align: center;
  }
  .page-switchbar .inline-switch-targets {
    grid-template-columns: 1fr;
  }
  .surface-ribbon {
    align-items: flex-start;
    flex-direction: column;
  }
  .surface-ribbon strong {
    text-align: left;
  }
  .selected-files-head,
  .selected-files li {
    display: grid;
  }
  .login-page {
    padding: 14px;
  }
  .login-panel {
    padding: 20px;
    border-radius: 8px;
  }
  .login-panel .brand {
    align-items: flex-start;
  }
  .login-panel .brand h1 {
    font-size: 24px;
  }
}

.app-install-button[hidden] { display: none !important; }
.login-install-button { width: 100%; margin-top: 12px; }

body.pwa-standalone .app-install-button { display: none !important; }
