/* ===== Tailwind CSS design system (tailwindcss.com) — slate + indigo ===== */
:root {
  --bg: #f8fafc;             /* slate-50 */
  --panel: #ffffff;
  --sidebar: #ffffff;
  --ink: #0f172a;            /* slate-900 */
  --ink-soft: #475569;       /* slate-600 */
  --ink-faint: #94a3b8;      /* slate-400 */
  --line: #e2e8f0;           /* slate-200 */
  --line-strong: #e2e8f0;    /* slate-200 (Tailwind ring) */
  --primary: #4f46e5;        /* indigo-600 */
  --primary-hover: #4338ca;  /* indigo-700 */
  --primary-soft: #eef2ff;   /* indigo-50 */
  --green: #059669;          /* emerald-600 */
  --green-soft: #ecfdf5;     /* emerald-50 */
  --amber: #d97706;          /* amber-600 */
  --red: #dc2626;            /* red-600 */
  --purple: #7c3aed;         /* violet-600 */
  /* soft badge tints (bg-*-50 / text-*-700) */
  --emerald-50:#ecfdf5; --emerald-700:#047857;
  --amber-50:#fffbeb;  --amber-700:#b45309;
  --red-50:#fef2f2;    --red-700:#b91c1c;
  --indigo-50:#eef2ff; --indigo-700:#4338ca;
  --violet-50:#f5f3ff; --violet-700:#6d28d9;
  --slate-50:#f8fafc; --slate-100:#f1f5f9; --slate-700:#334155;
  --radius: 8px;             /* rounded-lg (inputs, buttons) */
  --radius-sm: 6px;          /* rounded-md (chips, badges) */
  --radius-lg: 12px;         /* rounded-xl (cards) */
  --shadow: 0 1px 3px 0 rgba(0,0,0,.1), 0 1px 2px -1px rgba(0,0,0,.1);
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,.05);
  --ring: 0 0 0 3px rgba(79,70,229,.35);   /* indigo focus ring */
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4285;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: var(--sidebar);
  border-right: 1px solid var(--line-strong);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 8px;
  background: #0f172a; color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
}
.brand h1 { font-size: 15px; margin: 0; font-weight: 700; }
.brand span { font-size: 12px; color: var(--ink-faint); }

.nav-label { font-size: 11px; letter-spacing: .08em; color: var(--ink-faint); text-transform: uppercase; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--ink-soft); text-decoration: none; font-weight: 500;
  cursor: pointer;
}
.nav-item .ico { width: 18px; height: 18px; opacity: .8; }
.nav-item:hover { background: #f1f5f9; }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .badge {
  margin-left: auto; background: var(--red); color: #fff; font-size: 11px;
  border-radius: 999px; padding: 1px 8px; font-weight: 600;
}
.sidebar hr { border: none; border-top: 1px solid var(--line); margin: 12px 4px; }

.main { flex: 1; min-width: 0; padding: 26px 32px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.topbar h2 { margin: 0; font-size: 22px; font-weight: 700; }
.topbar p { margin: 4px 0 0; color: var(--ink-soft); }

/* ---------- Banner ---------- */
.banner {
  display: flex; align-items: center; gap: 10px;
  background: var(--primary-soft); color: var(--primary);
  border-radius: var(--radius); padding: 13px 18px; margin-bottom: 22px;
  font-weight: 500;
}
.banner a { color: var(--primary); font-weight: 600; text-decoration: none; }
.banner .x { margin-left: auto; cursor: pointer; color: var(--primary); opacity: .6; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: 1.4fr .9fr; }
.grid.stats { grid-template-columns: repeat(4, 1fr); margin-bottom: 22px; }
@media (max-width: 1080px){ .grid.cols-2{ grid-template-columns:1fr; } .grid.stats{ grid-template-columns:repeat(2,1fr);} }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card .card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.card .card-head .sub { margin-left: auto; color: var(--ink-faint); font-weight: 500; font-size: 12px; }
.card .card-body { padding: 20px; }

.stat {
  padding: 18px 20px; display: flex; align-items: center; gap: 14px;
}
.stat .icon {
  width: 44px; height: 44px; border-radius: 8px;
  background: #f1f5f9; display: grid; place-items: center;
}
.stat .n { font-size: 22px; font-weight: 700; line-height: 1; }
.stat .l { color: var(--ink-soft); font-size: 13px; margin-top: 4px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }

/* Emphasised primary upload block */
.field-highlight {
  background: var(--primary-soft);
  border: 1.5px solid var(--primary);
  border-left-width: 4px;
  padding: 16px;
  margin: 22px 0;
  position: relative;
}
.field-highlight .dropzone {
  background: #fff;
  border-color: var(--primary);
  border-style: solid;
}
.field-highlight .dropzone:hover, .field-highlight .dropzone.drag {
  background: var(--primary-soft);
}
.req-badge {
  display: inline-block; background: var(--primary); color: #fff;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 7px; margin: 0 6px; vertical-align: middle;
}
.field label { display: block; font-weight: 600; margin-bottom: 7px; font-size: 13px; }
.field .hint { color: var(--ink-faint); font-weight: 400; font-size: 12px; margin-left: 6px; }
.input, select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
  background: #fff; color: var(--ink); outline: none; transition: border .15s, box-shadow .15s;
}
.input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: var(--ring); }
textarea { resize: vertical; min-height: 82px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width:620px){ .row{ grid-template-columns:1fr; } }

/* segmented control (platform / phase) */
.seg { display: inline-flex; background: #f1f5f9; border-radius: 6px; padding: 4px; gap: 4px; }
.seg label { margin: 0; }
.seg input { display: none; }
.seg span {
  display: block; padding: 8px 20px; border-radius: 6px; cursor: pointer;
  font-weight: 600; color: var(--ink-soft); font-size: 13px; transition: .12s;
}
.seg input:checked + span { background: #fff; color: var(--primary); box-shadow: var(--shadow); }

/* pair chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { margin: 0; }
.chips input { display: none; }
.chips span {
  display: inline-block; padding: 7px 13px; border-radius: 6px;
  border: 1px solid var(--line-strong); cursor: pointer; font-weight: 600;
  font-size: 12.5px; color: var(--ink-soft); background: #fff; transition: .12s;
}
.chips input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }

/* dropzone */
.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm);
  padding: 22px; text-align: center; cursor: pointer; color: var(--ink-soft);
  transition: .15s; background: #f8fafc;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.dropzone strong { color: var(--primary); }
.dropzone .files { margin-top: 10px; font-size: 12.5px; color: var(--ink); text-align: left; }
.dropzone .files div { padding: 2px 0; }
.detect { margin-top: 8px; font-size: 12.5px; font-weight: 600; min-height: 16px; }
.detect.ok { color: var(--green); }
.detect.warn { color: var(--amber); }
.detect.bad { color: var(--red); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid transparent; cursor: pointer; font-weight: 600; font-size: 14px;
  padding: 9px 16px; border-radius: var(--radius); font-family: inherit;
  text-decoration: none; transition: .12s; box-shadow: var(--shadow-sm);
}
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--slate-50); border-color: var(--ink-faint); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { background: #047857; border-color: #047857; }
.btn-danger-ghost { background:#fff; border:1px solid var(--line-strong); color: var(--red); padding: 8px 12px; box-shadow: var(--shadow-sm); }
.btn-danger-ghost:hover { background: var(--red-50); border-color: var(--red); }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Live report ---------- */
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-faint); display: inline-block; }
.live-dot.on { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100%{ opacity:1;} 50%{ opacity:.5;} }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.metric { background: #f8fafc; border-radius: var(--radius-sm); padding: 12px 14px; }
.metric .k { color: var(--ink-faint); font-size: 12px; }
.metric .v { font-size: 18px; font-weight: 700; margin-top: 3px; }
.metric .v.pos { color: var(--green); }
.metric .v.neg { color: var(--red); }

.endpoint {
  background: #0f172a; color: #cbd5e1; border-radius: var(--radius-sm);
  padding: 12px 14px; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px; word-break: break-all; margin-top: 12px; position: relative;
}
.endpoint .lbl { color: #64748b; display: block; margin-bottom: 4px; font-size: 11px; }
.endpoint .copy { position:absolute; top:10px; right:10px; cursor:pointer; color:#94a3b8; font-size:11px; }

/* ---------- Table (Tailwind style) ---------- */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11px; color: var(--ink-faint); font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--slate-50);
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--slate-100); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--slate-50); }

/* Tailwind soft-tint badges: bg-*-50 + text-*-700 */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 9999px; font-size: 11.5px; font-weight: 600;
  background: var(--slate-100); color: var(--slate-700);
}
.tag .d { width: 7px; height: 7px; border-radius: 50%; }
.tag.mt4 { background: var(--indigo-50); color: var(--indigo-700); }
.tag.mt5 { background: var(--violet-50); color: var(--violet-700); }
.tag.first { background: var(--emerald-50); color: var(--emerald-700); }
.tag.second { background: var(--amber-50); color: var(--amber-700); }
.tag.ver { background: var(--slate-100); color: var(--slate-700); }
.pair-list { display: flex; flex-wrap: wrap; gap: 4px; }
.pair-mini { font-size: 11px; font-weight: 600; background: var(--slate-100); color: var(--slate-700); padding:2px 8px; border-radius:9999px; }
.shot-thumbs { display: flex; gap: 4px; }
.shot-thumbs img { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line-strong); }

.empty { text-align: center; padding: 46px 20px; color: var(--ink-faint); }
.empty svg { opacity: .35; margin-bottom: 10px; }

/* flash */
.flash { padding: 13px 18px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 500; }
.flash.ok { background: var(--emerald-50); color: var(--emerald-700); }
.flash.err { background: var(--red-50); color: var(--red-700); }
.flash.err ul { margin: 6px 0 0; padding-left: 18px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(16,24,40,.55); display: none; place-items: center; z-index: 50; padding: 20px; backdrop-filter: blur(2px); }
.modal-bg.open { display: grid; }
.modal { background: #fff; max-width: 720px; width: 100%; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(16,24,40,.3); }

/* modal hero header */
.md-hero { padding: 22px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.md-hero .top { display: flex; align-items: flex-start; gap: 12px; }
.md-hero h3 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; flex: 1; }
.md-hero .x { cursor: pointer; color: var(--ink-faint); font-size: 22px; line-height: 1; padding: 0 2px; }
.md-hero .x:hover { color: var(--ink); }
.md-hero .chips-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }

.md-body { padding: 22px 24px; }
.md-sec { margin-bottom: 22px; }
.md-sec:last-child { margin-bottom: 0; }
.md-sec > .h, .md-body > .h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 700; margin-bottom: 10px; }

/* info grid */
.md-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px){ .md-grid { grid-template-columns: repeat(2,1fr); } }
.md-cell { background: #f8fafc; border: 1px solid var(--line); padding: 12px 14px; }
.md-cell .k { color: var(--ink-faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.md-cell .v { font-weight: 700; font-size: 15px; margin-top: 4px; word-break: break-word; }

/* download rows */
.dl-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--line-strong); margin-bottom: 8px; background: #fff; }
.dl-row:last-child { margin-bottom: 0; }
.dl-row .ic { width: 34px; height: 34px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 16px; flex: 0 0 34px; }
.dl-row .nm { flex: 1; min-width: 0; }
.dl-row .nm .t { font-weight: 600; word-break: break-all; }
.dl-row .nm .s { color: var(--ink-faint); font-size: 12px; }
.dl-row a.btn { flex: 0 0 auto; padding: 8px 14px; }
.md-empty { color: var(--ink-faint); font-size: 13px; padding: 4px 0; }

.md-comment { background: #f8fafc; border-left: 3px solid var(--line-strong); padding: 12px 14px; white-space: pre-wrap; }

.shot-gallery { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.shot-gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border: 1px solid var(--line-strong); transition: .12s; }
.shot-gallery a:hover img { border-color: var(--primary); }
.tag.ver { background: var(--slate-100); color: var(--slate-700); }

/* ---------- Analytics chart ---------- */
.chart-toggle {
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink-soft);
  font-weight: 600; font-size: 12px; padding: 6px 12px; cursor: pointer; font-family: inherit;
}
.chart-toggle.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chart-period {
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink-soft);
  font-weight: 600; font-size: 12px; padding: 6px 12px; cursor: pointer; font-family: inherit;
}
.chart-period.active { background: #0f172a; border-color: #0f172a; color: #fff; }
.chart-wrap { position: relative; width: 100%; }
.growth-svg { width: 100%; height: 360px; display: block; overflow: visible; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.zero-line { stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 4 4; }
.grid-lbl { fill: var(--ink-faint); font-size: 11px; font-family: inherit; }
.crosshair { stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-tip {
  position: absolute; top: 6px; pointer-events: none; z-index: 3;
  background: #0f172a; color: #fff; padding: 6px 10px; font-size: 12px;
  display: flex; flex-direction: column; line-height: 1.35; min-width: 96px; text-align: center;
}
.chart-tip span { color: #94a3b8; font-size: 11px; }
.chart-empty { padding: 60px 20px; text-align: center; color: var(--ink-faint); }
.ea-row { cursor: pointer; }
.ea-row:hover { background: var(--slate-50) !important; }

/* ---------- Toast notifications ---------- */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 360px;
  background: #0f172a; color: #fff; padding: 13px 15px; box-shadow: 0 12px 30px rgba(16,24,40,.35);
  transform: translateX(120%); opacity: 0; transition: transform .25s ease, opacity .25s ease;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(18,183,106,.25); flex: 0 0 auto; }
.toast-title { font-weight: 700; font-size: 13.5px; }
.toast-sub { color: #cbd5e1; font-size: 12px; margin-top: 2px; }
.toast-x { margin-left: auto; cursor: pointer; color: #94a3b8; font-size: 18px; line-height: 1; }
.toast-x:hover { color: #fff; }

/* ---------- Pay calculator ---------- */
.pay-breakdown { margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.pay-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.pay-row:last-child { border-bottom: none; }
.pay-row span { color: var(--ink-soft); }
.pay-row strong { font-weight: 700; }
.pay-row.total { background: var(--slate-50); font-size: 15px; }
.pay-row.total strong { color: var(--green); font-size: 18px; }

/* ---------- Work-this-week (pay) card ---------- */
.work-card { margin-bottom: 22px; }
.work-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 720px){ .work-summary { grid-template-columns: repeat(2, 1fr); } }
.work-kpi { background: var(--slate-50); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.work-kpi .v { font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1; }
.work-kpi .k { color: var(--ink-soft); font-size: 12.5px; margin-top: 6px; }
.work-days { display: flex; gap: 8px; align-items: flex-end; }
.work-day { flex: 1; text-align: center; }
.work-day.is-today .wd-label { color: var(--primary); font-weight: 700; }
.work-day.is-today .wd-bar-fill { background: var(--primary); }
.wd-bar { height: 74px; display: flex; align-items: flex-end; justify-content: center; }
.wd-bar-fill { width: 60%; max-width: 34px; min-height: 2px; background: #c7cdf7; border-radius: 4px 4px 0 0; }
.wd-added { font-weight: 700; font-size: 14px; margin-top: 6px; }
.wd-label { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.wd-time { font-size: 11px; color: var(--ink-faint); margin-top: 2px; }

/* ---------- Dashboard EA profit boxes ---------- */
.sec-title { margin: 26px 0 14px; font-size: 16px; font-weight: 700; }
.ea-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 20px; }
.ea-box { padding: 18px 20px; }
.ea-box-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.ea-box-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ea-box-sub { color: var(--ink-faint); font-size: 12px; margin-top: 5px; display: flex; align-items: center; gap: 6px; }
.ea-box-profit { display: flex; align-items: baseline; gap: 8px; margin: 16px 0 10px; }
.ea-box-profit .big { font-size: 26px; font-weight: 700; line-height: 1; }
.ea-box-profit .pct { font-weight: 600; font-size: 14px; }
.ea-box .pos { color: var(--green); }
.ea-box .neg { color: var(--red); }
.ea-box-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }

/* ---------- Per-EA detail (MyFXBook-style) ---------- */
.modal.wide { max-width: 1000px; }
.ea-detail { display: grid; grid-template-columns: 240px 1fr; }
@media (max-width: 760px){ .ea-detail { grid-template-columns: 1fr; } }
.ea-info { border-right: 1px solid var(--line); padding: 16px 20px; }
@media (max-width: 760px){ .ea-info { border-right: none; border-bottom: 1px solid var(--line); } }
.ea-info .row2 { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.ea-info .row2:last-child { border-bottom: none; }
.ea-info .row2 .k { color: var(--ink-soft); }
.ea-info .row2 .v { font-weight: 700; }
.ea-info .row2.gap { border: none; padding: 4px 0; }
.ea-main { padding: 16px 20px; min-width: 0; }
.ea-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.ea-periods { margin-top: 18px; }
.ea-periods table { width: 100%; border-collapse: collapse; }
.ea-periods th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); padding: 8px 12px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.ea-periods td { padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.ea-periods tr:last-child td { border-bottom: none; }

/* monthly profit bars */
.mbars { display: flex; align-items: flex-end; gap: 10px; overflow-x: auto; padding: 6px 0 2px; }
.mbar { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 42px; }
.mbar-track { height: 96px; display: flex; align-items: flex-end; }
.mbar-fill { width: 26px; min-height: 3px; }
.mbar-lbl { font-size: 10.5px; color: var(--ink-faint); white-space: nowrap; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { background: #fff; border: 1px solid var(--line-strong); box-shadow: var(--shadow); padding: 34px; width: 100%; max-width: 400px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand .logo { width: 44px; height: 44px; background: #0f172a; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.login-brand h1 { margin: 0; font-size: 17px; font-weight: 700; }
.login-brand span { font-size: 12px; color: var(--ink-faint); }
.login-title { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.login-sub { margin: 0 0 22px; color: var(--ink-soft); font-size: 13px; }

/* ---------- Connection key ---------- */
.conn-key {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px;
  background: #f1f5f9; color: var(--ink-soft); padding: 3px 6px;
}
.conn-key .copy-key {
  border: none; background: var(--primary); color: #fff; cursor: pointer;
  font-size: 10.5px; font-weight: 600; padding: 2px 7px; font-family: inherit;
}
.conn-key .copy-key:hover { background: var(--primary-hover); }
.key-box {
  display: flex; align-items: center; gap: 10px;
  background: #0f172a; color: #cbd5e1; padding: 12px 14px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; word-break: break-all;
}
.key-box button {
  margin-left: auto; border: none; background: var(--primary); color: #fff;
  cursor: pointer; font-size: 12px; font-weight: 600; padding: 6px 12px; font-family: inherit; flex: 0 0 auto;
}

/* ---- Dropzone enhancements (upload boxes + stop-modal) : shared ---- */
.dropzone { position: relative; cursor: pointer; }
.dropzone.paste-ok  { border-color: var(--green); background: var(--green-soft); }
.dropzone.paste-bad { border-color: var(--red);   background: var(--red-50); }
.dropzone.dz-armed  { border-color: var(--primary); background: var(--primary-soft); }
.paste-flash { position: absolute; top: 6px; right: 10px; font-size: 11px; font-weight: 600; color: var(--ink-soft); }
.dropzone .files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.file-item { display: inline-flex; align-items: center; gap: 7px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px; padding: 4px 7px; font-size: 11.5px; max-width: 100%; }
.file-thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; display: block; border: 1px solid var(--line-strong); }
.file-meta { color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.file-x { border: none; background: none; color: var(--ink-faint); cursor: pointer; font-size: 13px; line-height: 1; padding: 2px 3px; }
.file-x:hover { color: var(--red); }
.file-menu { border: none; background: none; color: var(--ink-faint); cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 4px; border-radius: 5px; }
.file-menu:hover { color: var(--primary); background: var(--primary-soft); }
.dz-menu { position: fixed; z-index: 2000; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 6px; min-width: 196px; }
.dz-menu button { display: flex; align-items: center; gap: 9px; width: 100%; border: none; background: none; padding: 9px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--ink); text-align: left; font-family: inherit; }
.dz-menu button:hover { background: var(--primary-soft); color: var(--primary); }
.dz-menu button.danger { color: var(--red); }
.dz-menu button.danger:hover { background: var(--red-50); color: var(--red); }

/* ---- Link chips (upload form + EA detail popup) ---- */
.link-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.link-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--primary); cursor: pointer; font-weight: 500; font-family: inherit; }
.link-chip:hover { background: var(--primary-soft); border-color: var(--primary); }
.link-chip.copied { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.link-chip.copied:hover { background: var(--green-soft); border-color: var(--green); }
.link-chip .tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }

/* ---- EA detail popup footer (provider / version / phase / created) ---- */
.md-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 12px; }
.md-foot b { color: var(--ink-soft); font-weight: 600; }

/* ---- Per-EA analytics modal: KPI tiles + panel polish ---- */
.ea-info .kl { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); margin-bottom: 4px; font-weight: 600; }
.ea-info .ea-kpi-hero { border: 1px solid var(--line); border-radius: 12px; padding: 12px 10px; text-align: center; margin-bottom: 8px; background: var(--slate-50); }
.ea-info .ea-kpi-hero.pos { background: var(--green-soft); border-color: #bbf7d0; }
.ea-info .ea-kpi-hero.neg { background: var(--red-50); border-color: #fecaca; }
.ea-info .ea-kpi-hero .kv { font-size: 24px; font-weight: 800; line-height: 1.1; }
.ea-info .ea-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.ea-info .ea-kpi { border: 1px solid var(--line); border-radius: 10px; padding: 9px 5px; text-align: center; background: var(--panel); }
.ea-info .ea-kpi .kv { font-size: 13.5px; font-weight: 800; line-height: 1.1; white-space: nowrap; }
.ea-info .row2 { padding: 9px 0; }
.ea-info .row2 .k { font-size: 12.5px; }
