/* BNO Foods Back Office — interface styles.
   Visual language follows the approved preview (BNO-Foods-Portal-Preview-v1.0):
   navy rail, gold accent, white cards on a cool grey ground.
   Single stylesheet, no build step, no external fonts. */

:root {
  --nav: #101b31;
  --nav-2: #192845;
  --nav-line: #263652;
  --ink: #172033;
  --muted: #71809a;
  --line: #e3e8f0;
  --bg: #f4f7fb;
  --card: #fff;
  --gold: #dfba43;
  --gold-dark: #a8871c;
  --green: #18a879;
  --red: #e35d62;
  --amber: #dc9625;
  --blue: #356ee8;
  --shadow: 0 12px 36px rgba(24, 38, 64, .08);
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; }

/* Focus must stay visible for keyboard users; never remove it silently. */
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- shell ---------- */

.app { min-height: 100vh; display: grid; grid-template-columns: 264px 1fr; }

.side {
  background: var(--nav);
  color: #d7dfed;
  padding: 24px 18px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand-mark { display: flex; gap: 13px; align-items: center; padding: 4px 12px 26px; }
.diamond { width: 16px; height: 16px; background: var(--gold); transform: rotate(45deg); border-radius: 2px; flex: none; }
.brand-mark strong { display: block; letter-spacing: .19em; font-size: 15px; color: #fff; }
.brand-mark small { letter-spacing: .22em; font-size: 9px; color: #8fa0bd; }

.nav { display: grid; gap: 4px; }
.nav a {
  color: #cbd5e6;
  padding: 11px 15px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.nav a:hover { background: var(--nav-2); color: #fff; text-decoration: none; }
.nav a.active { background: var(--nav-2); color: #fff; box-shadow: inset 3px 0 var(--gold); }
.nav .ico { width: 18px; text-align: center; color: #92a4c3; flex: none; }

.side-foot { margin-top: auto; }
.side-note {
  border: 1px solid var(--nav-line);
  background: #17243d;
  border-radius: 10px;
  padding: 12px;
  font-size: 11px;
  color: #8193b0;
  margin-bottom: 12px;
}
.side-note strong { color: #fff; display: block; margin-top: 3px; font-size: 12px; }

.user-row {
  padding: 14px 6px 0;
  display: flex;
  gap: 11px;
  align-items: center;
  border-top: 1px solid var(--nav-line);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gold); color: #172033;
  display: grid; place-items: center; font-weight: 800; flex: none;
}
.user-row strong { color: #fff; font-size: 12px; display: block; }
.user-row small { color: #8193b0; font-size: 10px; }
.logout-btn {
  background: none; border: 1px solid var(--nav-line); color: #8fa0bd;
  border-radius: 8px; padding: 6px 9px; font-size: 11px; margin-left: auto;
}
.logout-btn:hover { color: #fff; border-color: #47597a; }

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

.top {
  min-height: 74px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}
.crumb { color: #8190a8; font-size: 13px; }
.crumb strong { color: var(--ink); }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.content { padding: 24px 28px 64px; max-width: 1750px; width: 100%; margin: 0 auto; }

/* ---------- environment + mode banners ---------- */

/* Deliberately loud. It must be impossible to think you are somewhere you
   are not. */
.env-banner {
  padding: 9px 28px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.env-banner.env-local { background: #263140; color: #e6edf7; }
.env-banner.env-staging { background: #7a5b10; color: #fff6dc; }
.env-banner.env-production { background: #0f3221; color: #d7f0e0; }
.env-banner .tag {
  background: rgba(255, 255, 255, .16);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 11px;
}

.demo-banner {
  background: repeating-linear-gradient(135deg, #fff4d4, #fff4d4 12px, #ffeab5 12px, #ffeab5 24px);
  border-bottom: 2px solid var(--gold-dark);
  color: #6b5210;
  padding: 11px 28px;
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  gap: 10px;
  align-items: center;
}
.demo-banner .badge {
  background: var(--gold-dark); color: #fff; border-radius: 5px;
  padding: 3px 8px; font-size: 11px; letter-spacing: .08em;
}

.mode-switch { display: flex; background: #edf1f7; border: 1px solid #dde4ee; padding: 3px; border-radius: 999px; }
.mode-switch button {
  border: 0; background: transparent; border-radius: 999px;
  padding: 6px 14px; color: #7b899f; font-weight: 800; font-size: 12px;
}
.mode-switch button.active { background: #1c2d49; color: #fff; }
.mode-switch button.active.demo { background: var(--gold-dark); }
.mode-switch button[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- flashes ---------- */

.flash { padding: 12px 15px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; border: 1px solid; }
.flash-success { background: #e8f7f0; border-color: #a9dfc8; color: #116647; }
.flash-error { background: #fdecec; border-color: #f2b8ba; color: #98282d; }
.flash-warning { background: #fff6dc; border-color: #efd994; color: #7a5b10; }

/* ---------- headline ---------- */

.headline { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.headline h1 { font-size: 25px; margin-bottom: 5px; }
.headline p { margin: 0; color: var(--muted); max-width: 70ch; }

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

.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 9px;
  padding: 10px 14px; font-weight: 700; font-size: 13px; display: inline-flex;
  align-items: center; gap: 8px; min-height: 40px;
}
.btn:hover { border-color: #c3cddd; text-decoration: none; }
.btn-primary { background: #172943; color: #fff; border-color: #172943; }
.btn-primary:hover { background: #23385a; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #2a2205; }
.btn-gold:hover { background: #e8c65b; }
.btn-danger { background: #fff; border-color: #f2b8ba; color: #98282d; }
.btn-sm { padding: 7px 10px; min-height: 34px; font-size: 12px; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; }

/* ---------- KPI ---------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; }
.kpi .label { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; }
.kpi .num { font-size: 24px; font-weight: 800; margin: 6px 0 3px; }
.kpi .note { font-size: 11px; color: var(--muted); }
.kpi .num.good { color: var(--green); }
.kpi .num.bad { color: var(--red); }
.kpi .num.unknown-num { color: var(--muted); font-size: 17px; font-weight: 700; }

/* An unknown value never looks like a number. */
.unknown { color: var(--muted); font-style: italic; font-weight: 500; }

/* ---------- panels ---------- */

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 20px; }
.panel-head { padding: 17px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 14px; align-items: center; flex-wrap: wrap; }
.panel-head h2 { font-size: 16px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.panel-body { padding: 18px 20px; }
.panel-foot { padding: 12px 20px; background: #fbfcfe; border-top: 1px solid var(--line); font-size: 11.5px; color: #8491a5; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

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

.brand-grid { padding: 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.brand-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: #fff; display: flex; flex-direction: column; }
.brand-card:hover { box-shadow: 0 10px 25px rgba(30, 44, 70, .10); }
.card-top { display: flex; gap: 12px; align-items: center; }
.logo {
  width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center;
  font-weight: 900; position: relative; flex: none; font-size: 15px;
}
.brand-card h3 { font-size: 15px; }
.ref { font-size: 10px; color: #8b98aa; margin-top: 3px; }

.site-row { margin: 14px 0 12px; padding: 10px 11px; background: #f7f9fc; border-radius: 9px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.site-row a { font-size: 12px; color: #50627f; word-break: break-all; }

.status { font-size: 11px; font-weight: 800; white-space: nowrap; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; background: currentColor; }
.st-live { color: var(--green); }
.st-placeholder, .st-in_build { color: var(--amber); }
.st-not_started, .st-offline { color: var(--red); }
.st-unverified { color: var(--muted); }

.rows { display: grid; gap: 7px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #74829a; font-size: 12px; }
.row b { color: #26334a; text-align: right; }

.progress { height: 5px; background: #edf1f6; border-radius: 9px; margin-top: 13px; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 9px; }
.next-action { font-size: 11.5px; color: #65748c; margin: 11px 0; flex: 1; }
.next-action b { color: #40506b; }

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

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: #6f7e96;
  text-align: left; background: #f7f9fc; padding: 11px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13px; }
table.data tr:hover td { background: #fbfcfe; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }

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

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 11px; font-weight: 800; color: #617089; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; background: #fff;
}
.field textarea { min-height: 74px; resize: vertical; }
.field .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 99px; border: 1px solid var(--line); background: #fff; }
.pill-draft { background: #fff3d1; border-color: #ecd79a; color: #8a6817; }
.pill-review { background: #e7eefc; border-color: #bacff5; color: #26468c; }
.pill-approved { background: #e8f7f0; border-color: #a9dfc8; color: #116647; }
.pill-live { background: #18a879; border-color: #18a879; color: #fff; }
.pill-failed { background: #fdecec; border-color: #f2b8ba; color: #98282d; }
.pill-muted { color: var(--muted); }

/* ---------- studio ---------- */

.studio { display: grid; grid-template-columns: 250px minmax(340px, 1fr) 380px; gap: 0; min-height: calc(100vh - 190px); }
.studio > * { min-width: 0; }
.studio-tree { background: #fbfcfe; border-right: 1px solid var(--line); overflow-y: auto; padding-bottom: 20px; }
.studio-tree-head { padding: 14px; border-bottom: 1px solid var(--line); }
.tree-label { padding: 12px 13px 5px; color: #8995a7; text-transform: uppercase; font-size: 9.5px; letter-spacing: .1em; }
.tree-item { display: block; padding: 9px 13px; color: #52617a; font-size: 12.5px; border-left: 3px solid transparent; }
.tree-item:hover { background: #f2f5fa; text-decoration: none; }
.tree-item.page { font-weight: 700; }
.tree-item.region { padding-left: 26px; }
.tree-item.active { background: #fff6d6; color: #6d5410; border-left-color: var(--gold); font-weight: 700; }

.studio-preview { background: #e7ebf1; display: flex; flex-direction: column; }
.preview-tools { background: #fff; border-bottom: 1px solid var(--line); padding: 9px 12px; display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.preview-url { background: #f4f6f9; border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; font-size: 12px; color: #62718a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; }
.preview-stage { padding: 16px; overflow: auto; flex: 1; display: flex; justify-content: center; }
.preview-frame { background: #fff; width: 100%; max-width: 980px; border-radius: 9px; box-shadow: 0 15px 38px rgba(31, 48, 72, .18); align-self: flex-start; overflow: hidden; }
.preview-frame.tablet { max-width: 720px; }
.preview-frame.mobile { max-width: 380px; }
.preview-label {
  background: #1b2d49; color: #fff; font-size: 11px; padding: 7px 12px;
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.preview-label b { color: var(--gold); }
.preview-empty { padding: 40px 26px; text-align: center; color: var(--muted); }

.studio-editor { background: #fff; border-left: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.editor-head { padding: 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.editor-body { padding: 14px; flex: 1; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.compare-col { border: 1px solid var(--line); border-radius: 9px; padding: 10px; font-size: 12px; }
.compare-col.proposed { border-style: dashed; background: #fffdf5; }
.compare-col h4 { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: #7a8799; margin-bottom: 7px; }
.compare-col .val { color: #26334a; word-break: break-word; }

.notice {
  background: #fff6dc; border: 1px solid #efd994; color: #7a5b10;
  padding: 11px 12px; border-radius: 9px; font-size: 12px; margin-bottom: 14px;
}
.notice.stop { background: #fdecec; border-color: #f2b8ba; color: #98282d; }
.notice.info { background: #eef3fd; border-color: #c3d4f5; color: #26468c; }
.notice.ok { background: #e8f7f0; border-color: #a9dfc8; color: #116647; }
.notice strong { display: block; margin-bottom: 3px; }

.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.cap { font-size: 11px; padding: 6px 8px; border-radius: 7px; border: 1px solid var(--line); }
.cap.yes { background: #e8f7f0; border-color: #a9dfc8; color: #116647; }
.cap.no { background: #f6f7f9; color: #97a2b3; }

/* ---------- import ---------- */

.map-table td { vertical-align: middle; }
.sample-cell { font-size: 11px; color: var(--muted); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sev-ok { color: var(--green); }
.sev-warning { color: var(--amber); }
.sev-error { color: var(--red); font-weight: 700; }
.msg-list { margin: 4px 0 0; padding-left: 16px; font-size: 11.5px; color: #65748c; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; }
.stat .n { font-size: 21px; font-weight: 800; }
.stat .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- auth ---------- */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--nav); padding: 24px; }
.auth-card { background: #fff; border-radius: 16px; padding: 32px; width: min(420px, 100%); box-shadow: 0 24px 60px rgba(8, 15, 30, .45); }
.auth-card h1 { font-size: 21px; margin-bottom: 6px; }
.auth-card p.sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }

/* ---------- error ---------- */

.error-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.error-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 30px; max-width: 520px; box-shadow: var(--shadow); }
.error-card .code { font-size: 42px; font-weight: 800; color: var(--muted); }

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

@media (max-width: 1180px) {
  .studio { grid-template-columns: 220px 1fr; }
  .studio-editor { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 900px) {
  .app { display: block; }
  .side { display: none; }
  .top { padding: 10px 14px; }
  .content { padding: 18px 14px 48px; }
  .env-banner, .demo-banner { padding-left: 14px; padding-right: 14px; }
  .studio { grid-template-columns: 1fr; }
  .studio-tree { border-right: 0; border-bottom: 1px solid var(--line); max-height: 260px; }
  .field-row { grid-template-columns: 1fr; }
  .compare { grid-template-columns: 1fr; }
}

@media print {
  .side, .top-actions, .btn { display: none; }
}

/* ---------- brand marks ---------- */
/* Real logo where the brand has one, monogram where it does not.
   The monogram is the common case (6 of 8 brands), so it is styled to look
   intentional rather than like a missing image. */
.logo { overflow: hidden; }
.logo img { width: 100%; height: 100%; object-fit: contain; padding: 5px; display: block; }
.logo .logo-fallback { display: none; }
.logo.logo-failed img { display: none; }
.logo.logo-failed .logo-fallback { display: block; }
.logo-lg { font-size: 19px; border-radius: 14px; }
.logo-sm { font-size: 12px; border-radius: 9px; }

/* ---------- readiness detail ---------- */
.readiness-parts { display: grid; gap: 3px; margin: 10px 0 4px; }
.readiness-part { display: flex; align-items: center; gap: 7px; font-size: 11px; color: #8a95a8; }
.readiness-part.done { color: #2c7a5b; }
.readiness-part .tick { width: 13px; text-align: center; font-weight: 800; flex: none; }

/* ---------- conflict flag ---------- */
.conflict {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fdecec; border: 1px solid #f2b8ba; color: #98282d;
  border-radius: 6px; padding: 3px 7px; font-size: 10.5px; font-weight: 700;
  margin-top: 5px;
}

/* ---------- empty states ---------- */
.empty {
  text-align: center; padding: 44px 26px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: var(--radius); background: #fbfcfe;
}
.empty .mark { font-size: 26px; opacity: .35; display: block; margin-bottom: 10px; }
.empty h3 { font-size: 15px; color: var(--ink); margin-bottom: 6px; }
.empty p { margin: 0 auto 14px; max-width: 46ch; font-size: 12.5px; line-height: 1.6; }

/* Cards in a row stay the same height so their readiness bars line up. */
.brand-card { height: 100%; }
.site-row { align-items: flex-start; }
.site-row .conflict { margin-top: 6px; }
