/* ============================================================
   CalibPro Manager — Main Stylesheet
   ISO/IEC 17025 Calibration Management System
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:    #185FA5;
  --blue-l:  #E6F1FB;
  --teal:    #0F6E56;
  --teal-l:  #E1F5EE;
  --amber:   #BA7517;
  --amber-l: #FAEEDA;
  --red:     #A32D2D;
  --red-l:   #FCEBEB;
  --green:   #3B6D11;
  --green-l: #EAF3DE;
  --gray:    #5F5E5A;
  --gray-l:  #F1EFE8;

  --bg-primary:   #ffffff;
  --bg-secondary: #f5f5f3;
  --bg-tertiary:  #eeece6;
  --text-primary: #1a1a18;
  --text-secondary: #666660;
  --text-tertiary:  #999990;
  --border:       rgba(0,0,0,0.12);
  --border-med:   rgba(0,0,0,0.22);

  --r: 8px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  min-height: 100vh;
}

/* ---------- Layout ---------- */
.app { display: flex; height: 100vh; overflow: hidden; width: 100%; min-width: 0; }

.sidebar {
  width: 212px;
  background: var(--bg-primary);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sb-hdr { padding: 14px 14px; border-bottom: 0.5px solid var(--border); }
.sb-logo { font-size: 13px; font-weight: 600; line-height: 1.3; }
.sb-logo span { font-size: 10px; color: var(--text-secondary); font-weight: 400; display: block; margin-top: 2px; }

.nav-lbl {
  font-size: 10px; color: var(--text-tertiary);
  padding: 10px 14px 3px; text-transform: uppercase;
  letter-spacing: .06em; font-weight: 500;
}
.nav-it {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px; cursor: pointer; font-size: 13px;
  color: var(--text-secondary); border-left: 2px solid transparent;
  transition: all .12s; user-select: none;
}
.nav-it:hover { background: var(--bg-secondary); color: var(--text-primary); }
.nav-it.active { color: var(--blue); border-left-color: var(--blue); background: var(--blue-l); }

/* ── Collapsible nav groups ── */
.nav-group-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px 8px; cursor: pointer; user-select: none;
  font-size: 10px; color: var(--blue);
  text-transform: uppercase; letter-spacing: .07em; font-weight: 700;
  background: var(--blue-l); border-left: 3px solid var(--blue);
  margin-top: 2px; transition: background .12s, color .12s;
}
.nav-group-hdr:hover { background: rgba(24,95,165,.12); color: var(--blue); }
.nav-chev { font-size: 10px; display: inline-block; transition: transform .2s; }
.nav-group-hdr.collapsed .nav-chev { transform: rotate(-90deg); }
.nav-group-body.collapsed { display: none; }
.nav-it-link {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px 7px 18px; font-size: 12px;
  color: var(--text-secondary); text-decoration: none;
  border-left: 2px solid transparent; transition: all .12s;
}
.nav-it-link:hover { background: var(--bg-secondary); color: var(--blue); }

.main { flex: 1; overflow: auto; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: var(--bg-primary);
  border-bottom: 0.5px solid var(--border);
  padding: 9px 18px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.topbar-title { font-size: 15px; font-weight: 500; }
.content { padding: 16px; flex: 1; }

/* ---------- Pages ---------- */
.page { display: none; }
.page.active { display: block; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-primary);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

/* ---------- Grids ---------- */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.g4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

/* ---------- Metrics ---------- */
.metric { background: var(--bg-secondary); border-radius: var(--r); padding: 12px; }
.metric-lbl { font-size: 11px; color: var(--text-secondary); margin-bottom: 3px; }
.metric-val { font-size: 22px; font-weight: 500; }
.metric-val.amber { color: var(--amber); }
.metric-val.red   { color: var(--red); }

/* ---------- Buttons ---------- */
.btn {
  padding: 6px 13px; border-radius: var(--r);
  border: 0.5px solid var(--border-med);
  background: var(--bg-primary); color: var(--text-primary);
  font-size: 13px; cursor: pointer; font-family: var(--font);
  transition: all .12s; white-space: nowrap;
}
.btn:hover { background: var(--bg-secondary); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .38; cursor: not-allowed; }

.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: #104d88; }

.btn-sm { padding: 4px 9px; font-size: 12px; }

.btn-danger { background: var(--red-l); color: var(--red); border-color: var(--red); }
.btn-warn   { background: var(--amber-l); color: var(--amber); border-color: var(--amber); }
.btn-teal   { background: var(--teal-l); color: var(--teal); border-color: var(--teal); }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 7px 10px;
  border-bottom: 0.5px solid var(--border);
  font-weight: 500; color: var(--text-secondary); font-size: 11px;
  white-space: nowrap;
}
td { padding: 7px 10px; border-bottom: 0.5px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-secondary); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 2px 7px;
  border-radius: 20px; font-size: 11px; font-weight: 500;
}
.bpass  { background: var(--green-l); color: var(--green); }
.bfail  { background: var(--red-l);   color: var(--red);   }
.bdue   { background: var(--amber-l); color: var(--amber); }
.bover  { background: var(--red-l);   color: var(--red);   }
.bok    { background: var(--teal-l);  color: var(--teal);  }
.bscrap { background: var(--gray-l);  color: var(--gray);  }
.bblue  { background: var(--blue-l);  color: var(--blue);  }
.bgray  { background: var(--gray-l);  color: var(--gray);  }

/* ---------- Form elements ---------- */
.fg { margin-bottom: 12px; }
.fl { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; display: block; }

.fi {
  width: 100%; padding: 6px 9px;
  border: 0.5px solid var(--border-med); border-radius: var(--r);
  background: var(--bg-primary); color: var(--text-primary);
  font-size: 13px; font-family: var(--font);
}
.fi:focus { outline: none; border-color: var(--blue); }
.fi[readonly] { background: var(--bg-secondary); color: var(--text-secondary); }
textarea.fi { resize: vertical; }

.chk-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; cursor: pointer; font-weight: 400;
  text-transform: none; letter-spacing: 0;
}

/* ---------- Alerts ---------- */
.alert {
  padding: 9px 13px; border-radius: var(--r);
  font-size: 13px; margin-bottom: 10px;
  border: 0.5px solid transparent;
}
.ai { background: var(--blue-l);  color: var(--blue);  border-color: #B5D4F4; }
.as { background: var(--green-l); color: var(--green); border-color: #C0DD97; }
.aw { background: var(--amber-l); color: var(--amber); border-color: #FAC775; }
.ae { background: var(--red-l);   color: var(--red);   border-color: #F7C1C1; }

/* ---------- Tabs ---------- */
.tab-bar {
  display: flex; gap: 2px; margin-bottom: 14px;
  border-bottom: 0.5px solid var(--border);
}
.tab {
  padding: 7px 14px; cursor: pointer; font-size: 13px;
  color: var(--text-secondary); border-bottom: 2px solid transparent;
  margin-bottom: -0.5px; transition: all .12s;
}
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 500; }

/* ---------- Section title ---------- */
.sec-title {
  font-size: 13px; font-weight: 500; margin-bottom: 10px;
  padding-bottom: 7px; border-bottom: 0.5px solid var(--border);
}

/* ---------- Modals ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--bg-primary); border-radius: 12px;
  width: 100%; max-width: 740px; max-height: 92vh;
  overflow-y: auto; border: 0.5px solid var(--border);
}
.mh {
  padding: 14px 18px; border-bottom: 0.5px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-weight: 500; font-size: 14px; }
.mb { padding: 18px; }
.mf {
  padding: 12px 18px; border-top: 0.5px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
}
.xbtn {
  background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--text-secondary); line-height: 1;
}

/* ---------- Signature card ---------- */
.sig-card {
  border: 0.5px solid var(--border-med); border-radius: var(--r);
  padding: 12px; background: var(--bg-secondary);
}
.sig-card-title {
  font-size: 11px; font-weight: 500; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px;
  display: flex; align-items: center;
}

/* ---------- Sig preview block (in calibration form) ---------- */
.sig-preview-block {
  border: 0.5px solid var(--border-med); border-radius: var(--r);
  padding: 12px; background: var(--bg-secondary); margin-bottom: 12px;
}
.sig-preview-header {
  font-size: 12px; font-weight: 500; color: var(--text-secondary);
  margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center;
}

/* ---------- Reading rows ---------- */
.rdr-hdr, .rdr-row {
  display: grid;
  grid-template-columns: 90px 90px 90px 90px 90px 62px 26px;
  gap: 6px; align-items: center;
}
.rdr-hdr {
  margin-bottom: 4px; font-size: 11px;
  color: var(--text-secondary); font-weight: 500;
}
.rdr-row { margin-bottom: 5px; }
.rdr-del-btn {
  background: none; border: none; cursor: pointer;
  color: var(--red); font-size: 15px; line-height: 1; padding: 0;
}

/* ---------- Logo upload area ---------- */
.logo-drop {
  border: 1.5px dashed var(--border-med); border-radius: var(--r);
  padding: 16px; text-align: center; cursor: pointer;
  transition: all .15s; background: var(--bg-secondary);
  min-height: 80px; display: flex; align-items: center;
  justify-content: center; flex-direction: column; gap: 4px;
}
.logo-drop:hover { border-color: var(--blue); background: var(--blue-l); }
.logo-preview { max-height: 60px; max-width: 180px; object-fit: contain; }
.logo-ph { font-size: 12px; color: var(--text-secondary); }
.logo-ph small { font-size: 10px; }

/* ---------- Signature canvas ---------- */
.sig-canvas-wrap {
  border: 1.5px solid var(--border-med); border-radius: var(--r);
  background: #ffffff; overflow: hidden;
}
.sig-canvas-wrap canvas {
  display: block; touch-action: none; cursor: crosshair; width: 100%;
}
.sig-preview-img {
  max-height: 50px; border: 0.5px solid var(--border);
  border-radius: 4px; background: #fff;
}

/* ---------- Expandable customer rows ---------- */
.cust-exp-row { background: var(--bg-secondary); }
.cust-exp-row td { padding: 12px 14px; }
.inst-sub { width: 100%; border-collapse: collapse; font-size: 12px; }
.inst-sub th {
  background: none; font-weight: 500; color: var(--text-secondary);
  font-size: 11px; padding: 4px 8px;
  border-bottom: 0.5px solid var(--border);
}
.inst-sub td { padding: 4px 8px; border-bottom: 0.5px solid var(--border); }
.inst-sub tr:last-child td { border-bottom: none; }

/* ---------- Certificate styles ---------- */
.cert-wrap {
  background: #fff;
  font-family: 'Times New Roman', Georgia, serif;
  color: #111;
  max-width: 740px;
  margin: 0 auto;
}
.cert-co   { text-align: center; font-size: 17px; font-weight: 700; letter-spacing: .04em; }
.cert-addr { text-align: center; font-size: 11px; color: #444; margin-bottom: 2px; }
.cert-title {
  text-align: center; font-size: 15px; font-weight: 700;
  letter-spacing: .08em; margin: 8px 0 2px; text-decoration: underline;
}
.cert-sub  { text-align: center; font-size: 11px; color: #555; margin-bottom: 8px; }
.cline     { border-top: 2px solid #111; margin: 5px 0; }
.cthin     { border-top: 1px solid #bbb; margin: 11px 0; }

.ct { width: 100%; border-collapse: collapse; font-size: 11px; margin: 6px 0; }
.ct td, .ct th { border: 1px solid #aaa; padding: 4px 7px; }
.ct th { background: #efefef; font-weight: 600; text-align: center; }

.cres {
  text-align: center; padding: 8px; margin: 10px 0;
  border-width: 2px; border-style: solid; font-size: 15px; font-weight: 700;
}
.cmbox {
  border: 1px solid #bbb; border-radius: 4px;
  padding: 7px 11px; font-size: 11px; margin: 7px 0; background: #fafafa;
}
.cmtitle { font-size: 11px; font-weight: 700; margin-bottom: 3px; text-decoration: underline; }

.csign-block {
  display: flex; gap: 40px;
  justify-content: flex-end; align-items: flex-end; flex-wrap: wrap;
}
.csign {
  border-top: 1px solid #888; padding-top: 4px;
  text-align: center; font-size: 11px; min-width: 150px;
}
.csign-name   { font-weight: 600; font-size: 12px; }
.csign-desig  { color: #444; }
.csign-empid  { color: #666; font-style: italic; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g3 { grid-template-columns: 1fr 1fr; }
  .g2 { grid-template-columns: 1fr; }
  .rdr-hdr, .rdr-row {
    grid-template-columns: 72px 72px 72px 72px 72px 52px 22px;
  }
}

@media (max-width: 480px) {
  .rdr-hdr, .rdr-row {
    grid-template-columns: 64px 64px 64px 64px 64px 48px 20px;
    font-size: 11px;
  }
  .g4 { grid-template-columns: 1fr 1fr; }
}

/* ---------- Print styles ---------- */
@media print {
  .sidebar, .topbar, .modal-bg, .btn { display: none !important; }
  .cert-wrap { max-width: 100%; margin: 0; }
}
/* ============================================================
   style_v6_additions.css
   Add these rules to css/style.css (append at end of file)
   CalibPro Manager v6 — New component styles
   ============================================================ */

/* ── Scanner video frame ── */
#scanner-video {
  background: #111;
  border-radius: 8px;
}

/* ── Reminder checkbox column ── */
.remind-chk {
  width: 16px; height: 16px; cursor: pointer; accent-color: var(--blue);
}

/* ── Reminder table header checkboxes ── */
#chk-all {
  width: 16px; height: 16px; cursor: pointer; accent-color: var(--blue);
}

/* ── Reminder log ── */
#reminder-log-list div {
  transition: background .1s;
}
#reminder-log-list div:hover { background: var(--bg-secondary); }

/* ── Toast ── */
#calibpro-toast {
  font-family: var(--font, 'Segoe UI', sans-serif);
  line-height: 1.4;
  cursor: default;
}
#calibpro-toast a { text-decoration: underline; }

/* ── Scanner result table ── */
#scanner-result table td:first-child { white-space: nowrap; }

/* ── PDF / Excel export buttons in topbar ── */
.topbar .btn-sm {
  white-space: nowrap;
}

/* ── Scan guide box animation ── */
@keyframes scanline {
  0%   { top: 10%; }
  50%  { top: 80%; }
  100% { top: 10%; }
}

/* ── Reminder manager metric cards ── */
#reminders-body .metric-val.red    { color: var(--red);   }
#reminders-body .metric-val.amber  { color: var(--amber); }

/* ── Print: hide scanner, reminder, export buttons ── */
@media print {
  #modal-scanner, #modal-reminders, .topbar .btn-sm { display: none !important; }
}
/* ============================================================
   style_v7.css — Dark Mode + v7 Component Additions
   Append to css/style.css
   CalibPro Manager v7
   ============================================================ */

/* ===== DARK MODE ===== */
[data-theme="dark"] {
  --bg-primary:    #1e1e1e;
  --bg-secondary:  #2a2a2a;
  --bg-tertiary:   #161616;
  --text-primary:  #e8e6df;
  --text-secondary:#a09e97;
  --text-tertiary: #666660;
  --border:        rgba(255,255,255,0.10);
  --border-med:    rgba(255,255,255,0.18);
}

[data-theme="dark"] .card            { background: var(--bg-primary); }
[data-theme="dark"] .sidebar         { background: #1a1a1a; }
[data-theme="dark"] .topbar          { background: #1a1a1a; }
[data-theme="dark"] .modal           { background: #1e1e1e; }
[data-theme="dark"] .fi              { background: #2a2a2a; color: var(--text-primary); border-color: rgba(255,255,255,.18); }
[data-theme="dark"] .fi[readonly]    { background: #222; color: var(--text-secondary); }
[data-theme="dark"] .btn             { background: #2a2a2a; color: var(--text-primary); border-color: rgba(255,255,255,.18); }
[data-theme="dark"] .btn:hover       { background: #333; }
[data-theme="dark"] .btn-primary     { background: var(--blue); color: #fff; }
[data-theme="dark"] .metric          { background: #252525; }
[data-theme="dark"] table            { color: var(--text-primary); }
[data-theme="dark"] th               { color: var(--text-secondary); border-color: rgba(255,255,255,.1); }
[data-theme="dark"] td               { border-color: rgba(255,255,255,.07); }
[data-theme="dark"] tr:hover td      { background: #2a2a2a; }
[data-theme="dark"] .logo-drop       { background: #2a2a2a; border-color: rgba(255,255,255,.2); }
[data-theme="dark"] .sig-card        { background: #252525; border-color: rgba(255,255,255,.12); }
[data-theme="dark"] .sig-preview-block { background: #252525; }
[data-theme="dark"] .nav-it.active   { background: rgba(24,95,165,.25); }
[data-theme="dark"] .nav-group-hdr  { background: rgba(24,95,165,.18); color: #7ab3e8; border-left-color: #7ab3e8; }
[data-theme="dark"] .cust-exp-row    { background: #242424; }

/* Certificate always light (print) */
.cert-wrap { background: #fff !important; color: #111 !important; }

/* ===== INSTRUMENT NAME / CUSTOMER NAME BOLD IN TABLES ===== */
/* Applied via inline <strong> tags in JS — no extra CSS needed */

/* ===== INTERVAL SELECT (3 months added) ===== */
/* rendered inline in instrument form */

/* ===== CUSTOM FIELDS ===== */
.custom-field-row {
  display: flex; gap: 8px; align-items: center;
  padding: 6px 0; border-bottom: 0.5px solid var(--border);
}
.custom-field-row:last-child { border-bottom: none; }

/* ===== REPORTS PAGE ===== */
#page-reports .metric-val { font-size: 20px; }

/* ===== AUDIT TRAIL ===== */
#page-audit pre {
  font-family: var(--font-mono, monospace);
  white-space: pre-wrap; word-break: break-all;
}

/* ===== CERT AMEND MODAL ===== */
.amend-badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 11px;
  background: var(--amber-l); color: var(--amber);
  margin-left: 8px;
}

/* ===== DARK MODE TOGGLE ===== */
.dark-toggle {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
}
.dark-toggle input { width:18px; height:18px; accent-color: var(--blue); }

/* ============================================================
   Mobile & Tablet Responsive — v8
   ============================================================ */

/* ── Hamburger button (shown only on mobile) ── */
#mob-menu-btn {
  display: none; background: none; border: none;
  cursor: pointer; padding: 6px 8px; font-size: 20px;
  color: var(--text-secondary); line-height: 1;
  margin-right: 4px;
}

/* ── Sidebar overlay backdrop ── */
#sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 200;
}
#sidebar-overlay.visible { display: block; }

/* ── Tablet (≤ 960px): narrower sidebar ── */
@media (max-width: 960px) {
  .sidebar { width: 188px; }
  .content { padding: 12px; }
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .tab-bar { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .tab { white-space: nowrap; flex-shrink: 0; }
}

/* ── Mobile (≤ 768px): slide-in sidebar ── */
@media (max-width: 768px) {
  #mob-menu-btn { display: flex; align-items: center; }

  .app { position: relative; }

  .sidebar {
    display: flex !important;          /* override old display:none */
    position: fixed; inset: 0 auto 0 0;
    width: 230px; z-index: 300;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,.15);
  }
  .sidebar.mob-open { transform: translateX(0); }

  .main { width: 100%; }
  .topbar { padding: 8px 12px; }
  .topbar-title { font-size: 14px; }
  .content { padding: 10px; }

  .g4 { grid-template-columns: 1fr 1fr; }
  .g3 { grid-template-columns: 1fr 1fr; }
  .g2 { grid-template-columns: 1fr; }

  /* Tables: make cells wrap-friendly */
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  td, th { font-size: 12px; padding: 6px 8px; }

  /* Modals: full width */
  .modal { max-width: 100%; border-radius: 12px 12px 0 0; }
  .modal-bg { align-items: flex-end; padding: 0; }

  /* Settings tabs: scrollable */
  .tab-bar { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .tab { white-space: nowrap; flex-shrink: 0; font-size: 12px; padding: 6px 10px; }

  /* Reading rows: scroll horizontally */
  .rdr-hdr, .rdr-row { min-width: 480px; }
  .rdr-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Metric cards */
  .metric-val { font-size: 18px; }

  /* Buttons: touch-friendly */
  .btn { min-height: 36px; }
  .btn-sm { min-height: 30px; font-size: 12px; }

  /* Card padding: tighter on mobile */
  .card { padding: 10px; }

  /* Hide page title on very small screens if needed */
  .topbar-title { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ── Small phone (≤ 480px) ── */
@media (max-width: 480px) {
  .g4 { grid-template-columns: 1fr 1fr; }
  .g3 { grid-template-columns: 1fr; }
  .metric-val { font-size: 16px; }
  .content { padding: 8px; }
  .card { padding: 8px; border-radius: 8px; }
  .topbar { padding: 7px 10px; }
  .mf { flex-direction: column-reverse; }
  .mf .btn { width: 100%; justify-content: center; }
}

/* ── Uncertainty calculator layout ── */
.unc-source-row {
  display: grid;
  grid-template-columns: 1fr 110px 110px 90px 90px 28px;
  gap: 6px; align-items: center; margin-bottom: 6px;
}
@media (max-width: 768px) {
  .unc-source-row {
    grid-template-columns: 1fr 90px 90px 70px 70px 24px;
    font-size: 12px;
  }
}
@media (max-width: 480px) {
  .unc-source-row { grid-template-columns: 1fr; }
  .unc-source-row > * { width: 100%; }
}

/* ── Dark mode sidebar overlay ── */
[data-theme="dark"] #sidebar-overlay { background: rgba(0,0,0,.65); }

/* ===== SERIAL NO FIELD — no spaces ===== */
/* handled in JS, no extra style needed */

/* ===== RANGE NORMALISATION HINT ===== */
.range-hint {
  font-size: 11px; color: var(--text-secondary);
  margin-top: 3px;
}

/* ===== PRINT: reports ===== */
@media print {
  #page-reports .btn,
  #rpt-from, #rpt-to { display: none; }
  #rpt-content { page-break-inside: auto; }
}

/* ===== WELCOME PAGE — CENTERED SINGLE COLUMN ===== */

/* ── Keyframes ── */
@keyframes ws3FadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ws3CardPop {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes ws3LogoFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
@keyframes ws3BrandShimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}
@keyframes ws3BgShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes ws3CardRipple {
  0%   { box-shadow: 0 0 0 0   rgba(24,95,165,.28); }
  70%  { box-shadow: 0 0 0 12px rgba(24,95,165,0); }
  100% { box-shadow: 0 0 0 0   rgba(24,95,165,0); }
}

/* ── Page shell — light sky blue animated gradient ── */
.ws3-page {
  min-height: 100%; overflow-y: auto;
  display: flex; flex-direction: column;
  align-items: center; padding: 36px 24px 28px;
  background: linear-gradient(135deg,
    #cce9fb 0%, #d9f0fd 25%, #b8e0f7 55%, #d0ecfb 80%, #e4f5fe 100%);
  background-size: 300% 300%;
  animation: ws3BgShift 14s ease infinite;
}

/* ── Hero section ── */
.ws3-hero {
  text-align: center; width: 100%;
  max-width: 600px; margin-bottom: 32px;
}

/* default invisible — animated in when ws-animate class set */
.ws3-hero .ws3-welcometo,
.ws3-hero .ws3-logo,
.ws3-hero .ws3-brand,
.ws3-hero .ws3-tagline,
.ws3-hero .ws3-user-pill,
.ws3-hero .ws3-badges,
.ws3-qs-wrap, .ws3-footer { opacity: 0; }

/* Staggered entrances */
#page-welcome.ws-animate .ws3-welcometo { animation: ws3FadeUp .5s .10s ease-out both; }
#page-welcome.ws-animate .ws3-logo      { animation: ws3FadeUp .5s .25s ease-out both,
                                                      ws3LogoFloat 4s 1.4s ease-in-out infinite; }
#page-welcome.ws-animate .ws3-brand     { animation: ws3FadeUp .5s .42s ease-out both; }
#page-welcome.ws-animate .ws3-tagline   { animation: ws3FadeUp .5s .58s ease-out both; }
#page-welcome.ws-animate .ws3-user-pill { animation: ws3FadeUp .4s .72s ease-out both; }
#page-welcome.ws-animate .ws3-badges    { animation: ws3FadeUp .4s .85s ease-out both; }
#page-welcome.ws-animate .ws3-qs-wrap   { animation: ws3FadeUp .5s .98s ease-out both; }
#page-welcome.ws-animate .ws3-card:nth-child(1) { animation: ws3CardPop .4s 1.10s ease-out both; }
#page-welcome.ws-animate .ws3-card:nth-child(2) { animation: ws3CardPop .4s 1.20s ease-out both; }
#page-welcome.ws-animate .ws3-card:nth-child(3) { animation: ws3CardPop .4s 1.30s ease-out both; }
#page-welcome.ws-animate .ws3-card:nth-child(4) { animation: ws3CardPop .4s 1.40s ease-out both; }
#page-welcome.ws-animate .ws3-card:nth-child(5) { animation: ws3CardPop .4s 1.50s ease-out both; }
#page-welcome.ws-animate .ws3-card:nth-child(6) { animation: ws3CardPop .4s 1.60s ease-out both; }
#page-welcome.ws-animate .ws3-footer    { animation: ws3FadeUp .4s 1.72s ease-out both; }

/* Brand text shimmer (fires after fade-up) */
#page-welcome.ws-animate .ws3-brand {
  animation: ws3FadeUp .5s .42s ease-out both,
             ws3BrandShimmer 3.5s 1.6s linear infinite;
}

/* ── Hero typography ── */
.ws3-welcometo {
  font-size: 13px; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: #1a5a8a;
  margin-bottom: 16px;
}
.ws3-logo {
  max-width: 180px; max-height: 80px;
  display: block; margin: 0 auto 16px;
}
.ws3-brand {
  font-size: 54px; font-weight: 900; line-height: 1;
  letter-spacing: -.015em; margin-bottom: 12px;
  background: linear-gradient(90deg,
    #1565c0 15%, #42a5f5 42%, #1565c0 55%, #0d47a1 75%, #1565c0 90%);
  background-size: 250% auto;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ws3-tagline {
  font-size: 14px; font-weight: 400; color: #2c5f8a;
  line-height: 1.65; max-width: 460px; margin: 0 auto 20px;
}
.ws3-user-pill {
  display: inline-flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.72); backdrop-filter: blur(8px);
  border: 1px solid rgba(21,101,192,.2);
  border-radius: 50px; padding: 7px 18px 7px 9px;
  font-size: 13px; color: #1a3a5c; margin-bottom: 16px;
}
.ws3-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--blue); color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.ws3-badges {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.ws3-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .07em;
  padding: 3px 11px; border-radius: 20px;
  background: rgba(255,255,255,.6);
  border: 1px solid rgba(21,101,192,.25);
  color: #1565c0;
}

/* ── Quick Start section ── */
.ws3-qs-wrap { width: 100%; max-width: 780px; }

.ws3-qs-hdr {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 20px;
}
.ws3-qs-line { flex: 1; height: 1px; background: rgba(21,101,192,.2); }
.ws3-qs-label {
  font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: #1565c0; white-space: nowrap;
}

/* 3-column card grid */
.ws3-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.ws3-card {
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(21,101,192,.14);
  border-radius: 14px; padding: 20px 16px 16px;
  text-align: center; cursor: pointer; opacity: 0;
  transition: transform .18s, box-shadow .18s, border-color .18s, background .18s;
}
.ws3-card:hover {
  background: #fff;
  border-color: var(--blue);
  box-shadow: 0 8px 28px rgba(21,101,192,.16);
  transform: translateY(-4px);
  animation: ws3CardRipple .8s ease-out;
}
.ws3-card-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin: 0 auto 12px;
}
.ws3-card-title { font-size: 13px; font-weight: 700; color: #0d2b5e; margin-bottom: 4px; }
.ws3-card-desc  { font-size: 11px; color: #4a6a8a; line-height: 1.5; }

/* ── Footer ── */
.ws3-footer {
  margin-top: 24px; font-size: 10px; letter-spacing: .07em;
  color: #5a7a9a; text-align: center;
}

/* ── Dark mode ── */
[data-theme="dark"] .ws3-page   {
  background: linear-gradient(135deg, #0a1628 0%, #0e2040 40%, #0a1830 70%, #0d2245 100%);
  background-size: 300% 300%; animation: ws3BgShift 14s ease infinite;
}
[data-theme="dark"] .ws3-welcometo { color: #7ab3e8; }
[data-theme="dark"] .ws3-brand     {
  background: linear-gradient(90deg, #90c8ff 15%, #c8e8ff 42%, #90c8ff 55%, #60a8f0 75%, #90c8ff 90%);
  background-size: 250% auto;
  -webkit-background-clip: text; background-clip: text;
}
[data-theme="dark"] .ws3-tagline   { color: #8ab0cc; }
[data-theme="dark"] .ws3-user-pill { background: rgba(255,255,255,.08); border-color: rgba(144,200,255,.25); color: #c8e0f8; }
[data-theme="dark"] .ws3-badge     { background: rgba(144,200,255,.12); border-color: rgba(144,200,255,.25); color: #7ab3e8; }
[data-theme="dark"] .ws3-qs-label  { color: #7ab3e8; }
[data-theme="dark"] .ws3-qs-line   { background: rgba(144,200,255,.18); }
[data-theme="dark"] .ws3-card      { background: rgba(255,255,255,.05); border-color: rgba(144,200,255,.15); }
[data-theme="dark"] .ws3-card:hover { background: rgba(255,255,255,.1); border-color: var(--blue); box-shadow: 0 8px 28px rgba(24,95,165,.3); }
[data-theme="dark"] .ws3-card-title { color: #d0e8f8; }
[data-theme="dark"] .ws3-card-desc  { color: #7a9ab8; }
[data-theme="dark"] .ws3-card-icon  { filter: brightness(.85); }
[data-theme="dark"] .ws3-footer     { color: #5a7a9a; }

/* ── Responsive ── */
@media (max-width: 680px) {
  .ws3-grid  { grid-template-columns: repeat(2, 1fr); }
  .ws3-brand { font-size: 38px; }
}
@media (max-width: 400px) {
  .ws3-grid  { grid-template-columns: 1fr; }
}

/* ===== EMBEDDED HELP OVERLAY ===== */
#help-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
}
.help-panel {
  display: flex; width: 92vw; max-width: 1080px; height: 86vh;
  background: var(--bg-primary); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.28);
  overflow: hidden;
}
.help-sidebar {
  width: 256px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  background: var(--bg-secondary);
}
.help-sidebar-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 12px 10px; border-bottom: 1px solid var(--border);
}
.help-nav { flex: 1; overflow-y: auto; padding-bottom: 12px; }
/* Nav section (topic group) */
.hn-section { border-bottom: 0.5px solid var(--border); }
.hn-section-hdr {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 12px; cursor: pointer; user-select: none;
  font-size: 12px; font-weight: 700; color: var(--blue);
  background: var(--blue-l); border-left: 3px solid var(--blue);
  letter-spacing: .02em;
}
.hn-section-hdr:hover { background: rgba(24,95,165,.14); }
.hn-section-hdr .hn-chev { font-size: 10px; margin-left: auto; }
.hn-section-body { display: none; background: var(--bg-primary); }
.hn-section-body.hn-open { display: block; }
/* Nav article (sub-item) */
.hn-article {
  display: block; padding: 6px 12px 6px 30px;
  font-size: 12px; color: var(--text-secondary);
  cursor: pointer; border-left: 3px solid transparent;
  transition: all .1s;
}
.hn-article:hover { background: var(--bg-secondary); color: var(--text-primary); }
.hn-article.hn-active {
  color: var(--blue); font-weight: 600;
  background: var(--blue-l); border-left-color: var(--blue);
}
/* Right content pane */
.help-content { flex: 1; overflow-y: auto; padding: 26px 34px; }
.help-content h2 {
  font-size: 19px; font-weight: 700; margin: 0 0 6px;
  color: var(--blue);
}
.help-content h3 {
  font-size: 13px; font-weight: 700; margin: 20px 0 8px;
  color: var(--text-primary); border-bottom: 1px solid var(--border);
  padding-bottom: 5px; text-transform: uppercase; letter-spacing: .04em;
}
.help-content p { font-size: 13px; line-height: 1.75; margin: 0 0 12px; color: var(--text-secondary); }
.help-content ul, .help-content ol { padding-left: 20px; margin: 0 0 12px; }
.help-content li { font-size: 13px; line-height: 1.75; color: var(--text-secondary); margin-bottom: 3px; }
.help-content strong { color: var(--text-primary); }
.help-content mark { background: #fef9c3; color: #7c5c00; border-radius: 2px; padding: 0 2px; }
/* Callout boxes */
.htip  { background: #eff8ff; border-left: 4px solid var(--blue);  padding: 10px 14px; border-radius: 0 6px 6px 0; margin: 12px 0; font-size: 12.5px; color: #1a3a5c; }
.hwarn { background: #fff7ed; border-left: 4px solid var(--amber); padding: 10px 14px; border-radius: 0 6px 6px 0; margin: 12px 0; font-size: 12.5px; color: #7c4a00; }
.hstd  { background: #f0fdf4; border-left: 4px solid #22c55e;      padding: 10px 14px; border-radius: 0 6px 6px 0; margin: 12px 0; font-size: 12.5px; color: #14532d; }
.hgray { background: var(--bg-secondary); border: 1px solid var(--border); padding: 10px 14px; border-radius: 6px; margin: 12px 0; font-size: 12.5px; }
/* Help tables */
.htbl { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 12px; }
.htbl th { background: var(--blue-l); color: var(--blue); padding: 7px 10px; text-align: left; border: 1px solid var(--border); font-weight: 600; }
.htbl td { padding: 6px 10px; border: 1px solid var(--border); vertical-align: top; color: var(--text-secondary); }
.htbl tr:hover td { background: var(--bg-secondary); }
/* Breadcrumb & footer */
.h-breadcrumb { font-size: 11px; color: var(--text-tertiary); margin-bottom: 16px; }
.h-contact { margin-top: 36px; padding: 14px 0 0; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-tertiary); line-height: 1.8; }
/* Content pane inner elements rendered by _helpShowArticle */
.hc-breadcrumb { font-size: 11px; color: var(--text-tertiary); margin-bottom: 14px; }
.hc-title { font-size: 19px; font-weight: 700; color: var(--blue); margin: 0 0 18px; }
.hc-body { font-size: 13px; line-height: 1.75; color: var(--text-secondary); }
.hc-body h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-primary); border-bottom: 1px solid var(--border); padding-bottom: 5px; margin: 18px 0 8px; }
.hc-body p  { margin: 0 0 10px; }
.hc-body ul, .hc-body ol { padding-left: 18px; margin: 0 0 10px; }
.hc-body li { margin-bottom: 3px; }
.hc-footer { margin-top: 32px; }
.hc-contact { padding: 12px 0 0; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-tertiary); line-height: 1.9; }
.hc-contact a { color: var(--blue); text-decoration: none; }
.hc-contact a:hover { text-decoration: underline; }
/* Generic help callout box wrapper */
.hbox { display: block; }
/* Help button in topbar */
.help-btn {
  background: none; border: none; cursor: pointer;
  padding: 4px 8px; font-size: 15px; color: var(--text-secondary);
  border-radius: var(--r); transition: color .12s, background .12s;
}
.help-btn:hover { color: var(--blue); background: var(--blue-l); }
/* Dark mode adjustments */
[data-theme="dark"] .help-sidebar      { background: #1c1c1c; }
[data-theme="dark"] .hn-section-hdr   { background: rgba(24,95,165,.2); }
[data-theme="dark"] .hn-article.hn-active { background: rgba(24,95,165,.25); }
[data-theme="dark"] .hn-section-body  { background: #242424; }
[data-theme="dark"] .htip  { background: rgba(24,95,165,.18); color: #a8c8f0; }
[data-theme="dark"] .hwarn { background: rgba(245,158,11,.14); color: #fcd34d; }
[data-theme="dark"] .hstd  { background: rgba(34,197,94,.12); color: #86efac; }
[data-theme="dark"] .htbl th { background: rgba(24,95,165,.22); }
@media (max-width: 768px) {
  .help-panel { width: 100vw; height: 100dvh; border-radius: 0; }
  .help-sidebar { width: 220px; }
  .help-content { padding: 16px 18px; }
}
/* ============================================================
   style_login.css — Login Screen & Auth Styles
   Append to css/style.css
   CalibPro Manager v7b
   ============================================================ */

/* ===== LOGIN SCREEN ===== */
#app-login {
  font-family: var(--font, 'Segoe UI', sans-serif);
}
#app-login input {
  transition: border-color .15s;
}
#app-login .btn-primary {
  letter-spacing: .02em;
}
#login-error {
  line-height: 1.4;
}

/* ===== USER AVATAR IN SIDEBAR ===== */
#user-avatar {
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background .2s;
}

/* ===== ROLE BADGES ===== */
.badge-admin    { background: #FCEBEB; color: #A32D2D; }
.badge-engineer { background: #E6F1FB; color: #185FA5; }
.badge-viewer   { background: #EAF3DE; color: #3B6D11; }

/* ===== BLOCKED ACTION FEEDBACK ===== */
.btn[disabled] {
  opacity: .35 !important;
  cursor: not-allowed !important;
}

/* ===== USER MANAGER TABLE ===== */
#user-manager-content code {
  font-size: 11px;
}

/* ===== DARK MODE: login screen ===== */
[data-theme="dark"] #app-login {
  background: #161616;
}
[data-theme="dark"] #app-login > div {
  background: #1e1e1e;
  border-color: rgba(255,255,255,.12);
}
[data-theme="dark"] #app-login .fi {
  background: #2a2a2a;
  color: #e8e6df;
  border-color: rgba(255,255,255,.18);
}

/* ===== PRINT: hide app chrome ===== */
@media print {
  #app-login, #app-loading, .sidebar, .topbar, .modal-bg { display: none !important; }
  .content { padding: 0 !important; }
  .main    { margin-left: 0 !important; }
}

/* ===== LOADING SCREEN ===== */
#app-loading {
  position: fixed; inset: 0; z-index: 9997;
  background: var(--bg-tertiary);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
#app-loading .loading-logo  { font-size: 26px; font-weight: 700; color: var(--blue); }
#app-loading .loading-msg   { font-size: 13px; color: var(--text-secondary); }
#app-loading .loading-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Hide native browser password reveal button (our custom eye is used instead) */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear { display: none; }
input[type="password"]::-webkit-contacts-auto-fill-button,
input[type="password"]::-webkit-credentials-auto-fill-button { display: none; }
