/* ── Simtec Client Portal — Styles ───────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* ── Simtec Brand Colors (derivados del logo: gradiente magenta→cyan) ── */
  --blue-50:  #ecfeff;   /* cyan-50  */
  --blue-100: #cffafe;   /* cyan-100 */
  --blue-200: #a5f3fc;   /* cyan-200 */
  --blue-300: #67e8f9;   /* cyan-300 */
  --blue-400: #22d3ee;   /* cyan-400 */
  --blue-500: #06b6d4;   /* cyan-500 */
  --blue-600: #0891b2;   /* cyan-600 — PRIMARY SIMTEC */
  --blue-700: #0e7490;   /* cyan-700 */
  --blue-800: #155e75;   /* cyan-800 */
  --blue-900: #0d1b2a;   /* sidebar dark navy */

  /* Gradiente del logo (magenta → violeta → cyan) */
  --brand-gradient:   linear-gradient(135deg, #d946ef 0%, #818cf8 50%, #06b6d4 100%);
  --brand-gradient-h: linear-gradient(90deg,  #d946ef 0%, #818cf8 50%, #06b6d4 100%);
  --brand-magenta: #d946ef;
  --brand-cyan:    #06b6d4;

  /* Logo URLs — logo real de simtecimpresoras.cl */
  --logo-horizontal: url('https://simtecimpresoras.cl/wp-content/uploads/2025/07/sIMTEC-impresoras.png');
  --logo-icon:       url('https://simtecimpresoras.cl/wp-content/uploads/2025/07/sIMTEC-impresoras.png');

  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-600: #16a34a;
  --green-700: #15803d;

  --amber-50:  #fffbeb;
  --amber-100: #fef3c7;
  --amber-600: #d97706;
  --amber-700: #b45309;

  --red-50:    #fef2f2;
  --red-100:   #fee2e2;
  --red-600:   #dc2626;
  --red-700:   #b91c1c;

  --gray-50:   #f9fafb;
  --gray-100:  #f3f4f6;
  --gray-500:  #6b7280;
  --gray-700:  #374151;

  --surface:   #f8fafc;
  --card:      #ffffff;
  --border:    #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);

  --radius:    12px;
  --radius-sm: 8px;
  --sidebar-w: 256px;
  --navbar-h:  64px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--slate-800);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

/* ── SCROLLBAR ────────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }

/* ── TYPOGRAPHY ───────────────────────────────────────────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 700; color: var(--slate-900); line-height: 1.3; }
h2 { font-size: 1.2rem; font-weight: 600; color: var(--slate-800); }
h3 { font-size: 1rem;   font-weight: 600; color: var(--slate-800); }
p  { color: var(--slate-500); }

/* ── LOGIN PAGE ───────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d1b2a 0%, #0e3a50 45%, #0891b2 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.login-card {
  background: var(--card);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px rgba(0,0,0,.3);
  position: relative;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.login-logo-icon {
  width: 48px;
  height: 48px;
  background: var(--blue-600);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.login-logo-icon svg { width: 28px; height: 28px; fill: white; }

.login-brand { font-size: 1.6rem; font-weight: 800; color: var(--blue-800); letter-spacing: -0.5px; }
.login-brand span { color: var(--blue-600); }

.login-subtitle {
  font-size: 0.8rem;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 500;
  margin-bottom: 36px;
  text-align: center;
}

.login-title { font-size: 1.15rem; font-weight: 600; color: var(--slate-700); margin-bottom: 6px; }
.login-desc  { font-size: 0.85rem; color: var(--slate-400); margin-bottom: 28px; }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--slate-600); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }

.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--slate-800);
  background: var(--slate-50);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.form-input:focus {
  border-color: var(--blue-600);
  background: white;
  box-shadow: 0 0 0 3px rgba(27, 79, 216, .12);
}

.form-input::placeholder { color: var(--slate-400); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--blue-600);
  color: white;
  box-shadow: 0 2px 4px rgba(27,79,216,.3);
}
.btn-primary:hover  { background: var(--blue-700); transform: translateY(-1px); box-shadow: 0 4px 8px rgba(27,79,216,.35); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary { background: var(--slate-100); color: var(--slate-700); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--slate-200); }

.btn-danger { background: var(--red-600); color: white; }
.btn-danger:hover { background: var(--red-700); }

.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }
.btn-block { width: 100%; }

.btn-ghost { background: transparent; color: var(--slate-500); }
.btn-ghost:hover { background: var(--slate-100); color: var(--slate-700); }

.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

.login-error {
  background: var(--red-50);
  border: 1.5px solid var(--red-100);
  color: var(--red-700);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}

.login-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--slate-400);
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.demo-hint {
  background: var(--blue-50);
  border: 1.5px solid var(--blue-100);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 24px;
  font-size: 0.8rem;
  color: var(--blue-800);
}
.demo-hint strong { font-weight: 600; }
.demo-hint .demo-cred { font-family: 'Courier New', monospace; background: var(--blue-100); padding: 1px 5px; border-radius: 4px; font-size: 0.78rem; }

/* ── APP SHELL ────────────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--blue-900);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform .25s;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--blue-600);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-icon svg { width: 20px; height: 20px; fill: white; }

.sidebar-brand { font-size: 1.1rem; font-weight: 800; color: white; letter-spacing: -0.3px; }
.sidebar-tagline { font-size: 0.65rem; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: 1px; margin-top: 1px; }

.sidebar-client {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-client-label { font-size: 0.65rem; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.sidebar-client-name  { font-size: 0.85rem; font-weight: 600; color: rgba(255,255,255,.9); line-height: 1.3; }

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-section-label {
  font-size: 0.63rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,.3);
  padding: 12px 20px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0;
  transition: all .12s;
  position: relative;
}

.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }

.nav-link:hover {
  color: white;
  background: rgba(255,255,255,.08);
}

.nav-link.active {
  color: white;
  background: rgba(255,255,255,.12);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--brand-cyan);
  border-radius: 0 2px 2px 0;
}

.sidebar-bottom {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-version { font-size: 0.7rem; color: rgba(255,255,255,.25); margin-top: 10px; text-align: center; }

/* Main area */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top bar */
.topbar {
  height: var(--navbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-page-title { font-size: 1rem; font-weight: 600; color: var(--slate-800); }

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

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.topbar-avatar {
  width: 34px;
  height: 34px;
  background: var(--blue-600);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.topbar-user-name { font-size: 0.85rem; font-weight: 600; color: var(--slate-700); }
.topbar-user-role { font-size: 0.73rem; color: var(--slate-400); }

/* Page content */
.page { padding: 28px; flex: 1; }

.page-header {
  margin-bottom: 24px;
}

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title { font-size: 1.4rem; font-weight: 700; color: var(--slate-900); }
.page-subtitle { font-size: 0.85rem; color: var(--slate-400); margin-top: 2px; }

/* ── STAT CARDS ───────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }

.stat-icon.blue   { background: var(--blue-50);  color: var(--blue-600); }
.stat-icon.green  { background: var(--green-50);  color: var(--green-600); }
.stat-icon.amber  { background: var(--amber-50);  color: var(--amber-600); }
.stat-icon.red    { background: var(--red-50);    color: var(--red-600); }
.stat-icon.gray   { background: var(--gray-100);  color: var(--gray-500); }

.stat-icon svg { fill: currentColor; }

.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--slate-900); line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--slate-400); font-weight: 500; margin-top: 3px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── ALERT BANNER ─────────────────────────────────────────────────────────────── */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.875rem;
  font-weight: 500;
}

.alert-banner.warning { background: var(--amber-50); border: 1.5px solid var(--amber-100); color: var(--amber-700); }
.alert-banner.error   { background: var(--red-50);   border: 1.5px solid var(--red-100);   color: var(--red-700); }
.alert-banner.info    { background: var(--blue-50);  border: 1.5px solid var(--blue-100);  color: var(--blue-700); }
.alert-banner.success { background: var(--green-50); border: 1.5px solid var(--green-100); color: var(--green-700); }

.alert-banner svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }

/* ── PRINTER GRID ─────────────────────────────────────────────────────────────── */
.printer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.printer-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s;
  position: relative;
}

.printer-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.printer-card-stripe { height: 4px; }
.printer-card-stripe.operational { background: linear-gradient(90deg, #16a34a, #22c55e); }
.printer-card-stripe.warning      { background: linear-gradient(90deg, #d97706, #f59e0b); }
.printer-card-stripe.error        { background: linear-gradient(90deg, #dc2626, #ef4444); }
.printer-card-stripe.offline      { background: linear-gradient(90deg, #6b7280, #9ca3af); }

.printer-card-body { padding: 18px 20px 0; }

.printer-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.printer-location {
  font-size: 1rem;
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1.2;
}

.printer-model {
  font-size: 0.8rem;
  color: var(--slate-400);
  margin-top: 2px;
}

.printer-serial {
  font-size: 0.75rem;
  color: var(--slate-300);
  font-family: 'Courier New', monospace;
  margin-top: 2px;
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge.operational { background: var(--green-50);  color: var(--green-700); border: 1px solid #bbf7d0; }
.status-badge.operational .dot { background: var(--green-600); }

.status-badge.warning { background: var(--amber-50); color: var(--amber-700); border: 1px solid #fde68a; }
.status-badge.warning .dot { background: var(--amber-600); animation: pulse-amber 1.5s infinite; }

.status-badge.error { background: var(--red-50); color: var(--red-700); border: 1px solid #fecaca; }
.status-badge.error .dot { background: var(--red-600); animation: pulse-red 1s infinite; }

.status-badge.offline { background: var(--gray-100); color: var(--gray-700); border: 1px solid #e5e7eb; }
.status-badge.offline .dot { background: var(--gray-500); }

@keyframes pulse-amber {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(1.3); }
}
@keyframes pulse-red {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(220,38,38,.5); }
  70%       { opacity: 0.8; box-shadow: 0 0 0 5px rgba(220,38,38,0); }
}

/* Ink bars */
.ink-section { margin-bottom: 16px; }
.ink-section-title { font-size: 0.72rem; font-weight: 600; color: var(--slate-400); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 10px; }

.ink-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}

.ink-label {
  font-size: 0.72rem;
  font-weight: 700;
  width: 14px;
  flex-shrink: 0;
  text-align: center;
}

.ink-label.k { color: var(--slate-700); }
.ink-label.c { color: #0891b2; }
.ink-label.m { color: #db2777; }
.ink-label.y { color: #ca8a04; }

.ink-bar-track {
  flex: 1;
  height: 8px;
  background: var(--slate-100);
  border-radius: 99px;
  overflow: hidden;
}

.ink-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .5s ease;
}

.ink-bar-fill.k { background: linear-gradient(90deg, #374151, #1f2937); }
.ink-bar-fill.c { background: linear-gradient(90deg, #0891b2, #06b6d4); }
.ink-bar-fill.m { background: linear-gradient(90deg, #db2777, #ec4899); }
.ink-bar-fill.y { background: linear-gradient(90deg, #ca8a04, #eab308); }

.ink-bar-fill.low { background: linear-gradient(90deg, #dc2626, #ef4444) !important; }

.ink-pct {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--slate-500);
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}
.ink-pct.low { color: var(--red-600); }

/* Printer stats row */
.printer-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px 0;
  border-top: 1px solid var(--slate-100);
  margin-bottom: 0;
}

.printer-stat { text-align: center; }
.printer-stat-value { font-size: 0.9rem; font-weight: 700; color: var(--slate-800); }
.printer-stat-label { font-size: 0.68rem; color: var(--slate-400); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 1px; }

/* Last error */
.printer-error {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  margin: 0 -20px;
  background: var(--red-50);
  border-top: 1px solid var(--red-100);
  border-bottom: 1px solid var(--red-100);
  font-size: 0.78rem;
  color: var(--red-700);
  font-weight: 500;
}

.printer-warning-msg {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  margin: 0 -20px;
  background: var(--amber-50);
  border-top: 1px solid var(--amber-100);
  border-bottom: 1px solid var(--amber-100);
  font-size: 0.78rem;
  color: var(--amber-700);
  font-weight: 500;
}

.printer-error svg, .printer-warning-msg svg { width: 13px; height: 13px; fill: currentColor; flex-shrink: 0; }

/* Printer card footer */
.printer-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--slate-100);
}

.printer-ip { font-size: 0.72rem; color: var(--slate-300); font-family: 'Courier New', monospace; }

.printer-actions { display: flex; gap: 8px; }

/* ── CARDS (generic) ──────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title { font-size: 0.95rem; font-weight: 600; color: var(--slate-800); }
.card-body  { padding: 20px; }

/* ── TABLE ────────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: var(--slate-50);
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 13px 16px;
  font-size: 0.875rem;
  color: var(--slate-700);
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--slate-50); }

/* ── TICKET ───────────────────────────────────────────────────────────────────── */
.ticket-list { display: flex; flex-direction: column; gap: 12px; }

.ticket-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s;
}

.ticket-item:hover { box-shadow: var(--shadow); }

.ticket-priority-bar {
  width: 4px;
  align-self: stretch;
  border-radius: 2px;
  flex-shrink: 0;
}
.ticket-priority-bar.critical { background: #7c3aed; }
.ticket-priority-bar.high     { background: var(--red-600); }
.ticket-priority-bar.medium   { background: var(--amber-600); }
.ticket-priority-bar.low      { background: var(--green-600); }

.ticket-info { flex: 1; min-width: 0; }
.ticket-title { font-weight: 600; color: var(--slate-800); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-meta  { font-size: 0.78rem; color: var(--slate-400); margin-top: 3px; }
.ticket-desc  { font-size: 0.82rem; color: var(--slate-500); margin-top: 6px; line-height: 1.5; }

.ticket-status { flex-shrink: 0; }

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill.open        { background: var(--blue-50);  color: var(--blue-700);  border: 1px solid var(--blue-100); }
.status-pill.in_progress { background: var(--amber-50); color: var(--amber-700); border: 1px solid var(--amber-100); }
.status-pill.resolved    { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-100); }
.status-pill.closed      { background: var(--gray-100); color: var(--gray-700);  border: 1px solid #e5e7eb; }

.priority-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.priority-badge.critical { background: #ede9fe; color: #6d28d9; }
.priority-badge.high     { background: var(--red-50);   color: var(--red-700); }
.priority-badge.medium   { background: var(--amber-50); color: var(--amber-700); }
.priority-badge.low      { background: var(--green-50); color: var(--green-700); }

/* ── MODAL ────────────────────────────────────────────────────────────────────── */
@keyframes modalFadeIn  { from { opacity: 0; }                        to { opacity: 1; } }
@keyframes modalSlideUp { from { transform: translateY(20px) scale(.97); } to { transform: translateY(0) scale(1); } }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: none;          /* hidden by default — no stacking-context bleed */
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.open {
  display: flex;          /* show as flex so the modal centres correctly */
  animation: modalFadeIn .18s ease forwards;
}

.modal {
  background: #ffffff;    /* explicit white — no CSS-variable dependency */
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,.35);
  animation: modalSlideUp .18s ease forwards;
}

.modal-overlay.open .modal { /* kept for legacy selectors */ }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 1rem; font-weight: 700; color: var(--slate-900); }
.modal-body  { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-close {
  width: 30px; height: 30px;
  border: none; background: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  color: var(--slate-400);
}
.modal-close:hover { background: var(--slate-100); color: var(--slate-700); }
.modal-close svg { width: 18px; height: 18px; fill: currentColor; }

/* ── VISIT CARD ───────────────────────────────────────────────────────────────── */
.visit-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--slate-100);
}
.visit-item:last-child { border-bottom: none; }

.visit-date-col { flex-shrink: 0; text-align: center; width: 54px; }
.visit-date-day   { font-size: 1.4rem; font-weight: 800; color: var(--blue-600); line-height: 1; }
.visit-date-month { font-size: 0.72rem; text-transform: uppercase; color: var(--slate-400); font-weight: 600; letter-spacing: 0.5px; }
.visit-date-year  { font-size: 0.7rem; color: var(--slate-300); }

.visit-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.visit-icon.maintenance { background: var(--blue-50); color: var(--blue-600); }
.visit-icon.repair       { background: var(--amber-50); color: var(--amber-600); }
.visit-icon.installation { background: var(--green-50); color: var(--green-600); }
.visit-icon.ink_refill   { background: #fdf4ff; color: #9333ea; }
.visit-icon svg { width: 18px; height: 18px; fill: currentColor; }

.visit-info { flex: 1; min-width: 0; }
.visit-type   { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--slate-400); margin-bottom: 3px; }
.visit-title  { font-weight: 600; color: var(--slate-800); font-size: 0.9rem; }
.visit-tech   { font-size: 0.78rem; color: var(--slate-400); margin-top: 2px; }
.visit-desc   { font-size: 0.82rem; color: var(--slate-500); margin-top: 6px; line-height: 1.5; }
.visit-result { font-size: 0.8rem; color: var(--green-600); margin-top: 4px; font-style: italic; }

/* ── CONTRACT ─────────────────────────────────────────────────────────────────── */
.contract-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.info-item { margin-bottom: 16px; }
.info-label { font-size: 0.72rem; font-weight: 600; color: var(--slate-400); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 4px; }
.info-value { font-size: 0.92rem; font-weight: 500; color: var(--slate-800); }

.contract-plan {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-800));
  color: white;
  border-radius: 99px;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 24px;
}

/* ── TOAST ────────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--slate-800);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 380px;
  pointer-events: all;
  animation: slide-in .25s ease;
}

.toast.success { background: #15803d; }
.toast.error   { background: var(--red-700); }
.toast svg { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; }

@keyframes slide-in {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── SELECT / TEXTAREA ────────────────────────────────────────────────────────── */
select.form-input, textarea.form-input {
  appearance: none;
  resize: vertical;
}
select.form-input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 20px; padding-right: 36px; }

/* ── LOADING SKELETON ─────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--slate-100) 25%, var(--slate-200) 50%, var(--slate-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── EMPTY STATE ──────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--slate-400);
}
.empty-state svg { width: 48px; height: 48px; fill: var(--slate-200); margin-bottom: 12px; }
.empty-state h3 { color: var(--slate-500); margin-bottom: 6px; }

/* ── RESPONSIVE ───────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-256px);
    width: 256px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 0 100vw rgba(0,0,0,.4);
  }

  .main { margin-left: 0; }

  .page { padding: 16px; }

  .printer-grid { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .topbar { padding: 0 16px; }

  .printer-stats { grid-template-columns: repeat(3, 1fr); }

  .hamburger { display: flex !important; }
}

.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: none; border: none;
  cursor: pointer;
  border-radius: 6px;
  color: var(--slate-600);
}
.hamburger:hover { background: var(--slate-100); }
.hamburger svg { width: 20px; height: 20px; fill: currentColor; }

/* ── UTILITIES ────────────────────────────────────────────────────────────────── */
.flex         { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1  { margin-top: 4px; }
.mt-2  { margin-top: 8px; }
.mt-4  { margin-top: 16px; }
.mb-4  { margin-bottom: 16px; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--slate-400); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

/* Spinner */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Last update bar */
.update-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  margin-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--slate-400);
}
.update-bar svg { width: 13px; height: 13px; fill: currentColor; margin-right: 4px; }
