/* PAE demo — Nivo look & feel (claude/ui-design-notes.md) */
:root {
  --topbar: #59595A;
  --rail: #EDEDED;
  --rail-border: #D0D0D0;
  --bg: #FAFAFA;
  --card: #FFFFFF;
  --line: #E0E0E0;
  --fill: #F5F5F5;
  --orange: #FB9527;
  --orange-dark: #E07F12;
  --orange-soft: #FFF3E6;
  --btn-secondary: #C1C1C1;
  --btn-disabled: #D9D9D9;
  --text: #212121;
  --muted: #6B6B6B;
  --ok: #2E7D32; --ok-bg: #E8F5E9;
  --info: #1565C0; --info-bg: #E3F2FD;
  --bad: #C62828; --bad-bg: #FDECEA;
  --neutral: #616161; --neutral-bg: #EEEEEE;
  --shadow: 0 2px 2px rgba(0,0,0,.14), 0 1px 5px rgba(0,0,0,.12);
  --font: "Montserrat", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); }
a { color: var(--orange); }
button, input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------------- shell */
.topbar { position: fixed; inset: 0 0 auto 0; height: 64px; background: var(--topbar); display: flex;
  align-items: center; padding: 0 84px 0 88px; z-index: 20; }
.topbar .logo { height: 44px; display: block; }
.topbar .spacer { flex: 1; }
.demo-badge { border: 1.5px solid var(--orange); color: #fff; border-radius: 14px; padding: 3px 12px;
  font-size: 11px; font-weight: 600; letter-spacing: .4px; margin-right: 28px; white-space: nowrap; }
.demo-badge b { color: var(--orange); }
.welcome { color: #E6E6E6; font-size: 18px; font-weight: 300; margin-right: 12px; }
.userbox { display: flex; align-items: center; gap: 10px; color: #fff; cursor: pointer; position: relative; }
.userbox .caret { border: 5px solid transparent; border-top-color: #fff; margin-top: 5px; }
.userbox .name { font-weight: 700; font-size: 14px; line-height: 1.1; }
.userbox .role { font-size: 11px; letter-spacing: .6px; font-weight: 600; }
.usermenu { position: absolute; right: 0; top: 40px; background: #fff; color: var(--text); box-shadow: var(--shadow);
  border-radius: 4px; min-width: 160px; display: none; }
.usermenu.open { display: block; }
.usermenu a { display: block; padding: 12px 16px; color: var(--text); text-decoration: none; }
.usermenu a:hover { background: var(--fill); }

.rail { position: fixed; top: 64px; bottom: 0; left: 0; width: 90px; background: var(--rail);
  border-right: 1px solid var(--rail-border); padding-top: 24px; overflow-y: auto; z-index: 10; }
.rail a { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: #4A4A4A;
  font-size: 9.5px; letter-spacing: .4px; padding: 10px 2px 12px; text-align: center; }
.rail a svg { width: 30px; height: 30px; fill: var(--orange); margin-bottom: 6px; }
.rail a.active { color: var(--orange); }
.rail a:hover { background: #E4E4E4; }

.main { margin: 64px 0 0 90px; padding: 20px 18px 40px; min-height: calc(100vh - 64px); }

/* ---------------- page header */
.page-head { display: flex; align-items: center; gap: 18px; min-height: 44px; margin-bottom: 4px; }
.page-icon { width: 28px; height: 28px; background: var(--orange); border-radius: 3px; display: grid; place-items: center; }
.page-icon svg { width: 20px; height: 20px; fill: #fff; }
.page-icon.plain { background: none; } .page-icon.plain svg { fill: var(--orange); width: 30px; height: 30px; }
.page-title { font-size: 15px; font-weight: 500; }
.crumbs { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.crumbs a { color: var(--orange); }
.crumbs .chev { width: 10px; height: 10px; border-right: 3px solid var(--orange); border-top: 3px solid var(--orange);
  transform: rotate(45deg); margin: 0 6px 0 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 12px; }

/* ---------------- buttons */
.btn { background: var(--orange); color: #fff; border: 0; border-radius: 4px; min-width: 150px; height: 38px;
  padding: 0 22px; font-weight: 700; letter-spacing: .5px; box-shadow: var(--shadow); cursor: pointer; }
.btn:hover { background: var(--orange-dark); }
.btn.wide { min-width: 222px; }
.btn.secondary { background: var(--btn-secondary); }
.btn.secondary:hover { background: #ADADAD; }
.btn:disabled { background: var(--btn-disabled); color: #fff; box-shadow: none; cursor: default; }
.btn.small { min-width: 0; height: 32px; padding: 0 14px; font-size: 13px; }
.btn.ghost { background: transparent; color: var(--orange); box-shadow: none; border: 1.5px solid var(--orange); }
.btn.ghost:hover { background: var(--orange-soft); }

/* ---------------- search + filters */
.toolbar { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 6px 0 22px; }
.search { position: relative; width: min(670px, 50%); background: #ECECEC; border-bottom: 1px solid #8A8A8A;
  border-radius: 4px 4px 0 0; height: 56px; display: flex; align-items: center; padding-left: 46px; }
.search svg { position: absolute; left: 16px; width: 22px; height: 22px; fill: #333; }
.search input { border: 0; background: transparent; width: 100%; height: 100%; font-size: 16px; outline: none; color: var(--text); }
.field { display: flex; flex-direction: column; background: #ECECEC; border-bottom: 1px solid #8A8A8A;
  border-radius: 4px 4px 0 0; padding: 7px 12px 4px; min-width: 200px; }
.field label { font-size: 11px; color: var(--muted); }
.field select, .field input { border: 0; background: transparent; height: 28px; outline: none; font-size: 15px; color: var(--text); }
.field.wide { min-width: 300px; }

/* ---------------- table card */
.card { background: var(--card); box-shadow: var(--shadow); border-radius: 4px; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th { text-align: left; font-weight: 500; font-size: 14px; padding: 0 24px; height: 56px; border-bottom: 1px solid var(--line); }
table.grid td { padding: 0 24px; height: 48px; border-bottom: 1px solid var(--line); font-size: 14px; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid td a { color: var(--orange); }
table.grid tr.group td { background: #F7F7F7; font-weight: 600; }
table.grid td.num, table.grid th.num { text-align: right; }
table.grid tfoot td { font-weight: 700; background: #FAFAFA; border-top: 1px solid var(--line); }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12.5px; color: var(--muted); }
.chk { width: 18px; height: 18px; border-radius: 2px; background: var(--orange); display: inline-grid; place-items: center; }
.chk::after { content: ""; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px,-1px); }
.chk.off { background: #fff; border: 2px solid #6B6B6B; } .chk.off::after { display: none; }
.paginator { display: flex; justify-content: flex-end; align-items: center; gap: 28px; height: 64px; padding: 0 20px;
  border-top: 1px solid var(--line); font-size: 12.5px; color: #333; }
.paginator select { height: 40px; border: 1px solid #BDBDBD; border-radius: 4px; padding: 0 10px; min-width: 84px; background: #fff; }
.paginator button { background: none; border: 0; font-size: 22px; color: #333; cursor: pointer; width: 36px; height: 36px; border-radius: 50%; }
.paginator button:disabled { color: #C8C8C8; cursor: default; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.loader { display: flex; justify-content: center; gap: 10px; padding: 60px 0; }
.loader i { width: 12px; height: 12px; border-radius: 50%; background: var(--orange); animation: blink 1s infinite ease-in-out; }
.loader i:nth-child(2) { animation-delay: .15s; } .loader i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3 } 40% { opacity: 1 } }

/* ---------------- badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11.5px; font-weight: 700; letter-spacing: .3px; }
.b-PUBLICADO { color: var(--ok); background: var(--ok-bg); }
.b-ACTUALIZADO { color: var(--info); background: var(--info-bg); }
.b-DUPLICADO { color: var(--neutral); background: var(--neutral-bg); }
.b-RECHAZADO { color: var(--bad); background: var(--bad-bg); }
.b-HABILITADO, .b-VALIDA { color: var(--ok); background: var(--ok-bg); }
.b-NO_HABILITADO, .b-ANULADA { color: var(--neutral); background: var(--neutral-bg); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 3px; background: var(--fill); border: 1px solid var(--line); font-size: 12px; }
.tag.ref { background: var(--orange-soft); border-color: #FFD3A3; }

/* ---------------- detail pages */
.tabhead { text-align: center; color: var(--orange); letter-spacing: 1.2px; font-weight: 500; font-size: 14px;
  padding: 26px 0 12px; border-bottom: 2px solid var(--orange); margin: 0 -18px 24px; }
.detail { padding: 0 54px; }
.detail .title { font-size: 16px; margin: 6px 0 18px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 12px 14px; margin-bottom: 24px; font-size: 15px; }
.kv b { font-weight: 700; }
.section { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 14px; }
.section h3 { font-size: 16px; margin: 0; }
.panel { background: #F7F7F7; box-shadow: 0 3px 8px rgba(0,0,0,.25); max-width: 680px; margin: 0 auto; padding: 56px 40px 30px; border-radius: 2px; }
.panel .input { background: #FAFAFA; border-bottom: 1px solid #DDD; padding: 8px 16px 6px; margin-bottom: 22px; }
.panel .input label { display: block; font-size: 12.5px; color: #8A8A8A; }
.panel .input input, .panel .input select, .panel .input textarea { width: 100%; border: 0; background: transparent;
  font-size: 16px; color: #555; padding: 4px 0; outline: none; }
.panel .row { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.panel .buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 36px; }
.errors { background: var(--bad-bg); color: var(--bad); border-radius: 4px; padding: 10px 14px; margin-bottom: 18px; }
.errors div + div { margin-top: 4px; }
.source-card { border-left: 4px solid var(--orange); background: var(--card); box-shadow: var(--shadow); padding: 16px 20px; border-radius: 2px; max-width: 760px; }
pre.json { background: #263238; color: #ECEFF1; padding: 16px; border-radius: 4px; overflow: auto; font-size: 12.5px; max-height: 480px; }

/* ---------------- dialog */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.32); display: grid; place-items: center; z-index: 50; }
.overlay .panel { width: 600px; max-height: 90vh; overflow: auto; padding-top: 30px; }
.overlay h2 { font-size: 15px; letter-spacing: 1.2px; color: var(--orange); text-align: center; font-weight: 500; margin: 0 0 26px; }

/* ---------------- KPI + chart */
.notice { background: var(--orange-soft); border-left: 4px solid var(--orange); padding: 10px 14px; border-radius: 2px; margin-bottom: 18px; font-size: 13px; }
.kpi-row { display: grid; grid-template-columns: 320px 1fr; gap: 18px; margin-bottom: 18px; }
.kpi { padding: 22px 24px; }
.kpi .label { color: var(--muted); font-size: 12px; letter-spacing: .6px; text-transform: uppercase; }
.kpi .value { font-size: 46px; font-weight: 700; color: var(--orange); margin: 6px 0; }
.kpi .value.na { font-size: 22px; color: var(--muted); }
.kpi .sub { font-size: 14px; }
.bars { padding: 18px 24px; }
.bar { display: grid; grid-template-columns: 260px 1fr 70px; align-items: center; gap: 12px; height: 34px; }
.bar .track { background: #F0F0F0; height: 16px; border-radius: 8px; overflow: hidden; }
.bar .fill { background: var(--orange); height: 100%; }
.bar .pct { text-align: right; font-weight: 600; font-size: 13px; }
.bar .name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 24px; border-top: 1px solid var(--line); }

/* ---------------- templates */
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
textarea.code { width: 100%; min-height: 520px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 4px; padding: 12px; background: #FFFFFF; resize: vertical; }
iframe.preview { width: 100%; height: 560px; border: 1px solid var(--line); background: #fff; border-radius: 4px; }

/* ---------------- toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #323232; color: #fff;
  padding: 12px 22px; border-radius: 4px; box-shadow: var(--shadow); z-index: 60; font-size: 14px; }
.toast.error { background: var(--bad); }

/* ---------------- login gate */
.gate { display: grid; place-items: center; height: calc(100vh - 64px); margin-top: 64px; }
.gate .panel { text-align: center; padding: 48px; }
.b-CONFLICTO { color: #8E24AA; background: #F3E5F5; }
.s-COMPLETED { color: var(--ok); background: var(--ok-bg); }
.s-DUPLICATE, .s-DISCOVERED, .s-PROCESSING { color: var(--neutral); background: var(--neutral-bg); }
.s-QUARANTINED { color: var(--bad); background: var(--bad-bg); }
.s-RETRY_PENDING { color: var(--info); background: var(--info-bg); }

/* Phase 2 — delivered menus / supply receipts */
.lead { color: var(--muted); margin: -6px 0 14px; max-width: 900px; }
.muted { color: var(--muted); }
.b-SI { color: var(--ok); background: var(--ok-bg); }
.b-NO { color: #B45309; background: #FEF3C7; }
.kpi-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.kpi.small { padding: 16px 20px; }
.kpi.small .value { font-size: 34px; margin: 4px 0; }
.kpi.small .sub { font-size: 13px; color: var(--muted); }
.chiplist { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.warn { color: #B45309; background: #FEF3C7; }
.plan { font-size: 12.5px; line-height: 1.35; max-width: 280px; }
.plan b { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.tag.src-Nivo { color: #fff; background: var(--primary, #F7931E); border-color: transparent; }
