/* ============================================================
   Servicio Rubí - PWA Taller Mecánico
   Design: Dark Mode Glassmorphism | Ruby Red Accent
   ============================================================ */

/* --- Custom Properties --- */
:root {
  --bg-primary: #f7f9fb;
  --bg-secondary: #eceef0;
  --bg-card: #ffffff;
  --bg-card-hover: #f2f4f6;
  --bg-glass: rgba(247, 249, 251, 0.85);
  --bg-glass-light: rgba(0, 0, 0, 0.04);
  --bg-input: #ffffff;
  --bg-sidebar: #eceef0;

  --ruby: #e96702;           /* Orange Accent */
  --ruby-light: #F97316;     /* Orange Light */
  --ruby-dark: #783200;      /* Orange Dark */
  --ruby-glow: rgba(233, 103, 2, 0.2);
  --ruby-subtle: rgba(233, 103, 2, 0.08);

  --accent-blue: #4FC3F7;
  --accent-green: #4CAF82;
  --accent-orange: #F97316;
  --accent-purple: #9C6FDE;
  --accent-yellow: #FFD166;

  --text-primary: #191c1e;
  --text-secondary: #46464b;
  --text-muted: #77767b;
  --text-on-ruby: #ffffff;

  --border: #c7c6cb;
  --border-active: #e96702;

  --sidebar-width: 260px;
  --topbar-height: 64px;
  --bottom-nav-height: 68px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 8px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 16px 32px rgba(0,0,0,0.08);
  --shadow-ruby: 0 4px 12px rgba(233, 103, 2, 0.15);

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Dark Mode (Industrial Precision Dark) --- */
[data-theme="dark"] {
  --bg-primary: #131316;
  --bg-secondary: #1b1b1e;
  --bg-card: #1f1f22;
  --bg-card-hover: #2a2a2d;
  --bg-glass: rgba(19, 19, 22, 0.92);
  --bg-glass-light: rgba(255, 255, 255, 0.04);
  --bg-input: #27272a;
  --bg-sidebar: #18181b;

  --ruby: #f97316;
  --ruby-light: #ffb690;
  --ruby-dark: #9d4300;
  --ruby-glow: rgba(249, 115, 22, 0.2);
  --ruby-subtle: rgba(249, 115, 22, 0.10);

  --accent-blue: #89ceff;
  --accent-green: #6fcf97;
  --accent-orange: #ffb690;
  --accent-purple: #c084fc;
  --accent-yellow: #ffd166;

  --text-primary: #e4e1e6;
  --text-secondary: #a1a1aa;
  --text-muted: #6b6b73;
  --text-on-ruby: #131316;

  --border: #3f3f46;
  --border-active: #f97316;

  --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 16px 32px rgba(0,0,0,0.5);
  --shadow-ruby: 0 4px 12px rgba(249, 115, 22, 0.25);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html[data-theme] { transition: background var(--transition-slow), color var(--transition-slow); }
html[data-theme] *, html[data-theme] *::before, html[data-theme] *::after { transition: background var(--transition-slow), border-color var(--transition-slow), color var(--transition-slow), box-shadow var(--transition-slow); }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { border: none; background: none; cursor: pointer; font-family: inherit; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
img { max-width: 100%; display: block; }

/* Background animated gradient */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 10% 0%, rgba(249, 115, 22, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 100%, rgba(137, 206, 255, 0.03) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* --- Material Icons --- */
.material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-slow);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--ruby), var(--ruby-dark));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-ruby);
  flex-shrink: 0;
}
.brand-icon .material-symbols-rounded { font-size: 20px; color: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.brand-sub { font-size: 11px; color: var(--text-muted); font-weight: 400; }

.sidebar-close {
  display: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-glass-light);
  align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
}
.sidebar-close:hover { background: var(--ruby-subtle); color: var(--ruby-light); }

.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition: var(--transition);
}
.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--ruby-subtle);
  color: var(--ruby-light);
}
.nav-item.active .nav-icon {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
.nav-icon { font-size: 20px; flex-shrink: 0; }
.nav-label { flex: 1; }
.nav-badge {
  min-width: 20px; height: 20px;
  background: var(--ruby);
  color: #fff;
  font-size: 11px; font-weight: 700;
  border-radius: 10px;
  display: none;
  align-items: center; justify-content: center;
  padding: 0 6px;
}
.nav-badge.visible { display: flex; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass-light);
}
.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--ruby), var(--accent-purple));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; line-height: 1.3; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* --- Overlay --- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}
.overlay.visible { opacity: 1; pointer-events: auto; }

/* --- Main Layout --- */
.main-layout {
  margin-left: var(--sidebar-width);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* --- Theme Toggle --- */
.theme-toggle {
  position: relative;
  width: 36px;
  height: 36px;
}
.theme-toggle .theme-icon-light,
.theme-toggle .theme-icon-dark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.theme-toggle .theme-icon-dark {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}
[data-theme="dark"] .theme-toggle .theme-icon-light {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}
[data-theme="dark"] .theme-toggle .theme-icon-dark {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* --- Topbar --- */
.topbar {
  position: sticky; top: 0;
  height: var(--topbar-height);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 80;
}
.menu-toggle {
  display: none;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  align-items: center; justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-glass-light);
  transition: var(--transition);
}
.menu-toggle:hover { background: var(--ruby-subtle); color: var(--ruby-light); }

.topbar-title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-glass-light);
  transition: var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--ruby-subtle); color: var(--ruby-light); }
.notif-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: var(--ruby);
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
  display: none;
}
.notif-dot.visible { display: block; }

/* --- Search Bar --- */
.search-bar-container {
  padding: 0 20px;
  max-height: 0; overflow: hidden;
  transition: max-height var(--transition), padding var(--transition);
}
.search-bar-container.open { max-height: 80px; padding: 12px 20px; }
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}
.search-bar input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 14px; color: var(--text-primary);
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar .material-symbols-rounded { color: var(--text-muted); font-size: 20px; }
#searchClose { color: var(--text-muted); transition: var(--transition); }
#searchClose:hover { color: var(--ruby-light); }

/* --- Page Content --- */
.page-content {
  flex: 1;
  padding: 24px 20px calc(var(--bottom-nav-height) + 16px);
  overflow-y: auto;
}

/* --- Bottom Nav --- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 80;
}
.bnav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
  padding: 8px 0;
  transition: var(--transition);
}
.bnav-item .material-symbols-rounded { font-size: 22px; }
.bnav-item.active { color: var(--ruby-light); }
.bnav-item.active .material-symbols-rounded {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-close { display: flex; }
  .main-layout { margin-left: 0; }
  .menu-toggle { display: flex; }
  .bottom-nav { display: flex; }
  .page-content { padding-bottom: calc(var(--bottom-nav-height) + 24px); }
}
@media (min-width: 769px) {
  .topbar { padding: 0 28px; }
  .topbar-title { display: none; }
  .page-content { padding: 28px 28px 28px; }
}

/* ============================================================
   COMPONENTS
   ============================================================ */

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}
.card:hover { background: var(--bg-card-hover); border-color: rgba(255,255,255,0.12); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-size: 15px; font-weight: 600; color: var(--text-primary);
}
.card-subtitle {
  font-size: 12px; color: var(--text-muted);
  margin-top: 2px;
}

/* --- KPI Cards --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; align-items: flex-start; gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: var(--transition);
}
.kpi-card:hover::before { opacity: 1; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.kpi-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kpi-icon .material-symbols-rounded {
  font-size: 24px;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
.kpi-icon.ruby { background: var(--ruby-subtle); color: var(--ruby-light); }
.kpi-icon.blue { background: rgba(79,195,247,0.12); color: var(--accent-blue); }
.kpi-icon.green { background: rgba(76,175,130,0.12); color: var(--accent-green); }
.kpi-icon.orange { background: rgba(255,140,66,0.12); color: var(--accent-orange); }
.kpi-icon.purple { background: rgba(156,111,222,0.12); color: var(--accent-purple); }

.kpi-body { flex: 1; }
.kpi-value { font-size: 28px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.kpi-label { font-size: 13px; color: var(--text-secondary); }
.kpi-trend {
  font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 3px;
  margin-top: 6px;
}
.kpi-trend.up { color: var(--accent-green); }
.kpi-trend.down { color: var(--ruby-light); }

/* --- Tables --- */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-glass-light);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-card-hover); }
tbody td {
  padding: 14px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}
.td-muted { color: var(--text-secondary); font-size: 13px; }

/* --- Badges / Status --- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-pending { background: rgba(255,140,66,0.15); color: var(--accent-orange); }
.badge-active { background: rgba(79,195,247,0.15); color: var(--accent-blue); }
.badge-done { background: rgba(76,175,130,0.15); color: var(--accent-green); }
.badge-delivered { background: rgba(156,111,222,0.15); color: var(--accent-purple); }
.badge-cancelled { background: var(--ruby-subtle); color: var(--ruby-light); }
.badge-low { background: rgba(255,140,66,0.15); color: var(--accent-orange); }
.badge-ok { background: rgba(76,175,130,0.15); color: var(--accent-green); }
.badge-new { background: rgba(79,195,247,0.15); color: var(--accent-blue); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--ruby), var(--ruby-dark));
  color: #fff;
  box-shadow: var(--shadow-ruby);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--ruby-light), var(--ruby));
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(201,24,74,0.35);
}
.btn-secondary {
  background: var(--bg-glass-light);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-active); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-glass-light); }
.btn-danger { background: var(--ruby-subtle); color: var(--ruby-light); }
.btn-danger:hover { background: rgba(201,24,74,0.25); }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: var(--radius-sm); gap: 5px; }
.btn .material-symbols-rounded { font-size: 18px; }

/* --- Forms --- */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}
.form-control:focus { border-color: var(--ruby); box-shadow: 0 0 0 3px var(--ruby-glow); }
.form-control::placeholder { color: var(--text-muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 480px) { .form-grid { grid-template-columns: 1fr; } }
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%235A5B7A'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 36px;
}
select.form-control option { background: var(--bg-secondary); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.checkbox-label:hover { background: var(--bg-input); }
.checkbox-label input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--ruby);
  cursor: pointer;
}

/* --- Page Header --- */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header-left { flex: 1; }
.page-header h1 { font-size: 24px; font-weight: 800; }
.page-header p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* --- Section Headers --- */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 16px; font-weight: 700; }

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .material-symbols-rounded {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.4;
}
.empty-state h3 { font-size: 16px; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { font-size: 13px; }

/* --- Search & Filter Row --- */
.filters-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.search-input-wrapper {
  flex: 1; min-width: 200px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
}
.search-input-wrapper input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 14px; color: var(--text-primary);
}
.search-input-wrapper input::placeholder { color: var(--text-muted); }
.search-input-wrapper .material-symbols-rounded { color: var(--text-muted); font-size: 18px; }

/* --- List Items (mobile-friendly) --- */
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: var(--transition);
  margin-bottom: 10px;
}
.list-item:hover { background: var(--bg-card-hover); border-color: rgba(255,255,255,0.12); }
.list-avatar {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
  flex-shrink: 0;
}
.list-avatar.ruby { background: var(--ruby-subtle); color: var(--ruby-light); }
.list-avatar.blue { background: rgba(79,195,247,0.12); color: var(--accent-blue); }
.list-avatar.green { background: rgba(76,175,130,0.12); color: var(--accent-green); }
.list-avatar.orange { background: rgba(255,140,66,0.12); color: var(--accent-orange); }
.list-avatar.purple { background: rgba(156,111,222,0.12); color: var(--accent-purple); }
.list-info { flex: 1; min-width: 0; }
.list-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* --- Modal --- */
.modal-container {
  position: fixed; inset: 0;
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
  pointer-events: none;
}
.modal-container.open { pointer-events: auto; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(13, 13, 26, 0.65);
  backdrop-filter: blur(6px);
  opacity: 0; transition: opacity var(--transition-slow);
}
.modal-container.open .modal-backdrop { opacity: 1; }
.modal-box {
  position: relative;
  width: 100%; max-width: 560px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  max-height: 92dvh;
  overflow-y: auto;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform var(--transition-slow);
  box-shadow: var(--shadow-lg);
}
@media (min-width: 600px) {
  .modal-container { align-items: center; }
  .modal-box {
    border-radius: var(--radius-xl);
    max-height: 85dvh;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: transform var(--transition-slow), opacity var(--transition-slow);
  }
  .modal-container.open .modal-box {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}
.modal-container.open .modal-box { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 0;
  flex-shrink: 0;
}
.modal-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-glass-light);
  transition: var(--transition);
}
.modal-close:hover { background: var(--ruby-subtle); color: var(--ruby-light); }
.modal-body { padding: 20px; flex: 1; overflow-y: auto; color: var(--text-primary); }
.modal-footer {
  padding: 0 20px 20px;
  display: flex; gap: 10px; justify-content: flex-end;
  flex-shrink: 0;
}

/* --- Toast --- */
.toast-container {
  position: fixed;
  top: calc(var(--topbar-height) + 10px);
  right: 16px;
  z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 340px;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  font-size: 13px; font-weight: 500;
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  backdrop-filter: blur(12px);
}
.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--ruby-light); }
.toast.info { border-left: 3px solid var(--accent-blue); }
.toast .material-symbols-rounded { font-size: 20px; flex-shrink: 0; }
.toast.success .material-symbols-rounded { color: var(--accent-green); }
.toast.error .material-symbols-rounded { color: var(--ruby-light); }
.toast.info .material-symbols-rounded { color: var(--accent-blue); }

/* --- Misc Utilities --- */
.flex { display: flex; }
.flex-1 { flex: 1; }
.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-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-ruby { color: var(--ruby-light); }
.text-green { color: var(--accent-green); }
.text-blue { color: var(--accent-blue); }
.text-orange { color: var(--accent-orange); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 12px; }
.progress-bar { height: 6px; background: var(--bg-glass-light); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--ruby), var(--ruby-light)); border-radius: 3px; transition: width 0.5s ease; }

/* --- Charts area --- */
.chart-area {
  height: 140px;
  display: flex; align-items: flex-end; gap: 6px;
  padding: 0 4px;
}
.bar-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.bar {
  width: 100%; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--ruby-light), var(--ruby));
  transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 4px; opacity: 0.8;
}
.bar:hover { opacity: 1; transform: scaleX(1.05); }
.bar-label { font-size: 10px; color: var(--text-muted); }

/* --- Animations --- */
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateX(10px); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.animate-in { animation: fadeIn 0.35s ease both; }

/* --- Detail View --- */
.detail-section { margin-bottom: 24px; }
.detail-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 4px; }
.detail-value { font-size: 14px; color: var(--text-primary); }

/* --- Order Items --- */
.order-item-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px; align-items: center;
  padding: 10px;
  background: var(--bg-glass-light);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 13px;
}
@media (max-width: 480px) {
  .order-item-row { grid-template-columns: 1fr auto; }
}

/* --- Stats row --- */
.stats-row {
  display: flex; gap: 16px;
  flex-wrap: wrap;
}
.stat-block {
  flex: 1; min-width: 100px;
  background: var(--bg-glass-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-align: center;
}
.stat-num { font-size: 22px; font-weight: 800; }
.stat-lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* --- Floating Action Button --- */
.fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 16px);
  right: 16px;
  width: 52px; height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--ruby), var(--ruby-dark));
  color: #fff;
  display: none;
  align-items: center; justify-content: center;
  box-shadow: var(--shadow-ruby);
  z-index: 79;
  transition: var(--transition);
}
.fab:hover { transform: scale(1.08); box-shadow: 0 8px 28px rgba(201,24,74,0.45); }
@media (max-width: 768px) { .fab { display: flex; } }

/* --- Inventory low stock --- */
.stock-indicator {
  display: flex; align-items: center; gap: 6px;
}
.stock-bar { flex: 1; height: 4px; background: var(--bg-glass-light); border-radius: 2px; overflow: hidden; }
.stock-fill { height: 100%; border-radius: 2px; }
.stock-fill.ok { background: var(--accent-green); }
.stock-fill.low { background: var(--accent-orange); }
.stock-fill.critical { background: var(--ruby-light); }

/* --- Collapsible Navigation Groups --- */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  user-select: none;
}
.nav-group-header:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.nav-group-header::after {
  content: '';
  border: solid var(--text-muted);
  border-width: 0 2px 2px 0;
  display: inline-block;
  padding: 3px;
  position: absolute;
  right: 16px;
  top: calc(50% - 6px);
  transform: rotate(45deg);
  transition: transform var(--transition), border-color var(--transition);
}
.nav-group.open .nav-group-header::after {
  transform: rotate(-135deg);
  border-color: var(--ruby-light);
}
.nav-group-items {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding-left: 20px;
  border-left: 1px solid var(--border);
  margin-left: 24px;
  margin-top: 2px;
  margin-bottom: 6px;
}
.nav-group.open .nav-group-items {
  display: flex;
}
.nav-group-items .nav-item {
  font-size: 13px;
  padding: 8px 12px;
}

/* ── CRUD Cards Grid ───────────────────────────────────────── */
.crud-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.crud-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.crud-card:hover {
  border-color: var(--border-active);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.crud-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.crud-card-icon-box {
  width: 40px; height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--ruby-subtle);
  color: var(--ruby-light);
  display: flex; align-items: center; justify-content: center;
}
.crud-card-icon-box .material-symbols-rounded { font-size: 20px; }

.crud-card-info { flex: 1; min-width: 0; }
.crud-card-title {
  font-size: 14px; font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crud-card-subtitle {
  font-size: 12px; color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.crud-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.crud-card-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
}
.crud-card-meta-label {
  color: var(--text-muted);
  font-weight: 500;
  text-transform: capitalize;
  white-space: nowrap;
  flex-shrink: 0;
}
.crud-card-meta-value {
  color: var(--text-primary);
  text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.crud-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}
.crud-card-date {
  font-size: 11px;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 4px;
}
.crud-card-actions {
  display: flex; gap: 6px;
  flex-shrink: 0;
}

/* ── CRUD Badges (estado) ──────────────────────────────────── */
.crud-badge {
  font-size: 10px; font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.crud-badge-success { background: rgba(76,175,130,0.14); color: var(--accent-green); }
.crud-badge-warning { background: rgba(255,209,102,0.18); color: #c89000; }
.crud-badge-danger  { background: var(--ruby-subtle); color: var(--ruby-light); }
.crud-badge-info    { background: rgba(79,195,247,0.14); color: var(--accent-blue); }

/* ── Configuración Tabs ────────────────────────────────────── */
.config-tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}
.config-tab {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 20px;
  font-size: 14px; font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: var(--transition);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.config-tab:hover { color: var(--text-primary); background: var(--bg-glass-light); }
.config-tab.active {
  color: var(--ruby);
  border-bottom-color: var(--ruby);
  background: var(--ruby-subtle);
}
.config-tab .material-symbols-rounded { font-size: 18px; }

.config-panel { padding: 24px; }
.config-section-title {
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
