/* ── FastFlowTrack — Layout ───────────────────────────────────────────────── */

/* ── App shell ───────────────────────────────────────────────────────────── */
html, body { height: 100%; }

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.site-footer { flex-shrink: 0; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border2);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  flex-shrink: 0;
  gap: 12px;
  z-index: 10;
}

.logo              { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.logo-mark         { width: 32px; height: 32px; background: var(--amber); border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.logo-mark svg     { width: 18px; height: 18px; fill: #0f0f0d; }
.logo-name         { font-family: var(--mono); font-size: 18.2px; font-weight: 600; letter-spacing: .05em; }
.logo-sub          { font-family: var(--mono); font-size: 11.7px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }

.hstats            { display: flex; gap: 0; flex: 1; justify-content: center; }
.hstat             { display: flex; flex-direction: column; align-items: center; padding: 3px 14px; border-right: 1px solid var(--border); }
.hstat:first-child { border-left: 1px solid var(--border); }
.hstat .hn         { font-family: var(--mono); font-size: 22.1px; font-weight: 600; line-height: 1; }
.hstat .hl         { font-size: 11.7px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-top: 2px; }
.hstat.ca .hn      { color: var(--amber); }
.hstat.cr .hn      { color: var(--red-t); }
.hstat.cg .hn      { color: var(--green-t); }
.hstat.cb .hn      { color: var(--blue-t); }

.hdr-btns { display: flex; gap: 7px; flex-shrink: 0; align-items: center; }

/* ── Body row (sidebar + main content) ──────────────────────────────────── */
.body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0; /* critical for flex children to scroll */
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 10px 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.slabel           { font-family: var(--mono); font-size: 11.7px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--hint); padding: 8px 14px 3px; }
.nav-item         { display: flex; align-items: center; justify-content: space-between; padding: 6px 14px; cursor: pointer; font-size: 15.6px; color: var(--muted); transition: background .1s, color .1s; }
.nav-item:hover   { background: var(--bg3); color: var(--text); }
.nav-item.active  { background: var(--amber-bg); color: var(--amber-t); border-left: 2px solid var(--amber); padding-left: 12px; }
.nav-item-l       { display: flex; align-items: center; gap: 7px; pointer-events: none; }
.nbadge           { font-family: var(--mono); font-size: 13px; font-weight: 600; padding: 1px 5px; border-radius: 3px; background: var(--bg4); color: var(--muted); pointer-events: none; }
.nav-item.active .nbadge { background: rgba(76,187,23,.2); color: var(--amber); }
.divider          { height: 1px; background: var(--border); margin: 5px 0; }
.ssr              { padding: 4px 14px; }
.ssr-lbl          { display: flex; justify-content: space-between; font-size: 13px; color: var(--hint); font-family: var(--mono); margin-bottom: 3px; text-transform: uppercase; letter-spacing: .04em; }
.ssr-lbl span     { color: var(--muted); }

/* ── Main content + detail panel wrapper ─────────────────────────────────── */
.main-wrap {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.main {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
  position: relative;
}

/* Background watermark logo */
.main::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, 60vw);
  height: min(480px, 60vw);
  background: url('../img/logo.png') center / contain no-repeat;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
}

.main-inner { padding: 14px; position: relative; z-index: 1; }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 7px; margin-bottom: 12px; flex-wrap: wrap; }

.sw         { flex: 1; position: relative; min-width: 160px; max-width: 300px; }
.sw svg     { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); width: 12px; height: 12px; stroke: var(--hint); fill: none; }
.sw input   { width: 100%; padding: 6px 8px 6px 27px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg3); color: var(--text); font-size: 15.6px; font-family: var(--mono); outline: none; }
.sw input::placeholder { color: var(--hint); }
.sw input:focus        { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(76,187,23,.12); }

.vtog        { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.vbtn        { padding: 5px 10px; cursor: pointer; background: var(--bg3); border: none; color: var(--muted); font-size: 13px; font-family: var(--mono); transition: background .1s; letter-spacing: .05em; }
.vbtn.active { background: var(--bg4); color: var(--amber); }

/* ── Detail panel (desktop: side panel, mobile: full overlay) ────────────── */
/* Detail panel — centered modal overlay */
.dp-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
  animation: dpFadeIn .18s ease;
}
@keyframes dpFadeIn { from{opacity:0} to{opacity:1} }
.dp {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  width: min(580px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,.8);
  animation: dpSlideUp .2s ease;
  position: relative;
}
@keyframes dpSlideUp { from{transform:translateY(16px);opacity:0} to{transform:none;opacity:1} }

/* Close button — top right corner */
.dp-close {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  padding: 10px 12px 0;
  background: var(--bg2);
}
.dp-close-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.dp-close-btn:hover { background: var(--bg4); color: var(--text); }

.dp-hdr       { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.dp-wo        { font-family: var(--mono); font-size: 13px; color: var(--muted); letter-spacing: .07em; text-transform: uppercase; margin-bottom: 3px; }
.dp-title     { font-size: 20.8px; font-weight: 600; line-height: 1.3; margin-bottom: 2px; }
.dp-cust      { font-size: 15.6px; color: var(--muted); margin-bottom: 8px; }
.dp-acts      { display: flex; gap: 5px; padding: 9px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.dp-sec       { padding: 11px 16px; border-bottom: 1px solid var(--border); }
.dp-sec:last-child  { border-bottom: none; }
.dp-sec-title { font-family: var(--mono); font-size: 11.7px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--hint); margin-bottom: 9px; display: flex; align-items: center; justify-content: space-between; }
.dp-field     { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; gap: 8px; }
.dfl          { font-size: 14.3px; color: var(--muted); min-width: 90px; flex-shrink: 0; }
.dfv          { font-size: 14.3px; font-weight: 500; text-align: right; flex: 1; word-break: break-word; font-family: var(--mono); }
.notes-a      { width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg3); color: var(--text); font-size: 14.3px; font-family: var(--mono); resize: vertical; min-height: 70px; outline: none; }
.notes-a:focus { border-color: var(--amber); }
