
:root {

  --ink-950: #0a0e15;
  --ink-900: #11151d;
  --surface: #161c27;
  --surface-soft: #1d2532;
  --surface-hover: #232c3b;
  --hairline: #2a3242;
  --hairline-soft: #1f2630;

  --gold: #cda45e;
  --gold-soft: #e8d5ae;
  --gold-dim: rgba(205, 164, 94, 0.16);

  --mint: #5fcba8;
  --mint-dim: rgba(95, 203, 168, 0.14);
  --coral: #e2785b;
  --coral-dim: rgba(226, 120, 91, 0.14);
  --ice: #8fa3c4;

  --text-hi: #f3f1ec;
  --text-mid: #b7bdc9;
  --text-lo: #7e8696;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 12px 24px -16px rgba(0, 0, 0, 0.6);

  --font-display: "Fraunces", "Iowan Old Style", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--ink-950);
  color: var(--text-hi);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: var(--font-body);
}

::selection {
  background: var(--gold-dim);
  color: var(--gold-soft);
}

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

/* ---------- App shell ---------- */

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


.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--ink-900);
  border-right: 1px dashed var(--hairline);
  display: flex;
  flex-direction: column;
  padding: 28px 0 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 0 26px 28px;
}

.sidebar-brand .mark {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
  color: var(--gold-soft);
  letter-spacing: -0.01em;
}

.sidebar-brand .mark em {
  color: var(--gold);
  font-style: normal;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 14px;
}

.nav-eyebrow {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-lo);
  padding: 16px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-mid);
  font-size: 14px;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
  cursor: pointer;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item:hover {
  background: var(--surface-soft);
  color: var(--text-hi);
}

.nav-item.active {
  background: var(--gold-dim);
  color: var(--gold-soft);
  border-left-color: var(--gold);
}

.sidebar-footer {
  padding: 14px 14px 0;
  border-top: 1px solid var(--hairline-soft);
  margin-top: 10px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--gold), #8a6a36);
  color: var(--ink-950);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.user-chip .who {
  flex: 1;
  min-width: 0;
}

.user-chip .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-hi);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip .role {
  font-size: 11px;
  color: var(--text-lo);
  text-transform: capitalize;
}

.logout-btn {
  width: 100%;
  margin-top: 6px;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  color: var(--text-mid);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.logout-btn:hover {
  border-color: var(--coral);
  color: var(--coral);
}



.main {
  flex: 1;
  min-width: 0;
  padding: 32px 40px 60px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 14px;
}

.topbar .eyebrow {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}

.topbar h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.topbar .sub {
  color: var(--text-lo);
  font-size: 13.5px;
  margin-top: 4px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-gold {
  background: var(--gold);
  color: #1c1404;
}

.btn-gold:hover {
  background: var(--gold-soft);
}

.btn-ghost {
  background: transparent;
  border-color: var(--hairline);
  color: var(--text-hi);
}

.btn-ghost:hover {
  background: var(--surface-soft);
  border-color: var(--text-lo);
}

.btn-danger-ghost {
  background: transparent;
  border-color: var(--coral-dim);
  color: var(--coral);
}

.btn-danger-ghost:hover {
  background: var(--coral-dim);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

.seg-toggle {
  display: inline-flex;
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-mid);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.seg-btn:hover {
  color: var(--text-hi);
}

.seg-btn.active {
  background: var(--gold);
  color: #1c1404;
}

.legend-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-mid);
}

.legend-row .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 9px;
}

.legend-row .name {
  display: flex;
  align-items: center;
}

.legend-row .amt {
  font-family: "JetBrains Mono", monospace;
  color: var(--text-hi);
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--text-mid);
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 30px;
}

@media (max-width: 1200px) {
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 760px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  animation: rise 0.5s ease both;
}

.stat-card .label {
  font-size: 12px;
  color: var(--text-lo);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card .value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.stat-card .value.mint {
  color: var(--mint);
}
.stat-card .value.coral {
  color: var(--coral);
}
.stat-card .value.gold {
  color: var(--gold-soft);
}

.stat-card .delta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-lo);
}

/* Signature "fill rule" progress device */
.fill-rule {
  margin-top: 14px;
  height: 3px;
  width: 100%;
  background: var(--hairline-soft);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.fill-rule > span {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--gold);
  border-radius: 2px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.fill-rule.danger > span {
  background: var(--coral);
}
.fill-rule.safe > span {
  background: var(--mint);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card:nth-child(1) {
  animation-delay: 0.02s;
}
.stat-card:nth-child(2) {
  animation-delay: 0.08s;
}
.stat-card:nth-child(3) {
  animation-delay: 0.14s;
}
.stat-card:nth-child(4) {
  animation-delay: 0.2s;
}
.stat-card:nth-child(5) {
  animation-delay: 0.26s;
}

/* ---------- Content grid / panels ---------- */

.panel-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

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

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-title h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.panel-title .meta {
  font-size: 12px;
  color: var(--text-lo);
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
}

table.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.ledger thead th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-lo);
  font-weight: 600;
  padding: 0 14px 12px;
  border-bottom: 1px solid var(--hairline);
}

table.ledger tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--hairline-soft);
  color: var(--text-hi);
  vertical-align: middle;
}

table.ledger tbody tr:hover {
  background: var(--surface-soft);
}

table.ledger .amt {
  font-family: var(--font-mono);
  font-weight: 500;
}

table.ledger .amt.in {
  color: var(--mint);
}
table.ledger .amt.out {
  color: var(--coral);
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-soft);
  color: var(--text-mid);
  border: 1px solid var(--hairline);
}

.chip.gold {
  background: var(--gold-dim);
  color: var(--gold-soft);
  border-color: transparent;
}

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-lo);
}

.empty-state .glyph {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--hairline);
  margin-bottom: 10px;
}

/* ---------- Forms / Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 12, 0.65);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  width: 100%;
  max-width: 440px;
  padding: 26px 26px 22px;
  animation: pop 0.22s ease both;
}

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

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-head h3 {
  font-family: var(--font-display);
  font-size: 19px;
  margin: 0;
}

.field {
  margin-bottom: 15px;
}

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-mid);
  margin-bottom: 6px;
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--ink-950);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-hi);
  font-size: 14px;
  font-family: var(--font-body);
  transition: border-color 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-hint {
  font-size: 11.5px;
  color: var(--text-lo);
  margin-top: 5px;
}

.field-error {
  font-size: 11.5px;
  color: var(--coral);
  margin-top: 5px;
  display: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

/* ---------- Toast ---------- */

#toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--gold);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-hi);
  box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.6);
  min-width: 220px;
  animation: slidein 0.25s ease both;
}

.toast.error {
  border-left-color: var(--coral);
}
.toast.success {
  border-left-color: var(--mint);
}

@keyframes slidein {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ---------- Misc page bits ---------- */

.page-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-lo);
  font-size: 13px;
}

.section-spacer {
  height: 8px;
}

.text-mono {
  font-family: var(--font-mono);
}

.center-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--surface-soft);
  border-radius: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: -260px;
    z-index: 50;
    transition: left 0.2s ease;
  }
  .sidebar.open {
    left: 0;
  }
  .main {
    padding: 24px 18px 50px;
  }
  .mobile-nav-toggle {
    display: inline-flex !important;
  }
}

.mobile-nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--text-hi);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 10px;
}
