/* ═══════════════════════════════════════════════════════════════════
   GoPaisa Report Panel — dashboard styles (index.html only).
   Auth pages (login / signup / logout) keep using styles.css.
   Theme: dark by default, body.light for light (key "app_theme").
   ═══════════════════════════════════════════════════════════════════ */

/* ───────────────────────── Tokens ───────────────────────── */
:root {
  --bg: #0D0F12; --surface: #15181D; --surface-2: #1A1E24; --hover: #20252C;
  --border: #272C34; --border-2: #3A414C; --field-line: #5E6672;
  --text: #ECEEF1; --text-2: #C3C8D0; --muted: #9AA1AC;
  --accent: #2BB5A0; --accent-hi: #7ADCCB; --on-accent: #0B1F1C;
  --accent-soft: #12302B; --accent-tint: #13221F; --accent-line: #2A5F55;
  --danger: #F29C94; --danger-soft: #3A1D1D;
  --warn: #FBD38D; --warn-soft: #3A2A12;
  --primary: #ECEEF1; --on-primary: #0D0F12;
  --shadow: none;
  --pop-shadow: 0 12px 32px -8px rgba(0, 0, 0, .6);

  /* Summary panel is dark in both themes; in dark mode it sits lighter than the page */
  --panel: #1E2229; --panel-2: #272C34; --panel-line: #333A44;
  --panel-text: #FFFFFF; --panel-muted: #B8BDC6; --panel-faint: #969DA9;
  --panel-field: #5E6672; --panel-track: #3A3F48;
  --cta: #2BB5A0; --on-cta: #0B1F1C;
  --n-amber-bg: #3A2A12; --n-amber-fg: #FBD38D;
  --n-red-bg: #3A1D1D;   --n-red-fg: #F8C4C4;
  --n-purple-bg: #2A2340; --n-purple-fg: #D9CCFF;
  --n-green-bg: #12302B; --n-green-fg: #BDEBE2;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --press: 0.97; --enter-y: 4px; --pop: 0.96;

  --sidebar-w: 248px;
  color-scheme: dark;
}
body.light {
  --bg: #F4F5F2; --surface: #FFFFFF; --surface-2: #FAFAF8; --hover: #ECEEE9;
  --border: #E1E3DD; --border-2: #D5D8D1; --field-line: #8A919C;
  --text: #16181D; --text-2: #3D434D; --muted: #5B6270;
  --accent: #0B6E63; --accent-hi: #084F47; --on-accent: #FFFFFF;
  --accent-soft: #E3F1EE; --accent-tint: #F1F8F6; --accent-line: #B9DDD5;
  --danger: #B42318; --danger-soft: #FDECEA;
  --warn: #8A5A00; --warn-soft: #FFF4DE;
  --primary: #16181D; --on-primary: #FFFFFF;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --pop-shadow: 0 12px 32px -8px rgba(0, 0, 0, .25);
  --panel: #16181D; --panel-2: #22252C; --panel-line: #2E323A;
  --panel-faint: #8E95A1;
  color-scheme: light;
}
@media (prefers-reduced-motion: reduce) {
  :root { --press: 1; --enter-y: 0px; --pop: 1; }
}

/* ───────────────────────── Base ───────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }

/* Press feedback on real buttons; toggles (chips, columns, rows) get colour only */
.btn, .cta, .pbtn, .nbtn, .xbtn, .icon-btn, .link-btn, .btn-download-adjust {
  transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease, color 150ms ease, opacity 150ms ease;
}
:is(.btn, .cta, .pbtn, .nbtn, .xbtn, .icon-btn, .link-btn, .btn-download-adjust):active:not(:disabled) { transform: scale(var(--press)); }

/* Entrances for state cards (new nodes / un-hidden nodes only) */
.note, .prog, .job, .status-line, .banner, #sum-state > * {
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
@starting-style {
  .note, .prog, .job, .status-line, .banner, #sum-state > * { opacity: 0; transform: translateY(var(--enter-y)); }
}

.spin, .spinning svg { animation: spin 600ms linear infinite; transform-origin: 50% 50%; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────────────────────── Layout ───────────────────────── */
.app { min-height: 100vh; display: flex; }
.main { flex: 1; min-width: 0; padding: 32px 32px 64px; }
.wrap { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }

.ph small {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ph .eyebrow-badge {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-hi);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  padding: 2px 10px;
  border-radius: 9999px;
  letter-spacing: .01em;
}
.ph h1 { margin: 4px 0 6px; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.ph p { max-width: 820px; color: var(--muted); line-height: 1.5; }

.split { display: flex; gap: 24px; align-items: flex-start; }
.flow { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
#export-top-controls, .view-section { display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 24px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow);
}
.card.card-flush { padding: 0; gap: 0; overflow: hidden; }
.card-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 16px; font-weight: 600; }
.step { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.step i {
  font-style: normal; width: 24px; height: 24px; border-radius: 999px; flex: none;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text);
  font-size: 12px; font-weight: 600; display: grid; place-items: center;
}
.step h2 { font-size: 16px; font-weight: 600; }
.step > span { font-size: 12px; color: var(--muted); }
.badge { font-size: 12px; font-weight: 600; color: var(--accent-hi); background: var(--accent-soft); padding: 3px 8px; border-radius: 6px; }

/* ───────────────────────── Sidebar ───────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex: none; position: sticky; top: 0; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 14px 14px; display: flex; flex-direction: column; gap: 24px;
  transition: width 200ms var(--ease-in-out);
}
.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-left: 6px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.brand-txt { display: flex; flex-direction: column; min-width: 0; white-space: nowrap; }
.brand-txt b { font-size: 15px; }
.brand-txt span { font-size: 12px; color: var(--muted); }
.sidebar-collapse-icon { transition: transform 200ms var(--ease-in-out); }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 6px; white-space: nowrap; }
.nav-label:first-child { padding-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: 8px; background: none; color: var(--text-2); font-weight: 500; text-align: left; white-space: nowrap;
}
.nav-item svg { flex: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-hi); font-weight: 600; }

.me { margin-top: auto; display: flex; align-items: center; gap: 6px; padding: 10px; border-radius: 10px; background: var(--bg); }
.me-id { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 999px; background: var(--text); color: var(--bg); display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; }
.me-email { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-actions { display: flex; gap: 4px; }

.sidebar.collapsed { width: 72px; }
.sidebar.collapsed :is(.brand-txt, .nav-text, .me-email) { display: none; }
.sidebar.collapsed .sidebar-header { flex-direction: column; padding-left: 0; }
.sidebar.collapsed .sidebar-collapse-icon { transform: rotate(180deg); }
.sidebar.collapsed .nav-label { font-size: 0; padding: 10px 0 4px; }
.sidebar.collapsed .nav-label::after { content: ""; display: block; height: 1px; margin: 0 10px; background: var(--border); }
.sidebar.collapsed .nav-label:first-child::after { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0; }
.sidebar.collapsed .me { flex-direction: column; padding: 8px 4px; }
.sidebar.collapsed .me-id { justify-content: center; }
.sidebar.collapsed .me-actions { flex-direction: column; }

/* ───────────────────────── Controls ───────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-2); }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.input {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--field-line); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 500; min-width: 0;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.input-sm { min-height: 36px; font-size: 13px; }
.input[type=search] { font-weight: 400; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; }

.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.date-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.date-row .date-presets { padding-bottom: 4px; flex: 1 1 520px; } /* wraps as one block instead of orphaning a chip */
.vsep { width: 1px; height: 24px; background: var(--border); align-self: center; }

.chip {
  min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 500;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-hi); font-weight: 600; }

.btn {
  min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 600; white-space: nowrap;
}
.btn:disabled { opacity: .45; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-ghost { background: var(--surface); border-color: var(--border-2); color: var(--text); font-weight: 500; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-danger-text { color: var(--danger); }
.icon-btn {
  width: 36px; height: 36px; padding: 0; border-radius: 8px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text); display: inline-grid; place-items: center; flex: none;
}
.icon-btn svg { width: 16px; height: 16px; }
.link-btn { min-height: 32px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--accent); font-size: 12px; font-weight: 600; }

.search { position: relative; display: block; }
.search svg { position: absolute; left: 14px; top: 14px; color: var(--muted); pointer-events: none; }
.search .input { width: 100%; padding-left: 40px; background: var(--surface-2); }

@media (hover: hover) and (pointer: fine) {
  .nav-item:not(.active):hover { background: var(--hover); color: var(--text); }
  .btn-ghost:hover:not(:disabled), .icon-btn:hover { background: var(--surface-2); }
  .btn-primary:hover:not(:disabled) { opacity: .88; }
  .link-btn:hover { background: var(--accent-soft); }
  .chip:hover:not(.active) { border-color: var(--field-line); }
  .tbl:hover:not(.on), .col:hover, .mrow:hover:not(.on) { border-color: var(--field-line); }
  .dd-btn:hover:not(:disabled) { border-color: var(--text-2); }
  .status-filter-option:hover { background: var(--surface-2); }
  .tab-btn:hover { color: var(--text); }
  .adjust-table tbody tr:not(.day-row):hover { background: var(--surface-2); }
  .btn-download-adjust:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
  .btn-details:hover { background: var(--accent-soft); }
  .adj-row:hover .btn-details { background: var(--accent-soft); }
  .pbtn:hover, .nbtn:hover { background: rgba(255, 255, 255, .06); }
  .xbtn:hover { background: rgba(244, 180, 180, .08); }
  .cta:hover:not(:disabled) { filter: brightness(1.06); }
}

/* ───────────────────────── Relational: tables & filters ───────────────────────── */
.tbls { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.tbl {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.tbl.on { border-color: var(--accent); background: var(--accent-tint); }
.tbl-txt { display: flex; flex-direction: column; min-width: 0; }
.tbl-txt b { font-size: 14px; }
.tbl-txt small { font-size: 12px; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 16px; border-top: 1px dashed var(--border); }
.filters-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.dd { position: relative; }
.dd-btn {
  min-height: 40px; min-width: 170px; padding: 0 12px; border: 1px solid var(--field-line); border-radius: 8px;
  background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 500;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.dd-btn.has-value { color: var(--text); border-color: var(--accent); background: var(--accent-tint); }
.dd-btn:disabled { opacity: .5; }
.dd-btn svg { transition: transform 200ms var(--ease-in-out); }
.dd-btn.open svg { transform: rotate(180deg); }
.dd-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; min-width: 220px; padding: 6px;
  border-radius: 10px; background: var(--surface); border: 1px solid var(--border-2); box-shadow: var(--pop-shadow);
  transform-origin: top left; transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out);
}
@starting-style { .dd-menu { opacity: 0; transform: scale(var(--pop)); } }
.status-filter-option { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.dd-note { font-size: 12px; color: var(--muted); }

/* ───────────────────────── Relational: columns ───────────────────────── */
.groups { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.grp + .grp { border-top: 1px solid var(--border); }
.grp-head { display: flex; align-items: center; gap: 4px; padding: 4px 10px 4px 16px; background: var(--surface-2); }
.grp-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0; border: 0; background: none; text-align: left; }
.grp-btn b { font-size: 14px; }
.grp-btn small { font-size: 12px; color: var(--muted); }
.chev { flex: none; transition: transform 200ms var(--ease-in-out); }
.grp-btn[aria-expanded=true] .chev { transform: rotate(90deg); }
.grp-body {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; padding: 12px 16px 16px;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
@starting-style { .grp-body { opacity: 0; transform: translateY(var(--enter-y)); } }
.col {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; min-width: 0;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 13px; cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.col.on { border-color: var(--accent-line); background: var(--accent-tint); color: var(--text); }
.col-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pii {
  flex: none; font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 5px; border-radius: 4px;
  color: var(--warn); background: var(--warn-soft);
}
.columns-empty { margin: 0; padding: 24px; text-align: center; color: var(--muted); border: 1px dashed var(--border-2); border-radius: 8px; }

/* ───────────────────────── MongoDB ───────────────────────── */
.mlist { display: flex; flex-direction: column; gap: 8px; max-height: 480px; overflow-y: auto; }
.mrow {
  display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 8px 16px; flex: none;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.mrow.on { border-color: var(--accent); background: var(--accent-tint); }
.mrow .mono { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }

/* ───────────────────────── Summary panel ───────────────────────── */
.sum {
  flex: 0 0 360px; min-width: 0; position: sticky; top: 24px; max-height: calc(100vh - 48px);
  background: var(--panel); color: var(--panel-text); border: 1px solid var(--panel-line); border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden;
  color-scheme: dark;
}
/* Only the upper part scrolls when many state cards stack up; password + download stay in view */
.sum-scroll { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px 24px 0; display: flex; flex-direction: column; gap: 16px; }
.sum-actions { flex: none; padding: 16px 24px 24px; display: flex; flex-direction: column; gap: 12px; background: var(--panel); }
.sum-mini { display: none; }
.sum-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sum-h h2 { font-size: 16px; font-weight: 600; }
.pbtn {
  min-height: 32px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--panel-line); background: none;
  color: var(--panel-muted); font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
}
.pbtn:disabled { opacity: .6; }
.sum-count { display: flex; flex-direction: column; gap: 4px; }
.big { font: 700 36px/1.1 'IBM Plex Mono', monospace; letter-spacing: -.02em; transition: opacity 150ms ease; }
.big.pending { opacity: .45; }
.sub { font-size: 13px; color: var(--panel-muted); }
.faint { font-size: 12px; color: var(--panel-faint); }
.sum-foot { margin: 0; line-height: 1.5; }
.sum-dl {
  margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px;
  padding: 16px 0; border-top: 1px solid var(--panel-line); border-bottom: 1px solid var(--panel-line);
}
.sum-dl dt { font-size: 12px; color: var(--panel-muted); }
.sum-dl dd { margin: 2px 0 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.sum-dl dd.mono { font-size: 13px; }
#sum-state:empty { display: none; }

.note { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px; border-radius: 10px; font-size: 12px; line-height: 1.5; }
.note b { font-size: 14px; }
.n-amber { background: var(--n-amber-bg); color: var(--n-amber-fg); }
.n-red { background: var(--n-red-bg); color: var(--n-red-fg); }
.n-purple { background: var(--n-purple-bg); color: var(--n-purple-fg); }
.n-green { background: var(--n-green-bg); color: var(--n-green-fg); }
.n-grey { background: var(--panel-2); color: var(--panel-muted); }
.note code { font-family: 'IBM Plex Mono', monospace; font-size: 11px; }
.nbtn {
  margin-top: 4px; min-height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid currentColor;
  background: none; color: inherit; font-size: 13px; font-weight: 600;
}

.sum .action-inputs { display: flex; flex-direction: column; gap: 6px; }
.sum .action-inputs > label { font-size: 12px; font-weight: 500; color: var(--panel-muted); }
.password-field { position: relative; display: flex; }
.password-field-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.password-field .input { width: 100%; padding-left: 36px; }
.sum .password-field .input { background: var(--panel-2); border-color: var(--panel-field); color: #fff; }
.sum .password-field-icon { color: var(--panel-faint); }
.action-inputs.is-invalid .input { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }
.sum .action-inputs.is-invalid .input { border-color: #F29C94; box-shadow: 0 0 0 3px rgba(242, 156, 148, .2); }
.field-error { font-size: 12px; color: var(--danger); }
.sum .field-error { color: var(--n-red-fg); }
.action-inputs:not(.is-invalid) .field-error { display: none; }

.cta {
  margin-top: 6px; width: 100%; min-height: 48px; border: 0; border-radius: 10px; background: var(--cta); color: var(--on-cta);
  font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.cta:disabled { opacity: .45; }

/* Progress (dark panel by default, .prog-light for cards) */
.prog { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 10px; background: var(--panel-2); }
.prog-top, .prog-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.prog-top > :first-child { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.prog-foot { font-size: 12px; color: var(--panel-muted); }
.track { position: relative; height: 6px; border-radius: 999px; background: var(--panel-track); overflow: hidden; }
.bar { height: 100%; border-radius: inherit; background: var(--cta); transition: width 300ms linear; }
.track.indeterminate .bar { position: absolute; width: 35% !important; animation: indeterminate 1.1s var(--ease-in-out) infinite; }
@keyframes indeterminate { from { left: -35%; } to { left: 100%; } }
.xbtn { min-height: 32px; padding: 0 10px; border-radius: 6px; border: 1px solid #6B3434; background: none; color: #F4B4B4; font-size: 12px; font-weight: 500; }

.prog-light, .job { background: var(--surface-2); border: 1px solid var(--border); }
.prog-light .prog-foot, .job .prog-foot { color: var(--muted); }
.prog-light .track, .track-light { background: var(--border); }
.prog-light .bar, .track-light .bar { background: var(--accent); }
.prog-light .xbtn { border-color: var(--border-2); color: var(--danger); }

/* ───────────────────────── Adjust ───────────────────────── */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); }
.tab-btn {
  min-height: 44px; padding: 0 4px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; color: var(--muted); font-weight: 600;
}
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }
#view-adjust { gap: 16px; }

.status-line { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 13px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.status-line.alert-success { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-hi); }
.status-line.alert-error, .status-line.s-error { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.status-line.alert-warning { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.banner { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-hi); font-size: 13px; }
.banner span { flex: 1; min-width: 0; }

.toolbar { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; border-bottom: 1px solid var(--border); }
.title-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.title-line h2 { font-size: 16px; font-weight: 600; }
.title-line .muted + .muted::before { content: "· "; }
#adjust-search-input { width: 220px; }
.export-row { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 22px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.export-row-txt { flex: 1 1 260px; }
.action-inputs.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.action-inputs.inline .password-field { width: 220px; }
/* The error sits in the row's bottom padding so it never pushes the table down */
.action-inputs.inline .field-error { position: absolute; right: 16px; bottom: 4px; font-size: 11px; line-height: 16px; }

.table-responsive { overflow-x: auto; position: relative; } /* positioned so the sr-only header can't escape the scroller */
.adjust-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 13px; }
.adjust-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 10px 16px; white-space: nowrap; }
.adjust-table td { padding: 10px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
.adjust-table :is(th, td):first-child { padding-left: 24px; }
.adjust-table :is(th, td):last-child { padding-right: 24px; text-align: right; }
.adjust-table .r, .adjust-table td.num { text-align: right; font-family: 'IBM Plex Mono', monospace; }
.adjust-table tbody tr { transition: background-color 120ms ease; }
.adjust-table tr.day-row th { background: var(--bg); color: var(--text-2); padding: 8px 24px; text-align: left; }
.adjust-table tr.day-row th span { font-weight: 400; color: var(--muted); }
.adjust-table tr.is-selected td { background: var(--accent-tint); }
.time-window-main { font-weight: 600; white-space: nowrap; }
.btn-download-adjust {
  min-width: 128px; justify-content: center; /* fixed width: label changes never reflow the table */
  min-height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.btn-download-adjust:disabled { opacity: .7; }
.btn-download-adjust.is-done { border-color: var(--accent-line); background: var(--accent-tint); color: var(--accent); opacity: 1; }

.adj-row { cursor: pointer; }
/* Parts of one hour read as a group: no divider between them, a dotted lead-in instead of the time */
.adjust-table tr.part-cont td { border-top: 1px dashed var(--border); }
.part-cont-mark { padding-left: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.layouts-legend { border-bottom: 1px solid var(--border); background: var(--surface-2); }
.layouts-legend summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 44px; padding: 8px 24px;
  font-size: 13px; cursor: pointer; list-style: none;
}
.layouts-legend summary::-webkit-details-marker { display: none; }
.layouts-legend details[open] .chev { transform: rotate(90deg); }
.legend-body { display: flex; flex-direction: column; gap: 10px; padding: 0 24px 14px 48px; }
.legend-items { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.row-actions { display: inline-flex; gap: 8px; justify-content: flex-end; }
.btn-details {
  min-height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid transparent; background: none;
  color: var(--accent); font-size: 12px; font-weight: 600; transition: background-color 150ms ease, transform 160ms var(--ease-out);
}
.btn-details:active { transform: scale(var(--press)); }
.layout-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; white-space: nowrap;
  font: 600 12px 'IBM Plex Mono', monospace; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
}
.layout-chip.is-diff { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.flag { display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; white-space: nowrap; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }

/* Details drawer (modal side sheet; the table behind it never moves) */
.drawer-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(10, 12, 15, .45); transition: opacity 200ms ease; }
@starting-style { .drawer-backdrop { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(480px, 100vw);
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: -24px 0 64px -24px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column;
  transition: transform 320ms cubic-bezier(0.32, 0.72, 0, 1);
}
@starting-style { .drawer { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }
.drawer-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.drawer-h h2 { font-size: 18px; font-weight: 700; margin-top: 2px; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 24px 32px; display: flex; flex-direction: column; gap: 20px; }
.drawer-file { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.drawer-file .mono { font-size: 12px; overflow-wrap: anywhere; color: var(--text-2); }
.drawer-dl { position: relative; padding-bottom: 18px; }
.drawer-dl .password-field { flex: 1 1 180px; width: auto; }
.drawer-dl .field-error { right: auto; left: 0; bottom: 0; }
.drawer-stats { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 12px; padding: 16px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.drawer-stats dt { font-size: 12px; color: var(--muted); }
.drawer-stats dd { margin: 2px 0 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.drawer-stats .wide { grid-column: 1 / -1; }
.stat-note { margin: 0; font-size: 12px; color: var(--muted); }
.drawer-sec { display: flex; flex-direction: column; gap: 10px; }
.drawer-sec h3 { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.drawer-sec p { font-size: 13px; }
.drawer-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.drawer-sec .search svg { top: 10px; }
.layout-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.diff-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.diff-list code { font-family: 'IBM Plex Mono', monospace; }
.diff-list .add { color: var(--accent); }
.diff-list .rem { color: var(--danger); }
.hdr-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.hdr-list li { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 4px 12px; font-size: 12px; }
.hdr-list li + li { border-top: 1px solid var(--border); }
.hdr-list li.is-new { background: var(--warn-soft); }
.hdr-list code { flex: 1; min-width: 0; font-family: 'IBM Plex Mono', monospace; overflow-wrap: anywhere; color: var(--text); }
.hdr-n { flex: none; width: 32px; color: var(--muted); text-align: right; }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 24px; text-align: center; color: var(--muted); }
.empty-state b { color: var(--text); }
.pager { padding: 12px 24px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }

.run-card { max-width: 820px; }
.run-card .row .field { min-width: 240px; }
.helper { margin-top: 10px; font-size: 12px; color: var(--muted); }
.helper b { color: var(--text-2); }
.job { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 10px; }

/* Segmented control: thumb slides under the active option */
.seg { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 8px; background: var(--hover); }
.seg-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 6px;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); transition: transform 200ms var(--ease-in-out);
}
.seg:has(#adjust-mode-range.active) .seg-thumb { transform: translateX(100%); }
.segmented-btn { position: relative; min-height: 36px; padding: 0 16px; border: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.segmented-btn.active { color: var(--text); font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  .seg-thumb, .sidebar, .grp-body, .dd-menu { transition: none; }
}

/* ───────────────────────── Modals ───────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px;
  background: rgba(10, 12, 15, .6); transition: opacity 200ms ease;
}
@starting-style { .modal-overlay { opacity: 0; } }
.dialog {
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px;
  display: flex; flex-direction: column; gap: 16px; box-shadow: 0 24px 64px -16px rgba(0, 0, 0, .45);
  transition: transform 200ms var(--ease-out), opacity 200ms var(--ease-out);
}
@starting-style { .dialog { transform: scale(var(--pop)); opacity: 0; } }
.dialog h3 { font-size: 18px; }
.dialog p { color: var(--text-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.range-box { padding: 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); text-align: center; color: var(--accent-hi); }
.kv-box { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }
.kv-split { padding-top: 12px; border-top: 1px dashed var(--border-2); }
.kv-split.kv { display: grid; }
#adjust-modal-multi-summary { display: flex; flex-direction: column; gap: 8px; }
.multi-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.file-name { font-size: 12px; overflow-wrap: anywhere; color: var(--accent-hi); }
.schema-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.schema-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; }
.schema-item-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.schema-item-txt .mono { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schema-item-txt span:last-child { color: var(--muted); font-size: 11px; }
.schema-item > .badge { flex: none; }

/* ───────────────────────── Responsive ───────────────────────── */
/* Large / 4K: give the extra width to the data (more column tiles, roomier table) */
@media (min-width: 1800px) { .wrap { max-width: 1600px; } .sum { flex-basis: 400px; } }
@media (min-width: 2300px) { .wrap { max-width: 1920px; } }
@media (min-width: 3000px) { .wrap { max-width: 2400px; } }

/* Short screens (1280×720, 1366×768): tighter header and panel so the download button stays visible */
@media (max-height: 820px) and (min-width: 1101px) {
  .main { padding-top: 20px; }
  .wrap { gap: 18px; }
  .ph h1 { font-size: 22px; margin: 2px 0 4px; }
  .ph p { font-size: 13px; }
  /* Sized to fit below the page header before any scrolling, so Download is never under the fold */
  .sum { top: 16px; max-height: calc(100vh - 150px); }
  .sum-scroll { padding: 20px 20px 0; gap: 12px; }
  .sum-actions { padding: 12px 20px 20px; gap: 8px; }
  .big { font-size: 30px; }
  .sum-dl { padding: 12px 0; gap: 10px 12px; }
  .sum-foot { display: none; }
}

/* Below 1100px the panel moves under the form, and password + download become a fixed bottom bar */
@media (max-width: 1100px) {
  .main { padding: 24px 20px 120px; }
  .split { flex-direction: column; align-items: stretch; }
  .sum { flex-basis: auto; position: static; max-height: none; overflow: visible; }
  .sum-scroll { overflow: visible; padding-bottom: 24px; }
  .sum-actions {
    position: fixed; z-index: 30; left: var(--sidebar-w); right: 0; bottom: 0;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 20px;
    border-top: 1px solid var(--panel-line); box-shadow: 0 -8px 24px -12px rgba(0, 0, 0, .5);
  }
  .app:has(.sidebar.collapsed) .sum-actions { left: 72px; }
  .sum-mini { display: block; flex: 1 1 160px; min-width: 0; font-size: 13px; color: var(--panel-muted); }
  .sum .action-inputs { flex: 2 1 380px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .sum .action-inputs > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sum .password-field { flex: 1 1 180px; }
  .sum .field-error { flex-basis: 100%; order: 3; }
  .cta { width: auto; margin-top: 0; min-height: 44px; padding: 0 20px; font-size: 14px; }
  .sum-foot { display: none; }
}

@media (max-width: 760px) {
  .app { flex-direction: column; }
  /* Sidebar becomes a compact top bar with a horizontal section strip */
  .sidebar, .sidebar.collapsed {
    width: 100%; height: auto; position: static; padding: 10px 16px; gap: 8px;
    flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .sidebar-header { padding-left: 0; }
  .sidebar-collapse-btn { display: none; }
  .sidebar.collapsed .brand-txt { display: flex; }
  .me, .sidebar.collapsed .me { margin: 0 0 0 auto; padding: 0; background: none; flex-direction: row; }
  .me-id { display: none !important; }
  .sidebar.collapsed .me-actions { flex-direction: row; }
  .sidebar-nav { order: 3; flex-basis: 100%; flex-direction: row; overflow-x: auto; gap: 6px; }
  .nav-label { display: none; }
  .nav-item, .sidebar.collapsed .nav-item { flex: none; min-height: 40px; padding: 0 12px; }
  .sidebar.collapsed .nav-text { display: inline; }
  .main { padding: 20px 16px 150px; }
  .sum-actions { left: 0; padding: 10px 16px; }
  .app:has(.sidebar.collapsed) .sum-actions { left: 0; }
  .cta { flex: 1 1 auto; }
  .ph h1 { font-size: 24px; }
  .card { padding: 18px; }
  .toolbar { padding: 16px; }
  .date-row .field:not(.field-inline) { flex: 1 1 140px; }
  .vsep { display: none; }
  #adjust-search-input, .action-inputs.inline, .action-inputs.inline .password-field { width: 100%; }
  .action-inputs.inline .btn { flex: 1; }
  .dd { flex: 1 1 100%; }
  .dd-btn { width: 100%; }
  .run-card .row .field { min-width: 0; flex: 1 1 100%; }
  .drawer-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer-h, .drawer-body { padding-left: 16px; padding-right: 16px; }
}
