:root {
  --bg: #0d0f14;
  --surface: #161920;
  --surface2: #1e2230;
  --surface3: #252a3a;
  --border: #2e3448;
  --accent: #f5a623;
  --accent2: #e8533a;
  --green: #2ecc71;
  --red: #e74c3c;
  --blue: #3b82f6;
  --text: #e8eaf0;
  --text2: #9ba3b8;
  --text3: #5c6480;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'IBM Plex Sans', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); min-height: 100vh; overflow-x: hidden; }

/* LAYOUT */
.app { display: flex; height: 100vh; }
.sidebar { width: 220px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* SIDEBAR */
.sidebar-logo { padding: 20px 18px 16px; border-bottom: 1px solid var(--border); }
.sidebar-logo .co { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--accent); letter-spacing: 0.05em; line-height: 1.3; }
.sidebar-logo .sub { font-size: 10px; color: var(--text3); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.1em; }
.nav { padding: 12px 8px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text2); transition: all 0.15s; margin-bottom: 2px; border: none; background: none; width: 100%; text-align: left; text-decoration: none; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--surface3); color: var(--accent); }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-section { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.12em; padding: 14px 12px 6px; }

/* TOPBAR */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-date { font-family: var(--mono); font-size: 12px; color: var(--text2); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all 0.15s; font-family: var(--sans); }
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: #e09820; }
.btn-ghost { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--surface3); }
.btn-danger { background: #3a1a18; color: var(--red); border: 1px solid #5a2a26; }
.btn-danger:hover { background: #4a2220; }
.btn-success { background: #0f2e1f; color: var(--green); border: 1px solid #1a4a2e; }
.btn-success:hover { background: #163d2a; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* CONTENT */
.content { flex: 1; overflow-y: auto; padding: 24px; }

/* STATS */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.stat-card.green::before { background: var(--green); }
.stat-card.red::before { background: var(--red); }
.stat-card.blue::before { background: var(--blue); }
.stat-card.yellow::before { background: var(--accent); }
.stat-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }
.stat-val { font-family: var(--mono); font-size: 22px; font-weight: 600; }
.stat-val.green { color: var(--green); }
.stat-val.red { color: var(--red); }
.stat-val.blue { color: var(--blue); }
.stat-val.yellow { color: var(--accent); }
.stat-sub { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* PANELS */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 20px; }
.panel-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.panel-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.panel-body { padding: 20px; }

/* TABLE */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { background: var(--surface2); color: var(--text3); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer; user-select: none; }
th:hover { color: var(--text); }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 500; font-family: var(--mono); }
.tag-green { background: #0f2e1f; color: var(--green); }
.tag-red { background: #3a1a18; color: var(--red); }
.tag-yellow { background: #2e2208; color: var(--accent); }
.tag-blue { background: #0f1f3a; color: var(--blue); }
.mono { font-family: var(--mono); }

/* FORMS / MODAL */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 100; display: none; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.overlay.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: 600px; max-width: 95vw; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text2); cursor: pointer; font-size: 20px; line-height: 1; padding: 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.cols3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; }
input, select, textarea { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 9px 12px; font-size: 13px; font-family: var(--sans); outline: none; transition: border-color 0.15s; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select option { background: var(--surface2); }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* SEARCH & FILTER */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { position: relative; }
.search-box input { padding-left: 34px; width: 220px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text3); width: 14px; }

/* BALANCE INDICATOR */
.bal-pos { color: var(--green); font-family: var(--mono); }
.bal-neg { color: var(--red); font-family: var(--mono); }

/* PERSON CARD */
.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.person-card { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 16px; cursor: pointer; transition: all 0.15s; }
.person-card:hover { border-color: var(--accent); background: var(--surface3); }
.pc-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.pc-type { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 12px; }
.pc-row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
.pc-row .lbl { color: var(--text3); }
.pc-bal { font-family: var(--mono); font-size: 16px; font-weight: 600; margin-top: 10px; }

/* PAGINATION */
.pager { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text2); }
.pager-btn { background: var(--surface2); border: 1px solid var(--border); color: var(--text2); padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.pager-btn:hover { color: var(--text); }
.pager-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pager-info { margin: 0 auto; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* EMPTY */
.empty { text-align: center; padding: 48px 24px; color: var(--text3); }
.empty svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty p { font-size: 13px; }

/* ALERTS */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alert-info { background: #0f1f3a; border: 1px solid #1a3a6a; color: #7ab4f5; }

/* PRINT */
@media print {
  .sidebar, .topbar, .toolbar, .btn, .pager { display: none !important; }
  .main { overflow: visible; }
  .content { padding: 0; }
  body { background: #fff; color: #000; }
  table, th, td { color: #000; border-color: #ccc; background: #fff !important; }
}
