:root {
  color-scheme: dark;
  --bg: #05060a;
  --panel: #0b1220;
  --panel-2: #07101a;
  --border: #16233a;
  --text: #eaf9ff;
  --muted: #8aa3b8;
  --accent: #00f5d4;
  --accent-2: #00c4ff;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --grey: #64748b;
}
* { box-sizing: border-box; }
body { font-family: "Segoe UI", Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); margin: 0; }
a { color: var(--accent-2); }

/* ---------- Auth pages ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px;
  background: radial-gradient(circle at 20% 20%, #0c1f33 0, var(--bg) 60%); }
.auth-card { background: var(--panel-2); padding: 32px; border-radius: 12px; width: 100%; max-width: 380px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6); border: 1px solid var(--border); }
.auth-card .logo { display: block; height: 48px; margin: 0 auto 16px; }
.auth-card h2 { margin: 0 0 6px; text-align: center; }
.auth-card p.sub { margin: 0 0 18px; color: var(--muted); text-align: center; font-size: 14px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 14px; font-size: 14px; }

label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input, select, textarea { width: 100%; padding: 11px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: #050b14; color: var(--text); font-size: 14px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-2); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 8px;
  border: none; cursor: pointer; font-weight: 700; font-size: 14px; color: #012;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.block { width: 100%; margin-top: 18px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--red); color: #fff; }
.btn.sm { padding: 6px 10px; font-size: 12px; }

.alert { margin-top: 12px; padding: 10px 12px; border-radius: 8px; font-size: 14px; display: none; }
.alert.show { display: block; }
.alert.error { background: rgba(239, 68, 68, .12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .4); }
.alert.success { background: rgba(34, 197, 94, .12); color: #86efac; border: 1px solid rgba(34, 197, 94, .4); }

/* ---------- Admin layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 230px; background: var(--panel-2); border-right: 1px solid var(--border); padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; font-weight: 700; }
.sidebar .brand img { height: 34px; }
.sidebar nav a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--muted); text-decoration: none;
  margin-bottom: 4px; font-size: 14px; }
.sidebar nav a:hover { background: #0e1a2b; color: var(--text); }
.sidebar nav a.active { background: rgba(0, 196, 255, .12); color: var(--accent); }
.sidebar .spacer { flex: 1; }
.main { flex: 1; padding: 24px 28px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; gap: 12px; }
.topbar h1 { margin: 0; font-size: 22px; }
.topbar .who { color: var(--muted); font-size: 14px; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 20px; }
.panel h3 { margin: 0 0 14px; font-size: 16px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; border-left: 4px solid var(--accent-2); }
.card .label { color: var(--muted); font-size: 13px; }
.card .value { font-size: 28px; font-weight: 700; margin-top: 6px; }
.card.green { border-left-color: var(--green); }
.card.amber { border-left-color: var(--amber); }
.card.red { border-left-color: var(--red); }
.card.grey { border-left-color: var(--grey); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input { max-width: 320px; }
.toolbar select { max-width: 200px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; background: #0a1424; position: sticky; top: 0; }
td.wrap { white-space: normal; min-width: 180px; }
tbody tr:nth-child(odd) td { background: #0b1220; }
tbody tr:nth-child(even) td { background: #111d31; }
tbody tr:hover td { background: #16294a; }
.empty { text-align: center; color: var(--muted); padding: 24px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.valid, .badge.completed { background: rgba(34, 197, 94, .15); color: #86efac; }
.badge.due_soon, .badge.processing { background: rgba(245, 158, 11, .15); color: #fcd34d; }
.badge.expired, .badge.failed { background: rgba(239, 68, 68, .15); color: #fca5a5; }
.badge.not_calibrated { background: rgba(100, 116, 139, .2); color: #cbd5e1; }

.dropzone { border: 2px dashed var(--border); border-radius: 12px; padding: 34px; text-align: center; color: var(--muted);
  cursor: pointer; transition: border-color .2s, background .2s; }
.dropzone.drag, .dropzone:hover { border-color: var(--accent-2); background: rgba(0, 196, 255, .05); }
.dropzone strong { color: var(--text); }
.radio-row { display: flex; gap: 18px; margin: 14px 0; font-size: 14px; flex-wrap: wrap; }
.radio-row label { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--text); }
.radio-row input { width: auto; }

.view { display: none; }
.view.active { display: block; }

@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 10px; }
  .sidebar .brand { margin: 0 12px 0 0; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .sidebar .spacer { display: none; }
  .main { padding: 16px; }
}

/* ---------- Laravel views ---------- */
.sidebar .brand { color: var(--text); text-decoration: none; }
.block-btn { width: 100%; }
.main > .alert { margin: 0 0 18px; }
.auth-card .alert { margin: 0 0 12px; }
.auth-card form .btn.block { margin-top: 18px; }
.checkbox { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 14px; }
.checkbox input { width: auto; }
.inline-form { display: inline; }
.field-hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.thumb { height: 48px; border-radius: 6px; }

.pagination { display: flex; gap: 6px; list-style: none; padding: 0; margin: 16px 0 0; flex-wrap: wrap; }
.pagination li > a, .pagination li > span { display: inline-block; padding: 6px 11px; border-radius: 6px; border: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-size: 13px; }
.pagination li.active > span { background: rgba(0, 196, 255, .15); color: var(--accent); border-color: var(--accent-2); }
.pagination li.disabled > span { color: var(--grey); }

/* ---------- Calibration alerts ---------- */
a.card { display: block; color: inherit; text-decoration: none; transition: transform .15s, border-color .15s; }
a.card:hover { transform: translateY(-2px); border-color: var(--accent-2); }

.notice { margin-bottom: 18px; padding: 12px 14px; border-radius: 10px; font-size: 14px;
  background: rgba(245, 158, 11, .1); border: 1px solid rgba(245, 158, 11, .4); color: #fde68a; }
.notice a { color: #fff; font-weight: 600; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 0 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel-head h3 { margin: 0; }
.panel-head a { font-size: 13px; text-decoration: none; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 14px; color: var(--muted); text-decoration: none; font-size: 14px; border-bottom: 2px solid transparent;
  margin-bottom: -1px; display: inline-flex; align-items: center; gap: 8px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-count, .nav-count { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 999px; font-size: 12px;
  font-weight: 700; text-align: center; background: #13233a; color: var(--text); }
.tab-expiring .tab-count, .tab-count.amber, .nav-count.amber { background: rgba(245, 158, 11, .2); color: #fcd34d; }
.tab-expired .tab-count, .tab-count.red, .nav-count.red { background: rgba(239, 68, 68, .2); color: #fca5a5; }
.tab-valid .tab-count { background: rgba(34, 197, 94, .15); color: #86efac; }
.sidebar nav a { display: flex; align-items: center; justify-content: space-between; }

.toolbar .per-page { display: flex; align-items: center; gap: 8px; margin: 0 0 0 auto; color: var(--muted); font-size: 13px; }
.toolbar .per-page select { width: auto; padding: 8px 10px; }
.result-info { font-size: 13px; margin-bottom: 10px; }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.notify { position: relative; }
.notify summary { list-style: none; cursor: pointer; position: relative; display: flex; padding: 8px; border-radius: 50%;
  border: 1px solid var(--border); color: var(--text); }
.notify summary::-webkit-details-marker { display: none; }
.notify summary:hover, .notify[open] summary { border-color: var(--accent-2); }
.notify-count { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; padding: 1px 6px; }
.notify-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 330px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .55); z-index: 50; overflow: hidden; }
.notify-head { padding: 10px 14px; font-weight: 700; border-bottom: 1px solid var(--border); }
.notify-summary { display: block; padding: 8px 14px; text-decoration: none; font-size: 13px; border-bottom: 1px solid var(--border); }
.notify-summary.amber { color: #fcd34d; }
.notify-summary.red { color: #fca5a5; }
.notify-summary:hover { background: #0e1a2b; }
.notify-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 14px; font-size: 13px;
  border-bottom: 1px solid var(--border); }
.notify-item:last-child { border-bottom: none; }
.notify-item small { display: block; color: var(--muted); font-size: 11px; }
.notify-item.muted { color: var(--muted); }

@media (max-width: 800px) {
  .topbar { flex-wrap: wrap; }
  .topbar-right .who { display: none; }
  .notify-menu { width: 290px; }
  .toolbar .per-page { margin-left: 0; }
}
