/* ====== Server bar ====== */
.server-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 28px; z-index: 999;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end;
  gap: 20px; padding: 0 20px;
  font-size: 11px; font-family: var(--mono);
}
.sb-item { display: flex; align-items: center; gap: 5px; }
.sb-label { color: var(--text-3); }
.sb-val { color: var(--text-2); font-variant-numeric: tabular-nums; }
.sb-val.warn { color: var(--warn); }
.sb-val.danger { color: var(--danger); }

* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #09090b;
  --bg-1: #111114;
  --bg-2: #18181b;
  --bg-3: #1f1f23;
  --border: #27272a;
  --border-2: #3f3f46;
  --text: #fafafa;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --accent: #9147ff;
  --accent-2: #7c3aed;
  --accent-glow: rgba(145,71,255,.15);
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.5), 0 4px 12px rgba(0,0,0,.3);
  --font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
}
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body { padding-top: 28px; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; width: 100%; transition: border-color .2s, box-shadow .2s; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.muted { color: var(--text-3); font-size: 13px; }
.loading { color: var(--text-3); padding: 40px; text-align: center; font-size: 13px; }

/* Animations */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
.anim-fade { animation: fadeUp .4s ease-out both; animation-delay: calc(var(--delay, 0) * 60ms); }
.anim-card { animation: fadeUp .35s ease-out both; }

/* Layout */
.app { display: grid; grid-template-columns: 220px 1fr; height: 100vh; }
.sidebar { background: var(--bg-1); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 20px 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.logo { width: 34px; height: 34px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: white; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.3px; }
nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-2); transition: all .15s; font-size: 14px; }
.nav-item:hover { background: var(--bg-2); color: var(--text); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); font-weight: 500; }
.nav-item .icon { width: 16px; text-align: center; }
.sidebar-footer { border-top: 1px solid var(--border); padding-top: 16px; }
.status-pill { font-size: 12px; color: var(--text-3); padding: 6px 10px; background: var(--bg-2); border-radius: var(--radius-sm); text-align: center; }

/* Content */
.content { overflow-y: auto; padding: 28px 40px; }
.view { display: none; }
.view.active { display: block; animation: fadeIn .25s ease-out; }
.page-header { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.page-header h1 { font-size: 26px; font-weight: 700; letter-spacing: -.5px; flex: 1; }
.header-actions { display: flex; gap: 8px; }

/* Search */
.search-box { position: relative; }
.search-box input { padding-left: 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; }
.search-box input:focus { background: var(--bg-1); }

/* Section */
.section { margin-bottom: 36px; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-header h2 { font-size: 17px; font-weight: 600; letter-spacing: -.2px; white-space: nowrap; }
.section-header .search-box { flex: 1; max-width: 320px; }

/* Buttons */
.btn { padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; transition: all .15s; display: inline-flex; align-items: center; gap: 6px; }
.btn.primary { background: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent-2); box-shadow: 0 0 16px var(--accent-glow); }
.btn.secondary { background: var(--bg-3); color: var(--text); border: 1px solid var(--border-2); }
.btn.secondary:hover { background: var(--border); }
.btn.ghost { color: var(--text-2); }
.btn.ghost:hover { color: var(--text); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--border); }
.btn.danger:hover { background: var(--danger); color: white; }
.btn.success { background: var(--success); color: white; }
.btn.success:hover { filter: brightness(1.1); }
.btn.sm { padding: 5px 10px; font-size: 12px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat-card { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; transition: border-color .2s; }
.stat-card:hover { border-color: var(--border-2); }
.stat-label { color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.5px; }

/* Campaigns grid */
.campaigns-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.campaign-card { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: all .2s; position: relative; }
.campaign-card:hover { border-color: var(--border-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.campaign-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow), var(--shadow); }
.campaign-card .game-badge { display: inline-block; font-size: 11px; color: var(--accent); background: var(--accent-glow); padding: 2px 8px; border-radius: 10px; margin-bottom: 8px; font-weight: 500; }
.campaign-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; line-height: 1.3; }
.campaign-game { color: var(--text-2); font-size: 12px; margin-bottom: 10px; }
.campaign-meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--text-3); }
.campaign-meta .pill { padding: 3px 8px; background: var(--bg-3); border-radius: 10px; }
.drop-images { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; }
.drop-images img { width: 40px; height: 40px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* Batch list */
.batch-list { display: flex; flex-direction: column; gap: 8px; }
.batch-row { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; display: grid; grid-template-columns: 1fr 120px 130px 140px; gap: 16px; align-items: center; transition: all .15s; cursor: pointer; }
.batch-row:hover { border-color: var(--border-2); }
.batch-main { min-width: 0; }
.batch-name { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.batch-game { color: var(--text-2); font-size: 13px; }
.batch-notes { color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .3px; }
.status-idle { background: var(--bg-3); color: var(--text-2); }
.status-running { background: rgba(34,197,94,.12); color: var(--success); }
.status-finished { background: rgba(145,71,255,.12); color: var(--accent); }
.status-stopped { background: rgba(245,158,11,.12); color: var(--warn); }
.progress-bar { height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s ease-out; border-radius: 3px; }
.batch-progress { font-size: 13px; font-variant-numeric: tabular-nums; }

/* Batch detail */
.batch-overview { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.batch-info { display: flex; flex-direction: column; gap: 8px; }
.batch-info h2 { font-size: 20px; font-weight: 600; letter-spacing: -.3px; }
.info-row { display: flex; gap: 8px; font-size: 13px; }
.info-row .k { color: var(--text-3); min-width: 110px; }
.info-row .v { color: var(--text); }

/* Drops section */
.drops-section { margin-bottom: 24px; }
.drops-section h3 { font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .5px; }
.drops-grid { display: flex; gap: 12px; flex-wrap: wrap; }

/* Drop card v2 — Twitch-style with image overlay */
.drop-card-v2 { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; width: 200px; transition: border-color .2s, transform .2s; }
.drop-card-v2:hover { border-color: var(--border-2); transform: translateY(-2px); }
.drop-card-v2.done { border-color: var(--success); }
.dcv2-img-wrap { position: relative; width: 100%; height: 112px; overflow: hidden; background: var(--bg-3); }
.dcv2-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.dcv2-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 28px; background: var(--bg-3); }
.dcv2-overlay { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(to top, rgba(34,197,94,.45), transparent); transition: height .5s ease-out; pointer-events: none; }
.dcv2-pct { position: absolute; bottom: 6px; right: 8px; font-size: 13px; font-weight: 700; color: white; text-shadow: 0 1px 4px rgba(0,0,0,.8); }
.dcv2-info { padding: 10px 12px; }
.dcv2-name { font-size: 13px; font-weight: 600; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dcv2-bar-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.dcv2-bar { flex: 1; height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden; }
.dcv2-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--success)); border-radius: 3px; transition: width .5s ease-out; }
.dcv2-min { font-size: 11px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dcv2-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.dcv2-badge { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: .3px; }
.dcv2-badge.done { background: rgba(34,197,94,.15); color: var(--success); }
.dcv2-badge.claimed { background: rgba(145,71,255,.12); color: var(--accent); }
.drop-card-v2.done .dcv2-fill { background: var(--success); }
.drop-card-v2.done .dcv2-pct { color: var(--success); }

/* Per-account mini drop progress bars */
.acc-progress { min-width: 140px; }
.acc-pct-row { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.acc-pct-row b { color: var(--text); }
.mini-drops { display: flex; gap: 3px; margin-top: 6px; }
.mini-drop { width: 28px; height: 5px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.mini-drop-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .4s; }
.mini-drop-fill.claimed { background: var(--success); }

/* History separator */
.history-label { display: flex; align-items: center; gap: 8px; margin: 20px 0 12px; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; font-weight: 500; }
.history-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 16px; color: var(--text-2); font-size: 13px; font-weight: 500; border-bottom: 2px solid transparent; transition: all .15s; margin-bottom: -1px; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-color: var(--accent); }

/* Accounts table */
.accounts-table { width: 100%; border-collapse: collapse; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.accounts-table th, .accounts-table td { padding: 10px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--border); }
.accounts-table th { background: var(--bg-2); color: var(--text-2); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
.accounts-table tr:last-child td { border-bottom: none; }
.accounts-table tr:hover td { background: var(--bg-2); }
.accounts-table input[type="text"] { background: transparent; border: none; padding: 0; font-size: 13px; }
.accounts-table input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.check-cell { text-align: center; }

/* Upload zone */
.upload-zone { border: 2px dashed var(--border-2); border-radius: var(--radius); padding: 40px 20px; text-align: center; cursor: pointer; transition: all .2s; margin-bottom: 20px; }
.upload-zone:hover { border-color: var(--accent); background: var(--bg-1); }
.upload-zone input { display: none; }

/* Log view */
.log-view { background: #050506; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; font-family: var(--mono); font-size: 12px; max-height: 500px; overflow-y: auto; color: #a0e0a0; white-space: pre-wrap; word-break: break-all; }

/* New batch flow */
.new-flow { max-width: 900px; }
.step { display: flex; gap: 20px; margin-bottom: 24px; animation: fadeUp .3s ease-out both; }
.step-num { flex: 0 0 32px; height: 32px; background: var(--accent); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.step-body { flex: 1; min-width: 0; }
.step-body h3 { font-size: 16px; margin-bottom: 4px; font-weight: 600; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }

/* Campaign preview in new batch form */
.campaign-preview { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 20px; display: flex; gap: 12px; align-items: center; }
.campaign-preview .cp-game { font-size: 12px; color: var(--accent); font-weight: 500; }
.campaign-preview .cp-name { font-weight: 600; font-size: 15px; }
.campaign-preview .cp-drops { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* Farmable indicators */
.farm-star { color: #ffd700; font-size: 16px; vertical-align: middle; }
.farm-pill { background: rgba(29,185,84,.15); color: var(--success); font-weight: 500; }
.sub-pill { background: rgba(255,176,32,.12); color: var(--warn); }
.campaign-card.not-farmable { opacity: .55; }
.campaign-card.not-farmable:hover { opacity: .8; }
.farm-filter-btn { border: 1px solid var(--border); color: var(--text-2); }
.farm-filter-btn.active { background: var(--success); color: white; border-color: var(--success); }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 900; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay.open { display: flex; animation: fadeIn .2s ease-out; }
.modal { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 32px; max-width: 640px; width: 90%; max-height: 80vh; overflow-y: auto; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.modal h2 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.modal .modal-sub { font-size: 13px; color: var(--text-3); margin-bottom: 20px; }
.modal-close { position: absolute; top: 12px; right: 16px; font-size: 20px; color: var(--text-3); cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-batches { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.modal-batch-item { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; cursor: pointer; transition: border-color .15s; display: flex; align-items: center; justify-content: space-between; }
.modal-batch-item:hover { border-color: var(--accent); }
.modal-batch-item .mbi-name { font-weight: 600; font-size: 14px; }
.modal-batch-item .mbi-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.modal-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; max-height: 400px; overflow-y: auto; }
.modal-picker .campaign-card { padding: 12px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast { background: var(--bg-3); border: 1px solid var(--border-2); border-radius: var(--radius); padding: 12px 16px; font-size: 13px; box-shadow: var(--shadow); min-width: 240px; animation: slideIn .25s ease-out; }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
