/* =====================================================
   PlutoBalance — refined dark "vault" theme
   ===================================================== */
:root {
  --bg:        #0a0a0c;
  --bg-2:     #111114;
  --panel:    #16161a;
  --panel-2:  #1d1d22;
  --line:     #2a2a31;
  --line-2:   #36363f;
  --text:     #ececef;
  --text-dim: #8a8a93;
  --text-mute:#5a5a63;
  --gold:     #d4a64a;
  --gold-2:   #f0c266;
  --green:    #4ade80;
  --red:      #ef4444;
  --blue:     #60a5fa;
  --shadow:   0 20px 60px -20px rgba(0,0,0,0.7);
}

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700;800;900&family=Archivo+Narrow:wght@500;600;700&family=JetBrains+Mono:wght@400;500;700&family=Inter:wght@400;500;600&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* subtle grain background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 0%, rgba(212,166,74,0.06), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(96,165,250,0.04), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-2); }

/* =====================================================
   Layout
   ===================================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  position: relative;
  z-index: 1;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}

.brand {
  font-family: 'Archivo', sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand .dot {
  width: 10px; height: 10px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 16px var(--gold);
}
.brand a { color: var(--text); }

.crumbs {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.crumbs a { color: var(--text-dim); }
.crumbs a:hover { color: var(--gold); }

h1 {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 36px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
h2 {
  font-family: 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.subtitle { color: var(--text-dim); margin-bottom: 36px; font-size: 15px; }

/* =====================================================
   Buttons + inputs
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn:hover { background: var(--panel-2); border-color: var(--gold); }
.btn-primary {
  background: var(--gold);
  color: #1a1408;
  border-color: var(--gold);
  font-weight: 600;
}
.btn-primary:hover { background: var(--gold-2); border-color: var(--gold-2); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,0.08); border-color: var(--red); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  justify-content: center;
}

input, select, textarea {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  width: 100%;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
}
label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  margin-bottom: 6px;
}

/* =====================================================
   Cards (casino + subaccount tiles)
   ===================================================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 160px;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.card:hover {
  border-color: var(--line-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.card:hover::before { opacity: 0.6; }

.card-name {
  font-family: 'Archivo', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
}
.card-stat {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.card-pnl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.card-delete {
  position: absolute;
  top: 12px; right: 12px;
  background: transparent;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.15s;
}
.card:hover .card-delete { opacity: 1; }
.card-delete:hover { background: rgba(239,68,68,0.1); color: var(--red); }

.card-add {
  border: 1.5px dashed var(--line-2);
  background: transparent;
  color: var(--text-dim);
  align-items: center;
  justify-content: center;
  text-align: center;
}
.card-add:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.card-add .plus { font-size: 32px; font-weight: 300; }

/* =====================================================
   PNL colors
   ===================================================== */
.pnl-positive { color: var(--green); }
.pnl-negative { color: var(--red); }
.pnl-zero { color: var(--text-dim); }

/* =====================================================
   Table (the "excel sheet")
   ===================================================== */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 24px;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  flex-wrap: wrap;
  gap: 12px;
}

.summary-row {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}
.summary-item {
  display: flex;
  flex-direction: column;
}
.summary-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.summary-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

table.bets {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.bets thead th {
  background: var(--bg-2);
  text-align: left;
  padding: 12px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.bets thead th.numeric {
  text-align: left;
}
table.bets tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.bets tbody tr:hover { background: rgba(255,255,255,0.015); }
table.bets tbody tr:last-child td { border-bottom: none; }

table.bets td input,
table.bets td select,
table.bets td textarea {
  background: transparent;
  border: 1px solid transparent;
  padding: 6px 8px;
  font-size: 14px;
  border-radius: 4px;
}
table.bets td input:hover,
table.bets td select:hover,
table.bets td textarea:hover { border-color: var(--line-2); }
table.bets td input:focus,
table.bets td select:focus,
table.bets td textarea:focus {
  border-color: var(--gold);
  background: var(--bg-2);
}

td.numeric, th.numeric {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  text-align: left;
}
td.numeric input { text-align: left; }

table.bets tbody tr.row-active {
  background: rgba(212, 166, 74, 0.04);
  box-shadow: inset 3px 0 0 var(--gold);
}
table.bets tbody tr.row-active td:first-child::before {
  content: '';
}

.paste-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border: 1px dashed var(--gold);
  border-radius: 4px;
  background: rgba(212, 166, 74, 0.05);
  display: inline-block;
}

.thumb-wrap {
  position: relative;
  display: inline-block;
}

.thumb-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--bg);
  background: var(--red);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
}
.thumb-wrap:hover .thumb-remove {
  opacity: 1;
}
.thumb-remove:hover {
  transform: scale(1.15);
  background: #f87171;
}

/* Upload modal drop zone */
.upload-modal { max-width: 460px; }

.drop-zone {
  border: 2px dashed var(--line-2);
  border-radius: 10px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg-2);
  outline: none;
}
.drop-zone:hover, .drop-zone:focus, .drop-zone.drop-active {
  border-color: var(--gold);
  background: rgba(212, 166, 74, 0.04);
}
.drop-zone-icon {
  font-size: 36px;
  color: var(--gold);
  margin-bottom: 10px;
  font-weight: 300;
}
.drop-zone-text {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 6px;
}
.drop-zone-text kbd {
  display: inline-block;
  padding: 2px 6px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  margin: 0 2px;
}
.drop-zone-sub {
  font-size: 12px;
  color: var(--text-mute);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.05em;
}
.upload-status {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--gold);
  margin-top: 14px;
  min-height: 16px;
}

.thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  cursor: pointer;
  display: block;
}
.thumb-empty {
  width: 44px;
  height: 44px;
  border: 1px dashed var(--line-2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 18px;
  transition: all 0.15s;
}
.thumb-empty:hover {
  border-color: var(--gold);
  color: var(--gold);
}

#filePicker {
  display: none !important;
  position: absolute;
  left: -9999px;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
}
.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

/* =====================================================
   Login screen
   ===================================================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.login-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.login-box .brand {
  justify-content: center;
  margin-bottom: 4px;
  font-size: 28px;
  letter-spacing: 0.04em;
}
.login-box .tagline {
  text-align: center;
  color: var(--text-mute);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 36px;
}
.login-box label { margin-top: 4px; }
.login-box .btn { width: 100%; justify-content: center; margin-top: 20px; }
.login-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  min-height: 18px;
}

/* =====================================================
   Modal (image viewer + add forms)
   ===================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.modal h3 {
  font-family: 'Archivo', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}
.modal-img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 700px) {
  h1 { font-size: 32px; }
  .container { padding: 20px 16px 60px; }
  .table-wrap { overflow-x: auto; }
  table.bets { min-width: 900px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .card { padding: 20px; min-height: 130px; }
  .card-name { font-size: 18px; }
}
