/* ==================================================================
   VFD & MOTOR MONITOR — Professional UI Theme
   Design system: Inter · Slate surfaces · Indigo-Blue brand
   ================================================================== */

/* ------------------------- 1. Design tokens ---------------------- */
:root {
  /* layout */
  --sidebar-w: 264px;

  /* surfaces */
  --bg: #f3f5fa;
  --card-bg: #ffffff;
  --subtle-bg: #f8fafc;
  --header-bg: #f8fafd;

  /* text */
  --ink: #101828;
  --ink-soft: #344054;
  --muted: #667085;
  --faint: #98a2b3;

  /* brand */
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff4ff;
  --brand-border: #c7d7fe;
  --brand-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 55%, #1d4ed8 100%);

  /* status */
  --green: #079455;
  --green-soft: #ecfdf3;
  --amber: #d97706;
  --amber-soft: #fffaeb;
  --red: #d92d20;
  --red-soft: #fef3f2;

  /* lines */
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --table-border: #eaecf2;

  /* elevation */
  --shadow-xs: 0 1px 2px rgba(16,24,40,.05);
  --shadow-sm: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
  --shadow-md: 0 12px 28px -8px rgba(16,24,40,.12), 0 4px 10px -4px rgba(16,24,40,.05);
  --shadow-lg: 0 24px 48px -12px rgba(16,24,40,.18);
  --ring: 0 0 0 3px rgba(37,99,235,.16);

  /* shape */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* motion */
  --t-fast: .16s cubic-bezier(.4,0,.2,1);
  --t-med: .26s cubic-bezier(.4,0,.2,1);

  /* sidebar palette */
  --sb-bg: #0b1224;
  --sb-bg-2: #101a33;
  --sb-text: #a7b1cc;
  --sb-text-dim: #64708f;
  --sb-hover: rgba(148,163,199,.10);
}

/* ------------------------- 2. Base ------------------------------- */
* { box-sizing: border-box; }

html, body { width: 100%; overflow-x: hidden; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(1100px 380px at 78% -160px, rgba(37,99,235,.055), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 { letter-spacing: -.015em; color: var(--ink); }

::selection { background: rgba(37,99,235,.18); }

hr { border: 0; border-top: 1px solid var(--border); opacity: 1; }

kbd {
  background: var(--subtle-bg);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: .72rem;
  color: var(--ink-soft);
  font-family: inherit;
}

a:focus-visible, button:focus-visible, .btn:focus-visible,
.form-check-input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(37,99,235,.35);
  outline-offset: 2px;
}

/* --------------------- 3. Scrollbars ----------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #c6cede;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: #a9b3c9; }
.sidebar-nav::-webkit-scrollbar-thumb { background-color: rgba(148,163,199,.22); }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background-color: rgba(148,163,199,.38); }
.sidebar-nav { scrollbar-width: thin; scrollbar-color: rgba(148,163,199,.25) transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* --------------------- Buttons (global polish) ---------------------- */
.btn {
  border-radius: 10px;
  font-weight: 600;
  font-size: .88rem;
  letter-spacing: .005em;
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.btn-sm { border-radius: 8px; font-size: .8rem; }

.btn-primary {
  background: var(--brand-gradient);
  border: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 4px 12px -4px rgba(37,99,235,.55);
}
.btn-primary:hover, .btn-primary:focus-visible {
  background: linear-gradient(135deg, #2f74f2 0%, #1d53e0 55%, #1743bd 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 6px 16px -4px rgba(37,99,235,.6);
  transform: translateY(-1px);
  border: none;
}
.btn-primary:active {
  background: var(--brand-dark) !important;
  transform: translateY(0);
  box-shadow: inset 0 2px 4px rgba(13,35,90,.3) !important;
}
.btn-primary:disabled { background: var(--brand); opacity: .65; transform: none; }

.btn-outline-secondary {
  border-color: var(--border-strong);
  color: var(--ink-soft);
  background: var(--card-bg);
}
.btn-outline-secondary:hover {
  background: var(--subtle-bg);
  border-color: #b6bfce;
  color: var(--ink);
}
.btn-outline-danger { border-color: #fda29b; color: var(--red); }
.btn-outline-danger:hover {
  background: var(--red); border-color: var(--red); color: #fff;
  box-shadow: 0 4px 12px -4px rgba(217,45,32,.5);
}

/* --------------------- Forms (global polish) ------------------------ */
.form-label {
  font-weight: 600;
  font-size: .83rem;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.form-control, .form-select {
  border-radius: 10px;
  border-color: var(--border-strong);
  font-size: .9rem;
  padding: .52rem .8rem;
  color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.form-control::placeholder { color: #b7bfd0; }
.form-control:hover, .form-select:hover { border-color: #b6bfce; }
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: var(--ring);
}
.form-control:disabled { background: var(--subtle-bg); color: var(--faint); }
.form-select-sm { border-radius: 8px; padding: .3rem 1.9rem .3rem .6rem; font-size: .82rem; }
.form-check-input { border-color: var(--border-strong); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { box-shadow: var(--ring); border-color: var(--brand); }
.input-group-text {
  background: var(--subtle-bg);
  border-color: var(--border-strong);
  color: var(--muted);
  font-size: .85rem;
}

/* --------------------- Alerts / flash messages ---------------------- */
.alert {
  border-radius: var(--radius);
  border: 1px solid transparent;
  border-left-width: 4px;
  font-size: .87rem;
  font-weight: 500;
  box-shadow: var(--shadow-xs);
}
.alert-success { background: var(--green-soft); border-color: #b8ecd0; border-left-color: var(--green); color: #067647; }
.alert-danger  { background: var(--red-soft);   border-color: #fecdca; border-left-color: var(--red);   color: #b42318; }
.alert-warning { background: var(--amber-soft); border-color: #fee9b2; border-left-color: var(--amber); color: #b54708; }
.alert-info    { background: #eff8ff;           border-color: #b2ddff; border-left-color: #2e90fa;      color: #175cd3; }

/* --------------------- Modals --------------------------------------- */
.modal-content {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
}
.modal-title { font-size: .98rem; font-weight: 700; letter-spacing: -.01em; }
.modal-body { padding: 20px 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--header-bg);
  gap: 8px;
}
.modal-backdrop.show { opacity: .55; }

/* --------------------- Badges & misc -------------------------------- */
.badge { border-radius: 7px; font-weight: 600; padding: .38em .65em; }
.text-muted { color: var(--muted) !important; }

/* Keyboard accessibility */
a:focus-visible, button:focus-visible, .btn:focus-visible,
.form-check-input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(37,99,235,.35);
  outline-offset: 2px;
}

/* ------------------------- 4. Layout ------------------------------ */
.app-shell { display: flex; min-height: 100vh; width: 100%; }

.sidebar {
  width: var(--sidebar-w);
  background:
    radial-gradient(420px 300px at -60% -10%, rgba(59,130,246,.16), transparent 60%),
    radial-gradient(380px 320px at 130% 110%, rgba(37,99,235,.14), transparent 62%),
    linear-gradient(180deg, var(--sb-bg-2) 0%, var(--sb-bg) 100%);
  color: var(--sb-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 1000;
  transition: transform .24s cubic-bezier(.4,0,.2,1);
  border-right: 1px solid rgba(148,163,199,.10);
}

.main-content {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  flex: 1 1 auto;
  min-width: 0;
  transition: margin-left .24s cubic-bezier(.4,0,.2,1), width .24s cubic-bezier(.4,0,.2,1);
}

.content-inner {
  padding: 30px 34px 64px;
  width: 100%;
}

/* Mobile top bar — frosted glass */
.topbar {
  align-items: center;
  gap: 12px;
  padding: 12px 18px 12px 56px;
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(255,255,255,.84);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 700; letter-spacing: -.01em; }

/* ---------------- Sidebar show/hide toggle ----------------------- */
.sidebar-toggle {
  position: fixed;
  top: 22px;
  left: calc(var(--sidebar-w) - 15px);
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  z-index: 1100;
  cursor: pointer;
  transition: left .24s cubic-bezier(.4,0,.2,1), background var(--t-fast),
              color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  padding: 0;
}
.sidebar-toggle:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 4px 14px -4px rgba(37,99,235,.6);
}
.sidebar-toggle i { font-size: .85rem; transition: transform var(--t-med); }
.sidebar-toggle:active i { transform: scale(.86); }

.sidebar-hidden .sidebar,
html.sidebar-hidden-init .sidebar { transform: translateX(-100%); box-shadow: none; }
.sidebar-hidden .main-content,
html.sidebar-hidden-init .main-content { margin-left: 0; width: 100%; }
.sidebar-hidden .sidebar-toggle,
html.sidebar-hidden-init .sidebar-toggle { left: 14px; }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(11, 18, 36, .5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 998;
}

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 60px rgba(2,6,23,.45); }
  .app-shell:not(.sidebar-hidden) .sidebar { transform: translateX(0); }
  .app-shell:not(.sidebar-hidden) .sidebar-overlay { display: block; }
  .main-content { margin-left: 0; width: 100%; }
  .content-inner { padding: 22px 18px 56px; }
  .sidebar-toggle { top: 13px; left: 13px; }
  .sidebar-hidden .sidebar-toggle { left: 13px; }
}

@media (max-width: 575.98px) {
  .content-inner { padding: 18px 14px 48px; }
}

/* --------------------- Sidebar internals -------------------------- */
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 24px 20px 20px;
}
.brand-icon {
  width: 42px; height: 42px; border-radius: 13px;
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: #fff;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 6px 16px -6px rgba(37,99,235,.65);
}
.brand-title { font-weight: 700; color: #f4f6fb; font-size: .95rem; line-height: 1.2; letter-spacing: -.01em; }
.brand-subtitle { font-size: .72rem; color: var(--sb-text-dim); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.nav-section-label {
  font-size: .66rem; text-transform: uppercase; letter-spacing: .11em;
  color: var(--sb-text-dim); margin: 20px 12px 8px;
  font-weight: 700;
}
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 13px; margin-bottom: 3px;
  border-radius: 11px; color: var(--sb-text);
  text-decoration: none; font-size: .875rem; font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.nav-link i { font-size: 1rem; width: 19px; text-align: center; transition: transform var(--t-fast); }
.nav-link:hover { background: var(--sb-hover); color: #eef2fb; }
.nav-link:hover i { transform: translateY(-1px); }
.nav-link.active {
  background: var(--brand-gradient);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 8px 18px -8px rgba(37,99,235,.75);
}

.sidebar-footer {
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(148,163,199,.12);
}
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(96,165,250,.16);
  color: #93c5fd;
  box-shadow: inset 0 0 0 1px rgba(147,197,253,.30);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .82rem; flex-shrink: 0;
  letter-spacing: .02em;
}
.user-name {
  font-size: .82rem; font-weight: 600; color: #eef2fb; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 152px;
}
.user-role { font-size: .7rem; text-transform: capitalize; letter-spacing: .02em; }
.role-admin { color: #fdba74; }
.role-operator { color: #7dd3fc; }
.role-viewer { color: #a5b4fc; }
.logout-link {
  display: flex; align-items: center; gap: 8px;
  color: var(--sb-text); text-decoration: none; font-size: .82rem;
  padding: 8px 10px; margin: 2px -10px -6px;
  border-radius: 9px;
  transition: background var(--t-fast), color var(--t-fast);
}
.logout-link i { transition: transform var(--t-fast); }
.logout-link:hover { color: #fda29b; background: rgba(217,45,32,.12); }
.logout-link:hover i { transform: translateX(2px); }

/* --------------------- Cards / KPIs / Panels ---------------------- */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  flex-wrap: wrap; gap: 12px; margin-bottom: 22px;
}
.page-title { font-size: 1.42rem; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.page-subtitle { color: var(--muted); font-size: .88rem; margin-top: 3px; }

.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px;
}
@media (max-width: 991.98px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575.98px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card {
  position: relative;
  background: var(--card-bg); border-radius: var(--radius-lg); padding: 18px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; }
.kpi-icon {
  width: 40px; height: 40px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center; font-size: 1.05rem;
  transition: transform var(--t-med);
}
.kpi-value {
  font-size: 1.7rem; font-weight: 800; margin-top: 10px;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.kpi-label { color: var(--muted); font-size: .78rem; font-weight: 600; letter-spacing: .01em; }

/* Icon chips — soft tinted squares with a hairline ring */
.icon-blue  { background: var(--brand-soft); color: var(--brand);  box-shadow: inset 0 0 0 1px rgba(37,99,235,.10); }
.icon-green { background: var(--green-soft); color: var(--green);  box-shadow: inset 0 0 0 1px rgba(7,148,85,.12); }
.icon-amber { background: var(--amber-soft); color: var(--amber);  box-shadow: inset 0 0 0 1px rgba(217,119,6,.12); }
.icon-red   { background: var(--red-soft);   color: var(--red);    box-shadow: inset 0 0 0 1px rgba(217,45,32,.12); }

.panel {
  background: var(--card-bg); border-radius: var(--radius-lg); padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  margin-bottom: 22px;
}
.panel-title { font-weight: 700; font-size: 1.02rem; margin-bottom: 4px; letter-spacing: -.01em; }
.panel-subtitle { color: var(--muted); font-size: .82rem; margin-bottom: 16px; }

/* ------------------------- Tables --------------------------------- */
.table-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.table-card .table { margin-bottom: 0; --bs-table-striped-bg: transparent; }
.table-card thead th {
  background: var(--header-bg); color: var(--muted); font-size: .72rem;
  text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
  border-bottom: 1px solid var(--border-strong); padding: 11px 16px;
  white-space: nowrap;
}
.table-card tbody td {
  padding: 13px 16px; vertical-align: middle; font-size: .885rem;
  border-bottom: 1px solid var(--table-border);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.table-card tbody td:first-child { color: var(--ink); }
.table-card tbody tr:last-child td { border-bottom: none; }
.table-card tbody tr { transition: background var(--t-fast); }
.table-card tbody tr:hover { background: #f6f8fd; }

/* Soft status badges */
.badge-soft {
  display: inline-flex; align-items: center;
  padding: 5px 11px; border-radius: 20px;
  font-size: .71rem; font-weight: 600; letter-spacing: .01em;
  box-shadow: inset 0 0 0 1px rgba(16,24,40,.05);
  white-space: nowrap;
}
.badge-blue  { background: var(--brand-soft); color: var(--brand-dark); }
.badge-green { background: var(--green-soft); color: #067647; }
.badge-amber { background: var(--amber-soft); color: #b54708; }
.badge-red   { background: var(--red-soft);   color: #b42318; }
.badge-gray  { background: #eef1f6;           color: #5b6272; }

/* ------------------------- Forms ----------------------------------- */
.form-card {
  background: var(--card-bg); border-radius: var(--radius-lg); padding: 28px;
  border: 1px solid var(--border); max-width: 640px;
}

/* ------------------------- Buttons --------------------------------- */
/* Primary / outline / icon styling lives in the global overrides. */
.btn-icon {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border-radius: 9px;
}

/* ------------------------- Auth page ------------------------------ */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 18% 14%, #16224a, #0a0f1f 66%);
  padding: 20px;
}
.auth-card {
  background: var(--card-bg); border-radius: var(--radius-xl); padding: 42px 38px;
  width: 100%; max-width: 408px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  width: 54px; height: 54px; border-radius: 15px; margin-bottom: 18px;
  background: var(--brand-gradient);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 10px 22px -8px rgba(37,99,235,.7);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.45rem;
}
.auth-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 15px; }
.auth-title { font-weight: 800; font-size: 1.35rem; margin-bottom: 4px; letter-spacing: -.02em; }
.auth-subtitle { color: var(--muted); font-size: .88rem; margin-bottom: 26px; }

/* --------------------- Split-screen auth layout -------------------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(430px, 46%) 1fr;
}

.auth-brand {
  position: relative;
  display: flex; flex-direction: column;
  padding: 40px 52px;
  color: #dbe3f5;
  background:
    radial-gradient(560px 420px at -10% -8%, rgba(59,130,246,.30), transparent 60%),
    radial-gradient(520px 460px at 108% 112%, rgba(37,99,235,.24), transparent 58%),
    linear-gradient(160deg, #101a33 0%, #0b1224 58%, #080d1c 100%);
  overflow: hidden;
}
.auth-brand::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(148,163,199,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,199,.06) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(720px 480px at 30% 22%, #000 0%, transparent 78%);
  mask-image: radial-gradient(720px 480px at 30% 22%, #000 0%, transparent 78%);
  pointer-events: none;
}
.auth-brand-top {
  position: relative; z-index: 1;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.auth-clock { text-align: right; flex-shrink: 0; }
.auth-clock-time {
  font-size: 1.05rem; font-weight: 700; color: #e8edf9;
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.auth-clock-date { font-size: .68rem; color: #8d99ba; margin-top: 2px; }
.auth-brand-inner { position: relative; z-index: 1; max-width: 430px; margin: auto 0; padding: 30px 0; }
.auth-brand-badge {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 9px;
  border-radius: 999px;
  background: rgba(148,163,199,.10);
  box-shadow: inset 0 0 0 1px rgba(148,163,199,.22);
  font-size: .8rem; font-weight: 600; color: #cdd7ee;
  letter-spacing: .02em;
}
.auth-brand-badge img { width: 26px; height: 26px; border-radius: 8px; object-fit: contain; }
.auth-brand-badge i { font-size: 1rem; color: #93c5fd; }
.auth-brand-headline {
  margin: 28px 0 12px;
  font-size: clamp(1.55rem, 2.3vw, 2.05rem);
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: -.025em;
  color: #f4f7ff;
}
.auth-brand-headline em { font-style: normal; color: #7ea6ff; }
.auth-brand-sub { color: #97a3c2; font-size: .92rem; line-height: 1.65; max-width: 400px; }
.auth-points { list-style: none; padding: 0; margin: 32px 0 0; display: flex; flex-direction: column; gap: 16px; }
.auth-points li { display: flex; align-items: flex-start; gap: 13px; }
.point-icon {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #93c5fd;
  background: rgba(59,130,246,.14);
  box-shadow: inset 0 0 0 1px rgba(96,165,250,.28);
}
.auth-points strong { display: block; color: #e8edf9; font-size: .885rem; font-weight: 600; }
.auth-points small { color: #8d99ba; font-size: .78rem; line-height: 1.5; display: block; margin-top: 1px; }

.auth-stats { display: flex; gap: 22px; margin-top: 34px; }
.auth-stat-ring { position: relative; width: 74px; }
.auth-stat-ring svg { width: 74px; height: 74px; transform: rotate(-90deg); display: block; }
.ring-track { fill: none; stroke: rgba(148,163,199,.16); stroke-width: 4; }
.ring-fill { fill: none; stroke-width: 4; stroke-linecap: round; }
.ring-fill.ring-blue { stroke: #60a5fa; }
.ring-fill.ring-cyan { stroke: #22d3ee; }
.ring-fill.ring-purple { stroke: #c084fc; }
.auth-stat-value {
  position: absolute; top: 27px; left: 0; width: 74px; text-align: center;
  font-size: 1.05rem; font-weight: 800; color: #f4f7ff;
}
.auth-stat-label {
  text-align: center; font-size: .6rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: #8d99ba; margin-top: 6px;
}

.auth-brand-foot {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 18px; margin-top: 8px;
  border-top: 1px solid rgba(148,163,199,.14);
}
.auth-status-online {
  display: flex; align-items: center; gap: 7px;
  color: #8bd8b3; font-size: .72rem; font-weight: 700; letter-spacing: .05em;
}
.auth-status-online .dot {
  width: 7px; height: 7px; border-radius: 50%; background: #34d399;
  box-shadow: 0 0 0 3px rgba(52,211,153,.18);
  animation: authDotPulse 2s infinite;
}
@keyframes authDotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.auth-status-secure { color: #6d799b; font-size: .72rem; }

.auth-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 44px 28px;
}
.auth-box { width: 100%; max-width: 392px; }
.auth-mobile-brand { display: none; align-items: center; gap: 11px; margin-bottom: 30px; }
.auth-mobile-brand .auth-logo-sm {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--brand-gradient); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; flex-shrink: 0;
  box-shadow: 0 8px 18px -8px rgba(37,99,235,.7);
}
.auth-mobile-brand img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; }
.auth-mobile-brand span { font-weight: 700; color: var(--ink); font-size: .95rem; letter-spacing: -.01em; }

@media (max-width: 991.98px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none !important; }
  .auth-mobile-brand { display: flex; }
}

.auth-accent-bar { width: 34px; height: 3px; border-radius: 2px; background: var(--brand-gradient); margin-bottom: 16px; }
.auth-heading { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: 4px; }
.auth-subheading { color: var(--muted); font-size: .9rem; margin-bottom: 26px; }
.field { margin-bottom: 18px; }
.field .form-label { display: block; }
.input-icon { position: relative; }
.input-icon > i {
  position: absolute; left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--faint); font-size: .95rem;
  pointer-events: none;
  transition: color var(--t-fast);
}
.input-icon:focus-within > i { color: var(--brand); }
.input-icon .form-control { padding-left: 40px; height: 46px; }
.auth-submit { height: 46px; font-size: .93rem; margin-top: 6px; }
.auth-submit i { transition: transform var(--t-fast); }
.auth-submit:hover i { transform: translateX(3px); }
.auth-foot-note {
  margin-top: 26px; text-align: center;
  color: var(--faint); font-size: .76rem;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}

/* ------------------------- Empty states ---------------------------- */
.empty-state { text-align: center; padding: 52px 20px; color: var(--muted); }
.empty-state i {
  font-size: 1.35rem;
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--faint);
  background: var(--subtle-bg);
  border: 1px dashed var(--border-strong);
  border-radius: 50%;
}

.breadcrumb-filter {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 14px 18px;
  margin-bottom: 18px;
}

.page-eyebrow {
  font-size: .73rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--brand); font-weight: 700; margin-bottom: 2px;
}

.status-legend-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; font-size: .84rem; border-bottom: 1px solid var(--border);
}
.status-legend-row:last-child { border-bottom: none; }
.status-legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.status-legend-label { flex: 1; color: var(--ink-soft); font-weight: 500; }
.status-legend-value { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* KPI cards: subtle hover lift + icon pop */
.kpi-card { transition: transform var(--t-med), box-shadow var(--t-med), border-color var(--t-med); }
.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-border);
}
.kpi-card:hover .kpi-icon { transform: scale(1.08) rotate(-3deg); }
.panel, .table-card { transition: box-shadow var(--t-med); }

/* --------------------- Audit trail chips --------------------------- */
.audit-chip { display: flex; align-items: center; gap: 8px; min-width: 0; }
.audit-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark);
  box-shadow: inset 0 0 0 1px rgba(37,99,235,.14);
  display: flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 700; flex-shrink: 0;
}
.audit-text { line-height: 1.2; }
.audit-name { font-size: .82rem; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.audit-date { font-size: .71rem; color: var(--muted); }
.audit-updated { font-size: .7rem; color: var(--muted); margin-top: 1px; }
.audit-updated i { font-size: .65rem; }

/* --------------------- Form pages ---------------------------------- */
.form-page-header {
  display: flex; align-items: center; gap: 15px; margin-bottom: 24px;
}
.form-page-icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(160deg, #f0f5ff, #e3ecff);
  color: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(37,99,235,.12), var(--shadow-xs);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; flex-shrink: 0;
}
.form-breadcrumb { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.form-breadcrumb a {
  color: var(--muted); text-decoration: none;
  display: inline-flex; align-items: center; gap: 5px;
  transition: color var(--t-fast);
}
.form-breadcrumb a:hover { color: var(--brand); }

.form-card { box-shadow: var(--shadow-xs); }
.form-card-wide { max-width: 980px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .form-grid-2 { grid-template-columns: 1fr; } }
.form-col { display: flex; flex-direction: column; gap: 16px; }
.form-subsection {
  background: var(--subtle-bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px 6px;
}
.form-subsection .form-section-title { margin-top: 0; padding-top: 0; border-top: none; }
.form-card .form-section-title {
  font-size: .76rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 700; margin: 22px 0 12px;
  padding-top: 16px; border-top: 1px solid var(--border);
}
.form-card .form-section-title:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.form-hint { font-size: .78rem; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.form-card .form-control, .form-card .form-select { border-color: var(--border-strong); }
.form-card .form-control:focus, .form-card .form-select:focus {
  border-color: var(--brand); box-shadow: var(--ring);
}
.required-mark { color: var(--red); }

/* --------------------- Device type chips & status pills ------------ */
.device-type-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.device-type-icon.type-vfd   { background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 1px rgba(37,99,235,.10); }
.device-type-icon.type-motor { background: var(--green-soft); color: var(--green); box-shadow: inset 0 0 0 1px rgba(7,148,85,.12); }
.device-name-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.device-name-main { font-weight: 700; font-size: .89rem; letter-spacing: -.005em; }
.device-name-sub { font-size: .74rem; color: var(--muted); }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 20px;
  font-size: .71rem; font-weight: 600; letter-spacing: .01em;
  white-space: nowrap;
}
.status-ok   { background: var(--green-soft); color: #067647; }
.status-warn { background: var(--red-soft);   color: #b42318; }
.status-none { background: #eef1f6;           color: #8a90a3; }
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.rated-values { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.rated-values strong { color: var(--ink); font-weight: 600; }

/* Page header action row alignment tweak */
.page-header .btn i { vertical-align: -1px; }

/* --------------------- Explore (card drill-down) ------------------- */
.explore-breadcrumb {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: .84rem; margin-bottom: 18px;
}
.explore-breadcrumb a {
  color: var(--muted); text-decoration: none; font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 999px;
  transition: color var(--t-fast), background var(--t-fast);
}
.explore-breadcrumb a:hover { color: var(--brand); background: rgba(37,99,235,.07); }
.explore-breadcrumb a.active {
  color: var(--brand-dark); font-weight: 700;
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px rgba(37,99,235,.14);
}
.explore-breadcrumb i.bi-chevron-right { font-size: .66rem; color: #b9c1d4; }

.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.explore-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  transition: transform var(--t-med), box-shadow var(--t-med), border-color var(--t-med);
  position: relative;
}
.explore-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-border);
  color: inherit;
}
.explore-card-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
  transition: transform var(--t-med);
}
.explore-card:hover .explore-card-icon { transform: scale(1.06); }
.explore-card-link-wrap { display: block; text-decoration: none; color: inherit; }
.explore-card-body { flex: 1; min-width: 0; }
.explore-card-title { font-weight: 700; font-size: .96rem; margin-bottom: 2px; letter-spacing: -.01em; }
.explore-card-meta { font-size: .78rem; color: var(--muted); margin-bottom: 10px; }
.explore-card-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.explore-card-arrow {
  color: #b9c1d4; font-size: .95rem; margin-top: 13px; flex-shrink: 0;
  transition: transform var(--t-med), color var(--t-med);
}
.explore-card:hover .explore-card-arrow { transform: translateX(3px); color: var(--brand); }

.explore-card-device { align-items: flex-start; }
.explore-device-reading {
  display: flex; align-items: baseline; gap: 14px; margin: 8px 0 4px;
}
.explore-reading-value {
  font-weight: 700; font-size: .92rem; color: var(--ink);
  display: flex; align-items: center; gap: 4px;
  font-variant-numeric: tabular-nums;
}
.explore-reading-value i { font-size: .8rem; color: var(--muted); }
.explore-reading-value.text-danger, .explore-reading-value.text-danger i { color: var(--red) !important; }

/* --------------------- Technician multi-select checklist ----------- */
.technician-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--subtle-bg);
  padding: 10px;
  max-height: 220px;
  overflow-y: auto;
}
.technician-check-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 8px;
  font-size: .86rem; cursor: pointer;
  background: var(--card-bg);
  border: 1px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.technician-check-item:hover { background: #f2f6ff; border-color: var(--border-strong); }
.technician-check-item input { margin: 0; accent-color: var(--brand); }

/* --------------------- Bigger drill-down cards with stats ---------- */
.explore-grid.explore-grid-lg {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}
.explore-card-lg {
  flex-direction: column;
  align-items: stretch;
  padding: 20px;
}
.explore-card-lg .explore-card-top {
  display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px;
}
.explore-card-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 13px;
  margin-top: 4px;
}
.explore-stat { text-align: center; }
.explore-stat-value {
  font-weight: 800; font-size: 1.05rem; line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.explore-stat-label { font-size: .64rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.explore-stat-value.stat-alert   { color: var(--red); }
.explore-stat-value.stat-pending { color: #b54708; }
.explore-stat-value.stat-done    { color: var(--green); }

/* Back button used on drill-down levels */
.btn-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px; border-radius: 999px;
  background: var(--card-bg); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-xs);
  color: var(--ink-soft); font-size: .84rem; font-weight: 600;
  text-decoration: none; margin-bottom: 14px;
  transition: background var(--t-fast), color var(--t-fast),
              border-color var(--t-fast), transform var(--t-fast);
}
.btn-back i { transition: transform var(--t-fast); }
.btn-back:hover {
  background: var(--subtle-bg); color: var(--ink);
  border-color: #b6bfce;
  transform: translateY(-1px);
}
.btn-back:hover i { transform: translateX(-2px); }

/* ---------------- KPI strip (dashboard top — display only, non-clickable) --- */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
@media (max-width: 1200px) {
  .kpi-strip { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 700px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
}

.kpi-mini {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 14px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-xs);
  transition: transform var(--t-med), box-shadow var(--t-med), border-color var(--t-med);
}
.kpi-mini:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-border);
  color: inherit;
}
.kpi-mini-icon {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
  transition: transform var(--t-med);
}
.kpi-mini:hover .kpi-mini-icon { transform: scale(1.08); }
.kpi-mini-value {
  font-weight: 800; font-size: 1.25rem; line-height: 1.15; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-mini-label { font-size: .78rem; color: var(--muted); font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- Settings: logo preview ---------------------------- */
.logo-preview {
  width: 56px; height: 56px; border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  background: var(--subtle-bg);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Sidebar brand logo (when a custom logo is uploaded) */
.brand-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: 13px; }

/* ---------------- Year grid header ---------------------------------- */
.year-grid-card { padding: 0; overflow: hidden; box-shadow: var(--shadow-sm); }
.year-grid-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfcff 0%, #f5f8fd 100%);
}
.year-grid-header-title { display: flex; align-items: center; gap: 12px; }
.year-grid-header-icon {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: var(--brand-soft); color: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(37,99,235,.10);
  display: flex; align-items: center; justify-content: center; font-size: 1.05rem;
}
.year-grid-header-text .fw-semibold { font-size: .92rem; letter-spacing: -.01em; }
.year-grid-header-sub { font-size: .76rem; color: var(--muted); margin-top: 1px; }
.year-grid-hint {
  font-size: .76rem; color: var(--muted); display: flex; align-items: center; gap: 5px;
}
.year-grid-hint kbd {
  background: #fff; border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: 5px;
  padding: 1px 6px; font-size: .7rem; color: var(--ink-soft);
}

.year-grid-scroll { overflow-x: auto; max-width: 100%; }
.year-grid-table { margin-bottom: 0; white-space: nowrap; }
.year-grid-table thead th {
  background: var(--header-bg); color: var(--muted); font-size: .7rem;
  text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
  border-bottom: 1px solid var(--border-strong); padding: 13px 8px;
  position: sticky; top: 0; z-index: 2;
}
.year-grid-table tbody td { padding: 9px 8px; vertical-align: middle; border-bottom: 1px solid var(--table-border); }
.year-grid-table tbody tr:nth-child(even) { background: #fafbfe; }
.year-grid-table tbody tr:nth-child(even) .sticky-col,
.year-grid-table tbody tr:nth-child(even) .sticky-col-2 { background: #fafbfe; }
.year-grid-table tbody tr:hover { background: #f0f5ff; }
.year-grid-table tbody tr:hover .sticky-col,
.year-grid-table tbody tr:hover .sticky-col-2 { background: #f0f5ff; }

.year-grid-table .sticky-col {
  position: sticky; left: 0; z-index: 1; background: var(--card-bg);
  min-width: 230px; max-width: 260px; white-space: normal;
  border-right: 1px solid var(--table-border);
  border-left: 3px solid transparent;
}
.year-grid-table tbody tr.row-vfd .sticky-col { border-left-color: var(--brand); }
.year-grid-table tbody tr.row-motor .sticky-col { border-left-color: var(--green); }
.year-grid-table thead .sticky-col { z-index: 3; background: var(--header-bg); border-left: 3px solid transparent; }
.year-grid-table .sticky-col-2 {
  position: sticky; left: 230px; z-index: 1; background: var(--card-bg);
  min-width: 78px; font-size: .74rem; line-height: 1.4; text-align: center;
  border-right: 1px solid var(--table-border);
}
.year-grid-table thead .sticky-col-2 { z-index: 3; background: var(--header-bg); }

.current-month-col { background: var(--brand-soft) !important; }
.year-grid-table thead th.current-month-col { color: var(--brand-dark); }
.quarter-end { border-right: 2px solid #9aa4bd !important; }

.month-grid-cell { min-width: 84px; text-align: center; border-right: 1px solid var(--table-border); }
.year-grid-table thead th:not(.sticky-col):not(.sticky-col-2) { border-right: 1px solid var(--table-border); }
.grid-cell-inputs { display: flex; flex-direction: column; gap: 3px; align-items: center; }
.grid-input-row { display: flex; align-items: center; gap: 3px; }
.grid-unit { font-size: .64rem; color: var(--faint); font-weight: 600; min-width: 14px; text-align: left; }
.grid-input {
  width: 52px; font-size: .82rem; padding: 3px 4px;
  border: 1px solid transparent; border-radius: 7px; text-align: center;
  background: transparent; color: var(--ink); font-weight: 500;
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.grid-input::placeholder { color: #d5d9e3; }
.grid-input:hover { background: #f2f5fb; border-color: #e3e6ee; }
.grid-input:focus {
  outline: none; background: #fff; border-color: var(--brand);
  box-shadow: var(--ring);
}
.grid-input.over-limit { border-color: var(--red); color: var(--red); background: var(--red-soft); font-weight: 700; }
.grid-input.grid-saving { border-color: var(--border-strong); opacity: .7; }
.grid-input.grid-saved { border-color: var(--green); background: var(--green-soft); }
.grid-input.grid-error { border-color: var(--red); background: var(--red-soft); }
.grid-cell-readonly { display: flex; flex-direction: column; gap: 3px; font-size: .8rem; }
.grid-cell-readonly .grid-unit { margin-left: 2px; }

/* number input spinner cleanup for compact cells */
.grid-input::-webkit-outer-spin-button,
.grid-input::-webkit-inner-spin-button { margin: 0; }

/* ---------------- Clickable month chips + reading modal ------------- */
.month-cell-chip {
  width: 100%; min-width: 60px;
  display: inline-flex; flex-direction: column; gap: 2px;
  align-items: center; justify-content: center;
  background: transparent; border: 1px dashed transparent;
  border-radius: 8px; padding: 4px 2px; margin: 0;
  font-size: .78rem; line-height: 1.3; color: var(--ink);
  font-family: inherit; cursor: default; text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.month-cell-chip.is-clickable { cursor: pointer; }
.month-cell-chip.is-clickable:hover { background: #f0f5ff; border-color: var(--brand-border); }
.month-cell-chip .cell-line, .sticky-col-2 .cell-line { display: inline-flex; align-items: baseline; gap: 4px; font-weight: 500; }
.month-cell-chip .cell-lbl, .sticky-col-2 .cell-lbl { font-size: .6rem; color: var(--faint); font-weight: 700; min-width: 8px; text-align: left; }
.month-cell-chip .cell-val, .sticky-col-2 .cell-val { color: var(--ink); font-variant-numeric: tabular-nums; }
.month-cell-chip .cell-line.over-limit .cell-val { color: var(--red); font-weight: 700; }
.month-cell-chip .cell-line.over-limit .cell-lbl { color: var(--red); }
.month-grid-cell.has-reading .month-cell-chip .cell-lbl { color: var(--brand); }

.modal-sub { font-size: .78rem; color: var(--muted); }
.modal-tech-wrap { display: flex; flex-wrap: wrap; gap: 4px; max-height: 150px; overflow-y: auto; }
.modal-tech-wrap .empty-state { width: 100%; margin: 0; }
#modalStatus .alert { margin-top: 0; }

/* Read-only reading view (viewer role) — mirrors the edit-form layout */
#modalReadonly .form-label { margin-bottom: 7px; }
.ro-value {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #f9fafc;
  font-weight: 700; font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.ro-value > i {
  flex: none;
  font-size: .82rem; padding: 6px 8px; border-radius: 8px;
  background: var(--brand-soft); color: var(--brand);
}
.ro-value span { overflow-wrap: anywhere; white-space: pre-wrap; }
.ro-value.is-empty { color: var(--faint); font-weight: 500; font-size: .88rem; }
.ro-value.is-empty > i { background: #eef1f6; color: var(--faint); }
.ro-value.over-limit { border-color: #fecdca; background: var(--red-soft); color: var(--red); }
.ro-value.over-limit > i { background: rgba(217,45,32,.1); color: var(--red); }
.ro-notes { font-weight: 500; font-size: .88rem; min-height: 40px; padding-top: 10px; padding-bottom: 10px; align-items: flex-start; }
.ro-notes > i { display: none; }
.ro-tech-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  color: var(--brand-dark);
  font-size: .8rem; font-weight: 600;
}
.ro-tech-chip i { font-size: .75rem; }
.ro-none { color: var(--faint); font-size: .85rem; padding: 4px 2px; }

/* View-only badge in modal header + footer hint (viewer role) */
.ro-view-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--amber-soft); border: 1px solid #fee9b2;
  color: #b54708;
  font-size: .68rem; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase;
}
.ro-view-badge i { font-size: .72rem; }
.ro-footer-hint { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); font-size: .8rem; }

/* Device info popup trigger (VFDs & Motors list) */
.device-info-link { cursor: pointer; transition: color .15s ease; }
.device-info-link:hover { color: var(--brand); }
#deviceInfoModal .form-label { margin-bottom: 7px; }
#deviceInfoModal .modal-title { font-size: 1.05rem; }

/* ---------------- Progress bar + alert pulse on cards -------------- */
.explore-progress {
  height: 6px; border-radius: 999px; background: #edf0f6;
  overflow: hidden; margin: 12px 0 14px;
}
.explore-progress-bar {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--green), #22c58c);
  transition: width .45s cubic-bezier(.4,0,.2,1);
}

.explore-card-icon { position: relative; }
.explore-alert-badge {
  position: absolute; top: -3px; right: -3px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--red); border: 2px solid #fff;
  animation: pulse-alert-ring 1.8s infinite;
}
@keyframes pulse-alert-ring {
  0% { box-shadow: 0 0 0 0 rgba(217,45,32,.55); }
  70% { box-shadow: 0 0 0 7px rgba(217,45,32,0); }
  100% { box-shadow: 0 0 0 0 rgba(217,45,32,0); }
}

/* ---------------- Reorder controls (move up/down, admin only) ------ */
.reorder-controls { display: inline-flex; flex-direction: column; gap: 1px; vertical-align: middle; }
.reorder-btn {
  width: 22px; height: 16px; border: 1px solid var(--border); background: #fff;
  border-radius: 5px; display: flex; align-items: center; justify-content: center;
  font-size: .6rem; color: var(--muted); cursor: pointer; padding: 0; line-height: 1;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.reorder-btn:hover { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-border); }
.reorder-btn:disabled { opacity: .3; cursor: default; }
.reorder-btn:disabled:hover { background: #fff; color: var(--muted); border-color: var(--border); }

/* Dashboard cards: reorder row at the bottom */
.card-reorder-row {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  border-top: 1px solid var(--border); margin-top: 12px; padding-top: 10px;
}
.card-reorder-row .reorder-controls { flex-direction: row; gap: 4px; }
.card-reorder-label { font-size: .68rem; color: var(--muted); margin-right: auto; }

/* Year-grid table: reorder column */
.year-grid-table .reorder-col { min-width: 40px; text-align: center; }

/* ---------------- Nameplate details panel -------------------------- */
.nameplate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px;
  margin-top: 4px;
}
.nameplate-label { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; margin-bottom: 2px; }
.nameplate-value { font-size: .95rem; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.nameplate-notes {
  margin-top: 12px; padding: 10px 12px; background: var(--subtle-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: .82rem; color: var(--muted); line-height: 1.5;
}
.nameplate-subsection { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.nameplate-subtitle { font-weight: 700; font-size: .88rem; color: var(--ink); margin-bottom: 10px; letter-spacing: -.01em; }

/* ---------------- Reports page: Excel export styling ---------------- */
.btn-excel {
  background: #15803d; border-color: #15803d; color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px -4px rgba(21,128,61,.55);
}
.btn-excel:hover { background: #166534; border-color: #166534; color: #fff; transform: translateY(-1px); }

.report-preview-box { background: #f6fbf8 !important; border-color: #cde7d8 !important; }
.report-feature-list { list-style: none; padding: 0; margin: 0; }
.report-feature-list li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0; font-size: .84rem; color: var(--ink);
  border-bottom: 1px solid #e3efe8;
}
.report-feature-list li:last-child { border-bottom: none; }
.report-feature-list li i { font-size: 1rem; color: #15803d; margin-top: 1px; flex-shrink: 0; }

/* Small utilities shared across templates */
.badge-xs { font-size: .62rem; padding: 2px 6px; }
.page-title-sm { font-size: 1.2rem; }
.page-title-note { font-size: 1rem; font-weight: 500; color: var(--muted); }
.section-title-note {
  text-transform: none;
  font-weight: 500;
  color: var(--muted);
  font-size: .82rem;
}

/* Settings: clickable checkbox labels */
.clickable-label { cursor: pointer; user-select: none; }
.clickable-label:hover { color: var(--ink); }
.clickable-label input[type="checkbox"] { accent-color: var(--brand); margin-top: .1rem; }

/* ------------------------- Print ----------------------------------- */
@media print {
  .sidebar, .topbar, .sidebar-toggle, .sidebar-overlay,
  .btn-back, .explore-breadcrumb, .breadcrumb-filter,
  .page-header .btn, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; width: 100% !important; }
  body { background: #fff !important; }
  .content-inner { padding: 0 !important; max-width: none !important; }
  .table-card, .panel, .kpi-card, .kpi-mini, .explore-card, .form-card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    break-inside: avoid;
  }
}

/* ---------- User form: Unit/Department access-scope checklist ---------- */
.access-scope-tree { max-height: 420px; overflow-y: auto; padding-right: 4px; }
.access-scope-unit { margin-bottom: 6px; }
.access-scope-unit-label {
  background: #f2f5fb; border-radius: 8px;
}
.access-scope-depts { margin-left: 26px; margin-top: 2px; }
.access-scope-dept-label { padding: 5px 8px; font-size: .84rem; }
.access-scope-dept-label input:disabled { accent-color: #b9c0d4; }

/* ---------- Reports page: multi-select filter dropdowns ---------- */
.filter-checklist-menu {
  min-width: 220px; max-height: 260px; overflow-y: auto;
}
.filter-dropdown .dropdown-toggle {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .84rem;
}
.dropdown-item-check {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; font-size: .85rem; cursor: pointer; margin: 0;
}
.dropdown-item-check:hover { background: #f5f7fb; }
.dropdown-item-check input { margin: 0; accent-color: var(--brand); }

/* ---------- Pagination (long lists like VFDs & Motors) ---------- */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-top: 14px;
}
.pager-info { font-size: .82rem; color: var(--muted); }
.pager-controls { display: flex; align-items: center; gap: 6px; }
.pager-btn {
  display: inline-flex; align-items: center;
  padding: 6px 11px; border-radius: 8px;
  font-size: .82rem; font-weight: 600; text-decoration: none;
  color: var(--brand); background: #fff;
  border: 1px solid var(--border);
}
.pager-btn:hover { background: #f2f6ff; border-color: var(--border-strong); }
.pager-btn.disabled { color: #b9c0d4; pointer-events: none; background: #f7f8fb; }
.pager-current { font-size: .82rem; color: var(--dark); font-weight: 600; padding: 0 6px; }
