/* Taco Zocalo Inventory — hand-written, no build step.
   Deliberately dependency-free: the deployment story is "copy files to cPanel",
   and a Vite/npm build would be one more thing to go wrong on every update. */

:root {
  --brand:        #b4341f;
  --brand-dark:   #8c2617;
  --brand-light:  #fdf1ef;
  --accent:       #1f7a4d;
  --ink:          #1b1917;
  --ink-2:        #57514c;
  --ink-3:        #8a827b;
  --line:         #e6e0da;
  --bg:           #faf8f6;
  --surface:      #ffffff;
  --warn:         #b7791f;
  --warn-bg:      #fffbeb;
  --danger:       #b91c1c;
  --danger-bg:    #fef2f2;
  --ok:           #15803d;
  --ok-bg:        #f0fdf4;
  --info-bg:      #eff6ff;
  --info:         #1d4ed8;
  --radius:       10px;
  --shadow:       0 1px 2px rgba(27,25,23,.06), 0 4px 12px rgba(27,25,23,.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.5rem; margin: 0 0 .25rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.125rem; margin: 0 0 .75rem; font-weight: 620; }
h3 { font-size: .95rem; margin: 0 0 .5rem; font-weight: 600; }

/* ---------------------------------------------------------------- layout */

.topbar {
  background: var(--brand);
  color: #fff;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 56px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar .brand {
  font-weight: 700;
  color: #fff;
  font-size: 1rem;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.topbar .brand:hover { text-decoration: none; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: .82rem; opacity: .92; text-align: right; line-height: 1.3; }
.topbar .who strong { display: block; font-weight: 600; }

.lang-switch { display: flex; gap: .25rem; }
.lang-switch a {
  color: #fff; opacity: .7; font-size: .78rem; font-weight: 600;
  padding: .2rem .45rem; border-radius: 5px; border: 1px solid rgba(255,255,255,.3);
}
.lang-switch a.is-active { opacity: 1; background: rgba(255,255,255,.2); }
.lang-switch a:hover { text-decoration: none; opacity: 1; }

.shell { display: flex; min-height: calc(100vh - 56px); }

.sidebar {
  width: 224px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: .75rem;
}
.sidebar nav { display: flex; flex-direction: column; gap: 1px; }
.sidebar a {
  color: var(--ink-2);
  padding: .5rem .65rem;
  border-radius: 7px;
  font-size: .88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sidebar a:hover { background: var(--bg); text-decoration: none; color: var(--ink); }
.sidebar a.is-active { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }
.sidebar .group-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); font-weight: 700; padding: .9rem .65rem .3rem;
}
.sidebar .badge-count {
  margin-left: auto; background: var(--brand); color: #fff;
  font-size: .68rem; font-weight: 700; padding: .05rem .35rem; border-radius: 99px;
}

.main { flex: 1; padding: 1.25rem; max-width: 100%; overflow-x: hidden; }
.page-head { margin-bottom: 1.1rem; display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-3); font-size: .87rem; }
.page-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.card-head {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head .actions { margin-left: auto; display: flex; gap: .5rem; }
.card-body { padding: 1rem; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

/* ------------------------------------------------------------ stat tiles */

.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow);
}
.stat .label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); font-weight: 700; margin-bottom: .3rem;
}
.stat .value { font-size: 1.6rem; font-weight: 680; letter-spacing: -.02em; line-height: 1.1; }
.stat .value.sm { font-size: 1.2rem; }
.stat .foot { font-size: .78rem; color: var(--ink-3); margin-top: .2rem; }
.stat.attention { border-color: #f2c94c; background: var(--warn-bg); }
.stat.attention .value { color: var(--warn); }
.stat.alert { border-color: #f5b5b5; background: var(--danger-bg); }
.stat.alert .value { color: var(--danger); }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead th {
  text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-3); font-weight: 700; padding: .55rem .75rem;
  border-bottom: 1px solid var(--line); background: #fcfbfa; white-space: nowrap;
}
tbody td { padding: .55rem .75rem; border-bottom: 1px solid #f2eeea; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fdfcfb; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink-3); }
.strong { font-weight: 620; }
.nowrap { white-space: nowrap; }
tr.section-row td {
  background: var(--brand-light); font-weight: 700; font-size: .76rem;
  text-transform: uppercase; letter-spacing: .05em; color: var(--brand-dark);
}
tr.below-par td { background: var(--warn-bg); }

/* ---------------------------------------------------------------- pills */

.pill {
  display: inline-block; padding: .12rem .5rem; border-radius: 99px;
  font-size: .72rem; font-weight: 650; white-space: nowrap;
  background: #f0ece8; color: var(--ink-2);
}
.pill.ok       { background: var(--ok-bg);     color: var(--ok); }
.pill.warn     { background: var(--warn-bg);   color: var(--warn); }
.pill.danger   { background: var(--danger-bg); color: var(--danger); }
.pill.info     { background: var(--info-bg);   color: var(--info); }
.pill.transit  { background: #f5f0ff;          color: #6d28d9; }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .48rem .9rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: .87rem; font-weight: 600;
  cursor: pointer; font-family: inherit; line-height: 1.2; white-space: nowrap;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ok { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-ok:hover { filter: brightness(.93); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.93); }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ----------------------------------------------------------------- forms */

label { display: block; font-size: .8rem; font-weight: 620; margin-bottom: .28rem; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
  width: 100%; padding: .5rem .65rem; border: 1px solid var(--line);
  border-radius: 8px; font-size: .9rem; font-family: inherit; background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(180,52,31,.12);
}
input.qty { width: 92px; text-align: right; font-variant-numeric: tabular-nums; }
input.qty.changed { border-color: var(--warn); background: var(--warn-bg); }
.field { margin-bottom: .85rem; }
.field .hint { font-size: .76rem; color: var(--ink-3); margin-top: .25rem; }
.field .err { font-size: .78rem; color: var(--danger); margin-top: .25rem; font-weight: 600; }
.filters {
  display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end;
  padding: .75rem 1rem; border-bottom: 1px solid var(--line); background: #fcfbfa;
}
.filters .field { margin: 0; min-width: 150px; }
.checkline { display: flex; align-items: center; gap: .5rem; }
.checkline input { width: auto; }
.checkline label { margin: 0; }

/* --------------------------------------------------------------- notices */

.notice {
  padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem;
  font-size: .87rem; border: 1px solid;
}
.notice.ok     { background: var(--ok-bg);     border-color: #bbf7d0; color: #14532d; }
.notice.warn   { background: var(--warn-bg);   border-color: #fde68a; color: #78350f; }
.notice.danger { background: var(--danger-bg); border-color: #fecaca; color: #7f1d1d; }
.notice.info   { background: var(--info-bg);   border-color: #bfdbfe; color: #1e3a8a; }
.notice strong { font-weight: 700; }

.empty { padding: 2.5rem 1rem; text-align: center; color: var(--ink-3); }
.empty .big { font-size: 1.6rem; margin-bottom: .4rem; }

/* -------------------------------------------------------------- timeline */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  padding: .4rem 0 .4rem 1.4rem; position: relative;
  font-size: .85rem; border-left: 2px solid var(--line); margin-left: .35rem;
}
.timeline li::before {
  content: ''; position: absolute; left: -6px; top: .75rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--line); border: 2px solid var(--surface);
}
.timeline li.done { border-left-color: var(--accent); }
.timeline li.done::before { background: var(--accent); }
.timeline li.current::before { background: var(--brand); }
.timeline .when { color: var(--ink-3); font-size: .78rem; }

/* ----------------------------------------------------------------- login */

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1.25rem; background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 100%);
}
.login-card {
  background: var(--surface); border-radius: 14px; padding: 1.75rem;
  width: 100%; max-width: 400px; box-shadow: 0 12px 40px rgba(0,0,0,.22);
}
.login-card .logo { text-align: center; margin-bottom: 1.25rem; }
.login-card .logo .mark { font-size: 2rem; }
.login-card .logo h1 { font-size: 1.2rem; margin: .35rem 0 .15rem; }
.login-card .logo p { color: var(--ink-3); font-size: .85rem; margin: 0; }

/* -------------------------------------------------------------- utility */

.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.text-sm { font-size: .82rem; } .text-xs { font-size: .75rem; }
.flex { display: flex; gap: .5rem; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.hide { display: none !important; }
.sticky-actions {
  position: sticky; bottom: 0; background: var(--surface);
  border-top: 1px solid var(--line); padding: .75rem 1rem;
  display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
  box-shadow: 0 -4px 12px rgba(27,25,23,.05);
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 860px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; border-right: 0; border-bottom: 1px solid var(--line);
    padding: .5rem; overflow-x: auto;
  }
  .sidebar nav { flex-direction: row; gap: .3rem; }
  .sidebar a { white-space: nowrap; font-size: .82rem; padding: .4rem .6rem; }
  .sidebar .group-label { display: none; }
  .main { padding: .85rem; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .topbar .who { display: none; }
  h1 { font-size: 1.25rem; }
  table { font-size: .84rem; }
  tbody td, thead th { padding: .5rem .55rem; }
}

@media print {
  .topbar, .sidebar, .filters, .btn, .sticky-actions { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; }
}
