/* ERP MLC · dirección visual corporativa v4 */
:root {
  --navy: #0e253e;
  --navy-2: #173d60;
  --blue: #1f78c8;
  --blue-bright: #3995e4;
  --violet: #6c5ac7;
  --violet-soft: #f1effc;
  --ink: #172b40;
  --muted: #64788d;
  --page: #f3f6fa;
  --panel: #fff;
  --line: #dce5ee;
  --line-strong: #c5d3e1;
  --green: #15815f;
  --red: #c94255;
  --amber: #b36f18;
  --shadow: 0 10px 30px rgba(19, 49, 78, .075);
  --shadow-raised: 0 18px 46px rgba(13, 39, 65, .13);
}

html { background: var(--page); }
body {
  background:
    radial-gradient(circle at 74% -15%, rgba(74, 151, 223, .12), transparent 31%),
    radial-gradient(circle at 28% 118%, rgba(108, 90, 199, .07), transparent 30%),
    var(--page);
}

/* Navegación corporativa */
.app-shell { grid-template-columns: 238px minmax(0, 1fr); }
.app-main { margin-left: 238px; }
.sidebar {
  width: 238px;
  padding: 18px 14px;
  background:
    radial-gradient(circle at 12% 0, rgba(57, 149, 228, .22), transparent 27%),
    linear-gradient(180deg, #143652 0%, #102a44 48%, #0b2036 100%);
  box-shadow: 10px 0 34px rgba(10, 31, 51, .1);
}
.app-brand {
  min-height: 66px;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 15px;
  background: rgba(255, 255, 255, .045);
}
.app-brand:hover { border-color: rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .075); }
.app-brand .brand-mark { width: 43px; height: 43px; border-radius: 13px; box-shadow: 0 8px 18px rgba(3, 19, 34, .25); }
.app-brand > span:nth-child(2) strong { font-size: 14px; }
.app-brand > span:nth-child(2) small { color: #a8bfd3; font-size: 10px; }
.app-brand > b svg { width: 17px; height: 17px; }
.side-nav { gap: 6px; padding: 22px 1px; }
.side-nav button {
  min-height: 52px;
  gap: 11px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #c8d7e5;
  font-size: 13px;
}
.side-nav button .nav-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  border-radius: 10px;
  color: #b9d0e3;
  background: rgba(255, 255, 255, .07);
}
.nav-icon svg { width: 19px; height: 19px; display: block; }
.side-nav button:hover { border-color: rgba(255, 255, 255, .07); color: #fff; background: rgba(255, 255, 255, .06); }
.side-nav button.active {
  border-color: rgba(106, 181, 244, .28);
  color: #fff;
  background: linear-gradient(110deg, rgba(43, 137, 218, .34), rgba(108, 90, 199, .17));
  box-shadow: inset 3px 0 #55adf4, 0 8px 18px rgba(5, 23, 39, .12);
}
.side-nav button.active .nav-icon { color: #fff; background: linear-gradient(145deg, #2787d7, #6c5ac7); box-shadow: 0 6px 15px rgba(4, 28, 49, .18); }
.sync-note { padding: 12px; border: 1px solid rgba(255, 255, 255, .06); background: rgba(3, 18, 32, .2); }
.sync-note strong { font-size: 11px; }
.sync-note small { color: #a9bfd2; }
.account-button { min-height: 58px; padding: 9px 10px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .05); }
.account-button > span { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }

.page-content { width: min(100%, 1560px); padding: 30px clamp(25px, 3.1vw, 48px) 78px; }

/* Cabeceras con presencia, sin ocupar media pantalla */
.page-header, .inventory-minimal-header {
  position: relative;
  min-height: 112px;
  margin: 0 0 20px;
  padding: 22px 25px;
  align-items: center;
  border: 1px solid rgba(197, 214, 229, .9);
  border-radius: 19px;
  background:
    radial-gradient(circle at 94% 12%, rgba(62, 150, 228, .13), transparent 29%),
    linear-gradient(130deg, rgba(255, 255, 255, .99), rgba(247, 251, 255, .98));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.page-header::before, .inventory-minimal-header::before {
  content: "";
  position: absolute;
  top: -48px;
  right: 8%;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(85, 160, 225, .12);
  border-radius: 50%;
  box-shadow: 0 0 0 24px rgba(92, 163, 225, .035), 0 0 0 50px rgba(108, 90, 199, .025);
  pointer-events: none;
}
.page-header > div, .page-header .header-actions, .inventory-minimal-header > * { position: relative; z-index: 1; }
.eyebrow, .inventory-minimal-header span { color: var(--violet); font-size: 10px; font-weight: 900; letter-spacing: .1em; }
.page-header h1, .inventory-minimal-header h1 { color: var(--navy); font-size: clamp(29px, 2.7vw, 38px); }
.page-header p { margin-top: 6px; color: #5d7186; font-size: 13px; }
.header-actions { gap: 9px; }

.button { min-height: 44px; padding: 10px 16px; border-radius: 11px; font-size: 12px; }
.button.primary {
  border-color: #196bb5;
  background: linear-gradient(145deg, #2788db, #1768b1 74%);
  box-shadow: 0 8px 19px rgba(30, 118, 198, .2);
}
.button.primary:hover { background: linear-gradient(145deg, #3294e4, #1768b1 74%); box-shadow: 0 10px 24px rgba(30, 118, 198, .27); transform: translateY(-1px); }
.button.secondary, .mini-button, .tool-reset { background: linear-gradient(180deg, #fff, #f8fafc); }
.button.secondary:hover, .mini-button:hover, .tool-reset:hover { border-color: #9fbcd7; background: #f4f9fd; transform: translateY(-1px); }
.panel, .work-panel { border-color: rgba(210, 222, 233, .95); border-radius: 17px; box-shadow: var(--shadow); }
.work-panel { overflow: hidden; }

/* Inicio profesional */
.home-heading {
  position: relative;
  min-height: 174px;
  margin-bottom: 18px;
  padding: 30px 31px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 22px;
  color: #fff;
  background:
    radial-gradient(circle at 86% 13%, rgba(95, 185, 255, .3), transparent 27%),
    radial-gradient(circle at 68% 110%, rgba(130, 103, 226, .34), transparent 34%),
    linear-gradient(125deg, #102b47 0%, #174c75 60%, #236fa8 100%);
  box-shadow: 0 20px 50px rgba(13, 49, 81, .2);
  overflow: hidden;
}
.home-heading::after {
  content: "";
  position: absolute;
  right: -52px;
  bottom: -105px;
  width: 275px;
  height: 275px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(255, 255, 255, .025), 0 0 0 74px rgba(255, 255, 255, .018);
}
.home-heading > div, .home-account { position: relative; z-index: 1; }
.home-heading > div > span { color: #9fd4ff; }
.home-heading h1 { color: #fff; font-size: clamp(34px, 4vw, 48px); }
.home-heading p { color: #d5e8f7; font-size: 14px; }
.home-account { padding: 9px 11px; border-color: rgba(255, 255, 255, .17); color: #fff; background: rgba(255, 255, 255, .1); backdrop-filter: blur(10px); }
.home-account:hover { border-color: rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .14); }
.home-account > span { background: rgba(9, 36, 59, .55); }
.home-account strong { color: #fff; }
.home-account small { color: #d2e6f5; }

.home-dashboard-row { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(290px, .75fr); gap: 16px; margin-bottom: 24px; }
.home-operation, .home-stock-panel {
  min-width: 0;
  margin: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .95);
  box-shadow: var(--shadow);
}
.home-operation > header, .home-areas > header { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 13px; }
.home-operation > header > div, .home-areas > header > div { display: grid; gap: 3px; }
.home-operation > header span, .home-areas > header span { color: var(--violet); font-size: 9px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.home-operation h2, .home-areas h2 { color: var(--navy); font-size: 18px; letter-spacing: -.02em; }
.home-operation > header p, .home-areas > header p { margin: 0; color: var(--muted); font-size: 11px; }
.minimal-fast-actions { gap: 11px; }
.minimal-fast-actions button, .minimal-count-action {
  position: relative;
  min-height: 82px;
  padding: 15px 17px;
  border-color: #d6e1eb;
  border-radius: 14px;
  background: linear-gradient(145deg, #fff, #f8fbfd);
  box-shadow: 0 7px 18px rgba(23, 51, 79, .045);
  overflow: hidden;
}
.minimal-fast-actions button::after { content: ""; position: absolute; inset: auto 0 0; height: 3px; background: var(--green); opacity: .75; }
.minimal-fast-actions button.exit::after { background: var(--red); }
.minimal-fast-actions button:hover, .minimal-count-action:hover { border-color: #acc5db; box-shadow: 0 12px 27px rgba(23, 51, 79, .09); transform: translateY(-2px); }
.minimal-fast-actions button > span, .minimal-count-action > span { width: 43px; height: 43px; border-radius: 12px; box-shadow: 0 7px 16px rgba(19, 53, 80, .13); }
.minimal-fast-actions strong, .minimal-count-action strong { font-size: 15px; }

.home-stock-panel {
  color: #fff;
  background:
    radial-gradient(circle at 100% 0, rgba(85, 174, 242, .18), transparent 35%),
    linear-gradient(150deg, #173b5c, #102a44);
}
.home-stock-panel > header { display: flex; align-items: center; gap: 11px; padding-bottom: 14px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.home-stock-panel > header > span { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: linear-gradient(145deg, #318fda, #705dca); }
.home-stock-panel svg { width: 21px; height: 21px; }
.home-stock-panel > header > div { display: grid; gap: 2px; }
.home-stock-panel > header small { color: #a7c5da; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.home-stock-panel > header strong { font-size: 14px; }
.home-stock-panel > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 15px; }
.home-stock-panel > div > span { display: grid; gap: 4px; }
.home-stock-panel > div b { color: #fff; font-size: 23px; letter-spacing: -.04em; }
.home-stock-panel > div small { color: #aac1d2; font-size: 9px; }
.home-stock-panel > div .warning b { color: #ffc36e; }

.home-areas { margin-bottom: 0; }
.home-area-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; overflow: visible; border: 0; border-radius: 0; background: transparent; }
.home-area-list button,
.home-area-list button:nth-child(2n),
.home-area-list button:nth-last-child(-n+2) {
  min-height: 122px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 8px 22px rgba(22, 50, 78, .05);
}
.home-area-list button:hover { border-color: #a7c5df; background: #fff; box-shadow: 0 15px 34px rgba(21, 55, 87, .11); transform: translateY(-2px); }
.home-area-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; color: #287cc4; background: #e9f4fd; box-shadow: inset 0 0 0 1px rgba(34, 118, 193, .05); }
.home-area-icon svg { width: 24px; height: 24px; }
.home-area-icon.green { color: #14785a; background: #e9f7f1; }
.home-area-icon.red { color: #bd4050; background: #fff0f2; }
.home-area-icon.navy { color: #fff; background: linear-gradient(145deg, #255f8c, #173d60); }
.home-area-list button > div { gap: 5px; }
.home-area-list strong { color: var(--navy); font-size: 15px; }
.home-area-list button > div > span { color: var(--muted); font-size: 11px; line-height: 1.45; white-space: normal; }
.home-area-list button > b { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; color: #6a7e91; background: #f2f5f8; font-size: 19px; }

/* Componentes de trabajo */
.inline-summary { gap: 10px; margin: -6px 0 15px; }
.inline-summary span { padding: 7px 10px; border: 1px solid #dfe7ef; border-radius: 999px; background: rgba(255, 255, 255, .8); box-shadow: 0 4px 12px rgba(25, 54, 83, .03); }
.tools, .tools:has(.compact-select) { padding: 17px 18px; background: linear-gradient(180deg, #fff, #fbfcfe); }
.search input, .select select { height: 46px; border-radius: 11px; background-color: #fff; }
.search input:focus, .select select:focus { border-color: #67a8df; box-shadow: 0 0 0 4px rgba(31, 120, 200, .1); }
.result-count { padding: 7px 10px; border: 1px solid #e3eaf1; border-radius: 999px; background: #f5f8fb; }
.data-table th { padding: 13px 16px; background: #f7f9fc; }
.data-table td { padding: 15px 16px; }
.data-table tbody tr:hover { background: #f7fbff; }

/* Inventario */
.inventory-minimal-header { display: flex; }
.inventory-minimal-header > div { gap: 2px; }
.inventory-minimal-header::after { content: "Existencias y movimientos"; position: absolute; left: 25px; bottom: 18px; color: var(--muted); font-size: 11px; }
.inventory-minimal-header > div { padding-bottom: 18px; }
.inventory-toolbar { padding: 15px 17px; background: linear-gradient(180deg, #fff, #fbfcfe); }
.inventory-search > div { height: 46px; border-radius: 11px; }
.inventory-filters > summary { min-height: 44px; border-radius: 11px; }
.inventory-list-heading { padding: 11px 18px; background: #f7f9fc; }
.inventory-row { min-height: 78px; padding: 13px 18px; transition: background .16s ease, transform .16s ease; }
.inventory-row:hover { position: relative; z-index: 1; background: #f8fbff; }
.inventory-product strong { color: var(--navy); font-size: 14px; }
.inventory-row-stock > strong { font-size: 21px; }
.inventory-row-status { margin-top: 4px; }
.inventory-row-menu > summary { border-radius: 9px; background: linear-gradient(180deg, #fff, #f7f9fb); }

/* Catálogo, directorios y archivos */
.catalog-mobile-card, .directory-row, .document-card { transition: background .16s ease; }
.directory-row { min-height: 74px; padding: 14px 17px; }
.directory-row:hover, .document-card:hover { background: #f8fbff; }
.directory-row .client-mark { border-radius: 12px; color: #fff; background: linear-gradient(145deg, #337fbe, #6959bc); box-shadow: 0 7px 15px rgba(37, 86, 129, .13); }
.directory-row strong { color: var(--navy); font-size: 13px; }
.document-card { min-height: 82px; padding: 16px 18px; }
.document-icon { border-radius: 12px; box-shadow: 0 7px 16px rgba(30, 70, 105, .1); }
.document-card header strong { color: var(--navy); font-size: 13px; }
.document-details > summary { padding: 4px 0; }

/* Códigos SAT */
.sat-inline-form input { height: 42px; border-color: #d9b268; border-radius: 10px; background: linear-gradient(180deg, #fffefb, #fffbf2); box-shadow: inset 0 1px 2px rgba(113, 75, 18, .035); }
.sat-inline-form input:focus { outline: none; border-color: #c48829; box-shadow: 0 0 0 4px rgba(196, 136, 41, .1); }
.sat-code { border-radius: 9px; background: #edf7ff; }
.sat-mobile-code { border-top-style: dashed; }

/* Cotizador */
.quote-tabs { width: max-content; padding: 4px; border-radius: 11px; box-shadow: 0 5px 16px rgba(24, 53, 82, .04); }
.quote-tabs button { min-height: 39px; padding-inline: 16px; }
.quote-tabs button.active { color: #fff; background: linear-gradient(145deg, #287fca, #6556b9); box-shadow: 0 6px 15px rgba(37, 101, 162, .18); }
.quote-customer-card, .quote-lines-card, .quote-finish-card { border-radius: 17px; box-shadow: var(--shadow); }
.quote-customer-card { border-top: 3px solid var(--violet); }
.quote-lines-card { border-top: 3px solid var(--blue); }
.quote-finish-card { border-top: 3px solid var(--green); }
.quote-line { border-radius: 13px; background: linear-gradient(145deg, #fff, #fafcff); }
.quote-totals .grand { border-radius: 13px; background: linear-gradient(135deg, #153b5e, #235f90 65%, #6657b8); box-shadow: 0 10px 24px rgba(18, 58, 91, .16); }

/* Conteo físico */
.inventory-count-start { border-top: 4px solid var(--blue); box-shadow: var(--shadow); }
.inventory-count-archive { border-radius: 15px; box-shadow: 0 7px 20px rgba(24, 54, 84, .045); }
.inventory-count-progress { box-shadow: var(--shadow); }
.inventory-count-workspace { box-shadow: var(--shadow); }

/* Ventanas y notificaciones */
.modal { border-radius: 24px; box-shadow: 0 34px 90px rgba(5, 25, 43, .3); }
.modal > header { background: linear-gradient(145deg, #fff, #f5f9fd); }
.notification-bubble { background: linear-gradient(145deg, #dd4e62, #c63147); box-shadow: 0 14px 32px rgba(187, 45, 67, .3); }
.notification-bubble span svg { width: 21px; height: 21px; display: block; }

@media (max-width: 1200px) {
  .home-dashboard-row { grid-template-columns: 1fr; }
  .home-stock-panel > div { max-width: 500px; }
  .home-area-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app-main { margin-left: 0; }
  .mobile-header { background: linear-gradient(120deg, #173c5b, #102940); }
  .mobile-header button svg { width: 19px; height: 19px; display: block; }
  .mobile-nav button .nav-icon { width: 27px; height: 27px; display: grid; place-items: center; color: #74889b; }
  .mobile-nav button .nav-icon svg { width: 18px; height: 18px; }
  .mobile-nav button.active .nav-icon { color: var(--blue); }
  .page-header, .inventory-minimal-header { min-height: 105px; padding: 19px 20px; border-radius: 17px; }
  .inventory-minimal-header > div { padding-bottom: 17px; }
  .inventory-minimal-header::after { left: 20px; bottom: 16px; }
  .home-heading { min-height: 155px; padding: 25px; }
  .home-heading h1 { font-size: 36px; }
  .home-area-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-area-list button,
  .home-area-list button:nth-child(2n),
  .home-area-list button:nth-last-child(-n+2) { border: 1px solid var(--line); }
}

@media (max-width: 620px) {
  body { background: #f4f7fa; }
  .page-content { padding-top: 14px; }
  .page-header, .inventory-minimal-header { min-height: auto; padding: 17px; border-radius: 15px; }
  .page-header h1, .inventory-minimal-header h1 { font-size: 27px; }
  .page-header p { max-width: 92%; }
  .inventory-minimal-header > div { padding-bottom: 18px; }
  .inventory-minimal-header::after { left: 17px; bottom: 15px; }
  .home-heading { min-height: 145px; align-items: flex-start; padding: 22px 20px; border-radius: 18px; }
  .home-heading h1 { font-size: 31px; }
  .home-account { padding: 7px; }
  .home-dashboard-row { gap: 12px; margin-bottom: 20px; }
  .home-operation, .home-stock-panel { padding: 15px; border-radius: 15px; }
  .home-operation > header { align-items: flex-start; flex-direction: column; gap: 4px; }
  .minimal-fast-actions button { min-height: 72px; }
  .home-stock-panel > div b { font-size: 20px; }
  .home-area-list { grid-template-columns: 1fr; gap: 9px; }
  .home-area-list button,
  .home-area-list button:nth-child(2n),
  .home-area-list button:nth-last-child(-n+2) { min-height: 88px; padding: 14px; border-radius: 14px; }
  .home-area-icon { width: 42px; height: 42px; }
  .home-area-list button > div > span { line-height: 1.35; }
  .home-areas > header { align-items: flex-start; }
  .home-areas > header p { display: none; }
  .tools, .tools:has(.compact-select) { padding: 13px; }
  .inventory-row { border-left: 3px solid transparent; }
  .inventory-row.empty { border-left-color: var(--red); }
  .inventory-row.low { border-left-color: var(--amber); }
  .directory-row, .document-card { min-height: 72px; }
  .quote-tabs { width: 100%; }
  .quote-tabs button { flex: 1; }
  .modal { border-radius: 22px 22px 0 0; }
}
