@charset "UTF-8";
/* ============================================================
   CRM Ingenieria LMP - Main Stylesheet
   Paleta: Teal #005050 / #50A0A0 + Morado #8060A0
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=Source+Sans+3:wght@300;400;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ---- VARIABLES MODO CLARO ---- */
:root {
  /* Paleta LMP - colores exactos del logo */
  --lmp-cyan:     #50A0AA;  /* letra L */
  --lmp-dark:     #005050;  /* letra M */
  --lmp-purple:   #8264AA;  /* letra P */

  --c-teal-dark:  #005050;
  --c-teal:       #50A0AA;
  --c-teal-mid:   #3d8a90;
  --c-teal-light: #e0f2f3;
  --c-purple:     #8264AA;
  --c-purple-dk:  #6a4f90;
  --c-purple-lt:  #ede8f5;

  /* Funcionales modo claro */
  --c-navy:       var(--c-teal-dark);
  --c-blue:       var(--c-teal);
  --c-blue-mid:   var(--c-teal-mid);
  --c-blue-light: var(--c-teal-light);
  --c-accent:     var(--c-purple);
  --c-accent-dk:  var(--c-purple-dk);

  --c-success:    #1e8a5e;
  --c-warning:    #d4881a;
  --c-danger:     #c0392b;
  --c-info:       #2475a8;

  --c-gray-50:    #f7f8fa;
  --c-gray-100:   #eef0f4;
  --c-gray-200:   #dde1e9;
  --c-gray-400:   #9aa3b2;
  --c-gray-600:   #596070;
  --c-gray-800:   #2d3242;
  --c-white:      #ffffff;
  --c-bg:         #f4f6f8;

  /* Layout */
  --sidebar-w:    240px;
  --header-h:     58px;
  --radius:       8px;
  --radius-sm:    4px;
  --radius-lg:    12px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:       0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:    0 8px 30px rgba(0,0,0,.14);
  --transition:   .18s ease;
  --font-ui:      'IBM Plex Sans', sans-serif;
  --font-body:    'Source Sans 3', sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;
}

/* ---- MODO OSCURO ---- */
[data-theme="dark"] {
  --c-teal-dark:  #50A0A0;
  --c-teal:       #6bbaba;
  --c-teal-mid:   #82c8c8;
  --c-teal-light: #0d2828;
  --c-purple:     #a080c8;
  --c-purple-dk:  #b898d8;
  --c-purple-lt:  #1e1428;

  --c-navy:       var(--c-teal-dark);
  --c-blue:       var(--c-teal);
  --c-blue-mid:   var(--c-teal-mid);
  --c-blue-light: var(--c-teal-light);
  --c-accent:     var(--c-purple);
  --c-accent-dk:  var(--c-purple-dk);

  --c-success:    #3ec98a;
  --c-warning:    #f0a83a;
  --c-danger:     #e05c4a;
  --c-info:       #5aabde;

  --c-gray-50:    #141820;
  --c-gray-100:   #1e2330;
  --c-gray-200:   #2a3045;
  --c-gray-400:   #7a8499;
  --c-gray-600:   #aab2c2;
  --c-gray-800:   #e8ecf4;
  --c-white:      #1a1f2e;
  --c-bg:         #0f1219;

  --shadow-sm:    0 1px 3px rgba(0,0,0,.3);
  --shadow:       0 4px 12px rgba(0,0,0,.4);
  --shadow-lg:    0 8px 30px rgba(0,0,0,.5);
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--c-gray-800);
  background: var(--c-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--c-blue); text-decoration: none; }
a:hover { color: var(--c-blue-mid); }
img { max-width: 100%; display: block; }

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

/* ---- TOP HEADER ---- */
.app-header {
  grid-column: 1 / -1;
  grid-row: 1;
  background: var(--c-teal-dark);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky; top: 0; z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.app-header .logo-wrap {
  display: flex; align-items: center; gap: .65rem;
  color: white; font-family: var(--font-ui);
  font-weight: 700; font-size: .95rem;
  min-width: calc(var(--sidebar-w) - 1.5rem);
}
.app-header .logo-wrap img { height: 44px; width: auto; filter: brightness(0) invert(1); }
.app-header .logo-badge {
  background: var(--c-purple); color: white;
  font-size: .6rem; font-weight: 700; padding: 1px 5px;
  border-radius: var(--radius-sm); text-transform: uppercase;
  letter-spacing: .05em; align-self: flex-start; margin-top: 2px;
}
.header-spacer { flex: 1; }
.header-actions { display: flex; align-items: center; gap: .75rem; }
.header-user {
  display: flex; align-items: center; gap: .6rem;
  color: rgba(255,255,255,.85); font-size: .875rem;
  cursor: pointer; padding: .4rem .75rem; border-radius: var(--radius);
  position: relative;
  z-index: 201;
}
.header-user:hover { background: rgba(255,255,255,.12); }
.header-user .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--c-purple); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; font-family: var(--font-ui);
  border: 2px solid rgba(255,255,255,.25);
}
.user-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--c-white); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); min-width: 200px;
  border: 1px solid var(--c-gray-200); overflow: hidden;
  display: none; z-index: 300;
}
.user-dropdown.open { display: block; }
.user-dropdown a {
  display: flex; align-items: center; gap: .6rem;
  padding: .65rem 1rem; color: var(--c-gray-800);
  font-size: .875rem; transition: background var(--transition);
}
.user-dropdown a:hover { background: var(--c-gray-50); }
.user-dropdown .divider { height: 1px; background: var(--c-gray-200); margin: .25rem 0; }
.user-dropdown .danger { color: var(--c-danger); }

.btn-menu {
  display: none; background: none; border: none;
  color: white; cursor: pointer; padding: .4rem; border-radius: var(--radius-sm);
}
.btn-menu:hover { background: rgba(255,255,255,.1); }

/* ---- SIDEBAR ---- */
.app-sidebar {
  grid-column: 1;
  grid-row: 2;
  background: var(--c-white);
  border-right: 1px solid var(--c-gray-200);
  overflow-y: auto;
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
}
.nav-section { padding: 1.25rem 0 .5rem; }
.nav-section-label {
  padding: 0 1.1rem .35rem;
  font-size: .7rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--c-gray-400);
  font-family: var(--font-ui);
}
.nav-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem 1.1rem; color: var(--c-gray-600);
  font-size: .875rem; font-family: var(--font-ui);
  transition: all var(--transition); cursor: pointer;
  border-left: 3px solid transparent;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; opacity: .7; }
.nav-item:hover { background: var(--c-teal-light); color: var(--c-teal-dark); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
  background: var(--c-teal-light); color: var(--c-teal-dark);
  border-left-color: var(--c-teal); font-weight: 600;
}
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto; background: var(--c-purple); color: white;
  font-size: .65rem; font-weight: 700;
  padding: 1px 6px; border-radius: 10px; font-family: var(--font-ui);
}

/* ---- MAIN CONTENT ---- */
.app-main {
  grid-column: 2;
  grid-row: 2;
  padding: 1.75rem;
  overflow-x: hidden;
  min-width: 0;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.75rem; gap: 1rem; flex-wrap: wrap;
}
.page-title {
  font-family: var(--font-ui); font-size: 1.4rem;
  font-weight: 700; color: var(--c-teal-dark); line-height: 1.2;
}
.page-subtitle { font-size: .875rem; color: var(--c-gray-400); margin-top: .2rem; }
.page-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--c-white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); border: 1px solid var(--c-gray-200);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--c-gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-family: var(--font-ui); font-weight: 600; font-size: .95rem; color: var(--c-teal-dark); }
.card-body { padding: 1.25rem; }
.card-footer { padding: .85rem 1.25rem; background: var(--c-gray-50); border-top: 1px solid var(--c-gray-200); }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.stat-card {
  background: var(--c-white); border-radius: var(--radius-lg);
  border: 1px solid var(--c-gray-200); padding: 1.25rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: var(--shadow-sm); transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-icon { width: 44px; height: 44px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 26px; height: 26px; }
.stat-icon.blue   { background: var(--c-teal-light); color: var(--c-teal-dark); }
.stat-icon.navy   { background: var(--c-teal-light); color: var(--c-teal); }
.stat-icon.accent { background: var(--c-purple-lt); color: var(--c-purple-dk); }
.stat-icon.green  { background: #e4f5ed; color: var(--c-success); }
.stat-value { font-family: var(--font-ui); font-size: 1.6rem; font-weight: 700; color: var(--c-teal-dark); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--c-gray-400); margin-top: .2rem; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem 1.1rem; border-radius: var(--radius);
  font-family: var(--font-ui); font-size: .875rem; font-weight: 500;
  cursor: pointer; border: 1.5px solid transparent;
  transition: all var(--transition); white-space: nowrap;
  text-decoration: none; line-height: 1.4;
}
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary   { background: var(--c-teal); color: white; border-color: var(--c-teal); }
.btn-primary:hover   { background: var(--c-teal-dark); border-color: var(--c-teal-dark); color: white; }
.btn-secondary { background: var(--c-white); color: var(--c-gray-800); border-color: var(--c-gray-200); }
.btn-secondary:hover { background: var(--c-gray-50); border-color: var(--c-gray-400); color: var(--c-gray-800); }
.btn-accent    { background: var(--c-purple); color: white; border-color: var(--c-purple); font-weight: 600; }
.btn-accent:hover { background: var(--c-purple-dk); border-color: var(--c-purple-dk); color: white; }
.btn-danger    { background: var(--c-danger); color: white; border-color: var(--c-danger); }
.btn-danger:hover { background: #a93226; color: white; }
.btn-ghost     { background: transparent; color: var(--c-teal); border-color: transparent; }
.btn-ghost:hover { background: var(--c-teal-light); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg { padding: .7rem 1.4rem; font-size: 1rem; }
.btn-icon { padding: .45rem; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; margin-bottom: .35rem; font-size: .825rem; font-weight: 600; color: var(--c-gray-800); font-family: var(--font-ui); }
.form-label .required { color: var(--c-danger); margin-left: .2rem; }
.form-control {
  display: block; width: 100%;
  padding: .5rem .8rem; border-radius: var(--radius);
  border: 1.5px solid var(--c-gray-200); background: var(--c-white);
  font-size: .875rem; color: var(--c-gray-800);
  font-family: var(--font-body); transition: border-color var(--transition); outline: none;
}
.form-control:focus { border-color: var(--c-teal); box-shadow: 0 0 0 3px rgba(80,160,160,.15); }
.form-control::placeholder { color: var(--c-gray-400); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: .775rem; color: var(--c-gray-400); margin-top: .25rem; }
.form-row { display: grid; gap: 1rem; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th {
  background: var(--c-gray-50); padding: .7rem 1rem;
  text-align: left; font-family: var(--font-ui);
  font-size: .75rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--c-gray-400);
  border-bottom: 1px solid var(--c-gray-200); white-space: nowrap;
}
.table td { padding: .75rem 1rem; border-bottom: 1px solid var(--c-gray-100); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--c-teal-light); }
.table .actions { display: flex; gap: .4rem; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .55rem; border-radius: 20px;
  font-size: .72rem; font-weight: 600; font-family: var(--font-ui);
  letter-spacing: .02em; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-primary   { background: var(--c-teal-light); color: var(--c-teal-dark); }
.badge-secondary { background: var(--c-gray-100); color: var(--c-gray-600); }
.badge-success   { background: #e4f5ed; color: var(--c-success); }
.badge-warning   { background: #fdf3e3; color: var(--c-warning); }
.badge-danger    { background: #fce8e7; color: var(--c-danger); }
.badge-info      { background: #e3f0f8; color: var(--c-info); }
.badge-accent    { background: var(--c-purple-lt); color: var(--c-purple-dk); }

/* ============================================================
   SEARCH + FILTERS BAR
   ============================================================ */
.filters-bar { display: flex; gap: .75rem; align-items: center; margin-bottom: 1.25rem; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.search-box svg { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--c-gray-400); width: 17px; height: 17px; pointer-events: none; }
.search-box input {
  width: 100%; padding: .5rem .8rem .5rem 2.2rem;
  border: 1.5px solid var(--c-gray-200); border-radius: var(--radius);
  font-size: .875rem; background: var(--c-white);
  transition: border-color var(--transition); outline: none;
  color: var(--c-gray-800);
}
.search-box input:focus { border-color: var(--c-teal); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 1000; display: none; align-items: center; justify-content: center; padding: 1rem;
}
.modal-backdrop.open { display: flex; animation: fade-in .15s ease; }
.modal {
  background: var(--c-white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 600px;
  max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; min-height: 0;
  animation: slide-up .2s ease;
}
.modal.modal-lg { max-width: 860px; }
.modal.modal-xl { max-width: 1100px; }
.modal-header {
  padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--c-gray-200);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--c-teal-dark); color: white;
}
.modal-title { font-family: var(--font-ui); font-weight: 600; font-size: 1rem; }
.modal-close { background: none; border: none; color: rgba(255,255,255,.7); cursor: pointer; padding: .3rem; border-radius: var(--radius-sm); line-height: 1; font-size: 1.4rem; }
.modal-close:hover { color: white; background: rgba(255,255,255,.15); }
.modal-body { padding: 1.4rem; overflow-y: auto; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; }
.modal > form { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.modal > form > .modal-body { flex: 1; overflow-y: auto; }
.modal-footer { padding: .9rem 1.4rem; border-top: 1px solid var(--c-gray-200); display: flex; justify-content: flex-end; gap: .6rem; background: var(--c-gray-50); }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress { height: 6px; background: var(--c-gray-200); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--c-teal); border-radius: 3px; transition: width .4s ease; }
.progress-bar.green  { background: var(--c-success); }
.progress-bar.accent { background: var(--c-purple); }

/* ============================================================
   KANBAN / TIMELINE
   ============================================================ */
.kanban-board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.kanban-col { min-width: 260px; background: var(--c-gray-50); border-radius: var(--radius-lg); border: 1px solid var(--c-gray-200); flex-shrink: 0; }
.kanban-col-header { padding: .75rem 1rem; border-bottom: 1px solid var(--c-gray-200); display: flex; align-items: center; justify-content: space-between; font-family: var(--font-ui); font-size: .8rem; font-weight: 600; }
.kanban-items { padding: .75rem; display: flex; flex-direction: column; gap: .6rem; min-height: 80px; }
.kanban-card { background: var(--c-white); border-radius: var(--radius); padding: .85rem; box-shadow: var(--shadow-sm); border: 1px solid var(--c-gray-200); cursor: pointer; transition: box-shadow var(--transition); }
.kanban-card:hover { box-shadow: var(--shadow); }
.kanban-card-title { font-size: .875rem; font-weight: 600; color: var(--c-teal-dark); margin-bottom: .3rem; }
.kanban-card-meta { font-size: .75rem; color: var(--c-gray-400); display: flex; gap: .5rem; flex-wrap: wrap; }

/* Timeline */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before { content: ''; position: absolute; left: .5rem; top: 0; bottom: 0; width: 2px; background: var(--c-gray-200); }
.timeline-item { position: relative; margin-bottom: 1.2rem; }
.timeline-dot { position: absolute; left: -1.5rem; top: .3rem; width: 12px; height: 12px; border-radius: 50%; background: var(--c-gray-200); border: 2px solid white; box-shadow: 0 0 0 2px var(--c-gray-200); }
.timeline-dot.done   { background: var(--c-success); box-shadow: 0 0 0 2px var(--c-success); }
.timeline-dot.active { background: var(--c-teal); box-shadow: 0 0 0 2px var(--c-teal); animation: pulse 1.5s infinite; }
.timeline-dot.overdue{ background: var(--c-danger); box-shadow: 0 0 0 2px var(--c-danger); }
.timeline-content { background: var(--c-white); border-radius: var(--radius); padding: .8rem 1rem; border: 1px solid var(--c-gray-200); }
.timeline-title { font-size: .875rem; font-weight: 600; color: var(--c-teal-dark); }
.timeline-meta { font-size: .775rem; color: var(--c-gray-400); margin-top: .2rem; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--c-teal-dark) 0%, var(--c-teal) 55%, var(--c-purple) 100%);
  padding: 1.5rem;
}
.login-card { background: var(--c-white); border-radius: var(--radius-lg); padding: 2.5rem 2rem; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo img { height: 80px; margin: 0 auto 1rem; display: block; filter: none; mix-blend-mode: normal; }
.login-logo h1 { font-family: var(--font-ui); font-size: 1.3rem; font-weight: 700; color: var(--c-teal-dark); }
.login-logo p { font-size: .825rem; color: var(--c-gray-400); margin-top: .3rem; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert { padding: .75rem 1rem; border-radius: var(--radius); font-size: .875rem; display: flex; align-items: flex-start; gap: .6rem; margin-bottom: 1rem; border: 1px solid; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: .05rem; }
.alert-success { background: #e4f5ed; border-color: #b8e0ce; color: #14614a; }
.alert-danger   { background: #fce8e7; border-color: #f5b7b3; color: #922b21; }
.alert-warning  { background: #fdf3e3; border-color: #f5d5a0; color: #8a5d0a; }
.alert-info     { background: var(--c-teal-light); border-color: #a0d0d0; color: var(--c-teal-dark); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--c-gray-400); }
.empty-state svg { width: 48px; height: 48px; margin: 0 auto .75rem; opacity: .35; }
.empty-state h3 { font-family: var(--font-ui); font-size: 1rem; color: var(--c-gray-600); margin-bottom: .4rem; }
.empty-state p { font-size: .875rem; }

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; border-bottom: 2px solid var(--c-gray-200); margin-bottom: 1.25rem; gap: .1rem; flex-wrap: wrap; }
.tab-btn { padding: .6rem 1.1rem; border: none; background: none; cursor: pointer; font-family: var(--font-ui); font-size: .875rem; color: var(--c-gray-600); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all var(--transition); }
.tab-btn:hover { color: var(--c-teal); }
.tab-btn.active { color: var(--c-teal-dark); border-bottom-color: var(--c-teal); font-weight: 600; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============================================================
   QUOTE ITEMS TABLE
   ============================================================ */
.quote-items-table { width: 100%; }
.quote-items-table input[type="text"],
.quote-items-table input[type="number"] { border: 1px solid var(--c-gray-200); border-radius: var(--radius-sm); padding: .35rem .5rem; width: 100%; font-size: .85rem; outline: none; background: var(--c-white); color: var(--c-gray-800); }
.quote-items-table input:focus { border-color: var(--c-teal); }
.quote-subtotal { font-family: var(--font-mono); font-size: .875rem; text-align: right; }

/* ── Inputs numéricos HH: sin spinners — prioridad 3 dígitos visibles ── */
.hh-num-inp { -moz-appearance: textfield; appearance: textfield; }
.hh-num-inp::-webkit-inner-spin-button,
.hh-num-inp::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.quote-totals { text-align: right; padding: .75rem; font-family: var(--font-ui); font-size: .9rem; }
.quote-totals .total-row { display: flex; justify-content: flex-end; gap: 2rem; padding: .3rem 0; }
.quote-totals .grand-total { font-size: 1.15rem; font-weight: 700; color: var(--c-teal-dark); border-top: 2px solid var(--c-teal-dark); padding-top: .5rem; margin-top: .3rem; }

/* ============================================================
   TOGGLE MODO OSCURO
   ============================================================ */
.btn-theme-toggle {
  background: none; border: none; color: rgba(255,255,255,.75);
  cursor: pointer; padding: .45rem; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; transition: all var(--transition);
}
.btn-theme-toggle:hover { color: white; background: rgba(255,255,255,.12); }
.btn-theme-toggle svg { width: 20px; height: 20px; }


/* ---- HEADER COLOR POR SECCION ---- */
/* Dashboard: 3 franjas iguales con slash entre cada una */
body.section-dashboard .app-header {
  background: #50A0AA;
}
body.section-dashboard .app-header::before {
  content: '';
  position: absolute;
  top: 0; left: 33.33%; bottom: 0;
  width: calc(33.33% + 20px);
  background: #005050;
  clip-path: polygon(20px 0, 100% 0, calc(100% - 20px) 100%, 0 100%);
  z-index: 0;
}
body.section-dashboard .app-header::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: calc(33.33% + 20px);
  background: #8264AA;
  clip-path: polygon(20px 0, 100% 0, 100% 100%, 0 100%);
  z-index: 0;
}

/* Secciones individuales: color sólido sin franjas */
body.section-clients   .app-header { background: #50A0AA; }
body.section-clients   .app-header::before,
body.section-clients   .app-header::after { display: none; }

body.section-projects  .app-header { background: #005050; }
body.section-projects  .app-header::before,
body.section-projects  .app-header::after { display: none; }

body.section-quotes    .app-header { background: #8264AA; }
body.section-quotes    .app-header::before,
body.section-quotes    .app-header::after { display: none; }

body.section-users     .app-header,
body.section-activity  .app-header { background: #005050; }
body.section-users     .app-header::before,
body.section-users     .app-header::after,
body.section-activity  .app-header::before,
body.section-activity  .app-header::after { display: none; }

/* Contenido siempre encima */
.app-header > * { position: relative; z-index: 1; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fade-in  { from { opacity: 0 } to { opacity: 1 } }
@keyframes slide-up { from { opacity: 0; transform: translateY(16px) } to { opacity: 1; transform: none } }
@keyframes pulse    { 0%,100% { opacity: 1 } 50% { opacity: .5 } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }
  .app-sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0;
    width: var(--sidebar-w); z-index: 150;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .app-sidebar.open { transform: none; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 140; display: none; }
  .sidebar-overlay.open { display: block; }
  .btn-menu { display: flex; }
  .app-main { padding: 1.25rem 1rem; }
  .form-row.cols-3 { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  /* Modales full-width en tablet */
  .modal, .modal.modal-lg, .modal.modal-xl { max-width: 98vw; margin: .5rem; }
  /* Tablas: scroll horizontal con indicador visual */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap::after { content: ''; display: block; }
  /* Header: ocultar texto "CRM" en móvil para dar más espacio */
  .logo-wrap > div { display: none; }
}

@media (max-width: 600px) {
  :root { --header-h: 52px; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; gap: .75rem; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }
  /* Modales pantalla completa en móvil */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal, .modal.modal-lg, .modal.modal-xl {
    max-width: 100%; max-height: 95vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin: 0;
  }
  /* Tablas: columnas no esenciales ocultas */
  .table .hide-mobile { display: none; }
  /* Tabs: scroll horizontal */
  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .tab-btn { white-space: nowrap; }
  /* Cards: padding reducido */
  .card-body { padding: .875rem; }
  .card-header { padding: .75rem .875rem; }
  /* Stat cards: 2 columnas en móvil */
  .stat-card { padding: 1rem; }
  .stat-value { font-size: 1.3rem; }
  /* Filtros: stack vertical */
  .filters-bar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }
  /* Gantt: scroll horizontal con hint */
  .gantt-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* App main: menos padding */
  .app-main { padding: 1rem .75rem; }
  /* Header logo más pequeño */
  .app-header .logo-wrap img { height: 26px; }
  .app-header { padding: 0 .875rem; gap: .5rem; }
  .app-header .logo-wrap { min-width: unset; }ilqt1450   [,]
  .app-header .logo-badge { display: none; }
  .header-actions { gap: .4rem; }
  /* Botones de acción en tablas: solo iconos */
  .table .actions .btn span { display: none; }
  /* Page title más pequeño */
  .page-title { font-size: 1.15rem; }
}

@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr; }
  .app-main { padding: .75rem .5rem; }
}

/* ============================================================
   PRINT
   ============================================================ */

/* Dashboard grid mobile */
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr !important; }
}
@media print {
  .app-sidebar, .app-header, .no-print, .btn, .modal-backdrop { display: none !important; }
  .app-layout { display: block; }
  .app-main { padding: 0; }
  body { background: white; font-size: 13px; }
}