/* ============================================================
   Maintix CMMS — style.css
   ============================================================ */

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

:root {
  --sidebar-w: 272px;
  --topbar-h: 76px;
  --content-max: 1600px;

  --bg-app: #0a1017;
  --bg-app-2: #0d141d;
  --bg-sidebar: rgba(7, 12, 18, 0.94);
  --bg-sidebar-soft: #0e1620;
  --bg-topbar: rgba(10, 16, 23, 0.82);
  --bg-panel: rgba(16, 24, 35, 0.96);
  --bg-panel-2: #131d29;
  --bg-card: #15202d;
  --bg-card-2: #192636;
  --bg-input: #0d141d;
  --bg-row-hover: rgba(56, 189, 248, 0.06);
  --bg-modal: #101924;
  --bg-overlay: rgba(2, 6, 12, 0.72);

  --border: rgba(123, 162, 202, 0.14);
  --border-mid: rgba(123, 162, 202, 0.22);
  --border-light: rgba(123, 162, 202, 0.34);
  --border-strong: rgba(56, 189, 248, 0.22);

  --t-primary: #e5edf6;
  --t-secondary: #94a9bf;
  --t-muted: #61768c;
  --t-soft: #b7c8d9;
  --t-accent: #61d3ff;

  --accent: #1f8ac0;
  --accent-2: #38bdf8;
  --accent-3: #7dd3fc;
  --accent-glow: rgba(56, 189, 248, 0.18);
  --accent-glow-strong: rgba(56, 189, 248, 0.28);

  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.12);

  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.12);

  --orange: #f97316;
  --orange-dim: rgba(249, 115, 22, 0.12);

  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.12);

  --blue: #38bdf8;
  --blue-dim: rgba(56, 189, 248, 0.12);

  --slate-dim: rgba(148, 163, 184, 0.1);
  --violet-dim: rgba(129, 140, 248, 0.12);

  --font-ui: 'Barlow', sans-serif;
  --font-cond: 'Barlow Condensed', sans-serif;
  --font-mono: 'DM Mono', monospace;

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-panel:
    0 10px 30px rgba(0, 0, 0, 0.22),
    0 1px 0 rgba(255, 255, 255, 0.02) inset;
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.18);
  --shadow-modal:
    0 30px 80px rgba(0, 0, 0, 0.55),
    0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-accent: 0 0 0 1px rgba(56, 189, 248, 0.05), 0 10px 40px rgba(56, 189, 248, 0.08);

  --transition-fast: 140ms ease;
  --transition: 180ms ease;
  --transition-slow: 260ms ease;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.05), transparent 24%),
    linear-gradient(180deg, var(--bg-app) 0%, var(--bg-app-2) 100%);
  color: var(--t-primary);
  min-height: 100vh;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

img,
svg {
  display: block;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent),
    var(--bg-sidebar);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.sidebar-header {
  min-height: 76px;
  padding: 18px 18px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
  background:
    linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow:
    0 8px 24px rgba(31, 138, 192, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-family: var(--font-cond);
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--t-primary);
}

.brand-sub {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--t-muted);
}

.sidebar-toggle,
.topbar-menu-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--t-secondary);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  display: none;
  align-items: center;
  justify-content: center;
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast);
}

.sidebar-toggle:hover,
.topbar-menu-btn:hover {
  color: var(--t-primary);
  border-color: var(--border-light);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-context-card {
  margin: 16px 14px 6px;
  padding: 14px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(56, 189, 248, 0.08), rgba(56, 189, 248, 0.03));
  border: 1px solid rgba(56, 189, 248, 0.16);
  box-shadow: var(--shadow-soft);
}

.sidebar-context-top {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--t-accent);
  font-size: 0.78rem;
  font-weight: 600;
}

.sidebar-context-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  flex-shrink: 0;
}

.sidebar-context-meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.context-chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.18);
  color: var(--green);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.context-chip--soft {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--t-secondary);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-group-label {
  padding: 10px 10px 2px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t-muted);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--t-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  transition:
    color var(--transition-fast),
    background var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
  border: 1px solid transparent;
  position: relative;
}

.nav-item svg {
  flex-shrink: 0;
}

.nav-item span:first-of-type {
  min-width: 0;
}

.nav-item:hover {
  color: var(--t-primary);
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.04);
  transform: translateX(1px);
}

.nav-item.active {
  color: var(--t-accent);
  background:
    linear-gradient(90deg, rgba(56, 189, 248, 0.14), rgba(56, 189, 248, 0.05));
  border-color: rgba(56, 189, 248, 0.16);
  box-shadow: inset 2px 0 0 var(--accent-2);
}

.nav-item--dim {
  opacity: 0.5;
  pointer-events: none;
}

.nav-badge,
.nav-pill {
  margin-left: auto;
  flex-shrink: 0;
}

.nav-badge {
  min-width: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--amber);
  color: #111;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  text-align: center;
}

.nav-pill {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--t-muted);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-pill--live {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.18);
  color: var(--green);
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}

.user-avi {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-cond);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 8px 20px rgba(31, 138, 192, 0.28);
}

.user-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--t-primary);
  line-height: 1.2;
}

.user-role {
  margin-top: 2px;
  font-size: 0.7rem;
  color: var(--t-muted);
}

.user-status {
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

/* ============================================================
   Shell / Topbar / Content
   ============================================================ */

.shell {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--topbar-h);
  padding: 14px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.topbar-mobile {
  display: none;
}

.eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t-muted);
  margin-bottom: 3px;
}

.page-heading {
  font-family: var(--font-cond);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--t-primary);
}

.topbar-breadcrumb {
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--t-muted);
  letter-spacing: 0.04em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.topbar-time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--t-muted);
  letter-spacing: 0.04em;
}

.topbar-health {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  color: var(--t-secondary);
}

.health-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.content {
  width: 100%;
  max-width: var(--content-max);
  padding: 24px 26px 30px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.view {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.section-title {
  font-family: var(--font-cond);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--t-primary);
  text-transform: uppercase;
}

.section-subtitle {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--t-secondary);
}

/* ============================================================
   Hero Banner
   ============================================================ */

.hero-banner {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: 16px;
  padding: 24px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.12), transparent 30%),
    linear-gradient(135deg, rgba(17, 28, 40, 0.96), rgba(14, 22, 31, 0.96));
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-panel), var(--shadow-accent);
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '';
  position: absolute;
  inset: auto -70px -70px auto;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.14), transparent 68%);
  pointer-events: none;
}

.hero-banner__content {
  position: relative;
  z-index: 1;
}

.hero-banner__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.14);
  color: var(--t-accent);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hero-banner__title {
  margin-top: 14px;
  font-family: var(--font-cond);
  font-size: 2rem;
  line-height: 1.02;
  letter-spacing: 0.02em;
  max-width: 800px;
}

.hero-banner__text {
  margin-top: 12px;
  max-width: 740px;
  color: var(--t-secondary);
  font-size: 0.92rem;
}

.hero-banner__stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-content: stretch;
  position: relative;
  z-index: 1;
}

.hero-stat {
  min-height: 92px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-stat__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t-muted);
}

.hero-stat__value {
  margin-top: 7px;
  font-family: var(--font-cond);
  font-size: 1.8rem;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--t-primary);
}

/* ============================================================
   KPI / Ops
   ============================================================ */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-panel);
  transition:
    transform var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
  box-shadow:
    0 14px 35px rgba(0, 0, 0, 0.24),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset;
}

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.kpi-icon--blue {
  background: var(--blue-dim);
  color: var(--blue);
}

.kpi-icon--amber {
  background: var(--amber-dim);
  color: var(--amber);
}

.kpi-icon--orange {
  background: var(--orange-dim);
  color: var(--orange);
}

.kpi-icon--green {
  background: var(--green-dim);
  color: var(--green);
}

.kpi-body {
  flex: 1;
  min-width: 0;
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--t-secondary);
}

.kpi-value {
  margin-top: 7px;
  font-family: var(--font-cond);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
  color: var(--t-primary);
}

.kpi-trend {
  align-self: flex-start;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.kpi-trend--good {
  color: var(--green);
  background: var(--green-dim);
}

.kpi-trend--warn {
  color: var(--amber);
  background: var(--amber-dim);
}

.kpi-trend--neutral {
  color: var(--t-secondary);
  background: var(--slate-dim);
}

.ops-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.ops-strip-card {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.ops-strip-card__label {
  font-size: 0.72rem;
  color: var(--t-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.ops-strip-card__value {
  margin-top: 8px;
  font-family: var(--font-cond);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--t-primary);
}

/* ============================================================
   Panels / Dashboard Grid
   ============================================================ */

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}

.panel--table {
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-cond);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--t-soft);
}

.panel-subtitle {
  margin-top: 5px;
  font-size: 0.76rem;
  color: var(--t-muted);
}

.panel-link {
  color: var(--t-accent);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  opacity: 0.9;
}

.panel-link:hover {
  opacity: 1;
  transform: translateX(1px);
}

.panel-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-grid {
  display: grid;
  gap: 16px;
}

.dash-grid--3 {
  grid-template-columns: 1.1fr 1.1fr 0.9fr;
}

.dashboard-lower-grid {
  display: grid;
  grid-template-columns: 1.45fr 0.8fr;
  gap: 16px;
}

.metric-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric-row {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.metric-row span {
  color: var(--t-secondary);
  font-size: 0.8rem;
}

.metric-row strong {
  color: var(--t-primary);
  font-family: var(--font-cond);
  font-size: 1rem;
}

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.activity-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.activity-item__title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--t-primary);
}

.activity-item__meta {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--t-muted);
}

/* ============================================================
   Inline Lists / Cards
   ============================================================ */

.crit-item,
.mstatus-item,
.analytics-row {
  min-height: 62px;
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition:
    border-color var(--transition-fast),
    transform var(--transition-fast),
    background var(--transition-fast);
}

.crit-item:hover,
.mstatus-item:hover,
.analytics-row:hover {
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.crit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.crit-item-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.crit-item-ref {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--t-muted);
}

.crit-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--t-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crit-item-machine {
  font-size: 0.74rem;
  color: var(--t-secondary);
}

.mstatus-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mstatus-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mstatus-name {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--t-primary);
}

.mstatus-loc {
  font-size: 0.72rem;
  color: var(--t-secondary);
}

.empty-inline {
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  color: var(--t-muted);
  font-size: 0.8rem;
}

/* ============================================================
   Toolbars / Search / Filters
   ============================================================ */

.toolbar {
  padding: 14px;
  border-radius: 18px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-panel);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar--stackable {
  align-items: stretch;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 260px;
}

.search-ico {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--t-muted);
  pointer-events: none;
}

.search-field,
.select-field,
.f-input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-mid);
  background: var(--bg-input);
  color: var(--t-primary);
  outline: none;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
}

.search-field {
  padding-left: 36px;
}

.search-field::placeholder,
.f-input::placeholder {
  color: var(--t-muted);
}

.search-field:focus,
.select-field:focus,
.f-input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.toolbar-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--t-muted);
  white-space: nowrap;
}

/* ============================================================
   Tables
   ============================================================ */

.table-scroll {
  width: 100%;
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.data-table thead {
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-family: var(--font-cond);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t-muted);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  font-size: 0.82rem;
  color: var(--t-primary);
  border-bottom: 1px solid rgba(123, 162, 202, 0.1);
  vertical-align: middle;
  white-space: nowrap;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover td {
  background: var(--bg-row-hover);
}

.data-table tbody tr.is-selected td {
  background: rgba(56, 189, 248, 0.08);
}

.th-actions {
  width: 100px;
}

.td-wo-ref {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 10px;
  background: var(--blue-dim);
  color: var(--t-accent);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.td-asset-id {
  color: var(--t-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.td-desc {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--t-secondary);
}

.td-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================
   Badges / Pills / Status
   ============================================================ */

.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  font-family: var(--font-cond);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge::before,
.status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge--pending,
.status-pill.badge--pending {
  color: var(--t-secondary);
  background: var(--slate-dim);
}
.badge--pending::before,
.status-pill.badge--pending::before {
  background: var(--t-muted);
}

.badge--in-progress,
.status-pill.badge--in-progress {
  color: var(--blue);
  background: var(--blue-dim);
}
.badge--in-progress::before,
.status-pill.badge--in-progress::before {
  background: var(--blue);
  box-shadow: 0 0 8px var(--blue);
}

.badge--completed,
.status-pill.badge--completed {
  color: var(--green);
  background: var(--green-dim);
}
.badge--completed::before,
.status-pill.badge--completed::before {
  background: var(--green);
}

.badge--cancelled,
.status-pill.badge--cancelled {
  color: var(--red);
  background: var(--red-dim);
}
.badge--cancelled::before,
.status-pill.badge--cancelled::before {
  background: var(--red);
}

.badge--operational,
.status-pill.badge--operational {
  color: var(--green);
  background: var(--green-dim);
}
.badge--operational::before,
.status-pill.badge--operational::before {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.badge--maintenance,
.status-pill.badge--maintenance {
  color: var(--amber);
  background: var(--amber-dim);
}
.badge--maintenance::before,
.status-pill.badge--maintenance::before {
  background: var(--amber);
}

.badge--offline,
.status-pill.badge--offline {
  color: var(--t-muted);
  background: var(--slate-dim);
}
.badge--offline::before,
.status-pill.badge--offline::before {
  background: var(--t-muted);
}

.badge--critical,
.status-pill.badge--critical {
  color: var(--red);
  background: var(--red-dim);
}
.badge--critical::before,
.status-pill.badge--critical::before {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

.badge--p-critical {
  color: var(--red);
  background: var(--red-dim);
}
.badge--p-critical::before {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

.badge--p-high {
  color: var(--orange);
  background: var(--orange-dim);
}
.badge--p-high::before {
  background: var(--orange);
}

.badge--p-medium {
  color: var(--amber);
  background: var(--amber-dim);
}
.badge--p-medium::before {
  background: var(--amber);
}

.badge--p-low {
  color: var(--green);
  background: var(--green-dim);
}
.badge--p-low::before {
  background: var(--green);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px rgba(31, 138, 192, 0.25);
}

.btn--primary:hover {
  box-shadow: 0 14px 28px rgba(31, 138, 192, 0.32);
}

.btn--ghost {
  color: var(--t-secondary);
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--border-mid);
}

.btn--ghost:hover {
  color: var(--t-primary);
  border-color: var(--border-light);
  background: rgba(255, 255, 255, 0.05);
}

.btn--danger {
  color: #fff;
  background: linear-gradient(135deg, #dc2626, #ef4444);
  box-shadow: 0 10px 24px rgba(239, 68, 68, 0.2);
}

.btn--sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.76rem;
}

.btn-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid var(--border-mid);
  background: rgba(255, 255, 255, 0.02);
  color: var(--t-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast);
}

.btn-icon:hover {
  color: var(--t-primary);
  border-color: var(--border-light);
  background: rgba(255, 255, 255, 0.05);
}

.btn-icon--red:hover {
  color: var(--red);
  background: var(--red-dim);
  border-color: rgba(239, 68, 68, 0.25);
}

/* ============================================================
   Forms / Modal
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.18s ease;
}

.modal {
  width: 100%;
  max-width: 680px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-modal);
  border: 1px solid var(--border-mid);
  border-radius: 24px;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

.modal--sm {
  max-width: 460px;
}

.modal-head {
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-ico {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--blue-dim);
  color: var(--blue);
  flex-shrink: 0;
}

.modal-ico--red {
  background: var(--red-dim);
  color: var(--red);
}

.modal-title {
  font-family: var(--font-cond);
  font-size: 1.04rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--t-primary);
  line-height: 1.1;
}

.modal-sub {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--t-muted);
}

.modal-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--t-muted);
  transition:
    color var(--transition-fast),
    background var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--t-primary);
  background: rgba(255, 255, 255, 0.05);
}

.modal-body {
  padding: 18px 20px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-foot {
  padding: 16px 20px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-section {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}

.form-section__head {
  margin-bottom: 14px;
}

.form-section__head h3 {
  font-family: var(--font-cond);
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--t-primary);
}

.form-section__head p {
  margin-top: 4px;
  font-size: 0.77rem;
  color: var(--t-muted);
}

.form-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.f-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.f-label {
  font-family: var(--font-cond);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t-secondary);
}

.req {
  color: var(--red);
}

.f-input.invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.f-textarea {
  min-height: 84px;
  resize: vertical;
}

.f-error {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--red-dim);
  border: 1px solid rgba(239, 68, 68, 0.22);
  color: var(--red);
  font-size: 0.77rem;
  font-weight: 600;
}

.del-text {
  font-size: 0.84rem;
  color: var(--t-secondary);
  line-height: 1.65;
}

/* ============================================================
   Empty State
   ============================================================ */

.empty-state {
  padding: 58px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  color: var(--t-muted);
}

.empty-state h3 {
  font-family: var(--font-cond);
  font-size: 1rem;
  letter-spacing: 0.03em;
  color: var(--t-primary);
}

.empty-state p {
  max-width: 380px;
  font-size: 0.82rem;
}

/* ============================================================
   Machines view
   ============================================================ */

.machines-layout {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr;
  gap: 16px;
}

.machine-side-panel {
  min-height: 100%;
}

.machine-preview-empty {
  min-height: 260px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--t-muted);
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  padding: 20px;
}

.machine-preview {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.machine-preview__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.machine-preview__name {
  font-family: var(--font-cond);
  font-size: 1.2rem;
  letter-spacing: 0.03em;
  line-height: 1;
}

.machine-preview__meta {
  margin-top: 5px;
  color: var(--t-secondary);
  font-size: 0.78rem;
}

.machine-preview__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.preview-stat,
.preview-block {
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.preview-stat span,
.preview-block__label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--t-muted);
}

.preview-stat strong {
  display: block;
  margin-top: 7px;
  font-size: 0.92rem;
  color: var(--t-primary);
}

.preview-block p {
  margin-top: 8px;
  color: var(--t-secondary);
  font-size: 0.8rem;
}

/* ============================================================
   Analytics
   ============================================================ */

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.analytics-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.analytics-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.analytics-row__label {
  color: var(--t-secondary);
  font-size: 0.8rem;
}

.analytics-row__value {
  color: var(--t-primary);
  font-family: var(--font-cond);
  font-size: 1rem;
}

.insight-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.insight-card {
  padding: 14px;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.insight-card__label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t-muted);
}

.insight-card p {
  margin-top: 8px;
  color: var(--t-secondary);
  font-size: 0.8rem;
  line-height: 1.6;
}

/* ============================================================
   Utility states
   ============================================================ */

.mobile-sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(3, 8, 14, 0.58);
  backdrop-filter: blur(4px);
}

.status-dot--green {
  background: var(--green);
}
.status-dot--amber {
  background: var(--amber);
}
.status-dot--red {
  background: var(--red);
}
.status-dot--blue {
  background: var(--blue);
}

/* ============================================================
   Animations
   ============================================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   Scrollbar
   ============================================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(123, 162, 202, 0.24);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(123, 162, 202, 0.34);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1360px) {
  .dash-grid--3 {
    grid-template-columns: 1fr 1fr;
  }

  .dash-grid--3 > .panel:last-child {
    grid-column: 1 / -1;
  }

  .dashboard-lower-grid,
  .machines-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .hero-banner {
    grid-template-columns: 1fr;
  }

  .hero-banner__stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .kpi-row,
  .ops-strip,
  .analytics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  :root {
    --sidebar-w: 0px;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 288px;
    transition: transform var(--transition-slow);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.38);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .shell {
    margin-left: 0;
  }

  .sidebar-toggle,
  .topbar-menu-btn {
    display: inline-flex;
  }

  .topbar-mobile {
    display: block;
  }

  .topbar {
    padding: 14px 18px;
  }

  .content {
    padding: 18px;
  }

  .topbar-meta {
    display: none;
  }

  .toolbar-actions {
    margin-left: 0;
  }
}

@media (max-width: 760px) {
  .page-heading {
    font-size: 1.12rem;
  }

  .topbar-breadcrumb {
    font-size: 0.66rem;
  }

  .hero-banner {
    padding: 18px;
    border-radius: 20px;
  }

  .hero-banner__title {
    font-size: 1.55rem;
  }

  .hero-banner__stats {
    grid-template-columns: 1fr;
  }

  .kpi-row,
  .ops-strip,
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    padding: 12px;
  }

  .search-wrap {
    min-width: 100%;
  }

  .toolbar-filters,
  .toolbar-actions {
    width: 100%;
  }

  .toolbar-filters {
    flex-direction: column;
  }

  .toolbar-actions {
    justify-content: space-between;
  }

  .form-cols,
  .machine-preview__grid {
    grid-template-columns: 1fr;
  }

  .modal {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 20px;
  }

  .modal-overlay {
    padding: 12px;
  }

  .btn--ghost#btn-export {
    display: none;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .btn,
  .btn--sm {
    min-height: 38px;
  }

  .content {
    padding: 14px;
  }

  .section-title {
    font-size: 0.94rem;
  }

  .panel-header,
  .panel-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .data-table {
    min-width: 760px;
  }
}