/* ══════════════════════════════════════════════════════
   VanTools  –  Field Management App
   Teal primary · Orange accent · Blue tool highlights
   Mobile-first
   ══════════════════════════════════════════════════════ */

:root {
  --blue:        #1A56DB;
  --blue-dark:   #1240A1;
  --blue-light:  #E8F0FE;
  --teal:        #0E7490;
  --teal-dark:   #155E75;
  --teal-light:  #CFFAFE;
  --orange:      #F97316;
  --orange-dark: #EA6000;
  --orange-light:#FFF3E0;
  --green:       #059669;
  --green-light: #D1FAE5;
  --red:         #DC2626;
  --red-light:   #FEE2E2;
  --amber:       #D97706;
  --amber-light: #FEF3C7;
  --purple:      #7C3AED;
  --purple-light:#EDE9FE;
  --gray-900:    #111827;
  --gray-700:    #374151;
  --gray-600:    #4B5563;
  --gray-500:    #6B7280;
  --gray-400:    #9CA3AF;
  --gray-300:    #D1D5DB;
  --gray-100:    #F3F4F6;
  --white:       #FFFFFF;
  --bg:          #F1F4FB;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 2px 12px rgba(14,116,144,.12);
  --shadow-lg:   0 8px 32px rgba(14,116,144,.18);
  --transition:  0.2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--gray-900);
  min-height: 100vh;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
input, textarea, select {
  font-family: inherit;
  font-size: 1rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: .65rem .9rem;
  width: 100%;
  background: var(--white);
  transition: border var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14,116,144,.18);
}
label { display: block; font-size: .85rem; font-weight: 600; color: var(--gray-700); margin-bottom: .35rem; }
.form-group { margin-bottom: 1rem; }
textarea { resize: vertical; min-height: 80px; }

.checkbox-row {
  display: flex; align-items: center; gap: .55rem; cursor: pointer;
  font-weight: 600; color: var(--gray-700);
}
.checkbox-row input[type="checkbox"] {
  width: 20px; height: 20px; accent-color: var(--teal);
  flex-shrink: 0; padding: 0;
}

/* ── buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .7rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: background var(--transition), transform .1s, box-shadow var(--transition);
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--teal);   color: var(--white); }
.btn-primary:hover { background: var(--teal-dark); box-shadow: var(--shadow); }
.btn-blue      { background: var(--blue);   color: var(--white); }
.btn-blue:hover { background: var(--blue-dark); box-shadow: var(--shadow); }
.btn-orange    { background: var(--orange); color: var(--white); }
.btn-orange:hover { background: var(--orange-dark); box-shadow: var(--shadow); }
.btn-success   { background: var(--green);  color: var(--white); }
.btn-success:hover { filter: brightness(.92); }
.btn-danger    { background: var(--red);    color: var(--white); }
.btn-danger:hover  { filter: brightness(.92); }
.btn-outline   { background: transparent; border: 2px solid var(--teal); color: var(--teal); }
.btn-outline:hover { background: var(--teal-light); }
.btn-ghost     { background: var(--gray-100); color: var(--gray-700); }
.btn-ghost:hover   { background: var(--gray-300); }
.btn-sm        { padding: .45rem .9rem; font-size: .83rem; }
.btn-full      { width: 100%; }
.btn-icon      { padding: .55rem; border-radius: 50%; }

/* ── screens ─────────────────────────────────────────── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ── login / setup ───────────────────────────────────── */
#screen-login, #screen-setup {
  background: linear-gradient(145deg, #0c4a6e 0%, var(--teal-dark) 45%, var(--teal) 100%);
  align-items: center; justify-content: flex-start; padding-top: 3rem;
}
.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 2rem 1.6rem;
  width: min(440px, calc(100vw - 2rem));
  box-shadow: var(--shadow-lg);
  margin: 0 auto;
}
.login-logo {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  margin-bottom: 1.6rem;
}
.login-logo .logo-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--teal-dark), #0c4a6e);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: var(--white);
  box-shadow: 0 4px 12px rgba(14,116,144,.4);
}
.login-logo h1 { font-size: 1.7rem; color: var(--teal-dark); font-weight: 800; line-height: 1.1; letter-spacing: -.03em; }
.login-logo h1 span { color: var(--orange); }
.login-subtitle { text-align: center; color: var(--gray-500); font-size: .9rem; margin-bottom: 1.4rem; }

/* user list */
.user-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; max-height: 320px; overflow-y: auto; }
.user-btn {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--gray-300);
  background: var(--white);
  cursor: pointer; transition: all var(--transition);
  font-size: .95rem; font-weight: 500; color: var(--gray-900); text-align: left;
}
.user-btn:hover, .user-btn.active { border-color: var(--teal); background: var(--teal-light); }
.user-btn .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-weight: 700; font-size: .9rem; flex-shrink: 0;
}
.user-btn.admin-btn .avatar { background: linear-gradient(135deg, var(--teal-dark), #0c4a6e); }

/* PIN pad */
.pin-display { display: flex; justify-content: center; gap: .6rem; margin: 1.2rem 0 1rem; }
.pin-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--gray-300); background: transparent;
  transition: all .15s;
}
.pin-dot.filled { background: var(--teal); border-color: var(--teal); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-bottom: .8rem; }
.pin-key {
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 2px solid var(--gray-300);
  background: var(--white);
  font-size: 1.4rem; font-weight: 700;
  cursor: pointer; transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-900);
  user-select: none;
}
.pin-key:hover  { border-color: var(--teal); background: var(--teal-light); color: var(--teal); }
.pin-key:active { transform: scale(.93); }
.pin-key.del    { font-size: 1.1rem; color: var(--red); }
.pin-key.zero   { grid-column: 2; }
.pin-submit {
  width: 100%; padding: .9rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: var(--white); font-size: 1.05rem; font-weight: 700;
  border: none; cursor: pointer;
  box-shadow: 0 4px 12px rgba(249,115,22,.35);
  transition: filter var(--transition), transform .1s;
}
.pin-submit:hover   { filter: brightness(1.06); }
.pin-submit:active  { transform: scale(.97); }
.pin-error { color: var(--red); font-size: .88rem; text-align: center; margin-top: .5rem; min-height: 1.2rem; }

/* ── main app layout ─────────────────────────────────── */
#screen-app { background: var(--bg); }

.app-header {
  background: linear-gradient(90deg, #0c4a6e, var(--teal-dark));
  color: var(--white);
  padding: .9rem 1.1rem;
  display: flex; align-items: center; gap: .75rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 10px rgba(12,74,110,.35);
}
.app-header .header-logo { font-size: 1.3rem; font-weight: 800; flex: 1; letter-spacing: -.02em; display: flex; align-items: center; }
.app-header .header-logo span { color: var(--orange); }
.app-header .header-logo img { max-height: 38px; max-width: 160px; width: auto; object-fit: contain; display: block; filter: brightness(0) invert(1); }
.app-header .header-user {
  display: flex; align-items: center; gap: .5rem;
  font-size: .88rem; background: rgba(255,255,255,.12);
  padding: .4rem .8rem; border-radius: 20px;
}
.app-header .header-user .user-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; }
.header-logout {
  background: rgba(255,255,255,.15); border: none; color: var(--white);
  padding: .4rem .75rem; border-radius: 20px; font-size: .83rem;
  cursor: pointer; transition: background var(--transition);
}
.header-logout:hover { background: rgba(255,255,255,.28); }

/* bottom nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--white);
  border-top: 1.5px solid var(--gray-300);
  display: flex;
  box-shadow: 0 -4px 20px rgba(14,116,144,.1);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: .55rem .2rem .4rem;
  font-size: .65rem; font-weight: 600; color: var(--gray-500);
  cursor: pointer; border: none; background: none;
  transition: color var(--transition);
  gap: .2rem;
}
.nav-item .nav-icon { font-size: 1.25rem; }
.nav-item.active { color: var(--teal); }
.nav-item.active .nav-icon { filter: drop-shadow(0 0 4px rgba(14,116,144,.4)); }

.app-content { padding: 1rem; padding-bottom: 80px; }

/* ── view panels ─────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ── search bar ──────────────────────────────────────── */
.search-bar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search-bar input {
  flex: 1; border-radius: 24px;
  padding: .6rem 1.1rem;
  background: var(--white); box-shadow: var(--shadow);
  border-color: transparent;
}
.search-bar input:focus { border-color: var(--teal); }
.filter-select {
  border-radius: 24px; padding: .6rem .85rem;
  background: var(--white); box-shadow: var(--shadow);
  border-color: transparent; min-width: 0; max-width: 160px;
}

/* ── section header ──────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .85rem; gap: .5rem; flex-wrap: wrap;
}
.section-title { font-size: 1.1rem; font-weight: 800; color: var(--gray-900); }

/* ── stat cards ──────────────────────────────────────── */
.stats-row {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem;
  margin-bottom: 1.2rem;
}
.stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: .9rem 1rem; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: .2rem;
}
.stat-card .stat-num { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.stat-card .stat-label { font-size: .75rem; color: var(--gray-500); font-weight: 600; }
.stat-card .stat-sub { font-size: .7rem; color: var(--gray-400); }
.stat-teal   .stat-num { color: var(--teal); }
.stat-blue   .stat-num { color: var(--blue); }
.stat-orange .stat-num { color: var(--orange); }
.stat-green  .stat-num { color: var(--green); }
.stat-red    .stat-num { color: var(--red); }
.stat-purple .stat-num { color: var(--purple); }

/* ── status badge ────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .65rem; border-radius: 20px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.badge-teal     { background: var(--teal-light);   color: var(--teal-dark); }
.badge-green    { background: var(--green-light);  color: var(--green); }
.badge-blue     { background: var(--blue-light);   color: var(--blue); }
.badge-amber    { background: var(--amber-light);  color: var(--amber); }
.badge-red      { background: var(--red-light);    color: var(--red); }
.badge-purple   { background: var(--purple-light); color: var(--purple); }
.badge-gray     { background: var(--gray-100);     color: var(--gray-600); }
.badge-orange   { background: var(--orange-light); color: var(--orange-dark); }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ── tech library category headers ───────────────────── */
.library-cat-head {
  display: flex; align-items: center; gap: .5rem;
  margin: 1rem 0 .4rem; padding-bottom: .3rem;
  font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--gray-600); border-bottom: 2px solid var(--gray-100);
}
.library-cat-head:first-child { margin-top: 0; }
.library-cat-count {
  font-size: .72rem; font-weight: 700; color: var(--gray-500);
  background: var(--gray-100); border-radius: 20px; padding: .1rem .5rem;
}

/* ── tool card grid ──────────────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .75rem;
}
.tool-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  border-top: 4px solid var(--blue);
}
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.tool-card.status-signed_out { border-top-color: var(--orange); }
.tool-card.status-damaged     { border-top-color: var(--amber); }
.tool-card.status-lost        { border-top-color: var(--red); opacity: .75; }
.tool-card.status-retired     { border-top-color: var(--gray-400); opacity: .55; }
.card-photo { width: 100%; aspect-ratio: 1; object-fit: cover; }
.card-photo-placeholder {
  width: 100%; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--blue-light);
  font-size: 2.5rem;
}
.card-body { padding: .6rem .7rem .7rem; }
.card-name { font-weight: 700; font-size: .88rem; color: var(--gray-900); margin-bottom: .2rem; }
.card-category { font-size: .74rem; color: var(--gray-500); margin-bottom: .3rem; }
.card-holder { font-size: .74rem; color: var(--gray-600); margin-top: .2rem; }

/* photos in tool detail */
.tool-detail-photos { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .85rem; }
.photo-placeholder {
  background: var(--gray-100); border-radius: var(--radius-sm);
  aspect-ratio: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .3rem;
  color: var(--gray-400);
}
.ph-icon { font-size: 1.8rem; }
.holder-banner {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .85rem; background: var(--blue-light);
  border-radius: var(--radius-sm); margin-bottom: .85rem;
  border-left: 4px solid var(--blue);
}
.hb-icon { font-size: 1.5rem; }
.hb-label { font-size: .74rem; color: var(--gray-500); font-weight: 600; }
.hb-name { font-weight: 700; color: var(--blue-dark); }

/* upload area */
.upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-sm);
  padding: .75rem;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: var(--gray-100);
}
.upload-area input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
  width: 100%; padding: 0;
}
.upload-preview { width: 100%; height: 100px; object-fit: cover; border-radius: 6px; }

/* ── job cards ───────────────────────────────────────── */
.job-card, .cyl-card, .list-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  margin-bottom: .6rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  border-left: 4px solid var(--teal);
}
.job-card:hover, .cyl-card:hover, .list-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.job-card.leak { border-left-color: var(--red); }
.job-card.recovery { border-left-color: var(--purple); }
.job-card.charge { border-left-color: var(--orange); }
.job-card.transfer { border-left-color: var(--blue); }
.job-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; margin-bottom: .35rem;
}
.job-card-title { font-weight: 700; font-size: .98rem; color: var(--gray-900); }
.job-card-date  { font-size: .8rem; color: var(--gray-500); font-weight: 600; }
.job-card-sub   { font-size: .82rem; color: var(--gray-600); margin-bottom: .35rem; }
.job-card-meta  { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; font-size: .78rem; color: var(--gray-500); }
.job-kg { font-weight: 700; }
.job-kg.add { color: var(--orange-dark); }
.job-kg.rec { color: var(--purple); }

/* ── cylinder card ───────────────────────────────────── */
.cyl-card { border-left: 6px solid var(--ref-color, var(--teal)); padding: .9rem 1rem; }
.cyl-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .35rem; }
.cyl-card-title { font-weight: 800; font-size: 1rem; display: inline-flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.cyl-ref-chip {
  display: inline-block; width: 14px; height: 14px;
  border-radius: 3px; border: 1px solid rgba(0,0,0,.15);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
  vertical-align: -2px; flex-shrink: 0;
}
.cyl-card-sub { font-size: .8rem; color: var(--gray-500); }
.cyl-value { color: var(--gray-700); font-weight: 600; }
.fill-bar { width: 100%; height: 8px; background: var(--gray-100); border-radius: 4px; margin-top: .55rem; overflow: hidden; }
.fill-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--teal-dark)); transition: width var(--transition); }
.fill-bar.recovery > span { background: linear-gradient(90deg, var(--purple), #5b21b6); }
.fill-bar.warning > span  { background: linear-gradient(90deg, var(--amber), #b45309); }
.fill-bar.full > span     { background: linear-gradient(90deg, var(--red), #991b1b); }
.cyl-card-meta { display: flex; justify-content: space-between; font-size: .75rem; color: var(--gray-500); margin-top: .35rem; align-items: center; gap: .5rem; }
.cyl-actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.cyl-holder-row { display: flex; align-items: center; gap: .5rem; margin: .25rem 0 .4rem; font-size: .78rem; }
.cyl-holder-since { color: var(--gray-500); font-style: italic; }
.cyl-card.inactive { opacity: .55; border-left-color: var(--gray-400); }

/* Recovery cylinders are colour-coded to match the physical tank: yellow top
   half (vapour), grey bottom half (liquid). Hard-stop gradient at 50% gives
   the two-tone look without bleeding into a soft fade. */
.cyl-card.recovery {
  background: linear-gradient(
    to bottom,
    var(--amber-light) 0%, var(--amber-light) 50%,
    var(--gray-300)    50%, var(--gray-300)    100%
  );
}

/* by-type bar chart (refrigerant dashboard) */
.bytype-row {
  background: var(--white); padding: .6rem .8rem; border-radius: var(--radius-sm);
  margin-bottom: .5rem; box-shadow: var(--shadow);
}
.bytype-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .25rem; }
.bytype-name { font-weight: 700; font-size: .9rem; color: var(--gray-900); }
.bytype-vals { font-size: .8rem; color: var(--gray-500); }
.bytype-bars { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--gray-100); }
.bytype-bar-add { background: linear-gradient(90deg, var(--orange), var(--orange-dark)); }
.bytype-bar-rec { background: linear-gradient(90deg, var(--purple), #5b21b6); }

/* ── TDG document ─────────────────────────────────────── */
.tdg-controls-right { display: flex; align-items: center; gap: .5rem; }
.tdg-doc {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem 1.1rem 1.25rem;
}
.tdg-header { text-align: center; margin-bottom: .75rem; padding-bottom: .5rem; border-bottom: 2px solid var(--gray-900); }
.tdg-title { font-size: 1.1rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.tdg-sub   { font-size: .78rem; color: var(--gray-500); margin-top: .15rem; }
.tdg-pre   { white-space: pre-line; }
.tdg-meta { width: 100%; border-collapse: collapse; margin-bottom: .75rem; }
.tdg-meta th, .tdg-meta td { border: 1px solid var(--gray-300); padding: .4rem .55rem; text-align: left; vertical-align: top; font-size: .85rem; }
.tdg-meta th { background: var(--gray-100); width: 22%; font-weight: 700; }
.tdg-table { width: 100%; border-collapse: collapse; }
.tdg-table th, .tdg-table td { border: 1px solid var(--gray-300); padding: .4rem .5rem; font-size: .82rem; vertical-align: top; }
.tdg-table th { background: var(--gray-100); font-weight: 700; text-align: left; }
.tdg-table th.num, .tdg-table td.num { text-align: right; white-space: nowrap; }
.tdg-table tfoot td { background: var(--gray-100); border-top: 2px solid var(--gray-700); }
.tdg-group-row td { border-top: 2px solid var(--gray-400); padding-top: .55rem; }
.tdg-cyl-row td   { background: var(--gray-100); font-size: .78rem; color: var(--gray-700); border-top: 1px dashed var(--gray-300); }
.tdg-cyl-serial   { padding-left: 1.5rem !important; }
.tdg-sub          { color: var(--gray-500); font-size: .72rem; font-weight: normal; }
.tdg-sds-row td   { background: var(--blue-light); font-size: .78rem; padding: .35rem .5rem .55rem; }
.tdg-sds-row a    { color: var(--blue-dark); text-decoration: underline; font-weight: 600; }
.tdg-class-badge  { display: inline-block; padding: 1px 7px; border-radius: 10px; font-weight: 800; font-size: .75rem; }
.tdg-class-flam    { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.tdg-class-nonflam { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.tdg-class-summary-wrap { padding: .55rem 0; font-size: .85rem; }
.tdg-class-summary { margin-right: .25rem; }
.tdg-footer { margin-top: 1rem; }
.tdg-cert { font-size: .82rem; padding: .6rem .75rem; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); background: var(--gray-100); }
.tdg-sign-line { margin-top: .8rem; font-family: monospace; font-size: .85rem; }
.tdg-disclaimer { margin-top: .6rem; padding: .5rem .65rem; font-size: .73rem; color: var(--gray-500); background: var(--gray-100); border-left: 3px solid var(--gray-400); border-radius: var(--radius-sm); line-height: 1.45; }

/* ── report action bar ───────────────────────────────────── */
.report-action-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .75rem; flex-wrap: wrap; gap: .5rem;
}
.report-action-title { font-weight: 700; font-size: .95rem; color: var(--gray-900); }
#report-print-area { display: none; }
.rpt-print-header { margin-bottom: 1.25rem; padding-bottom: .6rem; border-bottom: 2px solid #000; }
.rpt-print-company { font-size: 1rem; font-weight: 700; color: var(--gray-700); }
.rpt-print-title   { font-size: 1.35rem; font-weight: 800; color: var(--gray-900); }
.rpt-print-date    { font-size: .82rem; color: var(--gray-500); margin-top: .2rem; }

@media print {
  body { background: var(--white) !important; }
  .app-header, .bottom-nav, #tdg-controls, .toast-container, .modal-overlay { display: none !important; }
  .app-content { padding: 0 !important; }
  .view { display: none !important; }
  #view-tdg.active { display: block !important; }
  .tdg-doc { box-shadow: none; border: 1px solid var(--gray-900); padding: .75rem; }
  .tdg-sds-row { display: none; }
  /* Report printing */
  body.printing-report .screen          { display: none !important; }
  body.printing-report #report-print-area { display: block !important; padding: 1.5rem; }
  .report-action-bar                    { display: none !important; }
  .report-table { box-shadow: none !important; }
}

/* ── inventory report ────────────────────────────────── */
.inv-summary-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.inv-card { background: var(--white); border-radius: var(--radius); padding: .7rem .85rem; box-shadow: var(--shadow); border-left: 4px solid var(--blue); }
.inv-card-total { border-left-color: var(--orange); }
.inv-card-label { font-size: .78rem; color: var(--gray-500); font-weight: 600; margin-bottom: .15rem; }
.inv-card-num   { font-size: 1.6rem; font-weight: 800; color: var(--gray-900); line-height: 1; margin-bottom: .35rem; }
.inv-card-sub   { font-size: .78rem; color: var(--gray-600); }
.inv-section { margin-top: 1rem; }
.inv-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; padding: .5rem 0; border-bottom: 2px solid var(--gray-300); margin-bottom: .5rem; }
.inv-section-title { font-weight: 700; font-size: 1rem; }
.inv-section-totals { font-size: .8rem; color: var(--gray-600); }
.inv-table th.num, .inv-table td.num { text-align: right; white-space: nowrap; }
.inv-inactive-note { margin-top: .6rem; padding: .5rem .75rem; font-size: .78rem; color: var(--gray-500); background: var(--gray-100); border-radius: var(--radius-sm); border-left: 3px solid var(--gray-300); }

/* ── inventory by-hand checklist ─────────────────────── */
.checklist-intro { margin-bottom: 1rem; font-size: .85rem; }
.checklist-group-head {
  display: flex; align-items: center; gap: .5rem;
  margin: 1.1rem 0 .4rem; padding-bottom: .3rem;
  font-size: .9rem; font-weight: 800; color: var(--gray-800);
  border-bottom: 2px solid var(--gray-300);
}
.checklist-group-head:first-of-type { margin-top: .25rem; }
.checklist-group-count { font-size: .72rem; font-weight: 700; color: var(--gray-500); background: var(--gray-100); border-radius: 20px; padding: .1rem .55rem; }
.checklist-table th, .checklist-table td { border: 1px solid var(--gray-300); }
.checklist-table .chk-col { width: 34px; text-align: center; }
.checklist-table .chk-write-col { width: 26%; }
.checklist-table td.chk-write { background: var(--white); }
.chk-box { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--gray-500); border-radius: 3px; vertical-align: middle; }
.chk-loc { font-size: .74rem; color: var(--gray-500); font-weight: 600; margin-top: .15rem; }
.checklist-print-meta { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-bottom: 1rem; font-size: .9rem; color: var(--gray-800); }
.chk-line { display: inline-block; min-width: 190px; border-bottom: 1px solid var(--gray-700); }
.chk-line-sm { min-width: 120px; }

@media print {
  /* Keep check boxes and table grid visible on paper */
  .chk-box { border-color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .checklist-table th, .checklist-table td { border: 1px solid #000 !important; }
  .checklist-table tr, .checklist-group-head { page-break-inside: avoid; }
  .checklist-group-head { border-bottom-color: #000; }
}

/* ── refrigerant prices panel ────────────────────────── */
.ref-price-row {
  display: grid; grid-template-columns: 18px 80px 1fr 160px;
  align-items: center; gap: .6rem; padding: .35rem .25rem;
  border-bottom: 1px solid var(--gray-100); font-size: .85rem;
}
.ref-price-row:last-child { border-bottom: none; }
.ref-price-code { font-weight: 700; }
.ref-price-name { color: var(--gray-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-price-input { display: inline-flex; align-items: center; gap: .25rem; background: var(--white); border: 1px solid var(--gray-300); border-radius: var(--radius-sm); padding: 0 .4rem; }
.ref-price-input .ref-price-prefix, .ref-price-input .ref-price-suffix { color: var(--gray-500); font-size: .8rem; }
.ref-price-input input.ref-price { border: none; padding: .25rem 0; width: 90px; text-align: right; background: transparent; outline: none; font-size: .85rem; }
@media (max-width: 480px) {
  .ref-price-row { grid-template-columns: 18px 70px 1fr; }
  .ref-price-row .ref-price-input { grid-column: 1 / -1; justify-self: start; }
}

/* ── modal ───────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(17,24,39,.5); backdrop-filter: blur(3px);
  align-items: flex-end; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--white);
  border-radius: 20px 20px 0 0;
  padding: 1.4rem 1.2rem;
  width: 100%; max-width: 560px;
  max-height: 92vh; overflow-y: auto;
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.1rem;
}
.modal-title { font-size: 1.15rem; font-weight: 800; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gray-100); border: none; cursor: pointer;
  font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
  color: var(--gray-500); transition: background var(--transition);
}
.modal-close:hover { background: var(--gray-300); }
.modal-footer { margin-top: 1.2rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.modal-footer .btn { flex: 1; min-width: 120px; }

/* ── detail grid / fields ────────────────────────────── */
.detail-field { margin-bottom: .65rem; }
.detail-field .field-label {
  font-size: .72rem; font-weight: 700; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .15rem;
}
.detail-field .field-value { font-size: .92rem; color: var(--gray-900); word-break: break-word; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }

/* ── admin panel ─────────────────────────────────────── */
.admin-tabs {
  display: flex; gap: .4rem; margin-bottom: 1rem; overflow-x: auto; padding-bottom: .2rem;
}
.admin-tab {
  padding: .5rem 1rem; border-radius: 20px;
  border: 2px solid var(--gray-300); background: var(--white);
  font-size: .85rem; font-weight: 600; color: var(--gray-600);
  cursor: pointer; white-space: nowrap; transition: all var(--transition);
}
.admin-tab.active { background: var(--teal); border-color: var(--teal); color: var(--white); }
.admin-tab-panel { display: none; }
.admin-tab-panel.active { display: block; }

/* list items */
.list-item {
  background: var(--white); border-radius: var(--radius-sm);
  padding: .85rem 1rem; margin-bottom: .5rem;
  display: flex; align-items: center; gap: .75rem;
  box-shadow: var(--shadow);
}
.list-item .item-main { flex: 1; min-width: 0; }
.list-item .item-title { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .item-sub   { font-size: .8rem; color: var(--gray-500); }
.list-item .item-actions { display: flex; gap: .4rem; flex-shrink: 0; }

/* report table */
.report-table-wrap { overflow-x: auto; margin-top: .5rem; }
.report-table {
  width: 100%; border-collapse: collapse; font-size: .82rem;
  background: var(--white); border-radius: var(--radius-sm); overflow: hidden;
  box-shadow: var(--shadow);
}
.report-table th {
  background: var(--teal); color: var(--white);
  padding: .55rem .7rem; text-align: left; font-weight: 700; white-space: nowrap;
}
.report-table td { padding: .5rem .7rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.report-table tr:last-child td { border-bottom: none; }
.report-table tr:nth-child(even) td { background: var(--gray-100); }
/* Technician group header rows inside the signed-out report */
.report-table tr.report-group-row td {
  background: var(--teal-light); color: var(--teal-dark);
  font-weight: 800; font-size: .82rem;
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 2px solid var(--teal); padding: .45rem .7rem;
}
.report-panel { display: none; }
.report-panel.active { display: block; }

/* ── toast ───────────────────────────────────────────── */
.toast-container { position: fixed; top: 1rem; right: 1rem; left: 1rem; z-index: 9999; pointer-events: none; display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.toast {
  background: var(--gray-900); color: var(--white);
  padding: .75rem 1.2rem; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600;
  max-width: 360px; width: 100%; text-align: center;
  pointer-events: auto; animation: toastIn .25s ease; box-shadow: var(--shadow-lg);
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.warning { background: var(--amber); }
@keyframes toastIn { from { opacity:0; transform:translateY(-12px); } to { opacity:1; transform:translateY(0); } }

/* ── empty / loading ─────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--gray-500); }
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: .8rem; }
.empty-state p { font-size: 1rem; font-weight: 500; }
.spinner { display: inline-block; width: 24px; height: 24px; border: 3px solid var(--gray-300); border-top-color: var(--teal); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: flex; justify-content: center; padding: 3rem; }

/* ── unit toggle ─────────────────────────────────────── */
.unit-toggle {
  background: var(--gray-100); border-radius: var(--radius-sm);
  padding: .55rem .75rem; margin-bottom: .85rem;
  display: flex; align-items: center; justify-content: space-between; gap: .65rem; flex-wrap: wrap;
}
.unit-toggle-label { font-size: .82rem; font-weight: 600; color: var(--gray-700); }
.unit-toggle-buttons { display: inline-flex; background: var(--white); border-radius: 999px; padding: 3px; gap: 2px; box-shadow: inset 0 0 0 1px var(--gray-300); }
.unit-btn {
  border: none; background: transparent; cursor: pointer;
  padding: .35rem .85rem; border-radius: 999px;
  font-size: .82rem; font-weight: 600; color: var(--gray-500);
  transition: background var(--transition), color var(--transition);
}
.unit-btn.active { background: var(--teal); color: var(--white); }
.unit-btn:not(.active):hover { color: var(--teal); }
.convert-hint { font-size: .75rem; color: var(--gray-500); margin-top: .25rem; font-style: italic; min-height: 1.1rem; }
.convert-hint.show { color: var(--teal-dark); font-style: normal; }
.dual-unit { display: inline; }
.dual-unit .primary { font-weight: 700; }
.dual-unit .secondary { color: var(--gray-500); font-size: .85em; margin-left: .25rem; }

/* ── misc ────────────────────────────────────────────── */
.divider { height: 1px; background: var(--gray-300); margin: 1rem 0; }
.chip { display: inline-block; padding: .2rem .6rem; border-radius: 12px; font-size: .72rem; font-weight: 700; background: var(--teal-light); color: var(--teal-dark); }
.callout {
  border-radius: var(--radius-sm); padding: .7rem .95rem;
  font-size: .85rem; margin-bottom: .85rem;
  display: flex; gap: .55rem; align-items: flex-start;
}
.callout-amber { background: var(--amber-light); color: #92400e; border-left: 4px solid var(--amber); }
.callout-red   { background: var(--red-light);   color: #7f1d1d; border-left: 4px solid var(--red); }
.callout-blue  { background: var(--teal-light);  color: var(--teal-dark); border-left: 4px solid var(--teal); }
.callout-green { background: var(--green-light); color: #065f46; border-left: 4px solid var(--green); }

/* ── home dashboard module cards ─────────────────────── */
.module-card {
  background: var(--white); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.module-card-head {
  display: flex; align-items: center; gap: .5rem;
  font-size: 1rem; font-weight: 800; color: var(--gray-900);
  margin-bottom: .85rem; padding-bottom: .6rem;
  border-bottom: 2px solid var(--gray-100);
}
.module-card-head.tools-head { border-bottom-color: var(--blue-light); }
.module-card-head.ref-head   { border-bottom-color: var(--teal-light); }

/* ── desktop tweaks ──────────────────────────────────── */
@media (min-width: 600px) {
  .login-card    { padding: 2.5rem 2.2rem; }
  .stats-row     { grid-template-columns: repeat(4, 1fr); }
  .modal         { border-radius: 16px; margin: auto; }
  .modal-overlay { align-items: center; }
  .app-content   { padding: 1.4rem; padding-bottom: 88px; }
  .inv-summary-cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .inv-summary-cards { grid-template-columns: 1fr; }
  .inv-section-head { flex-direction: column; align-items: stretch; }

  /* List rows (admin techs, refrigerants, library, tools…) get cramped on
     phones once a row has several action buttons. Let the row wrap so the
     content keeps the first line and the buttons drop to a full-width row
     below, wrapping and sharing the space evenly. */
  .list-item { flex-wrap: wrap; }
  .list-item .item-title { white-space: normal; }
  .list-item .item-actions {
    flex-basis: 100%;
    flex-wrap: wrap;
    margin-top: .6rem;
  }
  .list-item .item-actions .btn { flex: 1 1 auto; text-align: center; }
}
@media (min-width: 960px) {
  .app-content { max-width: 1100px; margin: 0 auto; }
  .bottom-nav  { max-width: 720px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; }
  .tools-grid  { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
