:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d7dde5;
  --line-soft: #e8edf3;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --primary-soft: #e7f5f2;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --warning: #a15c07;
  --warning-soft: #fff7e6;
  --nav: #1f2a37;
  --shadow: 0 14px 34px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  padding: 0 13px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.button-like {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border-radius: 7px;
  padding: 0 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 50px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  display: inline-grid;
  width: 34px;
  min-height: 30px;
  place-items: center;
  border: 1px solid transparent;
  background: transparent;
  padding: 0;
  transform: translateY(-50%);
}

.password-toggle:hover {
  background: #f2f4f7;
}

.eye-icon {
  position: relative;
  display: block;
  width: 20px;
  height: 12px;
  border: 2px solid #667085;
  border-radius: 999px / 700px;
}

.eye-icon::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #667085;
  transform: translate(-50%, -50%);
}

.password-toggle.showing .eye-icon::after {
  content: "";
  position: absolute;
  top: 4px;
  left: -4px;
  width: 27px;
  height: 2px;
  border-radius: 999px;
  background: #667085;
  transform: rotate(-35deg);
}

.primary {
  background: var(--primary);
  color: white;
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  border: 1px solid var(--line);
  background: white;
  color: #253044;
}

.secondary:hover {
  background: #f8fafc;
}

.ghost {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: #d7dee8;
}

.danger {
  border: 1px solid #f3b8b2;
  background: var(--danger-soft);
  color: var(--danger);
}

.full {
  width: 100%;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hidden {
  display: none !important;
}

.stack {
  display: grid;
  gap: 14px;
}

.auth-shell,
.client-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-panel,
.code-panel {
  width: min(520px, 100%);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-panel h1,
.code-panel h1,
.topbar h1 {
  margin: 0;
  line-height: 1.15;
}

.alert {
  border: 1px solid #fed7aa;
  border-radius: 7px;
  background: #fff7ed;
  color: #9a3412;
  padding: 12px;
}

.notice {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  width: min(420px, calc(100vw - 36px));
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  background: #ecfdf5;
  box-shadow: var(--shadow);
  color: #065f46;
  padding: 13px 14px;
  font-weight: 800;
}

.notice[data-type="error"] {
  border-color: #fecaca;
  background: #fff1f0;
  color: #991b1b;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 252px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  height: 100vh;
  align-content: start;
  gap: 22px;
  background: var(--nav);
  color: #f8fafc;
  padding: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 6px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 7px;
  background: #10b981;
  color: #06231d;
  font-weight: 900;
}

.brand small {
  display: block;
  color: #a7b4c5;
}

.nav-tabs {
  display: grid;
  gap: 6px;
}

.nav-tabs button {
  justify-content: start;
  border: 1px solid transparent;
  background: transparent;
  color: #d7dee8;
  text-align: left;
}

.nav-tabs button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-tabs button.active {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.15);
  color: #ffffff;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar p,
.section-header p,
.toolbar p {
  margin: 5px 0 0;
  color: var(--muted);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 18px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(310px, 390px) minmax(0, 1fr);
}

.accounts-layout {
  display: grid;
  grid-template-columns: minmax(310px, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.list-area {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
}

.overview-layout,
.dashboard-rank-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.overview-layout {
  grid-template-columns: minmax(360px, 520px) minmax(0, 1fr);
  align-items: start;
}

.dashboard-rank-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric,
.panel,
.table-wrap {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

.metric {
  padding: 16px;
}

.dashboard-metrics .metric {
  display: grid;
  gap: 6px;
  min-height: 104px;
  align-content: start;
}

.metric-primary {
  border-color: rgba(15, 118, 110, 0.24);
  background: linear-gradient(180deg, #ecfdf5 0%, #ffffff 72%);
}

.metric-warn {
  border-color: #fed7aa;
  background: linear-gradient(180deg, #fff7ed 0%, #ffffff 72%);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.metric small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.panel {
  padding: 18px;
}

.chart-panel {
  display: grid;
  gap: 16px;
}

.chart-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.chart-header h2,
.chart-header p {
  margin: 0;
}

.chart-header p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.chart-header > strong {
  min-width: 86px;
  color: var(--primary);
  font-size: 30px;
  line-height: 1;
  text-align: right;
}

.trend-chart {
  display: grid;
  gap: 8px;
}

.trend-chart svg {
  width: 100%;
  height: 170px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background:
    linear-gradient(to bottom, rgba(215, 221, 229, 0.55) 1px, transparent 1px) 0 0 / 100% 25%,
    #fbfcfe;
}

.trend-area {
  fill: rgba(15, 118, 110, 0.12);
}

.trend-line {
  fill: none;
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
}

.trend-dot {
  fill: #ffffff;
  stroke: var(--primary);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.rank-bars {
  display: grid;
  gap: 13px;
}

.rank-bar {
  display: grid;
  gap: 7px;
}

.rank-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.rank-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.rank-actions .compact-action {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

.ops-panel {
  align-content: start;
}

.task-panel {
  display: grid;
  gap: 14px;
}

.task-panel .section-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.task-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.task-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 11px;
}

.task-card.has-work {
  border-color: #fed7aa;
  background: #fffaf2;
}

.task-card span,
.task-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.task-card strong {
  color: #253044;
  font-size: 22px;
}

.task-list-grid {
  display: grid;
  gap: 10px;
}

.ops-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ops-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
}

.ops-card span,
.ops-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.ops-card strong {
  color: #253044;
}

.form-panel {
  position: sticky;
  top: 20px;
}

.panel h2,
.toolbar h2,
.section-header h2 {
  margin: 0;
  font-size: 18px;
}

.section-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-header.compact {
  align-items: center;
}

.section-header.compact span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.toolbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.toolbar-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  width: min(900px, 100%);
}

.toolbar-actions > button {
  flex: 0 0 auto;
}

.account-status-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.account-status-switch button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  border: 1px solid var(--line-soft);
  background: #ffffff;
  color: #253044;
  padding: 10px 12px;
  text-align: left;
}

.account-status-switch button span {
  overflow: hidden;
  color: #475467;
  text-overflow: ellipsis;
}

.account-status-switch button strong {
  color: #17202a;
  font-size: 20px;
}

.account-status-switch button.active {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--primary-soft);
  box-shadow: 0 8px 22px rgba(15, 118, 110, 0.08);
}

.account-status-switch button.active span,
.account-status-switch button.active strong {
  color: var(--primary-dark);
}

.search-box {
  flex: 1 1 190px;
  width: min(360px, 100%);
}

.compact-filter {
  flex-basis: 230px;
  width: min(260px, 100%);
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.empty-state {
  display: grid;
  gap: 10px;
  align-items: start;
  background: #f7fbff;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.empty-state button {
  width: fit-content;
}

.empty-line {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.actions.split {
  justify-content: space-between;
}

.actions.right {
  justify-content: flex-end;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
}

.compact-action {
  min-height: 34px;
  padding: 0 12px;
}

.more-actions {
  position: relative;
}

.more-actions summary {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: #253044;
  padding: 0 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
  white-space: nowrap;
}

.more-actions summary::-webkit-details-marker {
  display: none;
}

.more-menu {
  display: grid;
  width: 112px;
  gap: 8px;
  margin-top: 8px;
}

.more-menu button {
  width: 100%;
}

.token-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 4px 8px 0 0;
  border: 1px solid #d9e5ef;
  border-radius: 7px;
  background: #f8fafc;
  color: #475467;
  padding: 0 7px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.copy-list {
  display: grid;
  max-height: 280px;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.batch-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.batch-preview {
  display: grid;
  gap: 10px;
}

.batch-preview-table {
  max-height: 340px;
}

.batch-import-dialog textarea[name="text"] {
  min-height: 220px;
}

.copy-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.copy-item strong {
  display: block;
  margin-bottom: 5px;
}

.copy-item pre {
  margin: 0;
  color: #475467;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.link-details {
  display: grid;
  gap: 8px;
}

.link-details summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 800;
}

.qr-tools {
  display: grid;
  gap: 12px;
  margin-top: -4px;
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
}

.qr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.qr-preview {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  background: #f0f9ff;
  padding: 12px;
}

.qr-preview p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.secret-mask {
  font-family: "SFMono-Regular", Consolas, monospace;
  color: #075985;
}

.scanner-video {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: #0f172a;
  object-fit: cover;
}

.qr-status {
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--muted);
  padding: 10px;
  font-weight: 700;
}

.table-section {
  padding: 0;
  overflow: hidden;
}

.table-section .section-header {
  padding: 14px 16px 0;
}

.table-wrap {
  overflow: auto;
}

.table-wrap.embedded {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 14px;
}

#tab-tokens table {
  min-width: 960px;
}

#tab-accounts table {
  min-width: 1040px;
}

.account-info-cell strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#tab-ledger table,
.ledger-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

.ledger-table-wrap {
  max-height: calc(100vh - 230px);
  contain: layout paint;
  transform: translateZ(0);
}

.ledger-table input,
.ledger-table select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 6px 8px;
  font-size: 13px;
}

.ledger-table .ledger-field-head,
.ledger-table .ledger-field-cell {
  width: var(--col-width, 140px);
  min-width: var(--col-width, 140px);
  max-width: var(--col-width, 140px);
  overflow: hidden;
}

.ledger-table.row-low th,
.ledger-table.row-low td {
  padding-top: 7px;
  padding-bottom: 7px;
}

.ledger-table.row-medium th,
.ledger-table.row-medium td {
  padding-top: 11px;
  padding-bottom: 11px;
}

.ledger-table.row-high th,
.ledger-table.row-high td {
  padding-top: 16px;
  padding-bottom: 16px;
}

.ledger-table.row-extra th,
.ledger-table.row-extra td {
  padding-top: 22px;
  padding-bottom: 22px;
}

.ledger-table.row-low input,
.ledger-table.row-low select {
  min-height: 30px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.ledger-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 4;
  width: var(--ledger-sticky-current, var(--ledger-sticky-width, 168px));
  min-width: var(--ledger-sticky-current, var(--ledger-sticky-width, 168px));
  max-width: var(--ledger-sticky-current, var(--ledger-sticky-width, 168px));
  background: #ffffff;
  box-shadow: 1px 0 0 var(--line-soft);
}

.mobile-perf-note {
  margin: 0 0 10px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #eff6ff;
  padding: 8px 10px;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 700;
}

.table-load-more {
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--line-soft);
  padding: 12px;
}

.ledger-table th.sticky-col {
  z-index: 5;
  background: #f8fafc;
}

.field-icon {
  min-width: 28px;
  min-height: 24px;
  margin-left: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 0 6px;
  color: var(--muted);
}

.ledger-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  z-index: 8;
  width: 12px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.ledger-resize-handle::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 5px;
  width: 2px;
  height: calc(100% - 18px);
  border-radius: 999px;
  background: transparent;
}

.ledger-resize-handle:hover::after,
.ledger-table.is-resizing .ledger-resize-handle::after {
  background: #93c5fd;
}

.ledger-table th {
  position: relative;
}

.ledger-table .ledger-date-input {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.ledger-date-control {
  position: relative;
  display: block;
}

.ledger-date-display {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.ledger-date-picker {
  position: absolute;
  inset: 0;
  width: 100%;
  min-width: 0;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

.ledger-mobile-list {
  display: grid;
  gap: 10px;
}

.ledger-mobile-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #ffffff;
  padding: 12px;
  box-shadow: var(--shadow-soft);
}

.ledger-mobile-card-head,
.ledger-mobile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ledger-mobile-card-head strong {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-mobile-fields {
  display: grid;
  gap: 8px;
}

.ledger-mobile-field {
  display: grid;
  grid-template-columns: minmax(72px, 32%) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--field-color, var(--line-soft));
  border-radius: 8px;
  background: #fbfdff;
  padding: 8px;
}

.ledger-mobile-field > span {
  min-width: 0;
  overflow: hidden;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-mobile-field input,
.ledger-mobile-field select,
.ledger-mobile-field textarea,
.ledger-mobile-field .ledger-date-display {
  min-height: 36px;
  font-size: 13px;
}

.ledger-mobile-extra {
  border-top: 1px dashed var(--line-soft);
  padding-top: 8px;
}

.ledger-mobile-extra summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.ledger-mobile-extra .ledger-mobile-fields {
  margin-top: 8px;
}

.ledger-mobile-foot {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ledger-mobile-foot strong {
  color: var(--ink);
}

.field-options-editor {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
}

.field-options-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field-options-head strong {
  color: #344054;
  font-size: 14px;
}

.field-options-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field-option-list {
  display: grid;
  max-height: 260px;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
}

.field-option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px 38px;
  gap: 8px;
  align-items: center;
}

.field-option-row input {
  min-height: 38px;
}

.icon-button {
  display: grid;
  min-width: 38px;
  min-height: 38px;
  place-items: center;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.option-add-button {
  width: fit-content;
}

.ledger-field-head[style],
.ledger-field-cell[style] {
  background: color-mix(in srgb, var(--field-color) 22%, #ffffff);
}

.colored-select[style] {
  border-color: color-mix(in srgb, var(--field-color) 70%, var(--line));
  background: color-mix(in srgb, var(--field-color) 28%, #ffffff);
}

.ledger-config-dialog {
  min-width: min(520px, calc(100vw - 40px));
}

.field-config-list {
  display: grid;
  max-height: min(620px, calc(100vh - 220px));
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.field-config-row {
  display: grid;
  grid-template-columns: 24px 30px minmax(0, 1fr) 38px 38px 38px 48px;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  background: #ffffff;
  padding: 8px 10px;
}

.field-config-row:last-child {
  border-bottom: 0;
}

.field-config-row.is-hidden {
  background: #f8fafc;
  color: var(--muted);
}

.field-drag {
  color: #98a2b3;
  font-weight: 900;
}

.field-type-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #f8fafc;
  color: #344054;
  font-weight: 900;
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: #526074;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.tag,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #e7ebf0;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tag.active,
.tag.ready,
.pill.good {
  background: #dcfce7;
  color: #166534;
}

.tag.blocked {
  background: var(--warning-soft);
  color: var(--warning);
}

.tag.idle {
  background: #eef2ff;
  color: #3730a3;
}

.tag.pending,
.tag.duplicate,
.tag.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.tag.sent,
.tag.healthy {
  background: #dcfce7;
  color: #166534;
}

.tag.error,
.tag.revoked,
.tag.archived,
.tag.bad,
.pill.bad {
  background: #fee2e2;
  color: #991b1b;
}

.reminder-list {
  display: grid;
  gap: 7px;
  margin: 12px 0;
}

.reminder-list p {
  margin: 0;
}

.reminder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}

.reminder-item button {
  min-height: 30px;
  padding: 0 10px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.setting-card {
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 14px;
}

.backup-card {
  border-color: #bdece4;
  background: #f4fbf9;
}

.backup-card .button-like {
  width: fit-content;
}

.feishu-card {
  grid-column: span 2;
}

.backup-status {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.backup-status p {
  margin: 0;
}

.setting-card p {
  margin: 0;
}

.choice-grid {
  display: grid;
  gap: 10px;
}

.choice-grid button {
  display: grid;
  height: auto;
  min-height: 64px;
  justify-items: start;
  gap: 4px;
  padding: 12px 14px;
  text-align: left;
  white-space: normal;
}

.choice-grid button span {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  opacity: 0.78;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.client-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.client-info {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.client-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.client-info-item {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 11px;
}

.client-info-item.wide {
  grid-column: 1 / -1;
}

.client-info-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.client-info-item strong {
  color: #253044;
  font-size: 14px;
  line-height: 1.3;
  word-break: break-word;
}

.client-info-note {
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  background: #eef2ff;
  color: #3730a3;
  padding: 10px 11px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.client-info-note.warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.device-request-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 10px 22px rgba(16, 24, 40, 0.06);
}

.device-reset-confirm {
  display: grid;
  gap: 10px;
}

.code-box {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  border: 1px solid #cfe8e5;
  border-radius: 8px;
  background: #f6fbfa;
  padding: 18px;
  text-align: center;
}

.code-box.waiting {
  border-color: var(--line);
  background: #f8fafc;
}

.watermark-text {
  min-height: 20px;
  margin: 12px 0 0;
  color: #7c8798;
  font-size: 12px;
  text-align: center;
  word-break: break-word;
}

.code-label {
  color: var(--muted);
  font-size: 13px;
}

#codeValue {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 52px;
  line-height: 1;
  letter-spacing: 0;
}

.countdown {
  display: grid;
  gap: 8px;
}

.meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe4ee;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.2s ease;
}

dialog {
  width: min(720px, calc(100vw - 32px));
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.38);
}

.dialog-body {
  display: grid;
  gap: 14px;
}

.dialog-body h2 {
  margin: 0;
}

@media (max-width: 1050px) {
  .accounts-layout,
  .grid.two,
  .metric-grid,
  .settings-grid,
  .ops-list,
  .overview-layout,
  .dashboard-rank-grid {
    grid-template-columns: 1fr;
  }

  .task-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-panel {
    position: static;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
    padding-bottom: 88px;
  }

  .sidebar {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    height: auto;
    gap: 8px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 26px rgba(15, 23, 42, 0.18);
  }

  .brand,
  .sidebar form {
    display: none;
  }

  .nav-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-tabs button {
    flex: 0 0 auto;
    min-width: 76px;
    min-height: 42px;
    padding: 0 8px;
    text-align: center;
    justify-content: center;
    font-size: 12px;
  }

  .workspace {
    padding: 16px 12px 22px;
  }

  .topbar,
  .toolbar,
  .toolbar-actions {
    display: grid;
  }

  .search-box {
    width: 100%;
  }

  .chart-header {
    display: grid;
  }

  .chart-header > strong {
    text-align: left;
  }

  .trend-chart svg {
    height: 170px;
  }
}

@media (max-width: 520px) {
  .auth-panel,
  .code-panel {
    padding: 20px;
  }

  .task-summary-grid {
    grid-template-columns: 1fr;
  }

  #codeValue {
    font-size: 42px;
  }

  .inline-fields {
    grid-template-columns: 1fr;
  }

  .client-info-grid {
    grid-template-columns: 1fr;
  }

  .qr-preview {
    display: grid;
  }

  .qr-actions button {
    flex: 1 1 100%;
  }
}

/* 2026-05-29 visual refresh: quieter, denser admin workspace. */
:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #64748b;
  --line: #cfd8e3;
  --line-soft: #e6ebf2;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --primary-soft: #e8f6f3;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --warning: #a15c07;
  --warning-soft: #fff7e6;
  --nav: #111827;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 22px rgba(15, 23, 42, 0.05);
}

body {
  background:
    linear-gradient(180deg, #eef3f8 0, #f5f7fb 260px),
    var(--bg);
  letter-spacing: 0;
}

button,
.button-like,
input,
select,
textarea,
.metric,
.panel,
.table-wrap,
.tag,
.pill,
.token-chip,
dialog,
.notice,
.client-info-note,
.client-info-item,
.code-box,
.task-card,
.setting-card,
.ops-card {
  border-radius: 8px;
}

button,
.button-like {
  min-height: 36px;
  padding: 0 12px;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

button:hover,
.button-like:hover {
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

button:active {
  transform: translateY(1px);
}

input,
select,
textarea {
  border-color: #d6dee8;
  background: #fbfdff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.primary {
  background: #0f766e;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
}

.secondary {
  border-color: #d8e0ea;
  background: #ffffff;
}

.danger {
  border-color: #fecaca;
}

.app-shell {
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: #111827;
  box-shadow: 12px 0 36px rgba(15, 23, 42, 0.10);
}

.brand {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 18px;
}

.brand-mark {
  background: #ecfdf5;
  color: #0f766e;
}

.brand strong {
  color: #ffffff;
}

.brand small {
  color: #9ca3af;
}

.nav-tabs {
  gap: 6px;
}

.nav-tabs button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 14px;
}

.nav-tabs button:hover {
  background: rgba(255, 255, 255, 0.07);
  box-shadow: none;
}

.nav-tabs button.active {
  border-color: rgba(20, 184, 166, 0.22);
  background: rgba(15, 118, 110, 0.20);
  color: #ffffff;
}

.workspace {
  width: min(100%, 1600px);
  padding: 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  align-items: center;
  margin: -24px -24px 18px;
  border-bottom: 1px solid rgba(207, 216, 227, 0.8);
  background: rgba(245, 247, 251, 0.92);
  padding: 18px 24px;
  backdrop-filter: blur(14px);
}

.topbar h1 {
  font-size: 24px;
}

.topbar p {
  font-size: 13px;
}

.tab-panel.active {
  gap: 14px;
}

.metric,
.panel,
.table-wrap {
  border-color: #e3e9f1;
  box-shadow: var(--shadow-soft);
}

.panel {
  padding: 16px;
}

.metric {
  padding: 15px;
}

.metric-grid {
  gap: 10px;
}

.dashboard-metrics .metric {
  min-height: 96px;
}

.metric span,
.metric small,
.task-card span,
.task-card small,
.client-info-item span {
  color: #64748b;
}

.metric strong {
  color: #0f172a;
  font-size: 26px;
}

.metric-primary {
  border-color: #bdece4;
  background: linear-gradient(180deg, #ecfdf8 0%, #ffffff 78%);
}

.metric-warn {
  border-color: #fed7aa;
  background: linear-gradient(180deg, #fff7ed 0%, #ffffff 76%);
}

.overview-layout {
  grid-template-columns: minmax(380px, 500px) minmax(0, 1fr);
}

.chart-header {
  align-items: center;
}

.chart-header h2,
.panel h2,
.toolbar h2,
.section-header h2 {
  color: #0f172a;
  font-size: 17px;
}

.trend-chart svg {
  height: 190px;
  border-color: #e3e9f1;
  background:
    linear-gradient(to bottom, rgba(226, 232, 240, 0.75) 1px, transparent 1px) 0 0 / 100% 25%,
    #fbfdff;
}

.trend-line {
  stroke-width: 2.4;
}

.trend-area {
  fill: rgba(15, 118, 110, 0.10);
}

.task-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-card {
  background: #f8fafc;
}

.task-card.has-work {
  background: #fff9ed;
}

.task-list-grid {
  gap: 8px;
}

.reminder-list {
  margin: 0;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  background: #fbfdff;
  padding: 11px;
}

.reminder-item {
  border-top-color: #edf2f7;
}

.rank-bars {
  gap: 12px;
}

.rank-row {
  color: #1f2937;
}

.meter {
  height: 7px;
  background: #dfe7f0;
}

.toolbar {
  align-items: end;
  border: 1px solid #e3e9f1;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
  padding: 14px;
}

.toolbar-actions {
  align-items: end;
  gap: 9px;
}

.search-box span {
  color: #64748b;
  font-size: 12px;
}

.table-section {
  padding: 0;
  overflow: hidden;
}

.table-section .section-header {
  padding: 14px 16px;
}

.table-wrap {
  overflow: auto;
}

.table-wrap.embedded {
  border-width: 1px 0 0;
  border-radius: 0;
  box-shadow: none;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  text-transform: none;
}

td {
  background: #ffffff;
  vertical-align: top;
}

tbody tr:hover td {
  background: #fbfdff;
}

.row-actions,
.actions {
  gap: 8px;
}

.compact-action {
  min-width: 86px;
}

.more-actions summary {
  border-color: #d8e0ea;
  background: #ffffff;
}

.tag,
.pill {
  min-height: 26px;
  padding: 4px 10px;
  font-size: 12px;
}

.tag.active,
.tag.ready,
.tag.sent,
.tag.healthy,
.pill.good {
  background: #dcfce7;
  color: #166534;
}

.tag.duplicate {
  background: var(--warning-soft);
  color: var(--warning);
}

.tag.error {
  background: #fee2e2;
  color: #991b1b;
}

.tag.idle {
  background: #eef2ff;
  color: #3730a3;
}

.notice {
  border-color: #99f6e4;
}

dialog {
  max-height: min(860px, calc(100vh - 32px));
  overflow: auto;
  border-color: #e3e9f1;
}

.auth-shell,
.client-shell {
  background: #f5f7fb;
}

.auth-panel,
.code-panel {
  border-color: #e1e8f0;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.12);
}

.code-panel {
  width: min(560px, 100%);
}

.client-head {
  align-items: center;
}

.eyebrow {
  color: #0f766e;
}

.code-box {
  border-color: #d8eee9;
  background: #f8fcfb;
}

#codeValue {
  color: #111827;
}

.client-info-note,
.client-info-item {
  border-color: #e1e8f0;
}

.security-notice-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.48);
  padding: 18px;
}

.security-notice-dialog {
  display: grid;
  width: min(440px, 100%);
  gap: 16px;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  padding: 20px;
}

.security-notice-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: #ecfdf5;
  color: #0f766e;
  font-size: 20px;
  font-weight: 900;
}

.security-notice-content {
  display: grid;
  gap: 9px;
}

.security-notice-content h2,
.security-notice-content p {
  margin: 0;
}

.security-notice-content h2 {
  color: #0f172a;
  font-size: 20px;
  line-height: 1.25;
}

.security-notice-content p:not(.eyebrow) {
  color: #475569;
  font-size: 14px;
  line-height: 1.65;
}

@media (max-width: 1050px) {
  .overview-layout,
  .dashboard-rank-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
    padding-bottom: 88px;
  }

  .sidebar {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    height: auto;
    gap: 8px;
    border-right: 0;
    background: rgba(17, 24, 39, 0.98);
    box-shadow: 0 -12px 34px rgba(15, 23, 42, 0.18);
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  }

  .brand,
  .sidebar form {
    display: none;
  }

  .nav-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-tabs button {
    flex: 0 0 auto;
    min-width: 76px;
    min-height: 42px;
    justify-content: center;
    padding: 0 8px;
    font-size: 12px;
    text-align: center;
  }

  .workspace {
    padding: 14px 10px 20px;
  }

  .topbar {
    position: static;
    margin: 0 0 12px;
    border: 1px solid #e3e9f1;
    border-radius: 8px;
    padding: 14px;
  }

  .toolbar,
  .toolbar-actions {
    align-items: stretch;
  }

  th {
    position: static;
  }
}

@media (max-width: 520px) {
  .panel,
  .toolbar {
    padding: 12px;
  }

  .metric {
    padding: 13px;
  }

  .task-summary-grid {
    grid-template-columns: 1fr;
  }

  button,
  .button-like {
    min-height: 40px;
  }
}

/* 2026-05-31 ops UI redesign: denser, calmer, mobile-first admin surfaces. */
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: #d9e0e8;
  --line-soft: #e8edf3;
  --primary: #0f766e;
  --primary-dark: #0a5f59;
  --primary-soft: #e6f4f1;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --warning: #b54708;
  --warning-soft: #fff7e6;
  --nav: #151922;
  --shadow: 0 16px 38px rgba(16, 24, 40, 0.08);
  --shadow-soft: 0 8px 22px rgba(16, 24, 40, 0.05);
}

body {
  background: #f4f6f8;
  color: var(--ink);
}

button,
.button-like,
input,
select,
textarea,
.metric,
.panel,
.table-wrap,
.toolbar,
.notice,
dialog,
.auth-panel,
.code-panel {
  border-radius: 8px;
}

button,
.button-like {
  min-height: 38px;
  font-size: 13px;
  letter-spacing: 0;
}

button:hover,
.button-like:hover {
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.08);
}

input,
select,
textarea {
  border-color: #d6dee8;
  background: #fbfdff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.16);
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  border-color: #d7dee8;
  background: #ffffff;
  color: #243041;
}

.danger {
  border-color: #f4b5ae;
}

.app-shell {
  grid-template-columns: 232px minmax(0, 1fr);
}

.sidebar {
  background: #151922;
  box-shadow: none;
  padding: 18px 14px;
}

.brand {
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 6px 16px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(20, 184, 166, 0.28);
  background: #0f766e;
  color: #ffffff;
}

.brand strong {
  color: #ffffff;
  font-size: 15px;
}

.brand small {
  color: #98a2b3;
}

.nav-tabs {
  gap: 5px;
}

.nav-tabs button {
  min-height: 38px;
  justify-content: start;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #cbd5e1;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 750;
}

.nav-tabs button:hover {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.nav-tabs button.active {
  border-color: rgba(20, 184, 166, 0.22);
  background: #20312f;
  color: #ffffff;
}

.workspace {
  width: min(100%, 1520px);
  padding: 20px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  align-items: center;
  margin: -20px -20px 16px;
  border-bottom: 1px solid rgba(214, 222, 232, 0.9);
  background: rgba(244, 246, 248, 0.94);
  padding: 14px 20px;
  backdrop-filter: blur(12px);
}

.topbar h1 {
  color: #0f172a;
  font-size: 22px;
}

.topbar p,
.section-header p,
.toolbar p {
  color: #667085;
  font-size: 13px;
}

.tab-panel.active {
  gap: 12px;
}

.metric-grid {
  gap: 10px;
}

.metric,
.panel,
.table-wrap,
.toolbar {
  border-color: #e2e8f0;
  box-shadow: var(--shadow-soft);
}

.panel {
  padding: 14px;
}

.metric {
  display: grid;
  gap: 5px;
  min-height: 88px;
  align-content: start;
  padding: 14px;
}

.metric span,
.metric small {
  color: #667085;
  font-size: 12px;
}

.metric strong {
  margin-top: 4px;
  color: #0f172a;
  font-size: 25px;
}

.metric-primary {
  border-color: #b7e4dd;
  background: #f1fbf8;
}

.metric-warn {
  border-color: #f8c98a;
  background: #fff8ed;
}

.overview-layout {
  grid-template-columns: minmax(340px, 480px) minmax(0, 1fr);
  gap: 12px;
}

.dashboard-rank-grid {
  gap: 12px;
}

.chart-panel,
.task-panel,
.ops-panel {
  gap: 12px;
}

.chart-header h2,
.panel h2,
.toolbar h2,
.section-header h2 {
  color: #101828;
  font-size: 16px;
}

.trend-chart svg {
  height: 176px;
  border-color: #e2e8f0;
  background:
    linear-gradient(to bottom, rgba(226, 232, 240, 0.85) 1px, transparent 1px) 0 0 / 100% 25%,
    #fcfdff;
}

.trend-line {
  stroke: #0f766e;
  stroke-width: 2.4;
}

.trend-area {
  fill: rgba(15, 118, 110, 0.09);
}

.task-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-card,
.ops-card {
  border-color: #e2e8f0;
  background: #f8fafc;
  padding: 10px;
}

.task-card.has-work {
  border-color: #f8c98a;
  background: #fff8ed;
}

.reminder-list {
  border-color: #e2e8f0;
  background: #fbfdff;
  padding: 10px;
}

.rank-row {
  color: #344054;
}

.meter {
  height: 7px;
  background: #e2e8f0;
}

.meter span,
#meterBar {
  background: #0f766e;
}

.toolbar {
  align-items: end;
  padding: 12px;
}

.toolbar-actions {
  gap: 8px;
}

.search-box {
  width: min(320px, 100%);
}

.search-box span {
  color: #667085;
  font-size: 12px;
}

.table-section {
  padding: 0;
  overflow: hidden;
}

.table-section .section-header {
  margin: 0;
  padding: 13px 15px;
}

.table-wrap.embedded {
  border-width: 1px 0 0;
}

table {
  font-size: 13px;
}

th,
td {
  padding: 11px 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #667085;
  font-size: 12px;
  text-transform: none;
}

td {
  background: #ffffff;
}

tbody tr:hover td {
  background: #fbfdff;
}

.row-actions,
.actions {
  gap: 7px;
}

.compact-action {
  min-width: 82px;
}

.more-actions summary {
  border-color: #d7dee8;
}

.tag,
.pill {
  min-height: 24px;
  padding: 3px 9px;
  font-size: 12px;
}

.notice {
  border-color: #99f6e4;
  box-shadow: var(--shadow);
}

dialog {
  width: min(720px, calc(100vw - 24px));
  max-height: min(860px, calc(100vh - 24px));
  border-color: #e2e8f0;
  box-shadow: 0 24px 70px rgba(16, 24, 40, 0.18);
}

.dialog-body {
  gap: 12px;
}

.copy-item,
.qr-preview,
.client-info-note,
.client-info-item,
.code-box,
.security-notice-dialog {
  border-color: #e2e8f0;
}

.auth-shell,
.client-shell {
  background: #f4f6f8;
}

.auth-panel,
.code-panel {
  border-color: #e2e8f0;
  box-shadow: 0 20px 54px rgba(16, 24, 40, 0.12);
}

.code-panel {
  width: min(540px, 100%);
}

.code-box {
  background: #f8fcfb;
}

#codeValue {
  color: #0f172a;
}

.security-notice-overlay {
  background: rgba(16, 24, 40, 0.50);
}

.security-notice-icon {
  background: #e6f4f1;
  color: #0f766e;
}

@media (max-width: 1050px) {
  .overview-layout,
  .dashboard-rank-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
    padding-bottom: 84px;
  }

  .sidebar {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    height: auto;
    border-right: 0;
    background: rgba(21, 25, 34, 0.98);
    box-shadow: 0 -12px 34px rgba(16, 24, 40, 0.20);
    padding: 9px 9px calc(9px + env(safe-area-inset-bottom));
  }

  .brand,
  .sidebar form {
    display: none;
  }

  .nav-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-tabs button {
    flex: 0 0 auto;
    min-width: 72px;
    min-height: 40px;
    justify-content: center;
    padding: 0 8px;
    font-size: 12px;
    text-align: center;
  }

  .workspace {
    padding: 12px 10px 18px;
  }

  .topbar {
    position: static;
    display: grid;
    gap: 10px;
    margin: 0 0 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    padding: 13px;
  }

  .topbar h1 {
    font-size: 19px;
  }

  .toolbar,
  .toolbar-actions {
    display: grid;
    align-items: stretch;
  }

  .toolbar-actions > button,
  .toolbar-actions > label,
  .search-box,
  .compact-filter {
    width: 100%;
  }

  th {
    position: static;
  }

  table {
    min-width: 820px;
  }
}

@media (max-width: 520px) {
  .panel,
  .toolbar {
    padding: 12px;
  }

  .metric {
    min-height: 82px;
    padding: 12px;
  }

  .metric strong {
    font-size: 23px;
  }

  .task-summary-grid {
    grid-template-columns: 1fr;
  }

  button,
  .button-like {
    min-height: 40px;
  }

  .auth-panel,
  .code-panel,
  .security-notice-dialog {
    padding: 18px;
  }
}

/* 2026-05-31 mobile table ergonomics: compact frozen columns and account actions. */
.account-actions {
  flex-wrap: nowrap;
  min-width: 560px;
}

.account-actions.blocked-account-actions {
  min-width: 180px;
}

#tab-ledger .sticky-col strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  #tab-ledger table,
  .ledger-table {
    min-width: 100%;
  }

  .ledger-table-wrap {
    max-height: calc(100vh - 250px);
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .ledger-table .sticky-col {
    width: var(--ledger-sticky-current, var(--ledger-sticky-width, 160px));
    min-width: var(--ledger-sticky-current, var(--ledger-sticky-width, 160px));
    max-width: var(--ledger-sticky-current, var(--ledger-sticky-width, 160px));
  }

  .ledger-table th.sticky-col {
    font-size: 12px;
  }

  .ledger-table td.sticky-col {
    padding-right: 8px;
  }

  .ledger-table td.sticky-col strong {
    max-width: calc(var(--ledger-sticky-current, var(--ledger-sticky-width, 160px)) - 18px);
  }

  .ledger-table input,
  .ledger-table select {
    min-width: 0;
    max-width: 100%;
  }

  #tab-accounts table {
    min-width: 980px;
  }

  #tab-accounts th:first-child,
  #tab-accounts td:first-child {
    min-width: 220px;
    max-width: 240px;
  }

  #tab-accounts th:nth-child(2),
  #tab-accounts td:nth-child(2) {
    min-width: 76px;
    max-width: 90px;
    text-align: center;
  }

  #tab-accounts td:first-child strong,
  #tab-accounts td:nth-child(2) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .account-actions {
    min-width: 560px;
    max-width: none;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .account-actions.blocked-account-actions {
    min-width: 180px;
  }

  .account-actions::-webkit-scrollbar {
    display: none;
  }

  .account-actions button,
  .account-actions summary {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }
}

@media (max-width: 520px) {
  #tab-ledger table,
  .ledger-table {
    min-width: 100%;
  }

  .ledger-table .sticky-col {
    width: var(--ledger-sticky-current, var(--ledger-sticky-width, 156px));
    min-width: var(--ledger-sticky-current, var(--ledger-sticky-width, 156px));
    max-width: var(--ledger-sticky-current, var(--ledger-sticky-width, 156px));
    padding-left: 9px;
  }

  .ledger-table td.sticky-col strong {
    max-width: calc(var(--ledger-sticky-current, var(--ledger-sticky-width, 156px)) - 18px);
    font-size: 12px;
  }

  .ledger-table input,
  .ledger-table select {
    min-width: 0;
    max-width: 100%;
  }

  #tab-accounts table {
    min-width: 940px;
  }

  #tab-accounts th:first-child,
  #tab-accounts td:first-child {
    min-width: 205px;
    max-width: 220px;
  }

  #tab-accounts th:nth-child(2),
  #tab-accounts td:nth-child(2) {
    min-width: 68px;
    max-width: 78px;
  }

  .account-actions {
    min-width: 540px;
    max-width: none;
  }
}

/* 2026-06-01 workbench redesign: visual refresh without changing data or flows. */
:root {
  --bg: #eef3f7;
  --panel: #ffffff;
  --ink: #111827;
  --text: #111827;
  --muted: #64748b;
  --line: #cfd8e3;
  --line-soft: #e6edf4;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --primary-soft: #e5f6f2;
  --nav: #17212f;
  --shadow: 0 18px 44px rgba(15, 23, 42, 0.10);
  --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.08);
}

body {
  background:
    linear-gradient(180deg, #f7fafc 0, #eef3f7 360px),
    var(--bg);
}

button,
.button-like {
  border-radius: 9px;
}

input,
select,
textarea {
  border-radius: 9px;
  background: #fbfdff;
}

.app-shell {
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  gap: 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: #17212f;
  padding: 20px 16px;
}

.brand {
  border-bottom: 1px solid rgba(226, 232, 240, 0.12);
  padding: 4px 4px 18px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #14b8a6;
  color: #052e2b;
}

.brand strong {
  font-size: 15px;
}

.nav-tabs {
  gap: 5px;
}

.nav-tabs button {
  min-height: 40px;
  border-radius: 9px;
  padding: 0 11px;
  color: #cbd5e1;
  font-size: 13px;
}

.nav-tabs button.active {
  border-color: rgba(45, 212, 191, 0.36);
  background: #0f766e;
  box-shadow: 0 8px 20px rgba(20, 184, 166, 0.18);
}

.workspace {
  padding: 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  align-items: center;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  margin-bottom: 16px;
  padding: 14px 16px;
  backdrop-filter: blur(12px);
}

.topbar h1 {
  margin: 0;
  font-size: 21px;
}

.topbar p {
  font-size: 13px;
}

.metric,
.panel,
.table-wrap,
.toolbar {
  border-color: rgba(207, 216, 227, 0.82);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.toolbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  padding: 14px;
}

.toolbar h2,
.panel h2,
.section-header h2,
.chart-header h2 {
  color: #0f172a;
  font-size: 17px;
}

.toolbar-actions {
  gap: 8px;
}

.toolbar-actions .primary,
.toolbar-actions .secondary,
.actions .primary,
.actions .secondary,
.actions .danger {
  min-height: 36px;
}

.dashboard-metrics {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.metric {
  min-height: 98px;
  padding: 15px;
}

.metric span {
  font-weight: 800;
}

.metric strong {
  margin-top: 6px;
  color: #0f172a;
  font-size: 30px;
}

.metric-primary {
  border-color: rgba(15, 118, 110, 0.28);
  background: linear-gradient(180deg, #e6fffb 0%, #ffffff 76%);
}

.metric-warn {
  border-color: #fed7aa;
  background: linear-gradient(180deg, #fff7ed 0%, #ffffff 74%);
}

.overview-layout {
  grid-template-columns: minmax(390px, 1.08fr) minmax(340px, 0.92fr);
}

.task-card,
.ops-card,
.reminder-list,
.field-options-editor,
.copy-item,
.qr-preview,
.backup-status {
  border-radius: 10px;
}

.task-card {
  background: #f8fafc;
}

.task-card.has-work {
  border-color: #fbbf24;
  background: #fffbeb;
}

.reminder-list {
  border: 1px solid var(--line-soft);
  background: #fbfdff;
  padding: 12px;
}

.reminder-list > strong {
  display: block;
  margin-bottom: 7px;
}

.reminder-item {
  align-items: center;
}

.chart-panel {
  padding: 16px;
}

.trend-chart svg {
  border-radius: 10px;
  background:
    linear-gradient(to bottom, rgba(226, 232, 240, 0.85) 1px, transparent 1px) 0 0 / 100% 25%,
    #fbfdff;
}

.table-wrap {
  background: #ffffff;
}

table {
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  text-transform: none;
}

th,
td {
  border-bottom-color: #e7edf4;
}

tbody tr:hover td {
  background: #fbfdff;
}

.tag {
  border-radius: 999px;
  font-weight: 900;
}

.token-chip {
  border-radius: 999px;
}

.notice {
  top: auto;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 28px));
  min-height: 0;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 14px;
  line-height: 1.35;
}

dialog {
  border-radius: 14px;
  box-shadow: 0 22px 80px rgba(15, 23, 42, 0.22);
}

.dialog-body {
  border-radius: 14px;
}

.ledger-table-wrap {
  border-radius: 0 0 12px 12px;
}

.mobile-perf-note {
  margin: 0 12px 10px;
}

@media (max-width: 1050px) {
  .dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  body {
    background: #f4f7fa;
  }

  .app-shell {
    padding-bottom: 76px;
  }

  .sidebar {
    border-top: 1px solid rgba(226, 232, 240, 0.25);
    background: rgba(15, 23, 42, 0.96);
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    backdrop-filter: blur(18px);
  }

  .nav-tabs {
    display: grid;
    grid-template-columns: repeat(9, minmax(56px, 1fr));
    gap: 4px;
    overflow-x: auto;
  }

  .nav-tabs button {
    min-width: 56px;
    min-height: 48px;
    border-radius: 10px;
    padding: 5px 4px;
    color: #cbd5e1;
    font-size: 11px;
    line-height: 1.15;
  }

  .nav-tabs button::before {
    display: block;
    margin-bottom: 3px;
    color: #94a3b8;
    font-size: 15px;
    line-height: 1;
  }

  .nav-tabs button[data-tab="overview"]::before { content: "⌂"; }
  .nav-tabs button[data-tab="accounts"]::before { content: "□"; }
  .nav-tabs button[data-tab="ledger"]::before { content: "▦"; }
  .nav-tabs button[data-tab="tokens"]::before { content: "◇"; }
  .nav-tabs button[data-tab="migration"]::before { content: "⇄"; }
  .nav-tabs button[data-tab="health"]::before { content: "✓"; }
  .nav-tabs button[data-tab="logs"]::before { content: "≡"; }
  .nav-tabs button[data-tab="audit"]::before { content: "◎"; }
  .nav-tabs button[data-tab="settings"]::before { content: "⚙"; }

  .nav-tabs button.active {
    background: #0f766e;
    color: #ffffff;
  }

  .nav-tabs button.active::before {
    color: #ccfbf1;
  }

  .workspace {
    padding: 10px 10px 18px;
  }

  .topbar {
    position: static;
    display: flex;
    margin-bottom: 10px;
    padding: 12px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  .topbar p {
    display: none;
  }

  .topbar .secondary {
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }

  .tab-panel.active {
    gap: 12px;
  }

  .toolbar {
    gap: 10px;
    padding: 12px;
  }

  .toolbar-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .toolbar-actions > button,
  .toolbar-actions > label,
  .search-box,
  .compact-filter {
    width: 100%;
  }

  .metric-grid,
  .dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metric {
    min-height: 86px;
    padding: 12px;
  }

  .metric strong {
    font-size: 24px;
  }

  .panel {
    padding: 14px;
  }

  .section-header {
    margin-bottom: 10px;
  }

  .table-wrap {
    border-radius: 12px;
  }

  table {
    font-size: 13px;
  }

  .notice {
    right: 10px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    width: min(420px, calc(100vw - 20px));
  }
}

@media (max-width: 1200px) and (pointer: coarse) {
  .app-shell {
    display: block;
    padding-bottom: 76px;
  }

  .sidebar {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    height: auto;
    border-top: 1px solid rgba(226, 232, 240, 0.25);
    border-right: 0;
    background: rgba(15, 23, 42, 0.96);
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 26px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(18px);
  }

  .brand,
  .sidebar form {
    display: none;
  }

  .nav-tabs {
    display: grid;
    grid-template-columns: repeat(9, minmax(56px, 1fr));
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-tabs button {
    min-width: 56px;
    min-height: 48px;
    justify-content: center;
    border-radius: 10px;
    padding: 5px 4px;
    text-align: center;
    font-size: 11px;
    line-height: 1.15;
  }

  .workspace {
    padding: 10px 10px 18px;
  }

  .topbar {
    position: static;
    margin-bottom: 10px;
  }

  .notice {
    right: 10px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    max-width: min(330px, calc(100vw - 20px));
  }
}

.force-mobile-nav .app-shell {
  display: block;
  padding-bottom: 76px;
}

.force-mobile-nav .sidebar {
  position: fixed;
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  height: auto;
  border-top: 1px solid rgba(226, 232, 240, 0.25);
  border-right: 0;
  background: rgba(15, 23, 42, 0.96);
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 26px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(18px);
}

.force-mobile-nav .brand,
.force-mobile-nav .sidebar form {
  display: none;
}

.force-mobile-nav .nav-tabs {
  display: grid;
  grid-template-columns: repeat(9, minmax(56px, 1fr));
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.force-mobile-nav .nav-tabs::-webkit-scrollbar {
  display: none;
}

.force-mobile-nav .nav-tabs button {
  min-width: 56px;
  min-height: 48px;
  justify-content: center;
  border-radius: 10px;
  padding: 5px 4px;
  text-align: center;
  font-size: 11px;
  line-height: 1.15;
}

.force-mobile-nav .workspace {
  padding: 10px 10px 18px;
}

.force-mobile-nav .topbar {
  position: static;
  margin-bottom: 10px;
}

.force-mobile-nav .notice {
  right: 10px;
  bottom: calc(80px + env(safe-area-inset-bottom));
  max-width: min(330px, calc(100vw - 20px));
}

@media (max-width: 520px) {
  .dashboard-metrics,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar-actions {
    grid-template-columns: 1fr;
  }

  .account-status-switch {
    gap: 7px;
  }

  .account-status-switch button {
    min-height: 48px;
    padding: 8px 9px;
    font-size: 12px;
  }

  .account-status-switch button strong {
    font-size: 17px;
  }

  .inline-fields {
    grid-template-columns: 1fr;
  }
}

/* 2026-06-13 product UI redesign: stable ops console with cleaner hierarchy. */
:root {
  --bg: #edf2f6;
  --panel: #ffffff;
  --ink: #182230;
  --text: #182230;
  --muted: #667085;
  --line: #cbd5e1;
  --line-soft: #e5ebf2;
  --primary: #0e746f;
  --primary-dark: #085c59;
  --primary-soft: #e4f5f2;
  --accent: #335cff;
  --accent-soft: #edf1ff;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --warning: #a15c07;
  --warning-soft: #fff6e5;
  --success: #16784f;
  --success-soft: #e8f7ef;
  --nav: #101722;
  --shadow: 0 20px 46px rgba(16, 24, 40, 0.10);
  --shadow-soft: 0 8px 20px rgba(16, 24, 40, 0.06);
  --focus: 0 0 0 3px rgba(14, 116, 111, 0.16);
}

html {
  background: var(--bg);
}

body {
  background:
    linear-gradient(180deg, #f7fafc 0, #edf2f6 330px),
    var(--bg);
  color: var(--ink);
  font-size: 14px;
}

button,
.button-like,
input,
select,
textarea {
  border-radius: 8px;
}

button,
.button-like {
  min-height: 38px;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 800;
}

button:hover,
.button-like:hover {
  box-shadow: 0 7px 16px rgba(16, 24, 40, 0.08);
}

button:focus-visible,
.button-like:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

input,
select,
textarea {
  min-height: 40px;
  border-color: #d7e0ea;
  background: #fbfdff;
  color: #182230;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--focus);
}

label {
  color: #344054;
  font-size: 13px;
}

.primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(14, 116, 111, 0.18);
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  border: 1px solid #d7e0ea;
  background: #ffffff;
  color: #263445;
}

.secondary:hover {
  border-color: #b9c6d5;
  background: #f8fafc;
}

.danger {
  border: 1px solid #f3b8b2;
  background: var(--danger-soft);
  color: var(--danger);
}

.ghost {
  border-color: rgba(255, 255, 255, 0.18);
  color: #d9e4f0;
}

.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  gap: 20px;
  border-right: 1px solid rgba(226, 232, 240, 0.08);
  background:
    linear-gradient(180deg, #121b29 0, #101722 48%, #0e141f 100%);
  padding: 22px 16px;
}

.brand {
  gap: 11px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.10);
  padding: 0 6px 18px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(45, 212, 191, 0.28);
  border-radius: 8px;
  background: #e4f5f2;
  color: #075a56;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.brand strong {
  color: #ffffff;
  font-size: 15px;
}

.brand small {
  color: #94a3b8;
}

.nav-tabs {
  gap: 6px;
}

.nav-tabs button {
  min-height: 42px;
  justify-content: start;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #cbd5e1;
  padding: 0 12px;
  text-align: left;
}

.nav-tabs button::before {
  display: inline-grid;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  place-items: center;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.12);
  color: #aab7c8;
  font-size: 12px;
}

.nav-tabs button[data-tab="overview"]::before { content: "01"; }
.nav-tabs button[data-tab="accounts"]::before { content: "02"; }
.nav-tabs button[data-tab="tokens"]::before { content: "03"; }
.nav-tabs button[data-tab="ledger"]::before { content: "04"; }
.nav-tabs button[data-tab="migration"]::before { content: "05"; }
.nav-tabs button[data-tab="health"]::before { content: "06"; }
.nav-tabs button[data-tab="logs"]::before { content: "07"; }
.nav-tabs button[data-tab="audit"]::before { content: "08"; }
.nav-tabs button[data-tab="settings"]::before { content: "09"; }

.nav-tabs button:hover {
  background: rgba(255, 255, 255, 0.07);
  box-shadow: none;
}

.nav-tabs button.active {
  border-color: rgba(45, 212, 191, 0.34);
  background: #163d3b;
  color: #ffffff;
  box-shadow: inset 3px 0 0 #2dd4bf;
}

.nav-tabs button.active::before {
  background: rgba(204, 251, 241, 0.16);
  color: #ccfbf1;
}

.workspace {
  width: min(100%, 1560px);
  padding: 22px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 35;
  align-items: center;
  margin: 0 0 16px;
  border: 1px solid rgba(203, 213, 225, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.90);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  padding: 15px 16px;
  backdrop-filter: blur(14px);
}

.topbar h1 {
  color: #101828;
  font-size: 22px;
}

.topbar p,
.section-header p,
.toolbar p {
  color: #667085;
  font-size: 13px;
}

.notice {
  border-color: #99f6e4;
  border-radius: 8px;
  background: #ecfdf5;
  color: #056455;
  box-shadow: var(--shadow);
}

.tab-panel.active {
  gap: 14px;
}

.metric,
.panel,
.table-wrap,
.toolbar,
.auth-panel,
.code-panel,
dialog {
  border-color: rgba(203, 213, 225, 0.86);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.panel,
.toolbar {
  background: rgba(255, 255, 255, 0.94);
}

.panel {
  padding: 16px;
}

.toolbar {
  align-items: center;
  padding: 14px;
}

.toolbar h2,
.panel h2,
.section-header h2,
.chart-header h2 {
  color: #101828;
  font-size: 17px;
}

.toolbar-actions {
  gap: 9px;
}

.dashboard-metrics {
  grid-template-columns: repeat(5, minmax(145px, 1fr));
}

.metric {
  position: relative;
  min-height: 104px;
  overflow: hidden;
  background: #ffffff;
  padding: 16px;
}

.metric::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: #d7e0ea;
}

.metric-primary::before {
  background: var(--primary);
}

.metric-warn::before {
  background: #f59e0b;
}

.metric span {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  margin-top: 7px;
  color: #101828;
  font-size: 30px;
  line-height: 1;
}

.metric small {
  color: #667085;
}

.metric-primary {
  border-color: rgba(14, 116, 111, 0.25);
  background: linear-gradient(180deg, #f0fbf8 0, #ffffff 72%);
}

.metric-warn {
  border-color: #fed7aa;
  background: linear-gradient(180deg, #fff8ed 0, #ffffff 72%);
}

.overview-layout {
  grid-template-columns: minmax(390px, 1.06fr) minmax(360px, 0.94fr);
  gap: 14px;
}

.dashboard-rank-grid {
  gap: 14px;
}

.task-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.task-card,
.ops-card,
.setting-card,
.reminder-list,
.client-info-item,
.client-info-note,
.copy-item,
.qr-preview,
.backup-status,
.field-options-editor {
  border-radius: 8px;
}

.task-card,
.ops-card,
.setting-card {
  border-color: #e2e8f0;
  background: #f8fafc;
}

.task-card.has-work {
  border-color: #f6c36b;
  background: #fff8ed;
}

.task-card strong {
  color: #101828;
}

.reminder-list {
  border: 1px solid #e2e8f0;
  background: #fbfdff;
}

.reminder-item {
  align-items: center;
}

.chart-panel {
  padding: 16px;
}

.chart-header > strong {
  color: var(--primary);
}

.trend-chart svg {
  height: 182px;
  border-color: #e2e8f0;
  border-radius: 8px;
  background:
    linear-gradient(to bottom, rgba(226, 232, 240, 0.82) 1px, transparent 1px) 0 0 / 100% 25%,
    #fbfdff;
}

.trend-line {
  stroke: var(--primary);
}

.trend-area {
  fill: rgba(14, 116, 111, 0.10);
}

.meter {
  height: 7px;
  background: #e2e8f0;
}

.meter span,
#meterBar {
  background: linear-gradient(90deg, var(--primary), #335cff);
}

.account-status-switch {
  gap: 9px;
}

.account-status-switch button {
  min-height: 58px;
  border-color: #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.account-status-switch button.active {
  border-color: rgba(14, 116, 111, 0.34);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px rgba(14, 116, 111, 0.08);
}

.account-status-switch button strong {
  color: #101828;
}

.account-status-switch button.active strong,
.account-status-switch button.active span {
  color: #075a56;
}

.table-section {
  overflow: hidden;
  padding: 0;
}

.table-section .section-header {
  margin: 0;
  padding: 14px 16px;
}

.table-wrap {
  background: #ffffff;
}

.table-wrap.embedded {
  border-width: 1px 0 0;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid #e7edf4;
  padding: 11px 13px;
}

th {
  background: #f8fafc;
  color: #526176;
  font-size: 12px;
  font-weight: 900;
  text-transform: none;
}

td {
  background: #ffffff;
}

tbody tr:hover td {
  background: #f9fbfd;
}

.compact-action {
  min-width: 78px;
}

.tag,
.pill {
  min-height: 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 900;
}

.tag.active,
.tag.ready,
.tag.sent,
.tag.healthy,
.pill.good {
  border-color: #bcebd0;
  background: var(--success-soft);
  color: var(--success);
}

.tag.idle {
  border-color: #c7d2fe;
  background: var(--accent-soft);
  color: #3347a8;
}

.tag.blocked,
.tag.pending,
.tag.duplicate,
.tag.warning {
  border-color: #fed7aa;
  background: var(--warning-soft);
  color: var(--warning);
}

.tag.error,
.tag.revoked,
.tag.archived,
.tag.bad,
.pill.bad {
  border-color: #fecaca;
  background: var(--danger-soft);
  color: var(--danger);
}

dialog {
  width: min(720px, calc(100vw - 28px));
  max-height: min(860px, calc(100vh - 28px));
  padding: 20px;
}

dialog::backdrop {
  background: rgba(16, 24, 40, 0.46);
  backdrop-filter: blur(2px);
}

.auth-shell,
.client-shell {
  align-items: center;
  background:
    linear-gradient(135deg, #f7fafc 0, #eef4f7 48%, #f7f8fb 100%);
}

.auth-panel,
.code-panel {
  border-color: rgba(203, 213, 225, 0.86);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 72px rgba(16, 24, 40, 0.16);
}

.auth-panel {
  display: grid;
  gap: 18px;
}

.code-panel {
  width: min(560px, 100%);
  padding: 30px;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  letter-spacing: 0;
}

.client-head {
  align-items: center;
}

.client-head h1,
.auth-panel h1,
.code-panel h1 {
  color: #101828;
}

.code-box {
  gap: 15px;
  border-color: rgba(14, 116, 111, 0.22);
  border-radius: 8px;
  background: linear-gradient(180deg, #f2fbf8 0, #ffffff 100%);
  padding: 20px;
}

.code-box.waiting {
  border-color: #d7e0ea;
  background: #f8fafc;
}

#codeValue {
  color: #101828;
  font-size: 56px;
}

.code-label,
.countdown,
.watermark-text {
  color: #667085;
}

.client-info {
  margin-top: 16px;
}

.client-info-item {
  border-color: #e2e8f0;
  background: #f8fafc;
}

.client-info-note {
  border-color: #c7d2fe;
  background: var(--accent-soft);
  color: #3347a8;
}

.client-info-note.warning {
  border-color: #fed7aa;
  background: var(--warning-soft);
  color: #9a4d00;
}

.security-notice-overlay {
  background: rgba(16, 24, 40, 0.54);
  backdrop-filter: blur(3px);
}

.security-notice-dialog {
  border-color: #d7e0ea;
  border-radius: 8px;
  box-shadow: 0 26px 84px rgba(16, 24, 40, 0.24);
}

.security-notice-icon {
  border-radius: 8px;
  background: var(--primary-soft);
  color: #075a56;
}

@media (max-width: 1180px) {
  .dashboard-metrics,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-layout,
  .dashboard-rank-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
    padding-bottom: 78px;
  }

  .sidebar {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    height: auto;
    border-top: 1px solid rgba(226, 232, 240, 0.20);
    border-right: 0;
    background: rgba(16, 23, 34, 0.97);
    box-shadow: 0 -12px 34px rgba(16, 24, 40, 0.22);
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    backdrop-filter: blur(18px);
  }

  .brand,
  .sidebar form {
    display: none;
  }

  .nav-tabs,
  .force-mobile-nav .nav-tabs {
    display: grid;
    grid-template-columns: repeat(9, minmax(56px, 1fr));
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav-tabs button,
  .force-mobile-nav .nav-tabs button {
    min-width: 56px;
    min-height: 48px;
    justify-content: center;
    border-radius: 8px;
    padding: 5px 4px;
    font-size: 11px;
    line-height: 1.15;
    text-align: center;
  }

  .nav-tabs button::before,
  .force-mobile-nav .nav-tabs button::before {
    display: block;
    width: auto;
    height: auto;
    margin: 0 0 3px;
    background: transparent;
    font-size: 10px;
  }

  .workspace,
  .force-mobile-nav .workspace {
    padding: 10px 10px 18px;
  }

  .topbar,
  .force-mobile-nav .topbar {
    position: static;
    display: flex;
    margin-bottom: 10px;
    padding: 12px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  .topbar p {
    display: none;
  }

  .toolbar,
  .toolbar-actions {
    display: grid;
    align-items: stretch;
  }

  .toolbar-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .toolbar-actions > button,
  .toolbar-actions > label,
  .search-box,
  .compact-filter {
    width: 100%;
  }

  .task-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  th {
    position: static;
  }

  .notice,
  .force-mobile-nav .notice {
    right: 10px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: min(420px, calc(100vw - 20px));
    max-width: calc(100vw - 20px);
  }
}

@media (max-width: 560px) {
  .auth-shell,
  .client-shell {
    padding: 16px;
  }

  .auth-panel,
  .code-panel,
  .security-notice-dialog {
    padding: 20px;
  }

  .dashboard-metrics,
  .metric-grid,
  .task-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    min-height: 90px;
    padding: 13px;
  }

  .metric strong {
    font-size: 24px;
  }

  .toolbar-actions {
    grid-template-columns: 1fr;
  }

  .account-status-switch {
    gap: 7px;
  }

  .account-status-switch button {
    min-height: 50px;
    padding: 8px 9px;
  }

  .account-status-switch button strong {
    font-size: 17px;
  }

  #codeValue {
    font-size: 44px;
  }
}
