:root { color-scheme: dark; }
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font: 14px/1.5 system-ui, sans-serif;
  background: #0e1116; color: #e6e6e6;
  min-height: 100vh;
}

.hidden { display: none !important; }
.muted { color: #8a939f; font-size: 12px; }
.error { color: #ff6b6b; font-size: 12px; min-height: 16px; }

.center-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 360px; display: flex; flex-direction: column; gap: 10px; }
.login-card h1 { font-size: 18px; color: #00ff88; }

.card {
  background: #161b22; border: 1px solid #232a33;
  border-radius: 10px; padding: 14px;
}

header {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 18px;
}
h1 { font-size: 16px; color: #00ff88; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.chip {
  font-size: 11px; padding: 3px 10px; border-radius: 12px;
  background: #1c222b; border: 1px solid #2d3540; color: #b8c0cc;
}
.chip b { color: #00ff88; }

button {
  padding: 8px 14px; border: 1px solid #2d3540; border-radius: 7px;
  background: #1c222b; color: #e6e6e6; cursor: pointer; font-size: 13px;
}
button:hover { background: #242c37; }
button.primary { background: #00ff88; border-color: #00ff88; color: #04140c; font-weight: 600; }
button.primary:hover { background: #00e07a; }
button.ghost { background: transparent; }

input, select {
  padding: 8px 10px; border: 1px solid #2d3540; border-radius: 7px;
  background: #1c222b; color: #e6e6e6; font-size: 13px;
}
input[type="text"], input[type="password"] { flex: 1; min-width: 160px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 18px 12px; }
.chk { display: flex; gap: 5px; align-items: center; font-size: 13px; color: #b8c0cc; }
.chk input { accent-color: #00ff88; }

#app section.card { margin: 0 18px 12px; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 10px; text-align: left; font-size: 13px; border-bottom: 1px solid #1d232c; }
th { color: #8a939f; font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #1c222b; }
tr.tier-gold { background: #ffc83d0d; }
tr.tier-gold:hover { background: #ffc83d1a; }

.w-addr { font-family: ui-monospace, monospace; font-size: 12px; color: #00ff88; }
.tier { padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.tier-gold { background: #ffc83d22; color: #ffc83d; }
.tier-silver { background: #c0c8d422; color: #c0c8d4; }
.tier-bronze { background: #d4916122; color: #d49161; }
.tier-manual { background: #00ff8822; color: #00ff88; }
.w-pos { color: #00ff88; } .w-neg { color: #ff6b6b; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding-top: 10px; }

/* Detail drawer */
.detail {
  position: fixed; inset: 0; z-index: 50;
  background: #0e1116f2; overflow-y: auto; padding: 18px;
}
.detail-head { display: flex; justify-content: space-between; align-items: center; }
.detail-head h2 { font-family: ui-monospace, monospace; font-size: 14px; color: #00ff88; word-break: break-all; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.detail-grid .card:last-child { grid-column: 1 / -1; }
.detail-grid h3 { font-size: 12px; color: #8a939f; text-transform: uppercase; margin-bottom: 8px; }
.d-stat { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid #1d232c; font-size: 12px; }
.d-stat:last-child { border-bottom: none; }

/* Flag editor */
.flag-star { text-align: center; cursor: pointer; font-size: 15px; }
.flag-star:hover { transform: scale(1.2); }
#d-note {
  width: 100%; margin: 8px 0; padding: 8px 10px; resize: vertical;
  border: 1px solid #2d3540; border-radius: 7px;
  background: #1c222b; color: #e6e6e6; font: 13px/1.5 system-ui, sans-serif;
}
#d-note-save { margin-right: 8px; }

@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
