* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  color: #1f2937;
  background: #f3f4f6;
}
.hidden { display: none !important; }
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.panel {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 18px;
  margin: 14px 0;
}
.login-card {
  width: min(420px, 100%);
}
h1, h2, h3 { margin: 0 0 12px; }
p { margin: 0 0 12px; color: #6b7280; }
label {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
}
input, select, textarea, button {
  font: inherit;
  border-radius: 6px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  padding: 8px 9px;
  background: #fff;
}
.readonly-field {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 9px;
  background: #f9fafb;
  min-height: 64px;
}
.readonly-field span,
.readonly-field small {
  display: block;
  color: #6b7280;
  font-size: 12px;
}
.readonly-field strong {
  display: block;
  margin: 4px 0;
}
textarea { min-height: 72px; resize: vertical; }
button {
  border: 1px solid #2563eb;
  background: #2563eb;
  color: #fff;
  padding: 8px 12px;
  cursor: pointer;
}
button.secondary {
  border-color: #9ca3af;
  background: #fff;
  color: #111827;
}
button.danger {
  border-color: #dc2626;
  background: #dc2626;
}
button:disabled { opacity: .5; cursor: not-allowed; }
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: #111827;
  color: #fff;
}
header p { color: #d1d5db; }
nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: #e5e7eb;
}
nav button {
  border-color: #9ca3af;
  background: #fff;
  color: #111827;
}
nav button.active {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}
.impersonation-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 13px;
  font-weight: 700;
}
.impersonation-banner button {
  border-color: #ea580c;
  background: #ea580c;
  padding: 6px 10px;
}
main {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
}
.grid-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}
.grid-form.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.grid-form .full { grid-column: 1 / -1; }
.inline-ledger-form {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  background: #f9fafb;
}
.nested-form {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  background: #f9fafb;
  margin-bottom: 12px;
}
.order-entry-section {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  margin: 8px 0 12px;
}
.template-builder-block {
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
  margin-top: 12px;
}
.template-builder-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.template-row,
.manual-order-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}
.template-model-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  background: #f9fafb;
}
.template-model-head {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}
.template-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.template-summary div {
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #eff6ff;
  padding: 10px;
}
.template-summary span {
  display: block;
  color: #6b7280;
  font-size: 12px;
}
.template-summary strong {
  display: block;
  margin-top: 4px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 12px;
  background: #f9fafb;
}
.stat span { display: block; color: #6b7280; font-size: 12px; }
.stat strong { display: block; margin-top: 6px; font-size: 20px; }
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: #fff;
}
th, td {
  border-bottom: 1px solid #e5e7eb;
  padding: 9px 8px;
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}
th { background: #f9fafb; color: #6b7280; }
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.time-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 12px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}
.time-filter span {
  color: #6b7280;
  font-size: 13px;
  font-weight: 700;
}
.time-filter button {
  padding: 6px 10px;
}
.time-filter button.active {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}
.time-filter input {
  width: 150px;
  padding: 6px 8px;
}
.platform-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 12px;
}
.platform-switch span {
  color: #6b7280;
  font-size: 13px;
  font-weight: 700;
}
.platform-switch button.active {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}
.mode-switch {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 14px;
}
.mode-switch button {
  border-color: #9ca3af;
  background: #fff;
  color: #111827;
}
.mode-switch button.active {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}
.ledger-search {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 10px;
  margin: 12px 0;
}
.ledger-card {
  display: grid;
  gap: 12px;
  margin: 12px 0;
}
.finance-ledger-panel {
  border-top: 1px solid #e5e7eb;
  margin-top: 18px;
  padding-top: 14px;
}
.collapsible-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.collapsible-head h3 {
  margin-bottom: 4px;
}
.finance-ledger-panel.collapsed .ledger-card {
  display: none;
}
.ledger-summary {
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px;
  background: #eff6ff;
}
.ledger-summary h3 { margin-bottom: 8px; }
.ledger-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.ledger-metrics div {
  border: 1px solid #dbeafe;
  border-radius: 6px;
  padding: 8px;
  background: #fff;
}
.ledger-metrics span {
  display: block;
  color: #6b7280;
  font-size: 12px;
}
.expense-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.expense-stats div,
.expense-form-card,
.expense-list-panel {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 12px;
  background: #f9fafb;
}
.expense-stats span,
.section-hint {
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
}
.expense-stats strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}
.expense-layout {
  display: grid;
  grid-template-columns: minmax(320px, .8fr) minmax(0, 1.2fr);
  gap: 14px;
  align-items: start;
}
.expense-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px;
  gap: 10px;
  margin-bottom: 12px;
}
.expense-list {
  display: grid;
  gap: 10px;
}
.expense-card {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.expense-card.archived {
  background: #f8fafc;
  border-style: dashed;
}
.expense-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.expense-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  color: #6b7280;
  font-size: 12px;
}
.expense-note {
  margin-top: 8px;
  color: #4b5563;
  font-size: 13px;
}
.expense-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.expense-amount {
  text-align: right;
  white-space: nowrap;
}
.empty {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 14px;
  color: #6b7280;
  background: #fff;
  text-align: center;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, .35);
}
.modal-card {
  width: min(760px, 100%);
  max-height: 88vh;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #fff;
  padding: 16px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.detail-item {
  grid-column: span 3;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  background: #f9fafb;
}
.detail-item.full { grid-column: 1 / -1; }
.detail-item label {
  display: block;
  color: #6b7280;
  font-size: 12px;
  margin-bottom: 5px;
}
.detail-item div {
  font-weight: 700;
  white-space: pre-wrap;
  word-break: break-word;
}
.record-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.detail-metric {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px;
  background: #f9fafb;
}
.detail-metric span {
  display: block;
  color: #6b7280;
  font-size: 12px;
}
.detail-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
}
.detail-section {
  border-top: 1px solid #e5e7eb;
  padding-top: 14px;
  margin-top: 14px;
}
.detail-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.detail-section-title h3,
.detail-group h4 {
  margin: 0;
}
.detail-section-title span {
  color: #6b7280;
  font-size: 13px;
}
.detail-group {
  margin-bottom: 12px;
}
.voided {
  color: #9ca3af;
  text-decoration: line-through;
}
.audit-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}
.audit-item {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px;
  background: #f9fafb;
  font-size: 12px;
}
.audit-item strong { margin-right: 6px; }
.hint, .message {
  color: #6b7280;
  font-size: 13px;
  margin-top: 10px;
}
.message { color: #dc2626; min-height: 18px; }
.status {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
}
.status.completed,
.status.approved,
.status.paid { background: #dcfce7; color: #166534; }
.status.submitted { background: #fef3c7; color: #92400e; }
.status.rejected { background: #fee2e2; color: #991b1b; }
.status.reconcile-matched { background: #dcfce7; color: #166534; }
.status.reconcile-finance_missing,
.status.reconcile-amount_diff,
.status.reconcile-date_diff { background: #fee2e2; color: #991b1b; }
.status.reconcile-business_missing { background: #e0f2fe; color: #075985; }
.attention-row td {
  background: #fff7ed;
}
.settings-list, .template-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.setting-block {
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  background: #eff6ff;
}
.setting-row, .template-card {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px;
  background: #f9fafb;
}
.sub-account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px;
  background: #f9fafb;
}
.account-manage-row {
  display: grid;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
  overflow: hidden;
}
.account-manage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}
.account-manage-head::-webkit-details-marker {
  display: none;
}
.account-manage-head::before {
  content: '›';
  color: #64748b;
  font-size: 22px;
  line-height: 1;
  transition: transform 0.18s ease;
}
.account-manage-row[open] .account-manage-head::before {
  transform: rotate(90deg);
}
.account-manage-head > div {
  flex: 1;
}
.account-expand-label {
  color: #2563eb;
  font-size: 13px;
  white-space: nowrap;
}
.account-manage-body {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
}
.permission-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
}
.permission-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff;
}
.permission-group strong {
  color: #475569;
  font-size: 13px;
  margin-right: 2px;
}
.permission-check {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
}
.permission-check input {
  width: 16px;
  height: 16px;
}
.account-manage-actions {
  justify-content: flex-end;
}
.managed-bank-card-block {
  display: grid;
  gap: 10px;
  border-top: 1px dashed #cbd5e1;
  padding-top: 10px;
}
.managed-bank-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.managed-bank-card-head h4 {
  margin: 0;
  font-size: 15px;
}
.managed-bank-card-list {
  display: grid;
  gap: 8px;
}
.managed-bank-card-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  gap: 8px;
  align-items: end;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}
.managed-bank-card-row label,
.managed-bank-card-add label {
  margin: 0;
}
.managed-bank-card-row input,
.managed-bank-card-add input {
  padding: 8px 10px;
}
.setting-row {
  display: grid;
  grid-template-columns: 180px 180px 1fr;
  gap: 10px;
  align-items: center;
}
.setting-row[data-order-platform-default] {
  grid-template-columns: 150px repeat(4, minmax(120px, 1fr));
}
.profile-form {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}
.profile-avatar-block {
  display: grid;
  gap: 10px;
}
.avatar-preview {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f9fafb;
  color: #6b7280;
  font-weight: 700;
}
.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-crop-panel {
  display: grid;
  gap: 8px;
  width: min(320px, 100%);
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
}
.avatar-crop-panel canvas {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}
.avatar-crop-panel label {
  margin-bottom: 0;
}
.avatar-crop-panel input[type="range"] {
  padding: 0;
}
.profile-extra-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.template-card header {
  padding: 0;
  color: #111827;
  background: transparent;
}
.preset-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.preset {
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
}
.inline-form {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) auto;
  gap: 8px;
  align-items: end;
}
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: #6b7280;
  font-size: 13px;
}
.pager-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pager-actions label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.pager-actions select {
  width: auto;
  min-width: 72px;
  padding: 6px 8px;
}
.pager-actions button {
  padding: 6px 10px;
}
.attachment-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  min-width: 150px;
  margin-bottom: 4px;
  padding: 4px 6px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
}
.attachment-link span {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-link button {
  flex: 0 0 auto;
  padding: 4px 8px;
  font-size: 12px;
}
@media (max-width: 800px) {
  header { align-items: flex-start; flex-direction: column; }
  .grid-form, .grid-form.compact, .stats, .setting-row, .setting-row[data-order-platform-default], .profile-form, .profile-extra-fields, .ledger-search, .ledger-metrics, .detail-grid, .expense-stats, .expense-layout, .expense-toolbar, .template-builder-grid, .template-row, .manual-order-row, .template-model-head, .template-summary { grid-template-columns: 1fr; }
  .managed-bank-card-row { grid-template-columns: 1fr; }
  .sub-account-row, .account-manage-head { align-items: flex-start; flex-direction: column; }
  .detail-head { flex-direction: column; }
  .pager { align-items: flex-start; flex-direction: column; }
  .detail-item { grid-column: 1 / -1; }
}

/* Official release visual layer */
:root {
  --bg: #f6f8fa;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --teal: #14b8a6;
  --teal-dark: #0f9f92;
  --sky: #38bdf8;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --blue: #3b82f6;
  --shadow: 0 14px 38px rgba(15, 23, 42, .07);
  --soft-shadow: 0 8px 22px rgba(15, 23, 42, .05);
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 20% -10%, rgba(20, 184, 166, .14), transparent 32%),
    radial-gradient(circle at 95% 0%, rgba(56, 189, 248, .12), transparent 30%),
    var(--bg);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  letter-spacing: 0;
}

.login-view {
  background:
    linear-gradient(135deg, rgba(20, 184, 166, .16), rgba(56, 189, 248, .08)),
    var(--bg);
}

.login-card {
  width: min(460px, 100%);
  border: 1px solid rgba(226, 232, 240, .9);
  box-shadow: var(--shadow);
}

.login-card h1 {
  font-size: 28px;
  letter-spacing: 0;
}

.app-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  background: transparent;
  min-width: 0;
}

header {
  position: sticky;
  top: 0;
  z-index: 20;
  grid-column: 2;
  min-height: 72px;
  padding: 16px 28px;
  color: var(--ink);
  background: rgba(255, 255, 255, .86);
  border-bottom: 1px solid rgba(226, 232, 240, .8);
  backdrop-filter: blur(18px);
}

header h1 {
  position: relative;
  margin: 0;
  padding-left: 42px;
  font-size: 20px;
  font-weight: 800;
}

header h1::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background:
    linear-gradient(135deg, var(--teal), var(--sky));
  transform: translateY(-50%);
  box-shadow: 0 8px 18px rgba(20, 184, 166, .28);
}

header p {
  margin: 4px 0 0 42px;
  color: var(--muted);
  font-size: 13px;
}

header button {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

nav {
  position: sticky;
  top: 0;
  z-index: 25;
  grid-column: 1;
  grid-row: 1 / span 2;
  min-height: 100vh;
  align-content: start;
  gap: 8px;
  padding: 92px 16px 18px;
  background: rgba(255, 255, 255, .84);
  border-right: 1px solid rgba(226, 232, 240, .9);
  box-shadow: 12px 0 34px rgba(15, 23, 42, .04);
  backdrop-filter: blur(18px);
}

nav::before {
  content: "贸易资金结算系统";
  position: absolute;
  left: 18px;
  top: 28px;
  right: 16px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}

nav button {
  width: 100%;
  justify-content: flex-start;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #334155;
  font-weight: 700;
  text-align: left;
}

nav button::before {
  content: "";
  width: 9px;
  height: 9px;
  margin-right: 10px;
  border-radius: 50%;
  background: #cbd5e1;
  display: inline-block;
  vertical-align: 1px;
}

nav button:hover {
  background: #f8fafc;
  border-color: var(--line);
}

nav button.active {
  color: var(--teal-dark);
  border-color: rgba(20, 184, 166, .2);
  background: linear-gradient(135deg, rgba(20, 184, 166, .12), rgba(56, 189, 248, .08));
}

nav button.active::before {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, .14);
}

main {
  grid-column: 2;
  width: min(1400px, calc(100% - 48px));
  padding: 8px 0 34px;
  min-width: 0;
}

.panel {
  margin: 16px 0;
  padding: 22px;
  border: 1px solid rgba(226, 232, 240, .92);
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--soft-shadow);
  min-width: 0;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.view > h2,
.detail-head h2 {
  margin-bottom: 6px;
  font-size: 22px;
  font-weight: 850;
}

h3 {
  color: #1e293b;
  font-size: 16px;
  font-weight: 800;
}

p,
.hint,
small {
  color: var(--muted);
}

button {
  border-color: var(--teal);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal), #10b3c6);
  box-shadow: 0 8px 18px rgba(20, 184, 166, .18);
  font-weight: 750;
}

button.secondary {
  border-color: var(--line);
  background: #fff;
  color: #334155;
  box-shadow: none;
}

button.danger {
  border-color: var(--red);
  background: var(--red);
}

input,
select,
textarea {
  min-height: 38px;
  border-color: var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(20, 184, 166, .75);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, .12);
}

label {
  color: #334155;
  font-weight: 750;
}

.platform-switch,
.time-filter,
.toolbar {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.platform-switch button.active,
.time-filter button.active {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0;
}

.stat {
  position: relative;
  min-height: 150px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.stat::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 18px;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(20, 184, 166, .2), rgba(56, 189, 248, .18));
}

.stat.order::after { background: linear-gradient(135deg, rgba(245, 158, 11, .22), rgba(251, 191, 36, .14)); }
.stat.tax::after { background: linear-gradient(135deg, rgba(34, 197, 94, .22), rgba(20, 184, 166, .14)); }
.stat.personal::after { background: linear-gradient(135deg, rgba(59, 130, 246, .22), rgba(56, 189, 248, .14)); }

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

.stat strong {
  margin-top: 12px;
  padding-right: 42px;
  font-size: clamp(18px, 1.55vw, 26px);
  color: #0f172a;
  word-break: break-word;
}

.stat small {
  display: block;
  margin-top: 6px;
}

.mini-trend {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  height: 42px;
  display: flex;
  align-items: end;
  gap: 5px;
}

.mini-trend i {
  flex: 1;
  min-width: 5px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, rgba(20, 184, 166, .7), rgba(56, 189, 248, .28));
}

.dashboard-charts {
  display: grid;
  grid-template-columns: 1.35fr 1.15fr .95fr;
  gap: 14px;
  margin: 10px 0 18px;
}

.chart-card {
  min-height: 270px;
  padding: 18px;
  border: 1px solid rgba(226, 232, 240, .92);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.chart-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.chart-head h3 {
  margin: 0 0 4px;
}

.chart-head p {
  margin: 0;
  font-size: 12px;
}

.chart-head > span {
  height: 28px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f0fdfa;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}

.line-chart {
  height: 198px;
  display: flex;
  align-items: end;
  gap: 14px;
  padding: 14px 4px 0;
  border-bottom: 1px solid var(--line);
}

.line-point {
  flex: 1;
  height: 100%;
  display: grid;
  align-items: end;
  justify-items: center;
  gap: 8px;
}

.line-point i {
  width: 100%;
  max-width: 34px;
  height: var(--h);
  border-radius: 8px 8px 2px 2px;
  background: linear-gradient(180deg, var(--teal), rgba(20, 184, 166, .18));
  box-shadow: 0 10px 20px rgba(20, 184, 166, .16);
}

.line-point small {
  font-size: 12px;
}

.bar-chart {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: 80px minmax(90px, 1fr) minmax(104px, auto);
  align-items: center;
  gap: 10px;
}

.bar-row > span,
.bar-row strong {
  font-size: 12px;
}

.bar-row div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--sky));
}

.donut-layout {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.donut {
  width: 150px;
  height: 150px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 54%, transparent 55%),
    conic-gradient(var(--teal) 0 var(--a), var(--sky) var(--a) var(--b), var(--red) var(--b) 100%);
}

.donut.empty {
  background:
    radial-gradient(circle, #fff 0 54%, transparent 55%),
    conic-gradient(#e2e8f0 0 100%);
}

.donut strong {
  width: 86px;
  text-align: center;
  font-size: 13px;
}

.donut span {
  color: var(--muted);
  font-size: 12px;
}

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

.legend-list span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-size: 13px;
}

.legend-list i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-list .ok { background: var(--teal); }
.legend-list .info { background: var(--sky); }
.legend-list .warn { background: var(--red); }

.chart-empty {
  width: 100%;
  align-self: center;
  padding: 52px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: #f8fafc;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 800;
}

td {
  background: #fff;
}

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

.status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--blue);
  font-weight: 800;
}

.status.completed,
.status.approved,
.status.paid {
  background: #dcfce7;
  color: #15803d;
}

.status.pending,
.status.submitted {
  background: #fef3c7;
  color: #b45309;
}

.status.rejected,
.status.voided {
  background: #fee2e2;
  color: #b91c1c;
}

.grid-form,
.grid-form.compact,
.inline-ledger-form,
.nested-form,
.order-entry-section,
.template-model-card,
.readonly-field {
  border-color: var(--line);
  border-radius: 8px;
  background: #fff;
}

.finance-ledger-panel,
.ledger-card,
.detail-section,
.expense-form-card,
.expense-list-card,
.setting-block,
.template-card,
.sub-account-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.finance-ledger-panel,
.ledger-card,
.detail-section,
.setting-block {
  padding: 16px;
}

.detail-grid,
.ledger-metrics,
.expense-stats,
.template-summary {
  gap: 12px;
}

.detail-metric,
.ledger-metrics div,
.expense-stats div,
.template-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.impersonation-banner {
  grid-column: 2;
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
}

@media (max-width: 1180px) {
  .app-view {
    grid-template-columns: minmax(0, 1fr);
  }

  header,
  main,
  .impersonation-banner {
    grid-column: 1;
  }

  nav {
    position: sticky;
    top: 72px;
    grid-column: 1;
    grid-row: auto;
    min-height: auto;
    display: flex;
    padding: 10px 16px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  nav::before {
    display: none;
  }

  nav button {
    width: auto;
    white-space: nowrap;
  }

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

  .donut-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 800px) {
  main {
    width: calc(100% - 24px);
  }

  header {
    padding: 14px 16px;
  }

  .panel {
    padding: 16px;
  }

  .dashboard-charts,
  .stats,
  .donut-layout,
  .bar-row {
    grid-template-columns: 1fr;
  }

  .stat {
    min-height: 128px;
  }
}

/* Richer review theme inspired by the supplied reference */
:root {
  --violet: #7c3aed;
  --indigo: #4263ff;
  --pink: #ec4899;
  --orange: #fb923c;
  --cyan-soft: #e0f7ff;
  --violet-soft: #ede9fe;
  --pink-soft: #fce7f3;
  --orange-soft: #fff7ed;
}

body {
  position: relative;
  min-height: 100vh;
  background:
    linear-gradient(118deg, rgba(224, 247, 255, .78) 0%, rgba(246, 248, 255, .92) 38%, rgba(253, 244, 255, .72) 70%, rgba(255, 247, 237, .52) 100%),
    #f7f9ff;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .7;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'%3E%3Cpath d='M11 7.5v7M7.5 11h7' stroke='%2394a3b8' stroke-opacity='.34' stroke-width='.8' stroke-linecap='round'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='110' height='110' viewBox='0 0 110 110'%3E%3Cpath d='M55 49v12M49 55h12' stroke='%236366f1' stroke-opacity='.14' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: 22px 22px, 110px 110px;
}

.login-view {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(122deg, rgba(224, 247, 255, .82), rgba(239, 246, 255, .92) 42%, rgba(250, 245, 255, .86) 72%, rgba(255, 247, 237, .68));
}

.login-view::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .78;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'%3E%3Cpath d='M11 7.5v7M7.5 11h7' stroke='%2394a3b8' stroke-opacity='.36' stroke-width='.8' stroke-linecap='round'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='110' height='110' viewBox='0 0 110 110'%3E%3Cpath d='M55 49v12M49 55h12' stroke='%232563eb' stroke-opacity='.14' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: 22px 22px, 110px 110px;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(390px, calc(100% - 32px));
  padding: 30px;
  border-color: rgba(255, 255, 255, .78);
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 24px 70px rgba(66, 99, 255, .14), 0 10px 28px rgba(20, 184, 166, .12);
  backdrop-filter: blur(18px);
}

.login-card h1 {
  margin-bottom: 8px;
  font-size: 25px;
  text-align: center;
}

.login-card p {
  margin-bottom: 24px;
  text-align: center;
}

.login-card label {
  margin-bottom: 14px;
}

.login-card input {
  min-height: 44px;
  border-color: rgba(148, 163, 184, .55);
  background: rgba(255, 255, 255, .9);
}

.login-card button[type="submit"] {
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  background: linear-gradient(135deg, var(--indigo), var(--teal), var(--sky));
  border-color: transparent;
}

.login-card .message {
  text-align: center;
}

header,
nav,
.panel,
.chart-card,
.stat,
.finance-ledger-panel,
.ledger-card,
.detail-section,
.expense-form-card,
.expense-list-card,
.setting-block,
.template-card,
.sub-account-row {
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(16px);
}

nav {
  background: rgba(244, 247, 255, .88);
}

nav button:nth-child(3n + 1).active {
  color: #0f766e;
  background: linear-gradient(135deg, rgba(20, 184, 166, .16), rgba(56, 189, 248, .1));
}

nav button:nth-child(3n + 2).active {
  color: #4338ca;
  background: linear-gradient(135deg, rgba(66, 99, 255, .14), rgba(124, 58, 237, .1));
}

nav button:nth-child(3n).active {
  color: #be185d;
  background: linear-gradient(135deg, rgba(236, 72, 153, .12), rgba(251, 146, 60, .1));
}

.stat::after {
  background: linear-gradient(135deg, rgba(66, 99, 255, .2), rgba(56, 189, 248, .18));
}

.stat.pool::after { background: linear-gradient(135deg, rgba(20, 184, 166, .22), rgba(45, 212, 191, .15)); }
.stat.book::after { background: linear-gradient(135deg, rgba(124, 58, 237, .2), rgba(96, 165, 250, .14)); }
.stat.tax::after { background: linear-gradient(135deg, rgba(34, 197, 94, .22), rgba(20, 184, 166, .14)); }
.stat.profit::after { background: linear-gradient(135deg, rgba(236, 72, 153, .18), rgba(251, 146, 60, .14)); }
.stat.personal::after { background: linear-gradient(135deg, rgba(59, 130, 246, .2), rgba(124, 58, 237, .14)); }

.mini-trend i:nth-child(4n + 1) { background: linear-gradient(180deg, var(--teal), rgba(20, 184, 166, .22)); }
.mini-trend i:nth-child(4n + 2) { background: linear-gradient(180deg, var(--sky), rgba(56, 189, 248, .22)); }
.mini-trend i:nth-child(4n + 3) { background: linear-gradient(180deg, var(--violet), rgba(124, 58, 237, .18)); }
.mini-trend i:nth-child(4n) { background: linear-gradient(180deg, var(--orange), rgba(251, 146, 60, .2)); }

.chart-head > span {
  background: linear-gradient(135deg, rgba(20, 184, 166, .14), rgba(66, 99, 255, .1));
  color: #2563eb;
}

.line-point:nth-child(4n + 1) i { background: linear-gradient(180deg, var(--teal), rgba(20, 184, 166, .18)); }
.line-point:nth-child(4n + 2) i { background: linear-gradient(180deg, var(--sky), rgba(56, 189, 248, .18)); }
.line-point:nth-child(4n + 3) i { background: linear-gradient(180deg, var(--violet), rgba(124, 58, 237, .16)); }
.line-point:nth-child(4n) i { background: linear-gradient(180deg, var(--pink), rgba(236, 72, 153, .16)); }

.bar-row:nth-child(4n + 1) i { background: linear-gradient(90deg, var(--teal), var(--sky)); }
.bar-row:nth-child(4n + 2) i { background: linear-gradient(90deg, var(--indigo), var(--violet)); }
.bar-row:nth-child(4n + 3) i { background: linear-gradient(90deg, var(--orange), var(--pink)); }
.bar-row:nth-child(4n) i { background: linear-gradient(90deg, var(--green), var(--teal)); }

.donut {
  background:
    radial-gradient(circle, rgba(255, 255, 255, .96) 0 54%, transparent 55%),
    conic-gradient(var(--teal) 0 var(--a), var(--indigo) var(--a) var(--b), var(--pink) var(--b) 100%);
}

.platform-switch,
.time-filter,
.toolbar {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .88), rgba(248, 250, 252, .76));
}

.platform-switch button.active,
.time-filter button.active {
  background: linear-gradient(135deg, var(--teal), var(--indigo));
  box-shadow: 0 10px 22px rgba(66, 99, 255, .14);
}
