/* ═══════════════════════════════════════════
   DIAMOND CAPITAL — Design System v3
   Luxury dark finance. Geist + DM Serif Display
   ═══════════════════════════════════════════ */

/* Import fonts */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

:root {
  /* Surfaces */
  --s0: #07090F;      /* deepest bg */
  --s1: #0C0F1A;      /* page bg */
  --s2: #111525;      /* card */
  --s3: #161B2E;      /* elevated card */
  --s4: #1C2238;      /* hover state */
  --s5: #222A42;      /* active/selected */

  /* Borders */
  --b1: rgba(255,255,255,.05);
  --b2: rgba(255,255,255,.09);
  --b3: rgba(255,255,255,.14);

  /* Brand */
  --blue:    #3B82F6;
  --blue-l:  #60A5FA;
  --blue-d:  rgba(59,130,246,.12);
  --blue-glow: rgba(59,130,246,.2);

  /* Semantic */
  --green:   #10B981;
  --green-l: #34D399;
  --green-d: rgba(16,185,129,.1);
  --amber:   #F59E0B;
  --amber-l: #FCD34D;
  --amber-d: rgba(245,158,11,.1);
  --red:     #EF4444;
  --red-d:   rgba(239,68,68,.1);

  /* Gold accent */
  --gold:    #D4AF37;
  --gold-d:  rgba(212,175,55,.1);

  /* Text */
  --t1: #F1F4FF;
  --t2: #8892AC;
  --t3: #4E5A74;
  --t4: #2A3348;

  /* Typography */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-2xl: 24px;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
  --shadow-glow: 0 0 40px rgba(59,130,246,.08);

  /* Layout */
  --sidebar-w: 232px;
  --nav-h: 64px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
  background: var(--s1);
  color: var(--t1);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font-body); }
input, select, textarea { font-family: var(--font-body); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--s5); border-radius: 2px; }

/* ── TYPOGRAPHY ── */
.display { font-family: var(--font-display); font-weight: 400; line-height: 1.15; }
.mono { font-family: 'SF Mono', 'Fira Code', monospace; }

/* ── LAYOUT ── */
.app-layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--s0);
  border-right: 1px solid var(--b1);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .22s cubic-bezier(.4,0,.2,1);
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--b1);
}
.sb-brand-logo {
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  object-fit: contain;
  background: var(--s2);
  border: 1px solid var(--b2);
}
.sb-brand-name {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--t1);
  letter-spacing: .01em;
}
.sb-brand-tag {
  font-size: 10px;
  color: var(--t3);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: 1px;
}

.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--b1);
}
.sb-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue) 0%, #6366F1 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  flex-shrink: 0;
  color: #fff;
}
.sb-user-name { font-size: 13px; font-weight: 500; color: var(--t1); }
.sb-user-online {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--t3); margin-top: 1px;
}
.sb-online-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.sb-nav { padding: 8px 8px; flex: 1; overflow-y: auto; }
.sb-nav-section {
  font-size: 10px; font-weight: 600;
  color: var(--t4);
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 12px 10px 6px;
}
.sb-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  color: var(--t2);
  font-size: 13px;
  font-weight: 500;
  transition: background .12s, color .12s;
  margin-bottom: 1px;
  position: relative;
}
.sb-nav-item:hover { background: var(--s3); color: var(--t1); }
.sb-nav-item.active {
  background: var(--blue-d);
  color: var(--blue-l);
}
.sb-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 2px;
  background: var(--blue);
  border-radius: 0 2px 2px 0;
  margin-left: -8px;
}
.sb-nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: .7;
}
.sb-nav-item.active .sb-nav-icon { opacity: 1; }

.sb-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--b1);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sb-footer-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 7px;
  padding: 9px;
  border-radius: var(--r-md);
  font-size: 12px; font-weight: 500;
  transition: all .12s;
  border: none;
  text-decoration: none;
}
.sb-footer-btn.support {
  background: rgba(14,165,233,.08);
  border: 1px solid rgba(14,165,233,.15);
  color: #38BDF8;
}
.sb-footer-btn.support:hover { background: rgba(14,165,233,.14); }
.sb-footer-btn.logout {
  background: transparent;
  border: 1px solid var(--b1);
  color: var(--t3);
}
.sb-footer-btn.logout:hover {
  background: var(--red-d);
  border-color: rgba(239,68,68,.2);
  color: #FCA5A5;
}

/* overlay */
.sb-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 90;
  backdrop-filter: blur(3px);
}
.sb-overlay.open { display: block; }

/* ── MAIN ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── TOPBAR ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-8);
  height: 58px;
  border-bottom: 1px solid var(--b1);
  background: rgba(12,15,26,.8);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 50;
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 15px; font-weight: 600; color: var(--t1); }
.topbar-sub { font-size: 12px; color: var(--t3); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  background: var(--s2);
  border: 1px solid var(--b1);
  display: flex; align-items: center; justify-content: center;
  color: var(--t2);
  transition: all .12s;
  position: relative;
}
.icon-btn:hover { background: var(--s3); color: var(--t1); }
.icon-btn svg { width: 15px; height: 15px; }
.notif-pip {
  position: absolute; top: 5px; right: 5px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid var(--s1);
}

.hamburger {
  display: none;
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  background: var(--s2);
  border: 1px solid var(--b1);
  align-items: center; justify-content: center;
  color: var(--t2);
}
.hamburger svg { width: 16px; height: 16px; }

/* ── PAGE CONTENT ── */
.page-body { padding: var(--sp-8); flex: 1; }

/* ── CARDS ── */
.card {
  background: var(--s2);
  border: 1px solid var(--b1);
  border-radius: var(--r-xl);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--b1);
}
.card-title { font-size: 14px; font-weight: 600; color: var(--t1); }
.card-sub-info { font-size: 12px; color: var(--t3); }

/* ── STAT CARD ── */
.stat-card {
  background: var(--s2);
  border: 1px solid var(--b1);
  border-radius: var(--r-xl);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.stat-card:hover { border-color: var(--b2); transform: translateY(-1px); }
.stat-card::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
}
.stat-lbl {
  font-size: 11px; font-weight: 500;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}
.stat-val {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: var(--t1);
}
.stat-val.c-blue { color: var(--blue-l); }
.stat-val.c-green { color: var(--green-l); }
.stat-val.c-amber { color: var(--amber-l); }
.stat-val.c-gold { color: var(--gold); }
.stat-sub { font-size: 11px; color: var(--t3); margin-top: 5px; }

/* ── BADGE ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 11px; font-weight: 600;
  letter-spacing: .01em;
  border: 1px solid;
}
.badge-green { background: var(--green-d); color: var(--green-l); border-color: rgba(16,185,129,.2); }
.badge-blue  { background: var(--blue-d);  color: var(--blue-l);  border-color: rgba(59,130,246,.2); }
.badge-amber { background: var(--amber-d); color: var(--amber-l); border-color: rgba(245,158,11,.2); }
.badge-red   { background: var(--red-d);   color: #FCA5A5;        border-color: rgba(239,68,68,.2); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 0 16px;
  height: 34px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 500;
  border: none;
  transition: all .12s;
  letter-spacing: .01em;
  white-space: nowrap;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59,130,246,.3);
}
.btn-primary:hover { background: var(--blue-l); box-shadow: 0 4px 12px rgba(59,130,246,.4); }
.btn-secondary {
  background: var(--s3);
  color: var(--t2);
  border: 1px solid var(--b2);
}
.btn-secondary:hover { background: var(--s4); color: var(--t1); }
.btn-danger {
  background: var(--red-d);
  color: #FCA5A5;
  border: 1px solid rgba(239,68,68,.2);
}
.btn-danger:hover { background: rgba(239,68,68,.15); }
.btn svg { width: 14px; height: 14px; }

/* ── INPUTS ── */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-label { font-size: 12px; font-weight: 500; color: var(--t2); }
.input-wrap { position: relative; }
.input-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--t3);
  pointer-events: none;
  display: flex;
}
.input-icon svg { width: 14px; height: 14px; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%;
  background: var(--s3);
  border: 1px solid var(--b2);
  border-radius: var(--r-md);
  color: var(--t1);
  font-size: 13px;
  padding: 0 12px;
  height: 38px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none;
}
input:focus, select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
  background: var(--s4);
}
input::placeholder { color: var(--t3); }
input.has-icon { padding-left: 34px; }
select { cursor: pointer; }
select option { background: var(--s3); }

/* ── DETAIL ROWS ── */
.detail-list { overflow: hidden; }
.detail-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 20px;
  border-bottom: 1px solid var(--b1);
  gap: 12px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row-left {
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
.detail-row-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--s3);
  border: 1px solid var(--b1);
  display: flex; align-items: center; justify-content: center;
  color: var(--t2);
  flex-shrink: 0;
}
.detail-row-icon svg { width: 13px; height: 13px; }
.detail-row-label { font-size: 13px; color: var(--t2); }
.detail-row-value { font-size: 13px; font-weight: 500; color: var(--t1); text-align: right; }
.detail-row-value.c-blue { color: var(--blue-l); }
.detail-row-value.c-green { color: var(--green-l); }
.detail-row-value.c-amber { color: var(--amber-l); }

/* taxa special row */
.detail-row.taxa-row {
  background: rgba(245,158,11,.04);
  border-left: 2px solid rgba(245,158,11,.35);
}
.detail-row.taxa-row .detail-row-label { color: var(--amber-l); font-weight: 500; }
.detail-row.taxa-row .detail-row-value { color: var(--amber-l); }
.taxa-sub { font-size: 11px; color: var(--t3); margin-top: 2px; }

/* ── BOTTOM NAV ── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--s0);
  border-top: 1px solid var(--b1);
  padding: 0 0 max(12px, env(safe-area-inset-bottom));
  backdrop-filter: blur(16px);
}
.bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.bn-tab {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px;
  padding: 10px 4px 4px;
  color: var(--t3);
  text-decoration: none;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.bn-tab svg { width: 20px; height: 20px; stroke-width: 1.6; }
.bn-tab span { font-size: 10px; font-weight: 500; letter-spacing: .01em; }
.bn-tab.active { color: var(--blue-l); }

/* ── ALERT ── */
.alert {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 14px;
  border-radius: var(--r-lg);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.4;
}
.alert-error { background: var(--red-d); border: 1px solid rgba(239,68,68,.2); color: #FCA5A5; }
.alert-success { background: var(--green-d); border: 1px solid rgba(16,185,129,.2); color: var(--green-l); }

/* ── PROGRESS BAR ── */
.progress-bar {
  height: 5px;
  background: var(--s4);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue) 0%, var(--blue-l) 100%);
  border-radius: 3px;
  transition: width 1s ease;
}

/* ── TABLE ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px; font-weight: 600;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--b1);
  white-space: nowrap;
}
.data-table td {
  padding: 13px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--b1);
  white-space: nowrap;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover td { background: var(--s3); }

/* ── MODAL ── */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 200;
  backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal-panel {
  background: var(--s2);
  border: 1px solid var(--b2);
  border-radius: var(--r-2xl);
  padding: 24px;
  width: 100%; max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0,0,0,.6);
  animation: modalIn .2s ease both;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.97) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 20px; }
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--b1);
}
.modal-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--s2);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  border-top: 1px solid var(--b2);
  padding: 16px 20px 32px;
  animation: sheetUp .25s cubic-bezier(.4,0,.2,1) both;
}
@keyframes sheetUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.modal-handle {
  width: 36px; height: 4px;
  background: var(--s5);
  border-radius: 2px;
  margin: 0 auto 16px;
}

/* ── FORM GRID ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-col-full { grid-column: 1 / -1; }
.separator { height: 1px; background: var(--b1); margin: 8px 0; }
.hint-box {
  background: rgba(245,158,11,.05);
  border: 1px solid rgba(245,158,11,.15);
  border-radius: var(--r-md);
  padding: 10px 13px;
  font-size: 12px; color: rgba(245,158,11,.9);
  line-height: 1.5;
}

/* ── RING CHART ── */
.ring-wrap { position: relative; display: inline-flex; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--s4); }
.ring-fill  { fill: none; stroke: var(--blue-l); stroke-linecap: round; }
.ring-center {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--t1);
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .stat-grid-4 { grid-template-columns: 1fr 1fr !important; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding-bottom: var(--nav-h); }
  .topbar { padding: 0 16px; }
  .page-body { padding: 16px; }
  .hamburger { display: flex; }
  .bottom-nav { display: block; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal-panel { border-radius: var(--r-2xl) var(--r-2xl) 0 0; max-width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stat-grid-4, .stat-grid-5 { grid-template-columns: 1fr 1fr !important; }
  .page-body { padding: 12px; }
}
</style>
