:root {
  color-scheme: light;
  --ink: #1f2933;
  --ink-soft: #344054;
  --muted: #667085;
  --muted-2: #98a2b3;
  --line: #d7dde6;
  --line-soft: #e8edf3;
  --panel: #ffffff;
  --panel-soft: #f7f9fc;
  --canvas: #f3f5f8;
  --green: #0f6b57;
  --green-strong: #0b5a49;
  --green-soft: #e8f5f1;
  --teal: #15708a;
  --teal-soft: #e7f5f8;
  --amber: #946200;
  --amber-soft: #fff5dc;
  --rose: #a13d4a;
  --rose-soft: #fdebed;
  --violet: #6656a8;
  --violet-soft: #f0edfb;
  --shadow: 0 10px 28px rgba(31, 41, 51, 0.07);
  --shadow-soft: 0 1px 2px rgba(31, 41, 51, 0.06);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(21, 112, 138, 0.18);
  outline-offset: 2px;
}

strong,
b {
  font-weight: 600;
}

textarea {
  resize: vertical;
}

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

.app-shell {
  min-height: 100vh;
}

.boot-screen,
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.boot-screen {
  color: var(--muted);
  gap: 12px;
}

.pulse-mark,
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, var(--green), var(--teal)),
    var(--green);
  box-shadow: 0 10px 22px rgba(15, 107, 87, 0.18);
}

.pulse-mark {
  animation: breathe 1.4s ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.94);
    opacity: 0.72;
  }

  50% {
    transform: scale(1);
    opacity: 1;
  }
}

.login-panel {
  width: min(1000px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise 0.28s ease both;
}

.login-story {
  min-height: 500px;
  padding: 40px;
  color: #ffffff;
  background:
    linear-gradient(140deg, rgba(15, 107, 87, 0.96), rgba(21, 112, 138, 0.94)),
    var(--green);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-story h1 {
  max-width: 560px;
  margin: 40px 0 16px;
  font-size: 44px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: 0;
}

.login-story p {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.65;
}

.login-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 30px;
}

.login-meta span {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

.login-form {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.login-form h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
}

.login-form p {
  margin: 7px 0 0;
  font-size: 14px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

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

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field label {
  color: #526070;
  font-size: 13px;
  font-weight: 500;
}

.field input,
.field select,
.field textarea,
.chat-input input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 6px;
  padding: 10px 11px;
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.field textarea {
  min-height: 112px;
  line-height: 1.5;
}

.field input::placeholder,
.field textarea::placeholder,
.chat-input input::placeholder {
  color: var(--muted-2);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.chat-input input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(21, 112, 138, 0.12);
}

.field-note {
  color: var(--muted);
  font-size: 12px;
}

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

.totp-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.setup-key {
  display: block;
  padding: 9px 10px;
  border: 1px solid rgba(15, 107, 87, 0.18);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink-soft);
  cursor: pointer;
}

.check-row input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--green);
  flex: 0 0 auto;
}

.check-row span {
  display: grid;
  gap: 2px;
}

.check-row strong {
  color: var(--ink);
  font-size: 13px;
}

.check-row small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.primary-btn,
.ghost-btn,
.danger-btn,
.icon-btn {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    background 0.14s ease,
    border-color 0.14s ease;
}

.primary-btn {
  color: #ffffff;
  background: var(--green);
  box-shadow: 0 8px 18px rgba(15, 107, 87, 0.18);
}

.primary-btn:hover {
  background: var(--green-strong);
}

.ghost-btn {
  color: var(--ink-soft);
  background: #ffffff;
  border: 1px solid var(--line);
}

.ghost-btn:hover {
  border-color: #c8d0dc;
  background: var(--panel-soft);
}

.danger-btn {
  color: var(--rose);
  background: var(--rose-soft);
  border: 1px solid rgba(161, 61, 74, 0.16);
}

.icon-btn {
  width: 40px;
  padding: 0;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink-soft);
}

.mobile-action {
  width: auto;
  min-width: 58px;
  padding: 0 12px;
}

.primary-btn:hover,
.ghost-btn:hover,
.danger-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:active,
.ghost-btn:active,
.danger-btn:active,
.icon-btn:active {
  transform: translateY(0);
}

.primary-btn:disabled,
.ghost-btn:disabled,
.danger-btn:disabled,
.icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none;
  box-shadow: none;
}

.button-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  opacity: 0.86;
  animation: spin 0.7s linear infinite;
}

.api-loader {
  position: fixed;
  inset: auto 22px 22px auto;
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.98);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.api-busy .api-loader {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.loader-card {
  min-width: min(320px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(15, 107, 87, 0.15);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 42px rgba(31, 41, 51, 0.16);
  backdrop-filter: blur(12px);
}

.loader-ring {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(15, 107, 87, 0.18);
  border-top-color: var(--green);
  border-radius: 999px;
  animation: spin 0.74s linear infinite;
}

.loader-text {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}

.toast-root {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 90;
  display: grid;
  gap: 10px;
  width: min(390px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 28px;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 12px 13px 14px;
  border: 1px solid var(--line-soft);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 16px 38px rgba(31, 41, 51, 0.14);
  animation: toast-in 0.2s ease both;
}

.toast.leaving {
  animation: toast-out 0.18s ease both;
}

.toast.success {
  border-left-color: var(--green);
}

.toast.error {
  border-left-color: var(--rose);
}

.toast.info {
  border-left-color: var(--teal);
}

.toast-mark {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--teal);
}

.toast.success .toast-mark {
  background: var(--green);
}

.toast.error .toast-mark {
  background: var(--rose);
}

.toast-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.toast-copy strong {
  color: var(--ink);
  font-size: 13px;
}

.toast-copy span {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.4;
}

.toast-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.toast-close:hover {
  background: var(--panel-soft);
  color: var(--ink);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}

.error-line {
  min-height: 20px;
  color: var(--rose);
  font-size: 13px;
  font-weight: 500;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: #ffffff;
  border-right: 1px solid var(--line);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
}

.brand-title strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.brand-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

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

.nav button {
  min-height: 42px;
  border-radius: 6px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  color: #526070;
  font-weight: 500;
  text-align: left;
  border: 1px solid transparent;
}

.nav button:hover {
  background: var(--panel-soft);
}

.nav button.active {
  background: var(--green-soft);
  border-color: rgba(15, 107, 87, 0.18);
  color: var(--green);
}

.nav-mark {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line-soft);
  font-size: 11px;
  font-weight: 600;
}

.nav button.active .nav-mark {
  color: var(--green);
  border-color: rgba(15, 107, 87, 0.22);
}

.side-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

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

.topbar {
  min-height: 66px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0;
}

.topbar p {
  max-width: 720px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

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

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.section-gap {
  margin-top: 16px;
}

.panel-tools {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: #ffffff;
}

.panel-tools.bottom {
  border-top: 1px solid var(--line-soft);
  border-bottom: 0;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pager-copy {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.pager-copy strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.pager-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pager-actions label {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.pager-actions select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 28px 0 9px;
}

.pager-page {
  color: var(--ink-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.panel {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  animation: rise 0.24s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-head,
.panel-body {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
}

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

.capital-hero {
  min-height: 166px;
  padding: 22px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  border-top: 4px solid var(--green);
  background:
    linear-gradient(135deg, rgba(15, 107, 87, 0.08), rgba(21, 112, 138, 0.05) 52%, rgba(255, 255, 255, 0) 100%),
    #ffffff;
}

.capital-hero span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.capital-hero strong {
  display: block;
  margin: 10px 0 7px;
  color: var(--ink);
  font-size: 42px;
  font-weight: 600;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.capital-hero small {
  color: var(--ink-soft);
  font-size: 14px;
}

.capital-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.metric {
  --accent: var(--green);
  min-height: 124px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-top: 3px solid var(--accent);
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.14;
  font-variant-numeric: tabular-nums;
}

.metric small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.metric.green {
  --accent: var(--green);
}

.metric.teal {
  --accent: var(--teal);
}

.metric.amber {
  --accent: var(--amber);
}

.metric.violet {
  --accent: var(--violet);
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.account-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #ffffff;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease;
}

.account-tile:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 107, 87, 0.28);
  box-shadow: 0 10px 24px rgba(31, 41, 51, 0.07);
}

.tile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.account-tile h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.account-tile p {
  margin: 5px 0 14px;
  color: var(--muted);
  font-size: 12px;
}

.money {
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--panel-soft);
  border: 1px solid var(--line-soft);
  color: #526070;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.pill.green {
  background: var(--green-soft);
  border-color: rgba(15, 107, 87, 0.14);
  color: var(--green);
}

.pill.amber {
  background: var(--amber-soft);
  border-color: rgba(148, 98, 0, 0.14);
  color: var(--amber);
}

.pill.rose {
  background: var(--rose-soft);
  border-color: rgba(161, 61, 74, 0.14);
  color: var(--rose);
}

.pill.teal {
  background: var(--teal-soft);
  border-color: rgba(21, 112, 138, 0.14);
  color: var(--teal);
}

.table-wrap {
  overflow: auto;
}

.data-table,
table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.directory-table {
  min-width: 560px;
}

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

th {
  color: #526070;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  background: var(--panel-soft);
}

td {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

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

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

.table-title {
  display: inline-block;
  max-width: 420px;
  color: var(--ink);
  font-weight: 600;
}

.table-meta {
  margin-top: 6px;
}

.date-cell,
.muted-cell {
  color: var(--muted);
  white-space: nowrap;
}

.accounts-cell {
  min-width: 180px;
}

.amount-cell,
.transactions-table th:nth-child(5) {
  text-align: right;
}

.amount-in,
.amount-out {
  display: block;
  white-space: nowrap;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.amount-in {
  color: var(--green);
}

.amount-out {
  color: var(--rose);
}

.flow-label {
  display: inline-flex;
  width: 28px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.history-box {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 12px;
}

.history-box summary {
  cursor: pointer;
  color: var(--teal);
  font-weight: 600;
}

.history-item {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--panel-soft);
}

.history-item strong,
.history-item span,
.history-item p {
  display: block;
}

.history-item span {
  color: var(--muted);
}

.history-item p {
  margin: 4px 0 0;
  color: var(--ink-soft);
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.attachment-list.compact {
  gap: 6px;
}

.attachment-chip {
  max-width: 260px;
  min-height: 42px;
  display: inline-grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 5px 9px 5px 5px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--ink);
  text-decoration: none;
}

.attachment-chip:hover {
  border-color: var(--teal);
  background: #ffffff;
}

.attachment-chip img,
.file-badge {
  width: 34px;
  height: 34px;
  border-radius: 5px;
}

.attachment-chip img {
  object-fit: cover;
  background: #ffffff;
}

.file-badge {
  display: grid;
  place-items: center;
  color: var(--rose);
  background: var(--rose-soft);
  font-size: 11px;
  font-weight: 700;
}

.attachment-chip strong,
.attachment-chip small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip strong {
  font-size: 12px;
  font-weight: 600;
}

.attachment-chip small {
  color: var(--muted);
  font-size: 11px;
}

.data-table .ghost-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.empty {
  padding: 40px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

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

.composer .wide {
  grid-column: span 2;
}

.composer .full {
  grid-column: 1 / -1;
}

.settings-stack {
  display: grid;
  gap: 16px;
}

.settings-grid {
  align-items: start;
}

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

.settings-form .wide,
.settings-form .full {
  grid-column: 1 / -1;
}

.settings-panel .panel-body {
  background: #ffffff;
}

.rates-list {
  max-width: 520px;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.chat-box {
  min-height: 440px;
  display: flex;
  flex-direction: column;
}

.chat-stream {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 12px;
  max-height: 520px;
  padding: 18px;
  overflow: auto;
}

.bubble {
  max-width: 86%;
  border-radius: var(--radius);
  padding: 11px 13px;
  line-height: 1.5;
  font-size: 14px;
  animation: pop 0.18s ease both;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.99) translateY(3px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.bubble.user {
  justify-self: end;
  color: #ffffff;
  background: var(--green);
}

.bubble.system {
  justify-self: start;
  color: var(--ink-soft);
  background: var(--panel-soft);
  border: 1px solid var(--line-soft);
}

.chat-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px) auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line-soft);
}

.mention-field {
  position: relative;
  min-width: 0;
}

.mention-menu {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  display: grid;
  gap: 6px;
  max-height: 278px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 42px rgba(31, 41, 51, 0.16);
  animation: mention-pop 0.14s ease both;
}

.mention-menu[hidden] {
  display: none;
}

.mention-option {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 9px;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.mention-option:hover,
.mention-option.active {
  background: var(--teal-soft);
}

.mention-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.mention-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.mention-main small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes mention-pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-input input[type="file"] {
  color: var(--muted);
  font-size: 13px;
}

.draft-attachments {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.draft-list,
.details-list {
  display: grid;
  gap: 10px;
}

.draft-row,
.detail-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}

.draft-row span,
.detail-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.draft-row strong,
.detail-row strong {
  color: var(--ink);
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chart {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 112px;
  align-items: center;
  gap: 12px;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--panel-soft);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: var(--width);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--teal));
  transform-origin: left;
  animation: grow 0.55s ease both;
}

.chart-value {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@keyframes grow {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

.split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-ring {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    conic-gradient(var(--green) var(--value), var(--panel-soft) 0),
    var(--panel-soft);
}

.progress-ring span {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ffffff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

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

.reconcile-result {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  display: grid;
  gap: 12px;
}

.flag-item {
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius);
  padding: 12px;
  background: #ffffff;
}

.flag-item strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.flag-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.mobile-top {
  display: none;
}

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

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

  .composer .wide,
  .composer .full {
    grid-column: 1 / -1;
  }
}

@media (max-width: 940px) {
  .login-panel {
    grid-template-columns: 1fr;
  }

  .login-story {
    min-height: auto;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(306px, 84vw);
    z-index: 20;
    transform: translateX(-104%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
  }

  .mobile-top strong {
    min-width: 0;
    font-weight: 600;
  }

  .workspace {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    min-height: 0;
  }

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

  .actions {
    justify-content: flex-start;
  }

  .grid.cols-2,
  .grid.cols-3,
  .settings-grid,
  .chat-layout {
    grid-template-columns: 1fr;
  }

  .capital-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .capital-meta {
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 14px;
  }

  .login-form,
  .login-story {
    padding: 24px;
  }

  .login-story h1 {
    margin-top: 34px;
    font-size: 32px;
  }

  .login-meta,
  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .composer,
  .settings-form {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .panel-body,
  .metric {
    padding: 14px;
  }

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

  .capital-hero {
    min-height: 0;
    padding: 18px;
  }

  .capital-hero strong {
    font-size: 32px;
  }

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

  .actions {
    width: 100%;
  }

  .pager {
    align-items: stretch;
    flex-direction: column;
  }

  .pager-actions {
    justify-content: flex-start;
  }

  .actions .primary-btn,
  .actions .ghost-btn {
    flex: 1 1 150px;
  }

  .chat-input {
    grid-template-columns: 1fr;
  }

  .bubble {
    max-width: 100%;
  }

  .bar-row {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .chart-value {
    grid-column: 2;
    text-align: left;
  }

  .draft-row,
  .detail-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .draft-row strong,
  .detail-row strong {
    text-align: left;
  }

  .api-loader {
    inset: auto 16px 16px 16px;
  }

  .loader-card {
    min-width: 0;
    width: 100%;
  }

  .toast-root {
    top: 12px;
    right: 12px;
    width: calc(100vw - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
