/* ==========================================================================
   Mezquital Frozen Storage — ERP Preview
   Paleta NEUTRA: grises y blancos + un acento teal tenue. Sobrio, de almacén.
   ========================================================================== */

:root {
  --bg:        #eef0f2;   /* fondo general, gris muy claro */
  --surface:   #ffffff;   /* tarjetas y paneles */
  --surface-2: #f7f8f9;   /* filas alternas / zonas suaves */
  --border:    #e0e3e6;
  --border-2:  #d3d7db;

  --text:      #1f2733;   /* texto principal */
  --text-2:    #5b6470;   /* texto secundario */
  --text-3:    #8a929c;   /* texto tenue */

  --accent:      #0f7d78; /* teal tenue (único acento) */
  --accent-dark: #0b625e;
  --accent-soft: #e6f2f1; /* fondo teal muy claro */

  /* Semáforo — tonos apagados, nada neón */
  --verde:      #4c9a6a;
  --verde-bg:   #e9f3ec;
  --ambar:      #c08a2e;
  --ambar-bg:   #f7efdf;
  --rojo:       #c0574e;
  --rojo-bg:    #f6e7e5;

  --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 1px 3px rgba(20, 30, 40, .04);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body, #root { height: 100%; margin: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }

/* ---- Layout ------------------------------------------------------------- */
.app { display: flex; min-height: 100%; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: #202833;      /* gris azulado oscuro, sobrio */
  color: #cfd6de;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 12px;
}
.brand .logo {
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--accent);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 17px; flex-shrink: 0;
}
.brand .brand-name { color: #fff; font-weight: 650; font-size: 15px; line-height: 1.15; }
.brand .brand-sub { color: #8b95a1; font-size: 12px; }

.nav { padding: 12px 12px; flex: 1; overflow-y: auto; }
.nav-section { color: #6f7986; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 12px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 11px 12px; margin: 2px 0;
  border: none; background: transparent; color: #cfd6de;
  border-radius: 8px; font-size: 14.5px;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 550; }
.nav-item .ic { width: 20px; text-align: center; font-size: 16px; opacity: .95; }
.nav-item .badge {
  margin-left: auto; background: rgba(255,255,255,.16); color: #fff;
  font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 20px;
}
.nav-item.active .badge { background: rgba(255,255,255,.25); }

.sidebar-foot { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #6f7986; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---- Topbar ------------------------------------------------------------- */
.topbar {
  height: 62px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 26px;
  position: sticky; top: 0; z-index: 10;
}
.topbar .page-title { font-size: 18px; font-weight: 650; }
.topbar .spacer { flex: 1; }
.topbar .today { color: var(--text-2); font-size: 13.5px; display: flex; align-items: center; gap: 7px; }

.role-switch { display: flex; align-items: center; gap: 8px; }
.role-switch .label { font-size: 12.5px; color: var(--text-3); }
.role-tabs { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.role-tab {
  border: none; background: transparent; color: var(--text-2);
  font-size: 13.5px; padding: 6px 14px; border-radius: 7px; font-weight: 500;
}
.role-tab:hover { color: var(--text); }
.role-tab.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); font-weight: 600; }

/* ---- Content ------------------------------------------------------------ */
.content { padding: 26px; max-width: 1320px; width: 100%; }
.page-intro { color: var(--text-2); font-size: 14px; margin: -4px 0 20px; max-width: 780px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.card-head h3 { font-size: 15.5px; }
.card-head .sub { color: var(--text-3); font-size: 12.5px; }
.card-head .spacer { flex: 1; }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-dash { grid-template-columns: 1.5fr 1fr; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-dash { grid-template-columns: 1fr; } }

/* ---- Stat cards --------------------------------------------------------- */
.stat { padding: 18px 20px; }
.stat .stat-label { color: var(--text-2); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.stat .stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; }
.stat .stat-value .unit { font-size: 15px; font-weight: 500; color: var(--text-3); margin-left: 4px; }
.stat .stat-foot { color: var(--text-3); font-size: 12.5px; margin-top: 4px; }
.stat .stat-ic { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 17px; }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; }

/* progress bar (ocupación) */
.progress { height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; margin-top: 12px; }
.progress > span { display: block; height: 100%; background: var(--accent); }

/* ---- Tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; color: var(--text-2); font-weight: 600; font-size: 12.5px;
  text-transform: uppercase; letter-spacing: .03em;
  padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2);
  white-space: nowrap; position: sticky; top: 0;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.t-strong { font-weight: 600; }
.t-muted { color: var(--text-3); }
.t-sku { font-family: 'SF Mono', ui-monospace, Menlo, monospace; font-size: 12.5px; color: var(--text-2); }

/* ---- Chips / semáforo --------------------------------------------------- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip.verde { background: var(--verde-bg); color: #2f6b47; }
.chip.verde .dot { background: var(--verde); }
.chip.ambar { background: var(--ambar-bg); color: #8a621b; }
.chip.ambar .dot { background: var(--ambar); }
.chip.rojo  { background: var(--rojo-bg);  color: #93372f; }
.chip.rojo .dot { background: var(--rojo); }
.chip.neutral { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.chip.accent { background: var(--accent-soft); color: var(--accent-dark); }

.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.tag.nueva { background: var(--accent-soft); border-color: #cfe6e4; color: var(--accent-dark); }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: 8px; font-size: 14px; font-weight: 550;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.lg { padding: 12px 22px; font-size: 15px; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn:disabled { opacity: .5; cursor: default; }

/* ---- Filters / inputs --------------------------------------------------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.select, .input {
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  padding: 9px 12px; border-radius: 8px; font-size: 14px; min-width: 150px;
}
.input { min-width: 240px; }
.select:focus, .input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-label { font-size: 12.5px; color: var(--text-3); margin-right: 2px; }

/* ---- Dropzone (carga diaria) ------------------------------------------- */
.dropzone {
  border: 2px dashed var(--border-2); border-radius: 12px; background: var(--surface-2);
  padding: 44px 24px; text-align: center; color: var(--text-2);
}
.dropzone .big-ic { font-size: 40px; }
.dropzone h3 { margin: 10px 0 4px; color: var(--text); }

.audit-stat { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.audit-stat .n { font-size: 26px; font-weight: 700; }
.audit-stat .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 19px; }

/* ---- Charts ------------------------------------------------------------- */
.legend { display: flex; flex-direction: column; gap: 12px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.legend-row .sw { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.legend-row .lg-name { color: var(--text); }
.legend-row .lg-val { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }
.legend-row .lg-pct { color: var(--text-3); font-size: 12.5px; width: 42px; text-align: right; }

.callout { background: var(--accent-soft); border: 1px solid #cfe6e4; border-radius: 9px; padding: 12px 14px; color: var(--accent-dark); font-size: 13px; display: flex; gap: 10px; }
.callout .ic { font-size: 15px; }

/* ---- Facturar hoy ------------------------------------------------------- */
.fact-client { margin-bottom: 18px; }
.fact-client .fc-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.fact-client .fc-head .fc-name { font-weight: 650; font-size: 15.5px; }
.fact-client .fc-total { margin-left: auto; text-align: right; }
.fact-client .fc-total .lbl { font-size: 12px; color: var(--text-3); }
.fact-client .fc-total .amt { font-size: 20px; font-weight: 700; }
.va-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--accent-dark); margin-top: 3px; }
.va-line .x { color: var(--text-3); cursor: pointer; border: none; background: none; font-size: 13px; }

/* Detalle de subtotales */
.sub-grid { display: flex; gap: 26px; padding: 12px 18px; background: var(--surface-2); border-top: 1px solid var(--border); flex-wrap: wrap; }
.sub-grid .s-item { font-size: 13px; color: var(--text-2); }
.sub-grid .s-item b { color: var(--text); font-weight: 650; }

/* ---- Modal -------------------------------------------------------------- */
.modal-back { position: fixed; inset: 0; background: rgba(20,28,38,.42); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 460px; box-shadow: 0 12px 40px rgba(0,0,0,.22); overflow: hidden; }
.modal .m-head { padding: 18px 20px; border-bottom: 1px solid var(--border); font-weight: 650; font-size: 16px; }
.modal .m-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal .m-foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--text-2); font-weight: 550; }

/* ---- Toast -------------------------------------------------------------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #202833; color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 60;
  display: flex; align-items: center; gap: 10px;
}
.toast .ic { color: #6fd0a0; }

/* ---- Misc --------------------------------------------------------------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .big-ic { font-size: 38px; opacity: .5; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.hint-bar { background: #fbfaf4; border: 1px solid #ece6cf; color: #7a6a3a; border-radius: 9px; padding: 10px 14px; font-size: 13px; display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.sub-note { color: var(--text-3); font-size: 12px; }

/* ---- Tag EJEMPLO ------------------------------------------------------- */
.tag.ejemplo { background: #f3ede0; border-color: #e6dcc4; color: #8a6d2f; font-size: 10.5px; letter-spacing: .03em; }

/* ---- Login ------------------------------------------------------------- */
.login-wrap { min-height: 100vh; width: 100%; display: grid; place-items: center; background: #1b222c; padding: 24px; }
.login-card { background: var(--surface); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.35); width: 100%; max-width: 560px; padding: 32px; }
.login-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.login-brand .logo { width: 52px; height: 52px; border-radius: 12px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.login-form { display: flex; gap: 14px; }
.login-form .field { flex: 1; }
.login-sep { text-align: center; margin: 22px 0 16px; position: relative; color: var(--text-3); font-size: 12.5px; }
.login-sep::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); }
.login-sep span { background: var(--surface); padding: 0 12px; position: relative; }
.login-roles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.role-card { text-align: left; border: 1px solid var(--border-2); background: var(--surface); border-radius: 10px; padding: 14px 16px; transition: all .12s; }
.role-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.role-card .rc-name { font-weight: 650; font-size: 15px; color: var(--text); }
.role-card .rc-desc { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.login-foot { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 20px; }

/* ---- Segmented control (áreas) ---------------------------------------- */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.seg-btn { border: none; background: transparent; color: var(--text-2); font-size: 13px; padding: 6px 13px; border-radius: 6px; font-weight: 500; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); font-weight: 600; }

/* ---- Toggle (maniobras) ----------------------------------------------- */
.toggle { border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 7px; white-space: nowrap; }
.toggle:hover { border-color: var(--accent); }
.toggle.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.toggle:disabled { opacity: .5; }

/* ---- Select chico / con aviso ----------------------------------------- */
.select.sm { padding: 6px 10px; font-size: 13px; min-width: 120px; }
.select.warn { border-color: var(--rojo); background: var(--rojo-bg); color: #93372f; font-weight: 600; }
.select.efectivo { border-color: var(--ambar); background: var(--ambar-bg); color: #8a621b; font-weight: 600; }

/* ---- Portal ------------------------------------------------------------ */
.portal-head .logo { background: var(--accent); color: #fff; border-radius: 12px; display: grid; place-items: center; }

/* ---- Acordeón ---------------------------------------------------------- */
.acc-head { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent; border: none; padding: 16px 20px; }
.acc-head:hover { background: var(--surface-2); }
.acc-chev { color: var(--text-3); display: inline-flex; transition: transform .15s ease; }
.acc-chev.open { transform: rotate(90deg); }
.acc-body { border-top: 1px solid var(--border); }
