:root {
  color-scheme: dark;
  --bg: #0b0a08;
  --bg-deep: #070605;
  --sidebar: #080706;
  --surface: #18150f;
  --surface-2: #12100c;
  --surface-3: #201c14;
  --border: #2c271c;
  --border-strong: #3f3626;
  --text: #f3ede1;
  --text-soft: #c3b399;
  --text-2: #b3a48c;
  --muted: #7a7162;
  --muted-deep: #5f5545;
  --accent: #c9a470;
  --accent-bright: #e3c48f;
  --accent-deep: #8f6e42;
  --success: #7a9e7e;
  --danger: #c45c4a;
  --warn: #b8915a;
  --font-ui: 'Microsoft YaHei UI', 'Microsoft YaHei', 'PingFang SC',
    'Segoe UI', sans-serif;
  --font-display: 'Noto Serif SC', 'Songti SC', 'STSong', 'SimSun', serif;
  --font-mono: 'Cascadia Mono', 'Consolas', monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  background:
    radial-gradient(ellipse 60% 40% at 55% -12%, rgba(201, 164, 112, 0.08), transparent 62%),
    radial-gradient(ellipse 40% 50% at -8% 80%, rgba(145, 102, 44, 0.12), transparent 70%),
    linear-gradient(125deg, #080706 0%, #0b0a08 55%, #070605 100%);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 1px solid rgba(227, 196, 143, 0.72);
  outline-offset: 2px;
}

::selection {
  background: rgba(201, 164, 112, 0.25);
  color: #fff4dc;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  border-radius: 9px;
  background: var(--border-strong);
}

::-webkit-scrollbar-track {
  background: transparent;
}

code {
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(255, 242, 216, 0.05);
  color: #cbb187;
  font-family: var(--font-mono);
  font-size: 0.92em;
}

/* ------------------------------------------------------------
   Login
   ------------------------------------------------------------ */

.login-screen {
  position: relative;
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 24px;
}

.login-atmosphere {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  color: var(--accent);
}

.login-reel {
  position: absolute;
  border: 1px solid rgba(201, 164, 112, 0.08);
  border-radius: 50%;
  box-shadow:
    0 0 0 38px rgba(201, 164, 112, 0.018),
    0 0 0 120px rgba(201, 164, 112, 0.01);
}

.login-reel::before,
.login-reel::after {
  position: absolute;
  inset: 17%;
  border: 1px solid rgba(201, 164, 112, 0.07);
  border-radius: 50%;
  content: '';
}

.login-reel::after {
  inset: 36%;
  border-style: dashed;
}

.login-reel-a {
  left: -220px;
  bottom: -300px;
  width: 720px;
  height: 720px;
}

.login-reel-b {
  top: -360px;
  right: -260px;
  width: 820px;
  height: 820px;
  opacity: 0.65;
}

.login-screen::after {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  content: '';
}

.login-card {
  position: relative;
  z-index: 2;
  width: min(390px, 100%);
  padding: 34px 30px 28px;
  border: 1px solid rgba(201, 164, 112, 0.22);
  border-radius: 18px;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(201, 164, 112, 0.08), transparent 62%),
    linear-gradient(180deg, rgba(23, 18, 12, 0.98), rgba(10, 8, 6, 0.99));
  box-shadow:
    0 38px 100px rgba(0, 0, 0, 0.68),
    inset 0 1px 0 rgba(255, 232, 184, 0.06);
}

.login-card::before {
  position: absolute;
  top: -1px;
  left: 50%;
  width: 90px;
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  content: '';
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.brand-seal {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(222, 181, 106, 0.5);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(237, 208, 150, 0.2), transparent 62%),
    #1a130a;
  color: #e8cd97;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 0 22px rgba(201, 164, 112, 0.08);
}

.brand-seal.small {
  width: 27px;
  height: 27px;
  font-size: 14px;
}

.brand-name {
  color: #eadcc4;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.login-brand small {
  align-self: flex-end;
  padding-bottom: 4px;
  color: #76664e;
  font-family: 'Segoe UI', sans-serif;
  font-size: 7px;
  letter-spacing: 0.18em;
}

.login-card h1 {
  margin: 0;
  color: #f1e8d8;
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
}

.login-card > p {
  margin: 8px 0 26px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
  text-align: center;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#login-form label,
.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#login-form label span,
.modal-field span {
  color: #a89576;
  font-size: 9.5px;
  letter-spacing: 0.03em;
}

#login-form input,
.modal-field input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(201, 164, 112, 0.22);
  border-radius: 8px;
  outline: 0;
  background: rgba(5, 4, 3, 0.56);
  color: #e1d4bf;
  font-size: 12px;
  transition: border-color 160ms ease, background 160ms ease;
}

#login-form input:focus,
.modal-field input:focus {
  border-color: rgba(220, 181, 110, 0.58);
  background: rgba(5, 4, 3, 0.76);
}

#login-button {
  height: 42px;
  margin-top: 4px;
  border: 1px solid rgba(244, 220, 174, 0.62);
  border-radius: 8px;
  background: linear-gradient(180deg, #ddbd85, #c49b63);
  color: #281c0b;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow:
    inset 0 1px 0 rgba(255, 250, 235, 0.45),
    0 9px 26px rgba(172, 126, 59, 0.18);
  transition: filter 150ms ease, transform 150ms ease;
}

#login-button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

#login-button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.login-hint {
  margin: 21px 0 0 !important;
  padding-top: 14px;
  border-top: 1px solid rgba(201, 164, 112, 0.1);
  color: #625540 !important;
  font-size: 8px !important;
  line-height: 1.75 !important;
  text-align: left !important;
}

.login-foot {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(201, 164, 112, 0.25);
  font-family: 'Segoe UI', sans-serif;
  font-size: 8px;
  letter-spacing: 0.18em;
}

.form-error {
  min-height: 16px;
  color: #d38a76;
  font-size: 9px;
  line-height: 1.6;
}

.form-error:empty {
  min-height: 0;
}

/* ------------------------------------------------------------
   Dashboard shell
   ------------------------------------------------------------ */

.dashboard {
  min-height: 100vh;
  animation: dashboard-in 320ms ease both;
}

@keyframes dashboard-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  min-height: 52px;
  align-items: center;
  padding: 0 22px;
  gap: 18px;
  border-bottom: 1px solid rgba(201, 164, 112, 0.11);
  background: rgba(8, 7, 6, 0.9);
  backdrop-filter: blur(12px);
}

.top-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-word {
  color: #e5d5b9;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.brand-divider {
  width: 1px;
  height: 14px;
  margin: 0 3px;
  background: rgba(201, 164, 112, 0.16);
}

.brand-product {
  color: #8f7c5f;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.connection-state {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  color: #796a50;
  font-size: 9px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 9px rgba(122, 158, 126, 0.7);
}

.live-dot.is-paused {
  background: var(--warn);
  box-shadow: 0 0 8px rgba(184, 145, 90, 0.45);
}

.live-dot.is-offline {
  background: #725b50;
  box-shadow: none;
}

.demo-badge {
  padding: 2px 6px;
  margin-left: 3px;
  border: 1px solid rgba(184, 145, 90, 0.28);
  border-radius: 4px;
  background: rgba(184, 145, 90, 0.07);
  color: #b59868;
  font-size: 7px;
  letter-spacing: 0.08em;
}

.top-actions {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 5px;
}

.clock {
  padding-right: 8px;
  margin-right: 2px;
  border-right: 1px solid rgba(201, 164, 112, 0.12);
  color: #82745f;
  font-family: var(--font-mono);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.ghost-button,
.primary-button,
.icon-button {
  border: 1px solid rgba(201, 164, 112, 0.18);
  border-radius: 6px;
  background: rgba(255, 245, 225, 0.02);
  color: #a9977d;
  font-size: 8.5px;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    color 150ms ease;
}

.ghost-button {
  height: 26px;
  padding: 0 8px;
}

.ghost-button:hover {
  border-color: rgba(201, 164, 112, 0.35);
  background: rgba(201, 164, 112, 0.06);
  color: #ddc394;
}

.ghost-button.danger:hover {
  border-color: rgba(196, 92, 74, 0.35);
  background: rgba(196, 92, 74, 0.07);
  color: #d19685;
}

.primary-button {
  height: 31px;
  padding: 0 13px;
  border-color: rgba(240, 214, 166, 0.55);
  background: linear-gradient(180deg, #ddbd86, #c59d66);
  color: #281c0b;
  font-weight: 600;
}

.primary-button:hover {
  filter: brightness(1.06);
}

.dashboard-content {
  width: min(1560px, 100%);
  padding: 24px 28px 52px;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 6px 2px 20px;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #8e764f;
  font-family: 'Segoe UI', sans-serif;
  font-size: 7.5px;
  letter-spacing: 0.26em;
}

.page-head h1 {
  position: relative;
  padding-bottom: 9px;
  margin: 0;
  color: #f1e8d8;
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
}

.page-head h1 span {
  color: #d6ac69;
  font-size: 25px;
}

.page-head h1::after {
  position: absolute;
  bottom: 0;
  left: 1px;
  width: 45px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  content: '';
}

.page-subtitle {
  margin: 7px 0 0;
  color: #88785f;
  font-size: 10px;
  line-height: 1.7;
}

.page-meta {
  display: flex;
  align-items: center;
  padding-bottom: 3px;
  gap: 7px;
  color: #695b47;
  font-family: var(--font-mono);
  font-size: 8px;
}

.page-meta span {
  padding: 3px 6px;
  border: 1px solid rgba(201, 164, 112, 0.1);
  border-radius: 4px;
  background: rgba(201, 164, 112, 0.018);
}

/* ------------------------------------------------------------
   KPI cards
   ------------------------------------------------------------ */

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

.stat-card {
  position: relative;
  display: flex;
  min-height: 90px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 12px 13px;
  border: 1px solid rgba(201, 164, 112, 0.14);
  border-radius: 10px;
  background:
    linear-gradient(155deg, rgba(27, 21, 14, 0.7), rgba(11, 9, 6, 0.55));
}

.stat-card::after {
  position: absolute;
  top: -30px;
  right: -25px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 164, 112, 0.08), transparent 65%);
  content: '';
  pointer-events: none;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #817159;
  font-size: 8.5px;
}

.stat-label::before {
  width: 4px;
  height: 4px;
  transform: rotate(45deg);
  background: #8d7040;
  content: '';
}

.stat-card strong {
  color: #eadcc3;
  font-family: var(--font-mono);
  font-size: 25px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-card small {
  color: #635640;
  font-size: 8px;
}

.stat-card.is-accent strong {
  color: #e3c389;
}

.stat-card.is-live strong {
  color: #98b69a;
}

.stat-card.is-warn strong {
  color: #d1a970;
}

/* ------------------------------------------------------------
   Panels
   ------------------------------------------------------------ */

.monitor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(330px, 0.58fr);
  margin-top: 11px;
  gap: 11px;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  margin-top: 11px;
  gap: 11px;
}

.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(201, 164, 112, 0.14);
  border-radius: 11px;
  background:
    linear-gradient(165deg, rgba(21, 17, 11, 0.72), rgba(9, 7, 5, 0.58));
}

.panel-head {
  display: flex;
  min-height: 51px;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  gap: 12px;
  border-bottom: 1px solid rgba(201, 164, 112, 0.09);
}

.panel-head h2 {
  margin: 0;
  color: #d3c4ac;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.panel-head p {
  margin: 3px 0 0;
  color: #6c5e49;
  font-size: 8px;
}

.panel-badge {
  padding: 3px 7px;
  border: 1px solid rgba(201, 164, 112, 0.13);
  border-radius: 20px;
  color: #87765d;
  font-family: var(--font-mono);
  font-size: 7.5px;
  white-space: nowrap;
}

/* Accounts table */

.table-wrap {
  min-height: 210px;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8.5px;
  white-space: nowrap;
}

.data-table th {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(201, 164, 112, 0.07);
  color: #675943;
  font-size: 7.5px;
  font-weight: 400;
  text-align: left;
}

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(201, 164, 112, 0.045);
  color: #9f8e74;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background 130ms ease;
}

.data-table tbody tr:hover {
  background: rgba(201, 164, 112, 0.035);
}

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

.data-table .num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.account-cell {
  display: flex;
  align-items: center;
  gap: 7px;
}

.account-avatar {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid rgba(201, 164, 112, 0.17);
  border-radius: 50%;
  background: #1b150d;
  color: #cfb17d;
  font-family: var(--font-display);
  font-size: 10px;
}

.account-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.account-copy strong {
  color: #cbbba3;
  font-size: 9px;
  font-weight: 500;
}

.account-copy small {
  color: #635641;
  font-family: var(--font-mono);
  font-size: 7px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 2px 6px;
  gap: 4px;
  border-radius: 4px;
  font-size: 7.5px;
}

.status-chip::before {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  content: '';
}

.status-chip.online {
  background: rgba(122, 158, 126, 0.1);
  color: #91ad94;
}

.status-chip.offline {
  background: rgba(130, 110, 90, 0.08);
  color: #7e6e58;
}

.account-page {
  display: inline-flex;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(201, 164, 112, 0.055);
  color: #a18d6e;
  font-size: 7.5px;
}

.device-cell {
  color: #756650;
  font-size: 7.5px;
}

.device-cell small {
  display: block;
  margin-top: 2px;
  color: #5f523e;
  font-family: var(--font-mono);
  font-size: 7px;
}

.credits-value {
  color: #c6a66f !important;
}

.empty-state {
  display: flex;
  min-height: 190px;
  align-items: center;
  justify-content: center;
  color: #64563f;
  font-size: 9px;
}

/* Queue */

.queue-list {
  display: flex;
  min-height: 160px;
  flex-direction: column;
  padding: 7px 10px;
  gap: 5px;
}

.queue-item {
  display: flex;
  align-items: flex-start;
  padding: 9px;
  gap: 8px;
  border: 1px solid rgba(201, 164, 112, 0.1);
  border-radius: 8px;
  background: rgba(255, 245, 225, 0.014);
}

.queue-position {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  place-items: center;
  border: 1px solid rgba(201, 164, 112, 0.22);
  border-radius: 6px;
  color: #b4925d;
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.queue-main {
  min-width: 0;
  flex: 1;
}

.queue-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.queue-user {
  color: #c3b198;
  font-size: 8.5px;
}

.queue-meta {
  color: #675944;
  font-family: var(--font-mono);
  font-size: 7px;
}

.queue-prompt {
  display: -webkit-box;
  overflow: hidden;
  margin: 4px 0 0;
  color: #817159;
  font-size: 8px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.queue-cost {
  color: #b28f5b;
  font-family: var(--font-mono);
  font-size: 7.5px;
  white-space: nowrap;
}

.running-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 13px 7px;
  border-top: 1px solid rgba(201, 164, 112, 0.09);
  color: #8c7b62;
  font-size: 8px;
}

.running-head span:last-child {
  color: #b18c54;
  font-family: var(--font-mono);
}

.running-list {
  display: flex;
  flex-direction: column;
  padding: 0 10px 10px;
  gap: 4px;
}

.running-item {
  display: flex;
  align-items: center;
  padding: 7px 9px;
  gap: 7px;
  border-radius: 6px;
  background: rgba(201, 164, 112, 0.035);
  color: #89785e;
  font-size: 8px;
}

.running-spinner {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c9a470;
  box-shadow: 0 0 8px rgba(201, 164, 112, 0.65);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.7);
  }
}

.running-item span:nth-child(2) {
  flex: 1;
}

.running-item em {
  color: #665842;
  font-family: var(--font-mono);
  font-size: 7px;
  font-style: normal;
}

.queue-empty {
  display: flex;
  min-height: 130px;
  align-items: center;
  justify-content: center;
  color: #5f523e;
  font-size: 8.5px;
}

/* Credits */

.credit-summary {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  padding: 13px;
  gap: 9px;
  border-bottom: 1px solid rgba(201, 164, 112, 0.09);
}

.credit-summary article {
  padding: 9px 10px;
  border: 1px solid rgba(201, 164, 112, 0.1);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.12);
}

.credit-summary small {
  display: block;
  color: #70614a;
  font-size: 7.5px;
}

.credit-summary strong {
  display: block;
  margin-top: 4px;
  color: #e0c999;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
}

.credit-summary article:nth-child(2) strong {
  color: #c19076;
}

.credit-summary article:nth-child(3) strong {
  color: #99b39b;
}

.top-balances {
  display: flex;
  flex-direction: column;
  padding: 10px 13px;
  gap: 7px;
}

.balance-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 8px;
}

.balance-row span {
  overflow: hidden;
  color: #948268;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.balance-track {
  height: 3px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255, 244, 222, 0.06);
}

.balance-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7e5e31, #c9a470);
}

.balance-row em {
  color: #b3925f;
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-style: normal;
  text-align: right;
}

.ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 13px;
  border-top: 1px solid rgba(201, 164, 112, 0.08);
  border-bottom: 1px solid rgba(201, 164, 112, 0.06);
  color: #6c5d47;
  font-size: 7.5px;
}

.ledger-list {
  display: flex;
  flex-direction: column;
}

.ledger-item {
  display: grid;
  grid-template-columns: 1fr 62px 64px;
  align-items: center;
  padding: 7px 13px;
  gap: 7px;
  border-bottom: 1px solid rgba(201, 164, 112, 0.04);
  font-size: 8px;
}

.ledger-item:last-child {
  border-bottom: 0;
}

.ledger-item div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.ledger-item strong {
  overflow: hidden;
  color: #a49173;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-item small {
  color: #5d503d;
  font-size: 7px;
}

.ledger-amount {
  font-family: var(--font-mono);
  font-size: 8px;
  text-align: right;
}

.ledger-amount.is-plus {
  color: #8fae92;
}

.ledger-amount.is-minus {
  color: #bb8e71;
}

.ledger-balance {
  color: #6f6049;
  font-family: var(--font-mono);
  font-size: 7.5px;
  text-align: right;
}

/* Activity */

.activity-list {
  display: flex;
  min-height: 200px;
  flex-direction: column;
  padding: 7px 12px;
  gap: 5px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  padding: 8px 7px;
  gap: 7px;
  border-bottom: 1px solid rgba(201, 164, 112, 0.045);
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-mark {
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  margin-top: 5px;
  border-radius: 50%;
  background: #8c6d3d;
}

.activity-mark.succeeded {
  background: var(--success);
}

.activity-mark.failed {
  background: var(--danger);
}

.activity-mark.running {
  background: var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}

.activity-copy {
  min-width: 0;
  flex: 1;
}

.activity-copy strong {
  display: block;
  overflow: hidden;
  color: #a8977d;
  font-size: 8.5px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-copy small {
  display: flex;
  margin-top: 2px;
  gap: 6px;
  color: #5f523e;
  font-family: var(--font-mono);
  font-size: 7px;
}

.activity-status {
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 7px;
  white-space: nowrap;
}

.activity-status.succeeded {
  background: rgba(122, 158, 126, 0.1);
  color: #91ad94;
}

.activity-status.failed {
  background: rgba(196, 92, 74, 0.1);
  color: #c28c7f;
}

.activity-status.running {
  background: rgba(201, 164, 112, 0.1);
  color: #c4a46c;
}

.activity-status.queued {
  background: rgba(130, 110, 90, 0.08);
  color: #89795f;
}

.api-note {
  padding: 10px 13px 12px;
  border-top: 1px solid rgba(201, 164, 112, 0.09);
  background: rgba(201, 164, 112, 0.02);
}

.api-note strong {
  color: #a18b68;
  font-size: 8.5px;
  font-weight: 500;
}

.api-note p {
  margin: 4px 0 0;
  color: #655741;
  font-size: 7.5px;
  line-height: 1.75;
}

/* ------------------------------------------------------------
   Modal and toast
   ------------------------------------------------------------ */

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(390px, 100%);
  padding: 0 16px 15px;
  border: 1px solid rgba(201, 164, 112, 0.24);
  border-radius: 13px;
  background: linear-gradient(160deg, #1c170f, #0c0906);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.65);
  animation: modal-in 180ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 15px 0 12px;
  border-bottom: 1px solid rgba(201, 164, 112, 0.12);
}

.modal-card h2 {
  margin: 0;
  color: #e4d6c0;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.04em;
}

.modal-card header p {
  margin: 4px 0 0;
  color: #76664e;
  font-size: 8.5px;
}

.icon-button {
  display: grid;
  width: 26px;
  height: 26px;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  color: #8d7c63;
  font-size: 19px;
}

.icon-button:hover {
  color: #e3ca9a;
}

.modal-balance {
  padding: 10px 0 12px;
  color: #7e6d54;
  font-size: 9px;
}

.modal-balance strong {
  color: #e0c594;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.modal-field {
  margin-top: 9px;
}

.modal-field input {
  height: 34px;
  font-size: 10.5px;
}

.quick-amounts {
  display: flex;
  margin-top: 7px;
  gap: 4px;
}

.quick-amounts button {
  height: 26px;
  flex: 1;
  border: 1px solid rgba(201, 164, 112, 0.16);
  border-radius: 5px;
  background: rgba(201, 164, 112, 0.04);
  color: #ae956b;
  font-size: 8px;
}

.quick-amounts button:hover {
  border-color: rgba(201, 164, 112, 0.35);
  background: rgba(201, 164, 112, 0.09);
}

.modal-card footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 12px;
  margin-top: 5px;
  gap: 6px;
  border-top: 1px solid rgba(201, 164, 112, 0.1);
}

.toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  padding: 9px 12px;
  border: 1px solid rgba(201, 164, 112, 0.25);
  border-radius: 7px;
  background: rgba(24, 19, 12, 0.97);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.5);
  color: #cbb793;
  font-size: 9px;
  animation: toast-in 180ms ease both;
}

.toast.is-error {
  border-color: rgba(196, 92, 74, 0.3);
  color: #d29a8a;
}

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

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */

@media (max-width: 1280px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .monitor-grid {
    grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr);
  }

  .dashboard-content {
    padding: 20px 18px 44px;
  }
}

@media (max-width: 1000px) {
  .monitor-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-wrap: wrap;
    padding-top: 7px;
    padding-bottom: 7px;
    gap: 5px 12px;
  }

  .connection-state {
    margin-left: 0;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .dashboard-content {
    padding: 18px 14px 40px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .page-meta {
    padding-bottom: 0;
  }

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

@media (max-width: 640px) {
  .brand-product,
  .brand-divider {
    display: none;
  }

  .page-head h1 {
    font-size: 27px;
  }

  .stats-grid {
    gap: 6px;
  }

  .stat-card {
    min-height: 78px;
  }

  .stat-card strong {
    font-size: 21px;
  }

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

  .credit-summary article:first-child {
    grid-column: 1 / -1;
  }

  .account-page {
    display: none;
  }

  .data-table th:nth-child(3),
  .data-table td:nth-child(3) {
    display: none;
  }

  .ledger-item {
    grid-template-columns: 1fr 54px;
  }

  .ledger-balance {
    display: none;
  }

  .clock {
    display: none;
  }
}

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