/* =====================================================
   Arbitrage-Terminal – funktionale, dichte Oberfläche.
   Dark-first, kein Deko-Animationszirkus, Zahlen in Mono.
   ===================================================== */

:root, [data-theme="dark"] {
  --bg: #0e1116;
  --surface: #151a21;
  --surface-2: #1b212b;
  --border: #262e3a;
  --text: #d9e1ec;
  --text-dim: #8b96a5;
  --accent: #2fbf71;         /* Gewinn-Grün */
  --accent-dim: #1d7a49;
  --danger: #e05252;
  --warn: #e8a33d;
  --link: #6ab7ff;
}
[data-theme="light"] {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --border: #d7dde6;
  --text: #1a222d;
  --text-dim: #5b6675;
  --accent: #178a4c;
  --accent-dim: #0f5e33;
  --danger: #c23636;
  --warn: #b57414;
  --link: #1465c0;
}

* { transition: none !important; animation: none !important; } /* bewusst: keine Animationen */

html, body { background: var(--bg); color: var(--text); }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 13.5px;
}
.mono {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.95em;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.25rem; font-weight: 650; letter-spacing: .01em; margin: 0; }
h2 { font-size: .8rem; font-weight: 700; text-transform: uppercase;
     letter-spacing: .08em; color: var(--text-dim); margin: 0 0 .6rem; }
hr { border-color: var(--border); opacity: 1; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { font-weight: 800; letter-spacing: .14em; font-size: .85rem;
         padding: 1rem; color: var(--text); }
.brand-mark { color: var(--accent); }
.sidebar nav { flex: 1; }
.sidebar nav a {
  display: block; padding: .55rem 1rem; color: var(--text-dim);
  border-left: 3px solid transparent; font-weight: 500;
}
.sidebar nav a:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.sidebar nav a.active { color: var(--text); border-left-color: var(--accent); background: var(--surface-2); }
.sidebar nav i { width: 1.4rem; display: inline-block; }
.sidebar-bottom { padding: .75rem 1rem; border-top: 1px solid var(--border);
                  display: flex; gap: .75rem; align-items: center; }
.theme-toggle { background: none; border: none; color: var(--text-dim); font-size: 1.05rem; padding: 0; }
.theme-toggle:hover { color: var(--text); }
.notif { position: relative; color: var(--text-dim); font-size: 1.05rem; }
.badge-dot {
  position: absolute; top: -6px; right: -10px; background: var(--danger);
  color: #fff; border-radius: 9px; font-size: .6rem; padding: 0 4px; font-weight: 700;
}
.content { flex: 1; padding: 1.25rem 1.5rem; min-width: 0; }

.page-head { display: flex; justify-content: space-between; align-items: center;
             margin-bottom: 1rem; gap: 1rem; flex-wrap: wrap; }

/* ---------- KPI-Zeile ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
           gap: .6rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--border);
       border-radius: 6px; padding: .7rem .85rem; }
.kpi-num { font-size: 1.35rem; font-weight: 700; line-height: 1.1; }
.kpi-label { color: var(--text-dim); font-size: .72rem; text-transform: uppercase;
             letter-spacing: .05em; margin-top: .15rem; }
.kpi-accent { border-left: 3px solid var(--accent); }
.kpi-accent .kpi-num { color: var(--accent); }
.kpi-danger { border-left: 3px solid var(--danger); }
.kpi-danger .kpi-num { color: var(--danger); }
.kpi-warn { border-left: 3px solid var(--warn); }
.kpi-warn .kpi-num { color: var(--warn); }

/* ---------- Panels & Grid ---------- */
.panel { background: var(--surface); border: 1px solid var(--border);
         border-radius: 6px; padding: .9rem 1rem; margin-bottom: 1rem; }
.panel-link { float: right; font-size: .72rem; text-transform: none; letter-spacing: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Tabellen ---------- */
.table-dense { width: 100%; border-collapse: collapse; }
.table-dense th, .table-dense td {
  padding: .38rem .5rem; border-bottom: 1px solid var(--border);
  text-align: left; vertical-align: middle; white-space: nowrap;
}
.table-dense thead th { color: var(--text-dim); font-size: .7rem;
  text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
  border-bottom: 2px solid var(--border); }
.table-dense tbody tr:hover { background: var(--surface-2); }
.num { text-align: right !important; }
.truncate { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.truncate-sm { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--text-dim); text-align: center !important; padding: 1.5rem !important; }
.row-muted { opacity: .55; }

/* Signatur: profitable Zeilen tragen eine grüne Kante */
.row-profit td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.profit-pos { color: var(--accent); font-weight: 650; }
.profit-neg { color: var(--danger); font-weight: 650; }

.table-kv th { color: var(--text-dim); font-weight: 500; padding: .3rem .8rem .3rem 0;
               white-space: nowrap; vertical-align: top; }
.table-kv td { padding: .3rem 0; word-break: break-all; }

/* ---------- Marktplatz-Badges ---------- */
.mp { display: inline-block; min-width: 24px; text-align: center; border-radius: 4px;
      font-size: .68rem; font-weight: 800; text-transform: uppercase; padding: 1px 4px; }
.mp-amazon   { background: #2b2416; color: #f0a94b; }
.mp-kaufland { background: #2a1518; color: #ff7b84; }
.mp-ebay     { background: #14202b; color: #6ab7ff; }
[data-theme="light"] .mp-amazon   { background: #fdeeda; color: #8a5a10; }
[data-theme="light"] .mp-kaufland { background: #fde2e4; color: #a12730; }
[data-theme="light"] .mp-ebay     { background: #dcecfb; color: #16548f; }
.prime-ic { color: var(--link); }

/* ---------- Status ---------- */
.status { display: inline-block; padding: 1px 7px; border-radius: 9px;
          font-size: .68rem; font-weight: 700; text-transform: uppercase; }
.status-done, .status-active, .status-opportunity { background: rgba(47,191,113,.15); color: var(--accent); }
.status-running, .status-pending, .status-new { background: rgba(232,163,61,.15); color: var(--warn); }
.status-failed, .status-blocked { background: rgba(224,82,82,.15); color: var(--danger); }
.status-archived { background: var(--surface-2); color: var(--text-dim); }

/* ---------- Filter ---------- */
.filterbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .6rem; }
.filterbar .search { max-width: 320px; }
.filterbar .form-select, .filterbar .form-control { width: auto; }
.w-sm { max-width: 130px; }
.or { color: var(--text-dim); font-size: .8rem; }
.quickfilters { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .9rem; }
.chip { border: 1px solid var(--border); border-radius: 14px; padding: .15rem .7rem;
        font-size: .76rem; color: var(--text-dim); background: var(--surface); }
.chip:hover { color: var(--text); text-decoration: none; border-color: var(--text-dim); }
.chip-active { border-color: var(--accent); color: var(--accent); font-weight: 650; }

/* ---------- Bootstrap-Anpassungen ---------- */
.form-control, .form-select, .form-check-input {
  background: var(--surface-2); border-color: var(--border); color: var(--text);
  font-size: .85rem;
}
.form-control:focus, .form-select:focus {
  background: var(--surface-2); color: var(--text);
  border-color: var(--accent); box-shadow: 0 0 0 2px rgba(47,191,113,.18);
}
.form-control::placeholder { color: var(--text-dim); }
.form-label { color: var(--text-dim); font-size: .76rem; font-weight: 600;
              text-transform: uppercase; letter-spacing: .04em; margin-bottom: .2rem; }
.btn-accent { background: var(--accent-dim); border: 1px solid var(--accent);
              color: #fff; font-weight: 600; }
.btn-accent:hover { background: var(--accent); color: #fff; }
.btn-outline-accent { border: 1px solid var(--border); color: var(--text-dim); }
.btn-outline-accent:hover { border-color: var(--accent); color: var(--accent); background: none; }
.hint { color: var(--text-dim); font-size: .75rem; margin-top: .3rem; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem 1rem; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 800px) { .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; } }

.pager { display: flex; gap: .8rem; align-items: center; justify-content: center; margin: .5rem 0 1.5rem; }

/* ---------- Login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--surface); border: 1px solid var(--border);
              border-radius: 8px; padding: 2rem; width: 100%; max-width: 380px; }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row;
             align-items: center; overflow-x: auto; }
  .sidebar nav { display: flex; }
  .sidebar nav a { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
  .sidebar nav a.active { border-bottom-color: var(--accent); }
  .sidebar-bottom { border-top: none; margin-left: auto; }
  .content { padding: .9rem; }
  .panel { overflow-x: auto; }
}

/* ---------- Opportunity Score ---------- */
.score { display: inline-block; min-width: 34px; text-align: center;
         border-radius: 4px; padding: 1px 6px; font-weight: 700; }
.score-0 { background: rgba(224,82,82,.15);  color: var(--danger); }   /* 0–24 */
.score-1 { background: rgba(232,163,61,.15); color: var(--warn); }     /* 25–49 */
.score-2 { background: rgba(106,183,255,.13); color: var(--link); }    /* 50–74 */
.score-3, .score-4 { background: rgba(47,191,113,.15); color: var(--accent); } /* 75–100 */
