:root {
  --bg: #0d1117;
  --card: #161b22;
  --card2: #1c2230;
  --border: #30363d;
  --accent: #58a6ff;
  --accent2: #39d353;
  --warn: #e3b341;
  --danger: #f85149;
  --text: #c9d1d9;
  --muted: #8b949e;
  --r134a: #58a6ff;
  --r1234yf: #39d353;
  --r744: #bc8cff;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-header .brand {
  font-size: 1.15rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
.site-header nav { display: flex; gap: 20px; font-size: 0.88rem; }
.site-header nav a { color: var(--muted); }
.site-header nav a:hover { color: var(--text); text-decoration: none; }
.site-header nav a.active { color: var(--accent); }

/* ── Layout ── */
.page { max-width: 920px; margin: 0 auto; padding: 28px 20px 60px; }
.page-title {
  font-size: 1.55rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.page-subtitle { color: var(--muted); font-size: 0.9rem; margin-bottom: 28px; }

/* ── Card ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}
.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title .step {
  background: var(--accent);
  color: #0d1117;
  border-radius: 50%;
  width: 20px; height: 20px;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card.disabled { opacity: .38; pointer-events: none; }

/* ── Form controls ── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
}

select, input[type="text"], input[type="number"],
input[type="password"], textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color .15s;
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%238b949e' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L2 5h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 30px;
  cursor: pointer;
}
select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
select:disabled { opacity: .35; cursor: not-allowed; }
textarea { resize: vertical; min-height: 72px; }

.ac-wrap { position: relative; }
.ac-list {
  display: none;
  position: absolute;
  top: 100%; left: 0; right: 0;
  margin-top: 4px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 8px 20px rgba(0,0,0,.4);
}
.ac-item { padding: 9px 12px; font-size: 0.9rem; color: var(--text); cursor: pointer; }
.ac-item.active, .ac-item:hover { background: var(--accent); color: #fff; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 6px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  font-family: inherit;
}
.btn:active { transform: scale(.97); }
.btn:hover { opacity: .88; }
.btn-primary { background: var(--accent); color: #0d1117; }
.btn-success { background: var(--accent2); color: #0d1117; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-ghost   { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }

/* ── Result boxes ── */
.result-card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.result-card:last-child { margin-bottom: 0; }
.result-condition {
  font-size: 0.78rem;
  color: var(--warn);
  margin-bottom: 12px;
  font-style: italic;
}
.result-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 14px;
}
.stat { display: flex; flex-direction: column; gap: 3px; }
.stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.stat-value { font-size: 1.05rem; font-weight: 700; }
.stat-value.r134a  { color: var(--r134a); }
.stat-value.r1234yf { color: var(--r1234yf); }
.stat-value.r744   { color: var(--r744); }
.stat-value.amount { color: #c9d1d9; font-size: 1.2rem; }
.stat-value .tol   { font-size: 0.72rem; font-weight: 400; color: var(--muted); }
.stat-value.oil    { color: #e3b341; font-size: 0.95rem; }

.result-header {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent2);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Refrigerant badge */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .3px;
}
.badge-r134a   { background: rgba(88,166,255,.15); color: var(--r134a); border: 1px solid rgba(88,166,255,.3); }
.badge-r1234yf { background: rgba(57,211,83,.15);  color: var(--r1234yf); border: 1px solid rgba(57,211,83,.3); }
.badge-r744    { background: rgba(188,140,255,.15); color: var(--r744); border: 1px solid rgba(188,140,255,.3); }

/* ── Alerts / notices ── */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.88rem;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.alert-success { background: rgba(57,211,83,.1);  border: 1px solid rgba(57,211,83,.3);  color: #39d353; }
.alert-warn    { background: rgba(227,179,65,.1);  border: 1px solid rgba(227,179,65,.3);  color: #e3b341; }
.alert-info    { background: rgba(88,166,255,.1);  border: 1px solid rgba(88,166,255,.3);  color: #58a6ff; }
.alert-danger  { background: rgba(248,81,73,.1);   border: 1px solid rgba(248,81,73,.3);   color: #f85149; }

/* ── Admin items ── */
.suggest-item {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.suggest-item:last-child { margin-bottom: 0; }
.suggest-info { flex: 1; min-width: 0; }
.suggest-info h3 { font-size: 1rem; margin-bottom: 4px; }
.suggest-info .meta { font-size: 0.8rem; color: var(--muted); }
.suggest-actions { display: flex; gap: 8px; flex-shrink: 0; }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
}
.status-pending  { background: rgba(227,179,65,.15); color: var(--warn); border: 1px solid rgba(227,179,65,.35); }
.status-approved { background: rgba(57,211,83,.15);  color: var(--r1234yf); border: 1px solid rgba(57,211,83,.35); }
.status-rejected { background: rgba(248,81,73,.15);  color: var(--danger);  border: 1px solid rgba(248,81,73,.35); }

/* ── PIN gate ── */
.pin-gate { max-width: 360px; margin: 60px auto; text-align: center; }
.pin-gate h2 { margin-bottom: 8px; }
.pin-gate p  { color: var(--muted); font-size: 0.9rem; margin-bottom: 20px; }
.pin-row { display: flex; gap: 8px; justify-content: center; }
.pin-row input { max-width: 140px; text-align: center; letter-spacing: 3px; }

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ── Empty state ── */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .icon { font-size: 2.5rem; margin-bottom: 10px; }

/* ── Disclaimer ── */
.disclaimer {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  padding: 16px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .result-stats { grid-template-columns: 1fr 1fr; }
  .suggest-item { flex-direction: column; }
  .suggest-actions { flex-direction: row; }
}
