:root {
  --brand: #AACD00;            /* moove accent green (official) */
  --green: #8CC63F;            /* moove logo green */
  --blue: #0071BC;             /* moove/Engine Guard brand blue */
  --blue-deep: #0A3D68;        /* sidebar */
  --blue-hero: #0C4A82;        /* page hero */
  --ink: #1a1a1a;
  --line: #e4e8ec;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: #f6f8fa; }
.topbar { background: var(--brand); padding: 12px 20px; display: flex; align-items: baseline; gap: 10px; }
.topbar .brand { font-weight: 700; font-size: 1.2rem; color: #1a1a1a; }
.topbar .sub { opacity: .7; font-size: .9rem; }
main { padding: 28px 34px; }
main .field { max-width: 560px; }
h1 .tag { background: var(--brand); font-size: .8rem; padding: 2px 8px; border-radius: 6px; vertical-align: middle; }
.card { border: 1px solid #e2e2e2; border-radius: 10px; padding: 16px 20px; margin-top: 16px; }
.ok { color: #2b7a0b; }
.err { color: #b00020; }
button { background: var(--brand); border: 0; padding: 8px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; }
code { background: #f2f2f2; padding: 1px 5px; border-radius: 4px; }

/* Phase 1 additions */
.field { display: flex; flex-direction: column; margin-bottom: 12px; }
.field label { font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
.field input { padding: 8px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 1rem; }
.hint { font-size: .8rem; opacity: .7; margin-top: 12px; }
a { color: var(--blue); }
button.link { background: none; border: 0; color: var(--blue); padding: 0; font-weight: 600; cursor: pointer; text-decoration: underline; }
table.grid { border-collapse: collapse; width: 100%; margin-top: 12px; }
table.grid th, table.grid td { text-align: left; padding: 8px 12px; border-bottom: 1px solid #eee; font-size: .95rem; }
table.grid thead th { background: #f7f7f7; border-bottom: 2px solid var(--brand); }

/* Phase 2 additions */
.nav { margin: 8px 0 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.actions { display: flex; gap: 16px; align-items: center; margin-top: 12px; }
.card h3 { margin: 18px 0 8px; border-bottom: 1px solid #eee; padding-bottom: 4px; }
.comp { border: 1px solid #eee; border-radius: 8px; padding: 12px; margin-bottom: 10px; background: #fafafa; }
.sae { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.sae-in { width: 60px; }
select { padding: 8px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 1rem; background: white; }
table.grid.sub { margin: 6px 0; background: #fff; }
table.grid.sub th { background: #f0f4e8; border-bottom: 1px solid var(--brand); }

/* Phase 3 additions */
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 12px; }
.module { border: 1px solid #e2e2e2; border-radius: 10px; padding: 16px 18px; border-top: 4px solid var(--brand); }
.module.disabled { opacity: .55; border-top-color: #ccc; }
.module h3 { margin: 0 0 6px; }
.modlinks { list-style: none; padding: 0; margin: 8px 0 0; }
.modlinks li { margin: 4px 0; }
.tests { margin: 6px 0 0; padding-left: 18px; }
.check { display: block; margin: 4px 0; font-weight: 400; }
.check input { margin-right: 6px; }
.testlists { display: flex; gap: 32px; padding: 8px 4px; font-size: .9rem; }
.badge { padding: 2px 10px; border-radius: 12px; font-size: .8rem; font-weight: 600; color: #fff; }
.badge.pending { background: #e08a00; }
.badge.processing { background: #1565c0; }
.badge.analyzed { background: #2b7a0b; }

/* Shared top navigation */
.topbar { flex-wrap: wrap; }
a.brand { text-decoration: none; color: #1a1a1a; }
.topnav { display: flex; gap: 14px; margin-left: 20px; flex-wrap: wrap; }
.topnav a { color: #1a1a1a; font-weight: 600; text-decoration: none; }
.topnav a:hover { text-decoration: underline; }
.whoami { margin-left: auto; font-size: .9rem; display: flex; align-items: center; gap: 8px; }
.whoami .link { color: #1a1a1a; }

/* Phase 4 / fixes */
input:disabled, select:disabled { background: #f0f0f0; color: #666; cursor: not-allowed; }
a.module { text-decoration: none; color: inherit; display: block; transition: box-shadow .1s; }
a.module:hover { box-shadow: 0 2px 8px rgba(0,0,0,.1); }

/* Barcode label */
.label { border: 1px solid #000; box-sizing: border-box; padding: 0.05in 0.12in; display: flex;
         flex-direction: column; justify-content: space-between; background: #fff; color: #000;
         font-family: Arial, sans-serif; overflow: hidden; }
.lbl-head { display: flex; justify-content: space-between; align-items: center; }
.logo-bw { max-height: 0.2in; max-width: 42%; filter: brightness(0); object-fit: contain; }
.lbl-fields { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px;
              font-size: 9.5px; line-height: 1.35; margin: 1px 0; align-content: center; }
.lbl-fields b { font-weight: 700; }
.lbl-barcode { text-align: center; }
.lbl-barcode svg { display: block; width: 100%; height: 0.3in; }
.lbl-id { font-size: 10px; letter-spacing: 2px; font-weight: 700; }

@media print {
  .no-print { display: none !important; }
  .topbar { display: none !important; }
  .app-sidebar { display: none !important; }
  .app-shell { display: block !important; }
  .app-hero { display: none !important; }
  main { max-width: none !important; margin: 0 !important; padding: 0 !important; }
  body { background: #fff !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .label { border: none; }
}

/* Pretest worksheet */
.ws-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 10px; }
.ws-logo { height: 34px; }
.ws-title2 { font-weight: 700; font-size: 1.1rem; }
.ws-batchno { font-weight: 700; font-size: 1rem; }
.ws-cols { display: flex; gap: 4mm; align-items: flex-start; }
table.worksheet { border-collapse: collapse; flex: 1; font-size: 9px; }
table.worksheet th, table.worksheet td { border: 1px solid #333; padding: 2px 3px; text-align: center; }
table.worksheet thead th { background: #AACD00; color: #1a1a1a; }
table.worksheet td.seq { font-weight: 700; background: #f2f2f2; }
table.worksheet td.ws-cell { height: 16px; }
table.worksheet td.hl { background: #fff2a8; }
table.worksheet td.comments { width: 16%; }
table.worksheet th.ir, table.worksheet td.ir { width: 12px; padding: 2px 1px; }

/* Smart lookup */
.lookup { display: flex; align-items: center; gap: 6px; margin: 8px 0 14px; flex-wrap: wrap; }
.lookup .pfx { color: #999; font-weight: 700; font-family: monospace; }
.lookup input { padding: 7px 9px; border: 1px solid #ccc; border-radius: 6px; min-width: 220px; }

/* Button-styled link */
.btnlink { display: inline-block; background: var(--brand); color: #1a1a1a; text-decoration: none;
           padding: 8px 16px; border-radius: 8px; font-weight: 600; margin-top: 6px; }
.btnlink:hover { filter: brightness(0.95); }

/* Lid stickers (~35mm round) */
.sheet { display: grid; grid-template-columns: repeat(4, 1.5in); justify-content: center; gap: 0.28in; margin-top: 8px; padding-top: 0.5in; }
.sticker { width: 1.5in; height: 1.5in; border-radius: 50%; border: 1px solid #ccc;
           box-sizing: border-box; padding: 0.12in; display: flex; flex-direction: column;
           align-items: center; text-align: center; overflow: hidden; }
.lid-num { font-size: 24px; font-weight: 800; line-height: 1; }
.lid-tests { display: flex; flex-wrap: wrap; justify-content: center; gap: 1px 5px;
             margin-top: 1mm; line-height: 1.1; }
.lid-t { font-size: 16px; font-weight: 800; }
.lid-batch { font-size: 9px; font-weight: 600; margin-top: auto; }


/* Label document (2 copies + instructions) */
.label-doc { margin-top: 12px; }
.label-row { display: flex; gap: 0; }
.instructions { margin-top: 6mm; max-width: 7in; }
.instr-title { font-weight: 800; text-align: center; font-size: 13px; margin-bottom: 3px; }
.instr-body { font-size: 10px; line-height: 1.35; text-align: justify; margin: 0; }
.badge.rejected { background: #b00020; }
.badge.expired { background: #777777; }

/* Autocomplete suggestions */
.suggest { border: 1px solid #ccc; border-radius: 6px; max-width: 420px; margin: -6px 0 8px; background: #fff; }
.suggest-item { padding: 6px 10px; cursor: pointer; border-bottom: 1px solid #eee; }
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover { background: #f2f7e6; }

/* ============ App shell (sidebar) ============ */
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }
.app-sidebar { width: 212px; flex: 0 0 212px; background: var(--blue-deep); color: #c9dced;
               display: flex; flex-direction: column; padding: 14px 12px; position: sticky; top: 0;
               height: 100vh; }
.app-content { flex: 1 1 auto; min-width: 0; background: #f6f8fa; display: flex; flex-direction: column; }
.brandmark { display: flex; align-items: center; gap: 11px; padding: 4px 6px 16px; text-decoration: none; }
.brandmark img { height: 46px; width: auto; display: block; }
.brandmark span { color: #fff; font-weight: 700; font-size: 1.18rem; letter-spacing: .01em; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { color: #c1d5e7; text-decoration: none; font-size: .92rem; padding: 9px 11px; border-radius: 8px;
              display: flex; align-items: center; gap: 10px; border-left: 3px solid transparent; }
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.active { background: rgba(255,255,255,.11); color: #fff; border-left-color: var(--green); }
.side-nav a.active .ico { color: var(--green); }
.side-nav a.disabled { opacity: .5; pointer-events: none; }
.side-nav .ico { flex: 0 0 18px; width: 18px; height: 18px; display: inline-flex; color: #7fa7c8; }
.side-nav .ico svg { width: 18px; height: 18px; display: block; }
.side-user { margin-top: auto; padding: 12px 8px 4px; border-top: 1px solid rgba(255,255,255,.10);
             display: flex; align-items: center; gap: 9px; font-size: .85rem; }
.side-user .ava { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; background: var(--green);
                  color: #173404; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.side-user .u { min-width: 0; line-height: 1.25; }
.side-user .u b { color: #fff; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; }
.side-user .link { color: #98c3e6; font-size: .78rem; }

/* ============ Page hero ============ */
.app-hero { background: var(--blue-hero); color: #fff; padding: 22px 34px; position: relative; overflow: hidden;
            margin: -28px -34px 22px; }
.app-hero .inner { position: relative; z-index: 1; display: flex; align-items: center; gap: 18px; }
.app-hero h1 { color: #fff; font-size: 1.55rem; margin: 0; font-weight: 600; }
.app-hero p { color: #bcd6ee; margin: 5px 0 0; font-size: .9rem; }
.app-hero .eg-logo { height: 40px; display: block; }
.app-hero .derrick { position: absolute; right: 48px; top: -26px; opacity: .10; z-index: 0; pointer-events: none; }
.app-hero .hero-shield { position: absolute; right: 40px; top: 50%; transform: translateY(-50%); height: 150px; z-index: 0; opacity: .92; pointer-events: none; }
.home-help { margin-top: 22px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; font-size: .9rem; color: #44515d; }

/* ============ Module tiles ============ */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 16px; margin: 6px 0 4px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
        text-decoration: none; color: inherit; display: block; transition: border-color .12s, box-shadow .12s; }
a.tile:hover { border-color: #c3d3e0; box-shadow: 0 4px 14px rgba(12,74,130,.10); }
.tile-art { height: 104px; overflow: hidden; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.tile-art svg { width: 100%; height: 104px; display: block; }
.tile-img { max-width: 76%; max-height: 66px; object-fit: contain; display: block; }
.tile-body { padding: 12px 14px 14px; }
.tile-body h3 { margin: 0 0 3px; font-size: 1rem; }
.tile-body .d { font-size: .8rem; color: #5b6b78; margin: 0; line-height: 1.4; }
.tile.disabled { opacity: .6; pointer-events: none; }
.tile .pill { float: right; font-size: .68rem; font-weight: 600; padding: 2px 8px; border-radius: 20px;
              background: #eaf1f8; color: var(--blue); margin-left: 6px; }
.tile .pill.soon { background: #eef0f2; color: #7a8894; }
.section-lbl { font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; color: #8a97a3;
               margin: 22px 2px 10px; display: flex; align-items: center; gap: 10px; }
.section-lbl::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ============ Auth / login ============ */
.auth { position: relative; min-height: calc(100vh - 56px); display: flex; flex-direction: column;
        align-items: center; justify-content: center; overflow: hidden; }
.auth-blob { position: absolute; border-radius: 50%; filter: blur(6px); opacity: .45; z-index: 0; }
.auth-blob.b1 { width: 260px; height: 260px; right: 6%; top: 8%; background: radial-gradient(circle at 30% 30%, #7db7ff, #0071BC); }
.auth-blob.b2 { width: 180px; height: 180px; left: 8%; bottom: 12%; background: radial-gradient(circle at 30% 30%, #c4e693, #8CC63F); }
.auth-card { position: relative; z-index: 1; background: #fff; width: 100%; max-width: 400px; border-radius: 16px;
             padding: 30px 34px 26px; box-shadow: 0 18px 50px rgba(20,50,80,.14); border: 1px solid #eef1f4; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; }
.auth-brand img { height: 42px; }
.auth-brand span { font-weight: 800; font-size: 1.2rem; color: #16324f; }
.auth-sub { color: #8a97a3; font-size: .9rem; margin: 0 0 2px; }
.auth-h { font-size: 1.7rem; margin: 0 0 22px; color: #1f2c38; }
.auth-field { margin-bottom: 14px; }
.auth-field label { display: block; font-size: .82rem; font-weight: 600; color: #45525e; margin-bottom: 6px; }
.auth-input { display: flex; align-items: center; gap: 8px; border: 1px solid #d5dde4; border-radius: 10px; padding: 0 12px; background: #fff; transition: border-color .12s, box-shadow .12s; }
.auth-input:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,188,.12); }
.auth-input svg { width: 18px; height: 18px; color: #9aa7b2; flex: 0 0 18px; }
.auth-input input { flex: 1; border: 0; outline: 0; padding: 12px 0; font-size: 1rem; background: transparent; }
.auth-btn { width: 100%; margin-top: 6px; border: 0; border-radius: 10px; padding: 13px; cursor: pointer; font-weight: 700; font-size: 1rem; color: #fff; background: linear-gradient(180deg,#78bf34,#4d9020); }
.auth-btn:hover { filter: brightness(1.03); }
.auth-btn:disabled { opacity: .7; cursor: default; }
.auth-foot { position: relative; z-index: 1; margin-top: 22px; opacity: .85; }
.auth-foot img { height: 22px; }

/* ============ Data module ============ */
.mode-tabs { display: inline-flex; gap: 4px; background: #eef1f4; border-radius: 10px; padding: 4px; margin: 4px 0 14px; }
.mode-tabs .mode { background: transparent; border: 0; padding: 7px 18px; border-radius: 8px; font-weight: 600; color: #5b6b78; cursor: pointer; }
.mode-tabs .mode.on { background: #fff; color: var(--blue); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.preset-btn { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 18px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: border-color .12s, box-shadow .12s; }
.preset-btn:hover { border-color: #c3d3e0; box-shadow: 0 4px 14px rgba(12,74,130,.10); }
.preset-btn .q { font-size: 1.05rem; font-weight: 600; color: #1f2c38; line-height: 1.3; }
.preset-btn .t { font-size: .78rem; color: var(--blue); font-weight: 600; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 4px 0 14px; }
.filter-bar label { display: flex; flex-direction: column; font-size: .74rem; font-weight: 600; color: #5b6b78; gap: 4px; }
.filter-bar select, .filter-bar input { font-size: .9rem; }
.btn-export { margin-left: auto; background: var(--blue); color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 600; cursor: pointer; align-self: end; }
.btn-export:hover { filter: brightness(1.05); }
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat .n { display: block; font-size: 1.5rem; font-weight: 700; color: #1f2c38; }
.stat .l { display: block; font-size: .74rem; color: #7a8894; margin-top: 2px; }
.chart-wrap { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.chart-title { font-size: .82rem; font-weight: 600; color: #45525e; margin-bottom: 6px; }
.chart { width: 100%; max-width: 700px; height: auto; display: block; }
.chart .ax { font-size: 9px; fill: #8a97a3; }
.legend { display: flex; gap: 16px; font-size: .78rem; color: #5b6b78; margin-top: 4px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.data-table tr.out td { background: #fdecec; }
.grid tr.out td { background: #fdecec; }

/* ============ Demo sandbox ============ */
.demo-banner { display: flex; align-items: center; gap: 16px; background: #fff7e6; border: 1px solid #f3d489;
               color: #7a5b12; border-radius: 10px; padding: 12px 16px; margin: 2px 0 8px; font-size: .9rem; line-height: 1.5; }
.demo-banner .link { color: #7a5b12; margin-left: auto; white-space: nowrap; font-weight: 600; }

/* ============ Impersonation banner ============ */
.imp-banner { display: flex; align-items: center; gap: 16px; background: #0C4A82; color: #fff;
              padding: 9px 20px; font-size: .86rem; }
.imp-banner .link { color: #d3e6fb; margin-left: auto; white-space: nowrap; font-weight: 600; }

.comp.retire { border-color: #f0b8a6; background: #fdf3ef; }
.comp.retire code { background: #f6ddd2; }

/* Lid color rows (settings) */
.lid-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.lid-row .lidlab { width: 84px; font-size: .9rem; }
.lid-row .swatch { width: 24px; height: 24px; border-radius: 5px; border: 1px solid #ccc; }
