/* ============================================
   COPISTERÍA CMS · v3 · violeta + kawaii
   ============================================ */

/* ---------- TOKENS ---------- */
:root {
  /* Base claros con tinte violeta */
  --bg:           #f6f5fb;
  --bg-elev:      #ffffff;
  --surface:      #ffffff;
  --surface-2:    #f5f3fb;
  --border:       #ece9f5;
  --border-2:     #f2f0fa;
  --text:         #1c1e36;
  --text-2:       #5b5e7c;
  --text-3:       #8a8da8;
  --text-4:       #b4b6cc;

  /* Accent: violeta pastel cálido */
  --accent:       #7c6df0;
  --accent-2:     #6857ea;
  --accent-3:     #ada1f6;
  --accent-soft:  #ece8ff;
  --accent-ring:  rgba(124,109,240,.18);

  /* Sidebar morada como en la captura */
  --sidebar-bg:   #ffffff;
  --sidebar-hov:  #f3f0fc;
  --sidebar-act:  #ece8ff;

  /* Pastel semánticos */
  --c-blue:    #5b8def;  --c-blue-soft:    #e0e9ff;
  --c-green:   #2dbe7c;  --c-green-soft:   #d8f5e6;
  --c-amber:   #f59e0b;  --c-amber-soft:   #fff0d6;
  --c-red:     #ef4d65;  --c-red-soft:     #ffe1e6;
  --c-purple:  #a07cf5;  --c-purple-soft:  #ede5ff;
  --c-pink:    #ec5a98;  --c-pink-soft:    #ffdfee;
  --c-cyan:    #44c7e3;  --c-cyan-soft:    #d6f3fa;
  --c-indigo:  #7c6df0;  --c-indigo-soft:  #e6e1ff;
  --c-gray:    #94a3b8;  --c-gray-soft:    #e8ebf2;
  --c-yellow:  #facc15;  --c-yellow-soft:  #fff5cc;

  /* Spacing/radius */
  --r-xs: 8px;  --r-sm: 12px;  --r-md: 16px;
  --r-lg: 22px; --r-xl: 28px;  --r-2xl: 36px;

  --shadow-sm:   0 1px 2px rgba(60,40,120,.06);
  --shadow-md:   0 6px 20px rgba(80,60,160,.07), 0 1px 2px rgba(80,60,160,.04);
  --shadow-lg:   0 18px 50px rgba(80,60,160,.10), 0 2px 6px rgba(80,60,160,.05);
  --shadow-xl:   0 30px 80px rgba(80,60,160,.13), 0 4px 12px rgba(80,60,160,.06);
  --shadow-accent:0 12px 28px rgba(124,109,240,.32);

  --sidebar-w:   260px;
  --header-h:    72px;

  --font-sans:   'Nunito', ui-sans-serif, system-ui, sans-serif;
  --font-display:'Fraunces', Georgia, serif;
  --font-mono:   'JetBrains Mono', ui-monospace, Menlo, monospace;
}

[data-theme="dark"] {
  --bg:          #14131c;
  --bg-elev:     #1c1b27;
  --surface:     #1f1e2c;
  --surface-2:   #262534;
  --border:      #2f2e40;
  --border-2:    #28283a;
  --text:        #f3f1fb;
  --text-2:      #aaa6c4;
  --text-3:      #7e7b95;
  --text-4:      #555269;

  --accent:      #9786f5;
  --accent-2:    #8473ee;
  --accent-3:    #ada1f6;
  --accent-soft: rgba(124,109,240,.14);
  --accent-ring: rgba(124,109,240,.28);

  --sidebar-bg:  #1c1b27;
  --sidebar-hov: #262534;
  --sidebar-act: rgba(124,109,240,.18);

  --c-blue-soft:    rgba(91,141,239,.18);
  --c-green-soft:   rgba(45,190,124,.18);
  --c-amber-soft:   rgba(245,158,11,.18);
  --c-red-soft:     rgba(239,77,101,.18);
  --c-purple-soft:  rgba(160,124,245,.18);
  --c-pink-soft:    rgba(236,90,152,.18);
  --c-cyan-soft:    rgba(68,199,227,.18);
  --c-indigo-soft:  rgba(124,109,240,.20);
  --c-gray-soft:    rgba(148,163,184,.22);
  --c-yellow-soft:  rgba(250,204,21,.18);

  --shadow-sm:  0 1px 2px rgba(0,0,0,.4);
  --shadow-md:  0 6px 20px rgba(0,0,0,.35);
  --shadow-lg:  0 18px 50px rgba(0,0,0,.45);
  --shadow-xl:  0 30px 80px rgba(0,0,0,.55);
  --shadow-accent:0 12px 28px rgba(124,109,240,.45);
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  transition: background-color .25s, color .25s;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--accent); color: white; }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ---------- APP LAYOUT ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex; flex-direction: column;
  gap: 18px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 6px; }
.logo-mark {
  width: 48px; height: 48px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 30% 30%, #b6a8ff 0%, #7c6df0 60%, #6857ea 100%);
  color: white;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 800; font-size: 26px;
  box-shadow: var(--shadow-accent), inset 0 1px 0 rgba(255,255,255,.3);
  letter-spacing: -.02em;
  position: relative;
}
/* "carita" decorativa en el logo */
.logo-mark::after {
  content: '';
  position: absolute;
  top: 10px; right: 9px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: white;
  box-shadow: 10px 0 0 0 rgba(255,255,255,.95);
  opacity: .65;
}
.brand-text b {
  display: block;
  font-family: var(--font-display);
  font-weight: 800; font-size: 19px;
  color: var(--text);
  letter-spacing: -.02em;
  line-height: 1.1;
}
.brand-text small {
  display: block;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
  font-weight: 500;
}

.search-box {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 12px 9px 38px;
  display: flex; align-items: center;
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
  background: var(--surface);
}
.search-box > i { position: absolute; left: 14px; color: var(--text-3); font-size: 13px; }
.search-box input {
  border: 0; background: transparent; outline: none;
  font: inherit; font-size: 13px; color: var(--text);
  flex: 1; min-width: 0;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  color: var(--text-3);
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-height: 360px; overflow-y: auto;
  z-index: 30; display: none;
}
.search-results.show { display: block; }
.search-results a {
  display: flex; gap: 10px; padding: 10px 12px;
  border-bottom: 1px solid var(--border-2);
  font-size: 13px; align-items: center;
}
.search-results a:hover { background: var(--surface-2); }
.search-results a:last-child { border-bottom: 0; }
.search-results .sr-empty { padding: 16px; text-align: center; color: var(--text-3); font-size: 13px; }

nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-3);
  margin: 12px 12px 6px;
}
nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 14px;
  color: var(--text-2);
  font-size: 14px; font-weight: 600;
  position: relative;
  transition: all .15s;
}
nav a:hover { background: var(--sidebar-hov); color: var(--text); }
nav a.active {
  background: var(--sidebar-act);
  color: var(--accent);
  font-weight: 700;
}
nav a.active .nav-ic {
  transform: scale(1.05);
}
.nav-ic {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 13px;
  flex-shrink: 0;
  transition: transform .2s;
}
.nav-ic.c-blue   { background: var(--c-blue-soft);   color: var(--c-blue); }
.nav-ic.c-green  { background: var(--c-green-soft);  color: var(--c-green); }
.nav-ic.c-amber  { background: var(--c-amber-soft);  color: var(--c-amber); }
.nav-ic.c-red    { background: var(--c-red-soft);    color: var(--c-red); }
.nav-ic.c-purple { background: var(--c-purple-soft); color: var(--c-purple); }
.nav-ic.c-pink   { background: var(--c-pink-soft);   color: var(--c-pink); }
.nav-ic.c-cyan   { background: var(--c-cyan-soft);   color: var(--c-cyan); }
.nav-ic.c-indigo { background: var(--c-indigo-soft); color: var(--c-indigo); }
.nav-ic.c-gray   { background: var(--c-gray-soft);   color: var(--c-gray); }
.nav-pill {
  margin-left: auto;
  background: var(--accent); color: white;
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  min-width: 20px; text-align: center;
  box-shadow: 0 4px 10px var(--accent-ring);
}

.side-user {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center; gap: 10px;
  box-shadow: var(--shadow-sm);
}
.mini-avatar {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: var(--accent-soft);
  display: grid; place-items: center; font-size: 20px;
}
.su-info { min-width: 0; }
.su-info b {
  display: block; font-size: 13px; font-weight: 700;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--font-display);
}
.su-info small {
  display: block; font-size: 10.5px; color: var(--text-3);
  letter-spacing: .06em; margin-top: 1px;
  font-weight: 600;
}
.theme-toggle {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  display: grid; place-items: center;
  transition: all .15s;
}
.theme-toggle:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
[data-theme="dark"] .theme-toggle i::before { content: "\f185"; }

/* ---------- MAIN / TOPBAR ---------- */
.main {
  padding: 26px 32px 0;
  min-width: 0;
  display: flex; flex-direction: column;
  min-height: 100vh;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
  gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.hamburger {
  display: none;
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
}
.topbar h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800; font-size: 32px;
  letter-spacing: -.02em;
  color: var(--text);
}
.breadcrumb {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
  font-weight: 500;
}
.breadcrumb i { font-size: 11px; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.iconbar {
  position: relative;
  width: 42px; height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: grid; place-items: center;
  transition: all .15s;
  font-size: 15px;
}
.iconbar:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.iconbar .dot {
  position: absolute; top: -4px; right: -4px;
  background: var(--c-red); color: white;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px;
  border: 2px solid var(--bg);
  min-width: 18px; text-align: center; line-height: 1.4;
}
.logout {
  display: inline-flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 16px 0 6px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px; font-weight: 700;
  transition: all .15s;
}
.logout .logo-mini {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: grid; place-items: center;
  font-size: 18px;
}
.logout:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------- FLASH ---------- */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13.5px;
  box-shadow: var(--shadow-sm);
  animation: slideDown .25s ease;
}
.flash.ok  { background: var(--c-green-soft); border-color: var(--c-green); color: var(--c-green); }
.flash.err { background: var(--c-red-soft);   border-color: var(--c-red);   color: var(--c-red); }
.flash.info{ background: var(--c-blue-soft);  border-color: var(--c-blue);  color: var(--c-blue); }
.flash span { flex: 1; color: var(--text); font-weight: 600; }
.flash-x {
  background: transparent; border: 0;
  color: var(--text-3);
  width: 24px; height: 24px;
  border-radius: 6px;
}
.flash-x:hover { background: var(--surface-2); color: var(--text); }

/* ---------- HERO ---------- */
.hero {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border-radius: 26px;
  padding: 26px 32px;
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center; gap: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-accent);
}
.hero::before {
  content: ''; position: absolute;
  right: -60px; top: -60px;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(255,255,255,.25) 0%, transparent 70%);
  border-radius: 50%;
}
.hero::after {
  content: ''; position: absolute;
  left: -40px; bottom: -80px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,.15) 0%, transparent 70%);
  border-radius: 50%;
}
.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px; font-weight: 800;
  letter-spacing: -.025em;
  color: white;
}
.hero h1 .wave { display: inline-block; animation: wave 2s infinite; transform-origin: 70% 70%; }
.hero p { margin: 6px 0 0; color: rgba(255,255,255,.85); font-size: 14.5px; font-weight: 500; }
.hero-meta {
  display: flex; gap: 16px; margin-top: 14px;
  font-size: 12.5px; color: rgba(255,255,255,.85);
  flex-wrap: wrap;
}
.hero-meta span { display: inline-flex; align-items: center; gap: 5px; }
.hero-art {
  font-size: 90px;
  z-index: 1;
  animation: floaty 4s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,.15));
}

/* ---------- STAT CARDS ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 22px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: transform .2s, box-shadow .2s;
  overflow: hidden;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-head { display: flex; justify-content: space-between; align-items: flex-start; }
.stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.stat-ic {
  width: 44px; height: 44px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.stat-ic.c-blue   { background: var(--c-blue-soft);   color: var(--c-blue); }
.stat-ic.c-amber  { background: var(--c-amber-soft);  color: var(--c-amber); }
.stat-ic.c-green  { background: var(--c-green-soft);  color: var(--c-green); }
.stat-ic.c-purple { background: var(--c-purple-soft); color: var(--c-purple); }
.stat-ic.c-red    { background: var(--c-red-soft);    color: var(--c-red); }
.stat-ic.c-cyan   { background: var(--c-cyan-soft);   color: var(--c-cyan); }
.stat-ic.c-pink   { background: var(--c-pink-soft);   color: var(--c-pink); }
.stat-ic.c-indigo { background: var(--c-indigo-soft); color: var(--c-indigo); }

.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: 42px; font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
  line-height: 1;
  margin-top: 2px;
}
.stat-num small { font-size: 18px; color: var(--text-3); font-weight: 600; }
.stat-sub {
  display: block;
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 8px;
  font-weight: 500;
}
.stat-trend {
  font-size: 11.5px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 9px; border-radius: 999px;
}
.stat-trend.up   { background: var(--c-green-soft); color: var(--c-green); }
.stat-trend.down { background: var(--c-red-soft);   color: var(--c-red); }
.stat-trend.flat { background: var(--surface-2);    color: var(--text-3); }

/* ---------- PANEL ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; gap: 12px;
  flex-wrap: wrap;
}
.panel-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.panel-head h3 i { color: var(--accent); }
.panel-sub {
  display: block;
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 3px;
  font-weight: 500;
}
.panel-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- QUICK ACTIONS ---------- */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px,1fr));
  gap: 12px;
}
.qa {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 13.5px; font-weight: 700;
  color: var(--text);
  transition: all .15s;
}
.qa:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.qa-ic {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}

/* ---------- TABLE ---------- */
.table-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
.pretty {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px;
}
.pretty thead th {
  text-align: left;
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.pretty thead th:first-child { border-radius: 12px 0 0 12px; }
.pretty thead th:last-child  { border-radius: 0 12px 12px 0; }
.pretty tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--border-2);
  color: var(--text-2);
  vertical-align: middle;
}
.pretty tbody tr:last-child td { border-bottom: 0; }
.pretty tbody tr { transition: background .12s; }
.pretty tbody tr:hover { background: var(--surface-2); }
.pretty td b { color: var(--text); font-weight: 700; }
.pretty td small {
  display: block; color: var(--text-3);
  font-size: 11.5px; margin-top: 2px;
  font-weight: 500;
}
.cell-id {
  font-family: var(--font-mono);
  font-size: 12.5px; font-weight: 700;
  color: var(--accent);
}
.empty-state {
  text-align: center; padding: 56px 20px;
  color: var(--text-3);
}
.empty-state-art { font-size: 64px; margin-bottom: 12px; display: inline-block; animation: floaty 4s ease-in-out infinite; }
.empty-state h4 {
  margin: 0; font-family: var(--font-display);
  font-size: 18px; color: var(--text); font-weight: 700;
}
.empty-state p { margin: 6px 0 16px; font-size: 13px; }

/* ---------- BADGES & PRIORIDADES ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}
.badge i { font-size: 10px; }
.badge.pendiente   { background: var(--c-amber-soft);  color: var(--c-amber); }
.badge.recibido    { background: var(--c-blue-soft);   color: var(--c-blue); }
.badge.en_proceso  { background: var(--c-purple-soft); color: var(--c-purple); }
.badge.solucionado { background: var(--c-green-soft);  color: var(--c-green); }
.badge.cerrado     { background: var(--c-gray-soft);   color: var(--c-gray); }
.badge.en_proceso i { animation: spin 1.6s linear infinite; }

.prio {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 6px;
  font-size: 11px; font-weight: 700;
}
.prio i { font-size: 9px; }
.prio.prio-baja    { background: var(--c-gray-soft);  color: var(--c-gray); }
.prio.prio-media   { background: var(--c-blue-soft);  color: var(--c-blue); }
.prio.prio-alta    { background: var(--c-amber-soft); color: var(--c-amber); }
.prio.prio-urgente { background: var(--c-red-soft);   color: var(--c-red); }
.prio.prio-urgente i { animation: pulse 1.3s ease-in-out infinite; }

.chip {
  display: inline-block;
  padding: 3px 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-2);
  font-weight: 600;
}

/* ---------- BUTTONS ---------- */
.btn, button.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border: 0; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font-size: 13.5px; font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn.small { height: 34px; padding: 0 14px; font-size: 12.5px; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: var(--shadow-accent);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.btn.danger { background: var(--c-red); color: white; }
.btn.success { background: var(--c-green); color: white; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: inline-grid; place-items: center;
  transition: all .12s;
  font-size: 13px;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.icon-btn.danger:hover { background: var(--c-red-soft); color: var(--c-red); border-color: var(--c-red); }

.actions { display: inline-flex; gap: 6px; }
.actions form { display: inline; margin: 0; }

/* ---------- FORMS ---------- */
.form-grid { display: grid; gap: 16px 18px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label {
  font-size: 12.5px; font-weight: 700;
  color: var(--text-2);
  letter-spacing: .015em;
  display: flex; align-items: center; gap: 6px;
}
.field-label .req { color: var(--accent); font-weight: 800; }
.field-help {
  font-size: 12px; color: var(--text-3); margin-top: 2px;
  line-height: 1.4;
}
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], input[type=date], input[type=datetime-local],
input[type=tel], input[type=url], input:not([type]), select, textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 13px 16px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit; font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease, transform .12s ease;
  box-shadow: 0 1px 0 rgba(124,109,240,.02) inset;
  appearance: none;
  -webkit-appearance: none;
}
input[type=text]:hover, input[type=email]:hover, input[type=password]:hover,
input[type=number]:hover, input[type=search]:hover, input[type=date]:hover,
input[type=datetime-local]:hover, input[type=tel]:hover, input[type=url]:hover,
input:not([type]):hover,
select:hover, textarea:hover {
  border-color: var(--accent-3, #c8bff5);
  background: var(--surface);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-ring), 0 2px 8px rgba(124,109,240,.08);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-2);
  color: var(--text-3);
  cursor: not-allowed;
  opacity: .65;
}
input[readonly] {
  background: var(--surface-2);
  color: var(--text-2);
  cursor: default;
}
input::placeholder, textarea::placeholder {
  color: var(--text-3);
  font-weight: 400;
  opacity: 1;
}
textarea { min-height: 110px; resize: vertical; font-family: inherit; line-height: 1.55; }

/* Select: flecha custom violeta */
select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 42px;
  cursor: pointer;
}
select:focus {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent-2, var(--accent)) 50%),
    linear-gradient(135deg, var(--accent-2, var(--accent)) 50%, transparent 50%);
}

/* Inputs de fecha: cursor pointer + icono coloreado */
input[type=date], input[type=datetime-local], input[type=time] { cursor: pointer; }
input[type=date]::-webkit-calendar-picker-indicator,
input[type=datetime-local]::-webkit-calendar-picker-indicator,
input[type=time]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: .55;
  transition: opacity .15s;
  filter: invert(40%) sepia(70%) saturate(2000%) hue-rotate(230deg) brightness(95%) contrast(95%);
}
input[type=date]:hover::-webkit-calendar-picker-indicator,
input[type=datetime-local]:hover::-webkit-calendar-picker-indicator,
input[type=time]:hover::-webkit-calendar-picker-indicator { opacity: 1; }

/* Search: lupita built-in del navegador menos fea */
input[type=search] { -webkit-appearance: none; }
input[type=search]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 16px; width: 16px;
  background: var(--text-3);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/></svg>") center/contain no-repeat;
  cursor: pointer;
}

/* Inputs con error (añade class="has-error") */
input.has-error, select.has-error, textarea.has-error {
  border-color: var(--danger, #ef4d6b);
  background: rgba(239,77,107,.04);
}
input.has-error:focus, select.has-error:focus, textarea.has-error:focus {
  box-shadow: 0 0 0 4px rgba(239,77,107,.14);
}

/* Inputs con éxito (añade class="has-ok") */
input.has-ok, select.has-ok, textarea.has-ok {
  border-color: var(--ok, #2bb673);
  background: rgba(43,182,115,.04);
}

/* Grupos input + addon (ej: prefijos €, @, etc.) */
.input-group {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  overflow: hidden;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.input-group:hover { border-color: var(--accent-3, #c8bff5); background: var(--surface); }
.input-group:focus-within {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-ring), 0 2px 8px rgba(124,109,240,.08);
}
.input-group > input, .input-group > select {
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  flex: 1;
}
.input-group > input:focus, .input-group > select:focus { box-shadow: none !important; }
.input-group .addon {
  display: flex; align-items: center;
  padding: 0 14px;
  background: var(--accent-soft, #ece8ff);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  border-right: 1.5px solid var(--border);
}
.input-group .addon.right { border-right: none; border-left: 1.5px solid var(--border); }

.checkbox-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0;
  font-size: 13.5px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-2);
  user-select: none;
}
.checkbox-row input { width: auto; }

input[type=checkbox], input[type=radio] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: all .15s ease;
  flex-shrink: 0;
  margin: 0;
}
input[type=checkbox] { border-radius: 6px; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:hover, input[type=radio]:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
input[type=checkbox]:checked, input[type=radio]:checked {
  border-color: var(--accent);
  background: var(--accent);
}
input[type=checkbox]:checked::before {
  content: "";
  width: 11px; height: 11px;
  background: white;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
}
input[type=radio]:checked::before {
  content: "";
  width: 8px; height: 8px;
  background: white;
  border-radius: 50%;
}
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.filebox {
  border: 2px dashed var(--accent-3);
  border-radius: 18px;
  padding: 30px 20px;
  text-align: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13.5px;
  cursor: pointer;
  transition: all .15s;
}
.filebox:hover { background: var(--surface); border-color: var(--accent); }
.filebox i { font-size: 30px; margin-bottom: 10px; display: block; color: var(--accent); }
.filebox input { display: none; }
.filebox strong { display: block; margin-bottom: 4px; font-size: 14px; }
.filebox small { color: var(--text-3); }
.filebox.has-files { background: var(--c-green-soft); border-color: var(--c-green); color: var(--c-green); }
.filebox.has-files i { color: var(--c-green); }

/* ---------- FILE PILLS ---------- */
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.file-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  color: var(--text);
  transition: all .12s;
}
.file-pill:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.file-pill i { color: var(--accent); }
.file-pill .size { color: var(--text-3); font-size: 11px; font-weight: 500; }

/* ---------- GRIDS ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1.4fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-side { display: grid; grid-template-columns: 1fr 360px; gap: 18px; }
.grid-dash { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }

/* ---------- INCIDENT HEAD ---------- */
.incident-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center; gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 22px 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.big-avatar {
  width: 68px; height: 68px;
  border-radius: 22px;
  background: var(--accent-soft);
  display: grid; place-items: center;
  font-size: 34px;
}
.incident-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px; font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
}
.incident-head .meta {
  display: flex; gap: 14px;
  font-size: 12.5px; color: var(--text-3);
  margin-top: 6px;
  flex-wrap: wrap;
  font-weight: 500;
}
.incident-head .meta span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- CHAT ---------- */
.chat-panel { display: flex; flex-direction: column; }
.chat-box {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  height: 420px; overflow-y: auto;
  scroll-behavior: smooth;
}
.msg {
  background: var(--surface);
  border-radius: 16px;
  padding: 10px 14px;
  margin: 8px 0;
  max-width: 78%;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-2);
  animation: slideUp .18s ease;
}
.msg.mine {
  margin-left: auto;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border-color: var(--accent);
}
.msg.mine b, .msg.mine small { color: rgba(255,255,255,.85); }
.msg.system {
  margin: 12px auto;
  text-align: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--text-3);
  font-size: 11.5px;
  max-width: none;
  font-weight: 600;
}
.msg b {
  display: block; font-size: 12px;
  color: var(--text-2);
  margin-bottom: 3px;
  font-weight: 700;
}
.msg p { margin: 0; font-size: 13.5px; word-wrap: break-word; }
.msg small {
  display: block; font-size: 10.5px;
  color: var(--text-3); margin-top: 4px;
}
.chat-form { display: flex; gap: 8px; margin-top: 12px; }
.chat-form input { flex: 1; border-radius: 999px; }
.chat-form button {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white; border: 0;
  display: grid; place-items: center;
  box-shadow: var(--shadow-accent);
}
.chat-form button:hover { filter: brightness(1.05); }

/* ---------- STORE LIST ---------- */
.store-list { display: grid; gap: 10px; }
.store-card {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 16px;
  transition: all .15s;
}
.store-card:hover { border-color: var(--accent); background: var(--surface-2); }
.store-card b { font-weight: 700; color: var(--text); font-family: var(--font-display); }
.store-card small { display: block; color: var(--text-3); font-size: 12px; margin-top: 2px; font-weight: 500; }
.store-card .badge.ok { background: var(--c-green-soft); color: var(--c-green); border-radius: 999px; padding: 4px 12px; }

/* ---------- LOGIN / INSTALL ---------- */
.auth-bg {
  min-height: 100vh;
  display: grid; place-items: center;
  background: var(--bg);
  background-image:
    radial-gradient(at 20% 20%, var(--accent-soft) 0px, transparent 50%),
    radial-gradient(at 80% 80%, var(--c-pink-soft) 0px, transparent 50%);
  padding: 24px;
  font-family: var(--font-sans);
}
.auth-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 32px;
  padding: 44px 36px 36px;
  box-shadow: var(--shadow-xl);
  text-align: center;
}
.auth-logo {
  width: 72px; height: 72px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 30% 30%, #b6a8ff 0%, #7c6df0 60%, #6857ea 100%);
  color: white;
  margin: 0 auto 22px;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 36px; font-weight: 800;
  box-shadow: var(--shadow-accent);
  position: relative;
}
.auth-logo::after {
  content: '';
  position: absolute;
  top: 18px; right: 18px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: white;
  box-shadow: 14px 0 0 0 rgba(255,255,255,.95);
  opacity: .7;
}
.auth-card h1 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 28px; font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
}
.auth-card .sub {
  color: var(--text-3);
  font-size: 13.5px;
  margin-bottom: 28px;
  font-weight: 500;
}
.auth-card form { display: grid; gap: 12px; }
.auth-card button[type=submit] {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: 0; border-radius: 999px;
  padding: 14px;
  font-weight: 700; font-size: 14px;
  cursor: pointer;
  transition: all .15s;
  box-shadow: var(--shadow-accent);
}
.auth-card button[type=submit]:hover { filter: brightness(1.06); }
.auth-foot {
  margin-top: 26px;
  font-size: 12px; color: var(--text-3);
  font-weight: 500;
}

.alert {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13px;
  margin: 10px 0;
  display: flex; align-items: flex-start; gap: 9px;
  text-align: left;
  font-weight: 600;
}
.alert i { margin-top: 2px; }
.alert.ok  { background: var(--c-green-soft); color: var(--c-green); }
.alert.err { background: var(--c-red-soft);   color: var(--c-red); }
.alert.warn{ background: var(--c-amber-soft); color: var(--c-amber); }
.alert.info{ background: var(--c-blue-soft);  color: var(--c-blue); }

/* ---------- INSTALL ---------- */
.install-wrap {
  width: min(640px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 32px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.install-head {
  padding: 30px 34px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
}
.install-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px; font-weight: 800;
  letter-spacing: -.02em;
}
.install-head p { margin: 6px 0 0; color: rgba(255,255,255,.9); font-size: 13.5px; font-weight: 500; }
.install-body { padding: 30px 34px; }

/* ---------- FILTERS ---------- */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}
.filters .field { min-width: 160px; }
.filters input, .filters select { height: 38px; padding: 0 14px; font-size: 13px; border-radius: 999px; }

/* ---------- TIMELINE ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: ''; position: absolute;
  left: 10px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item::before {
  content: ''; position: absolute;
  left: -22px; top: 4px;
  width: 14px; height: 14px;
  background: var(--accent);
  border: 2px solid var(--bg);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.tl-time { font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.tl-text { font-size: 13.5px; color: var(--text); margin-top: 2px; }
.tl-text b { font-weight: 700; color: var(--accent); }

/* ---------- CHART ---------- */
.chart-wrap { position: relative; min-height: 260px; }
.chart-wrap canvas { max-width: 100%; }

/* ---------- HEATMAP ---------- */
.heatmap {
  display: grid;
  grid-template-columns: 50px repeat(24, 1fr);
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
}
.heatmap .h-label { color: var(--text-3); text-align: right; padding-right: 8px; display: flex; align-items: center; justify-content: flex-end; font-weight: 600; }
.heatmap .h-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--surface-2);
  display: grid; place-items: center;
  color: transparent;
  transition: transform .1s;
  cursor: default;
}
.heatmap .h-cell:hover { transform: scale(1.4); z-index: 5; color: white; }
.heatmap .h-cell[data-v="0"] { background: var(--surface-2); }
.heatmap .h-cell[data-v="1"] { background: rgba(124,109,240,.20); }
.heatmap .h-cell[data-v="2"] { background: rgba(124,109,240,.40); }
.heatmap .h-cell[data-v="3"] { background: rgba(124,109,240,.65); }
.heatmap .h-cell[data-v="4"] { background: rgba(124,109,240,.90); }
.heatmap .h-head { color: var(--text-3); text-align: center; font-weight: 600; }

/* ---------- DECO MASCOT ---------- */
.deco-cat {
  position: absolute;
  font-size: 64px;
  pointer-events: none;
  filter: drop-shadow(0 8px 16px rgba(80,60,160,.18));
  animation: floaty 4s ease-in-out infinite;
  z-index: 1;
}
.deco-cat.tr { top: -18px; right: 18px; transform: rotate(8deg); }
.deco-cat.br { bottom: -18px; right: 18px; transform: rotate(-6deg); }

/* ---------- FOOTER ---------- */
.appfoot {
  margin-top: auto;
  padding: 24px 0;
  border-top: 1px solid var(--border-2);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 32px;
  font-weight: 500;
}
.appfoot-meta { display: flex; gap: 8px; align-items: center; }

/* ---------- ANIMATIONS ---------- */
@keyframes slideDown  { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes slideUp    { from { opacity: 0; transform: translateY(8px); }  to { opacity: 1; transform: none; } }
@keyframes spin       { to { transform: rotate(360deg); } }
@keyframes pulse      { 50% { opacity: .6; transform: scale(1.1); } }
@keyframes wave       { 0%,60%,100% { transform: rotate(0); } 10%,30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(14deg); } 50% { transform: rotate(-4deg); } }
@keyframes floaty     { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1200px) { .grid-dash { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .grid2, .grid-side { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0;
    width: 280px; height: 100vh;
    transform: translateX(-100%);
    transition: transform .25s;
    z-index: 100;
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: grid; place-items: center; }
  .main { padding: 18px; }
  .grid3 { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .incident-head { grid-template-columns: auto 1fr; }
  .incident-head > *:last-child { grid-column: 1 / -1; }
  .form-grid.cols-2 { grid-template-columns: 1fr; }
  .topbar h2 { font-size: 24px; }
  .logout span { display: none; }
  .logout { padding: 0 6px; }
  .heatmap { grid-template-columns: 40px repeat(24, 1fr); }
  .heatmap .h-head, .heatmap .h-label { font-size: 9px; }
}

/* ---------- UTILS ---------- */
.muted { color: var(--text-3); }
.mt-0 { margin-top: 0; } .mt-16 { margin-top: 16px; }
.flex { display: flex; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.text-right { text-align: right; }
hr { border: 0; border-top: 1px solid var(--border-2); margin: 18px 0; }
.avatar-sm {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px;
  background: var(--accent-soft);
  border-radius: 10px;
  font-size: 16px;
  margin-right: 8px;
  vertical-align: middle;
}
.avatar-md {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px;
  background: var(--accent-soft);
  border-radius: 14px;
  font-size: 22px;
  vertical-align: middle;
}

/* ---------- NOTIFICATIONS PANEL ---------- */
.notif-wrap { position: relative; }
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: 540px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 16px 48px -8px rgba(60, 40, 140, .22), 0 4px 12px rgba(60, 40, 140, .08);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: notifIn .18s cubic-bezier(.2,.9,.3,1.2);
  transform-origin: top right;
}
@keyframes notifIn {
  from { opacity: 0; transform: translateY(-8px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.notif-panel[hidden] { display: none; }
.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--accent-soft, #ece8ff) 0%, var(--surface) 100%);
}
.notif-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display, inherit);
}
.notif-head h4 i { color: var(--accent); }
.notif-all {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 8px;
  transition: background .15s;
}
.notif-all:hover { background: var(--accent-soft); }
.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}
.notif-loading, .notif-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.notif-empty-ic {
  font-size: 42px;
  margin-bottom: 8px;
  animation: floaty 3s ease-in-out infinite;
}
.notif-empty p { margin: 0; font-weight: 600; color: var(--text-2); }
.notif-item {
  display: block;
  padding: 12px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: background .12s;
  border-left: 3px solid transparent;
  margin-bottom: 2px;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.prio-urgente { border-left-color: #ef4d6b; }
.notif-item.prio-alta    { border-left-color: #f59f3b; }
.notif-item.prio-normal  { border-left-color: var(--accent); }
.notif-item.prio-baja    { border-left-color: var(--border); }
.notif-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.notif-order {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: .02em;
}
.notif-status {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.notif-status.st-pendiente  { background: rgba(245,159,59,.14);  color: #b46d10; }
.notif-status.st-recibido   { background: rgba(124,109,240,.12); color: var(--accent); }
.notif-status.st-en_proceso { background: rgba(56,142,255,.12);  color: #1d6fdc; }
.notif-status.st-solucionado{ background: rgba(43,182,115,.14);  color: #1f8e57; }
.notif-status.st-cerrado    { background: var(--surface-2);      color: var(--text-3); }
.notif-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-item-sub {
  font-size: 11.5px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 4px;
}
.notif-item-sub i { font-size: 10px; }
.notif-when { color: var(--text-3); }

@media (max-width: 600px) {
  .notif-panel {
    position: fixed;
    top: 70px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}

/* ---------- NOTIFICATIONS · v3.4 (no leídas) ---------- */
.notif-item {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 10px;
  align-items: center;
  position: relative;
  padding: 12px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  border-left: 3px solid transparent;
  margin-bottom: 2px;
  transition: background .12s;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.is-unread { background: var(--accent-soft, #ece8ff); }
.notif-item.is-unread:hover { background: #ddd4ff; }
.notif-item.is-read { opacity: .72; }
.notif-item.is-read:hover { opacity: 1; }

.notif-ic {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--surface);
  color: var(--accent);
  font-size: 15px;
  border: 1px solid var(--border);
}
.notif-item.type-incident_new .notif-ic { color: #1f8e57; background: rgba(43,182,115,.10); border-color: rgba(43,182,115,.25); }
.notif-item.type-message_new  .notif-ic { color: var(--accent); background: rgba(124,109,240,.10); border-color: rgba(124,109,240,.25); }

.notif-body { min-width: 0; }
.notif-item-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-item-sub {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-when { font-size: 11px; color: var(--text-3); }
.notif-unread-dot {
  width: 9px; height: 9px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(124,109,240,.18);
  flex-shrink: 0;
}
