/* ── MenuPulse — shared.css ── */
/* Aesthetic: High-tech intelligence meets fine dining hospitality */
/* Brand: navy #2a4a64 | amber #cb883e | ink #1c2b35 */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400;1,600&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600&family=DM+Mono:wght@400;500&display=swap');

/* ── DESIGN TOKENS ── */
:root {
  --navy:        #2a4a64;
  --navy-dark:   #1e3548;
  --navy-mid:    #3d6480;
  --navy-lt:     #eaf0f5;
  --navy-glass:  rgba(42,74,100,.06);

  --amber:       #cb883e;
  --amber-dark:  #b0712a;
  --amber-lt:    #fdf5eb;
  --amber-glow:  rgba(203,136,62,.18);

  --ink:         #1c2b35;
  --ink2:        #2b4251;
  --ink3:        #6b7f8c;
  --ink4:        #9aafba;

  --surface:     #f7f9fb;
  --surface2:    #eef2f6;
  --white:       #ffffff;
  --border:      #d4dce4;
  --border-lt:   #e8edf2;

  --red:         #8a1b1b;
  --red-lt:      #fdf0f0;
  --green:       #1a6b3a;
  --green-lt:    #e8f5ec;

  /* Legacy aliases */
  --g1:  var(--navy);
  --g2:  var(--amber);
  --g2-dark: var(--amber-dark);
  --g3:  var(--amber-lt);
  --g4:  var(--border);
  --g5:  var(--surface);
  --amber-lt: #fdf5eb;
  --amber-semantic: #c45a00;
  --blue: var(--navy);
  --blue-lt: var(--navy-lt);

  --r:   10px;
  --r2:  16px;
  --shadow-xs: 0 1px 4px rgba(26,44,58,.06);
  --shadow:    0 2px 12px rgba(26,44,58,.08);
  --shadow-md: 0 4px 24px rgba(26,44,58,.1);
  --shadow-lg: 0 12px 48px rgba(26,44,58,.14);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  background: var(--surface);
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── HEADER ── */
.header {
  background: var(--white);
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border-lt);
  height: 64px;
  box-shadow: 0 1px 0 var(--border-lt), 0 4px 20px rgba(26,44,58,.06);
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: visible;
}

.header-brand {
  padding: 0 22px 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-right: 1px solid var(--border-lt);
  text-decoration: none;
  flex-shrink: 0;
  transition: background .15s;
}
.header-brand:hover { background: var(--surface); }
.header-brand img { height: 44px; width: auto; object-fit: contain; flex-shrink: 0; }
.header-brand-text { padding-left: 2px; }
.header-brand-text .name {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
  letter-spacing: -.02em;
}
.header-brand-text .sub {
  font-size: 9px;
  color: var(--ink4);
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-top: 3px;
  font-weight: 500;
}

.header-nav { display: flex; align-items: stretch; flex: 1; padding: 0 6px; overflow-x: visible; scrollbar-width: none; }
.header-nav::-webkit-scrollbar { display: none; }

/* ── More dropdown ── */
.nav-more { position: relative; display: flex; align-items: stretch; }
.nav-more-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 0 12px; font-size: 12px; font-weight: 500;
  color: var(--ink3); cursor: pointer;
  border: none; background: none;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap; transition: color .15s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.nav-more-btn:hover { color: var(--navy); }
.nav-more-btn.has-active { color: var(--navy); border-bottom-color: var(--amber); font-weight: 600; }
.nav-dropdown {
  display: none; position: absolute; top: 100%; left: 0;
  background: #fff; border: 1px solid var(--border-lt);
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  min-width: 200px; z-index: 200; padding: 4px 0;
}
.nav-dropdown.open { display: block; }
.nav-dropdown a {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; font-size: 13px; color: var(--ink2);
  text-decoration: none; transition: background .1s;
}
.nav-dropdown a:hover { background: var(--navy-glass); color: var(--navy); }
.nav-dropdown a.active { color: var(--navy); font-weight: 600; background: var(--navy-lt); }

.nav-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-top: none; border-left: none; border-right: none;
  background: none;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
  transition: all .2s;
  letter-spacing: -.01em;
  white-space: nowrap;
  position: relative;
  flex-shrink: 0;
}
.nav-tab .tab-icon { display: none; }
.nav-tab::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--navy-glass);
  opacity: 0;
  transition: opacity .2s;
  border-radius: 0;
}
.nav-tab:hover { color: var(--navy); }
.nav-tab:hover::after { opacity: 1; }
.nav-tab.active {
  color: var(--navy);
  border-bottom-color: var(--amber);
  font-weight: 600;
}
.nav-tab .tab-icon { font-size: 14px; }

.header-right {
  display: flex;
  align-items: center;
  padding: 0 22px;
  margin-left: auto;
  gap: 10px;
}
.rest-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--navy);
  background: var(--navy-lt);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(42,74,100,.2);
  font-weight: 500;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rest-pill::before {
  content: '🍽';
  font-size: 11px;
  flex-shrink: 0;
}

/* ── PAGE LAYOUT ── */
.page-wrap { display: flex; height: calc(100vh - 64px); }

.sidebar {
  width: 296px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border-lt);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  box-shadow: 2px 0 12px rgba(26,44,58,.04);
}
/* Subtle scrollbar for sidebar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  background: var(--surface);
}
.content::-webkit-scrollbar { width: 6px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.content.centered { max-width: 980px; margin: 0 auto; width: 100%; }

/* ── TYPOGRAPHY ── */
.sec-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--amber);
  margin-bottom: 8px;
  display: block;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-lt);
}
.page-head h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  color: var(--navy);
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.page-head p { font-size: 13px; color: var(--ink3); margin-top: 5px; line-height: 1.5; }

/* ── FORMS ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink2);
  text-transform: uppercase;
  letter-spacing: .07em;
}

input[type=text],
input[type=number],
select,
textarea {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--white);
  color: var(--ink);
  width: 100%;
  outline: none;
  transition: border .15s, box-shadow .15s;
  box-shadow: var(--shadow-xs);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--navy-mid);
  box-shadow: 0 0 0 3px rgba(42,74,100,.1);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.divider { height: 1px; background: var(--border-lt); margin: 2px 0; }

/* ── BUTTONS ── */
.btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--ink2);
  transition: all .2s;
  box-shadow: var(--shadow-xs);
  letter-spacing: -.01em;
}
.btn:hover {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.btn.primary {
  background: var(--amber);
  color: var(--white);
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 2px 12px var(--amber-glow);
  letter-spacing: -.01em;
}
.btn.primary:hover {
  background: var(--amber-dark);
  box-shadow: 0 4px 20px rgba(203,136,62,.3);
  transform: translateY(-1px);
}
.btn.primary:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.navy {
  background: var(--navy);
  color: var(--white);
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(42,74,100,.2);
}
.btn.navy:hover {
  background: var(--navy-dark);
  box-shadow: 0 4px 20px rgba(42,74,100,.3);
  transform: translateY(-1px);
}
.btn.sm { padding: 5px 13px; font-size: 12px; border-radius: 7px; }
.btn.full { width: 100%; font-size: 14px; padding: 12px; justify-content: center; display: flex; align-items: center; gap: 8px; }

/* ── CARDS ── */
.card {
  background: var(--white);
  border: 1px solid var(--border-lt);
  border-radius: var(--r2);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-head {
  padding: 13px 20px;
  background: linear-gradient(to right, var(--navy-glass), transparent);
  border-bottom: 1px solid var(--border-lt);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-head-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--navy);
  letter-spacing: -.01em;
}
.card-body { padding: 18px 20px; }

/* ── METRICS ── */
.metrics-row { display: grid; gap: 14px; margin-bottom: 24px; }
.metrics-row.cols2 { grid-template-columns: repeat(2,1fr); }
.metrics-row.cols3 { grid-template-columns: repeat(3,1fr); }
.metrics-row.cols4 { grid-template-columns: repeat(4,1fr); }

.metric {
  background: var(--white);
  border: 1px solid var(--border-lt);
  border-radius: var(--r2);
  padding: 20px 20px 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: all .2s;
}
.metric::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(to right, var(--navy), var(--amber));
  opacity: 0;
  transition: opacity .2s;
}
.metric:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.metric:hover::before { opacity: 1; }
.metric.warn { background: var(--amber-lt); border-color: rgba(203,136,62,.25); }
.metric.danger { background: var(--red-lt); border-color: rgba(138,27,27,.2); }
.metric .m-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink4);
  margin-bottom: 8px;
}
.metric.warn .m-lbl { color: var(--amber-semantic); }
.metric.danger .m-lbl { color: var(--red); }
.metric .m-val {
  font-family: 'Cormorant Garamond', serif;
  font-size: 34px;
  color: var(--navy);
  line-height: 1;
  font-weight: 600;
}
.metric.warn .m-val { color: var(--amber-semantic); }
.metric.danger .m-val { color: var(--red); }
.metric .m-sub { font-size: 11px; color: var(--ink4); margin-top: 6px; letter-spacing: -.01em; }

/* ── EMPTY & LOADING STATES ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  gap: 16px;
  padding: 40px;
}
.empty-state h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  color: var(--navy);
  font-weight: 600;
  opacity: .7;
}
.empty-state p {
  font-size: 13px;
  color: var(--ink3);
  max-width: 320px;
  line-height: 1.7;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: 20px;
}
.loading-state p {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  color: var(--navy);
  font-style: italic;
  opacity: .75;
  letter-spacing: .01em;
}

/* ── LOADING DOTS ── */
.dots { display: flex; gap: 8px; }
.dots span {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--amber);
  animation: dotpulse 1.4s ease-in-out infinite;
}
.dots span:nth-child(1) { background: var(--navy); }
.dots span:nth-child(2) { animation-delay: .2s; }
.dots span:nth-child(3) { animation-delay: .4s; background: var(--amber-dark); }
@keyframes dotpulse {
  0%,80%,100% { opacity:.2; transform:scale(.7); }
  40%          { opacity:1;  transform:scale(1.1); }
}

.spinner {
  width: 38px; height: 38px;
  border: 3px solid var(--border);
  border-top-color: var(--amber);
  border-right-color: var(--navy);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.prog-bar { height: 3px; background: var(--border); border-radius: 2px; margin: 16px auto 0; max-width: 280px; overflow: hidden; }
.prog-fill { height: 3px; background: linear-gradient(to right, var(--navy), var(--amber)); border-radius: 2px; transition: width .5s ease; width: 0; }

/* ── BANNERS ── */
.error-box {
  background: var(--red-lt);
  border: 1px solid rgba(138,27,27,.2);
  border-radius: var(--r);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--red);
  line-height: 1.6;
  margin-top: 12px;
  display: none;
}
.info-box {
  background: var(--navy-lt);
  border: 1px solid rgba(42,74,100,.18);
  border-left: 3px solid var(--navy);
  border-radius: var(--r);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--navy);
  margin-bottom: 14px;
  line-height: 1.65;
}
.success-box {
  background: var(--green-lt);
  border: 1px solid rgba(26,107,58,.2);
  border-left: 3px solid var(--green);
  border-radius: var(--r);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── TABLES ── */
table.rpt { width: 100%; border-collapse: collapse; border-radius: var(--r2); overflow: hidden; }
table.rpt th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.9);
  padding: 11px 16px;
  background: var(--navy);
  text-align: left;
}
table.rpt th:first-child { border-radius: var(--r2) 0 0 0; }
table.rpt th:last-child { border-radius: 0 var(--r2) 0 0; }
table.rpt td { padding: 11px 16px; border-bottom: 1px solid var(--border-lt); font-size: 13px; color: var(--ink2); }
table.rpt tr:last-child td { border-bottom: none; }
table.rpt tr:hover td { background: var(--navy-glass); }

/* ── UPLOAD ZONE ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r2);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  position: relative;
  transition: all .25s;
}
.upload-zone:hover, .upload-zone.drag {
  border-color: var(--amber);
  background: var(--amber-lt);
  box-shadow: 0 0 0 4px var(--amber-glow);
}
.upload-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-zone img.preview { width: 100%; max-height: 150px; object-fit: contain; border-radius: 8px; display: none; }
.uz-title { font-size: 13px; font-weight: 500; color: var(--ink2); margin-top: 8px; }
.uz-sub { font-size: 11px; color: var(--ink3); margin-top: 4px; }

/* ── TWO COL ── */
.two-col { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }

/* ── CHAT ── */
.chat-wrap {
  border: 1px solid var(--border-lt);
  border-radius: var(--r2);
  overflow: hidden;
  margin-top: 18px;
  box-shadow: var(--shadow);
}
.chat-hdr {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-lt);
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  background: linear-gradient(to right, var(--navy-glass), transparent);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -.01em;
}
.chat-msgs {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--white);
}
.chat-msgs::-webkit-scrollbar { width: 4px; }
.chat-msgs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.av {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
  letter-spacing: .02em;
}
.av.ai {
  background: linear-gradient(135deg, var(--navy-lt), #dde8f0);
  color: var(--navy);
  border: 1px solid rgba(42,74,100,.2);
}
.av.usr {
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  color: var(--white);
}
.mc2 { font-size: 13px; color: var(--ink2); line-height: 1.7; flex: 1; }
.chat-inp {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-lt);
  background: var(--surface);
}
.chat-inp input { flex: 1; font-size: 13px; }

/* ── SOURCE TAGS ── */
.src-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.src-cat   { background: var(--green-lt); color: var(--green); }
.src-ai    { background: var(--amber-lt); color: var(--amber-dark); }
.src-man   { background: var(--navy-lt);  color: var(--navy); }
.src-batch { background: #f0eafa; color: #6230b0; }

/* ── COST PILL (nav) ── */
.cost-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
}
.cp-good   { background: var(--green-lt); color: var(--green); }
.cp-warn   { background: var(--amber-lt); color: var(--amber-semantic); }
.cp-bad    { background: var(--red-lt);   color: var(--red); }
.cp-none   { background: var(--surface2); color: var(--ink3); }

/* ── INGREDIENT TABLE ── */
.it { width: 100%; border-collapse: collapse; font-size: 13px; }
.it th {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink3);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
}
.it td { padding: 8px 12px; border-bottom: 1px solid var(--border-lt); vertical-align: middle; }
.it tr:last-child td { border-bottom: none; }
.it tr:hover td { background: var(--navy-glass); }

/* ── SMALL TABLE INPUTS ── */
.ti2 {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
  width: 78px;
  outline: none;
  transition: border .15s;
}
.ti2:focus { border-color: var(--navy-mid); box-shadow: 0 0 0 2px rgba(42,74,100,.1); }
.ts2 {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
  outline: none;
}
.ts2:focus { border-color: var(--navy-mid); }
.rm-btn {
  width: 24px; height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--ink3);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  font-family: sans-serif;
}
.rm-btn:hover { background: var(--red-lt); color: var(--red); border-color: rgba(138,27,27,.2); }

/* ── CATALOG BROWSER ── */
.cat-browser {
  background: var(--white);
  border: 1px solid var(--border-lt);
  border-radius: var(--r2);
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.cat-item {
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border-lt);
  font-size: 13px;
  transition: background .1s;
}
.cat-item:last-child { border-bottom: none; }
.cat-item:hover { background: var(--navy-glass); }
.cat-item-name { font-weight: 600; color: var(--ink2); }
.cat-item-sku  { font-size: 10px; font-family: 'DM Mono', monospace; color: var(--ink3); margin-top: 2px; }
.cat-item-price { font-weight: 700; color: var(--navy); font-family: 'DM Mono', monospace; font-size: 12px; }
.cat-item-unit  { font-size: 11px; color: var(--ink4); }
.cat-add-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--amber);
  background: var(--white);
  color: var(--amber-dark);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.cat-add-btn:hover { background: var(--amber); color: var(--white); }

/* Ambiguous items */
.cat-item-ambiguous { background: #fffbf0; border-left: 3px solid var(--amber); }
.cat-item-ambiguous .cat-item-price { color: var(--amber-semantic); }
.amb-flag { font-size: 10px; font-weight: 700; color: var(--amber-semantic); background: var(--amber-lt); padding: 2px 8px; border-radius: 5px; margin-top: 3px; display: inline-block; }
.amb-edit { display: flex; align-items: center; gap: 5px; margin-top: 6px; }
.amb-edit input { width: 80px; padding: 4px 7px; border: 1px solid var(--amber); border-radius: 6px; font-size: 12px; font-family: 'DM Mono', monospace; }
.amb-edit select { padding: 4px 7px; border: 1px solid var(--amber); border-radius: 6px; font-size: 12px; background: var(--white); }
.amb-edit button { padding: 4px 12px; border-radius: 6px; border: none; background: var(--amber); color: var(--white); font-size: 11px; font-weight: 600; cursor: pointer; font-family: 'DM Sans', sans-serif; }
.amb-edit button:hover { background: var(--amber-dark); }

/* ── COST RIGHT PANEL ── */
.cost-right { display: flex; flex-direction: column; gap: 10px; }
.cost-right h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  color: var(--navy);
  font-weight: 600;
  letter-spacing: -.01em;
  margin-bottom: 2px;
}
.cl { display: flex; align-items: center; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--border-lt); }
.cl:last-of-type { border-bottom: none; }
.cl-lbl { font-size: 12px; color: var(--ink3); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-val { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--ink2); font-weight: 500; flex-shrink: 0; margin-left: 8px; }
.total-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 6px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.total-line > div:last-child {
  font-family: 'Cormorant Garamond', serif;
  font-size: 30px;
  color: var(--navy);
  font-weight: 600;
}
.pct-box {
  border-radius: var(--r);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pct-box.good { background: var(--green-lt); }
.pct-box.warn { background: var(--amber-lt); }
.pct-box.bad  { background: var(--red-lt); }
.pct-num { font-family: 'Cormorant Garamond', serif; font-size: 28px; font-weight: 600; }
.pct-lbl { font-size: 12px; font-weight: 600; }
.suggest-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--r);
  padding: 10px 14px;
  border: 1px solid var(--border-lt);
}
.suggest-num { font-family: 'Cormorant Garamond', serif; font-size: 26px; color: var(--amber); font-weight: 600; }

/* ── DISH NAV ── */
.dn-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r);
  cursor: pointer;
  transition: all .15s;
  border: 1px solid transparent;
}
.dn-item:hover { background: var(--navy-glass); }
.dn-item.active {
  background: var(--navy-lt);
  border-color: rgba(42,74,100,.2);
}
.dn-name { font-size: 13px; font-weight: 600; color: var(--ink2); letter-spacing: -.01em; }
.dn-sub  { font-size: 11px; color: var(--ink3); margin-top: 2px; }

/* Category headers */
.cat-header {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px 6px;
  border-bottom: 1px solid var(--border-lt);
  background: var(--surface);
  position: sticky; top: 0; z-index: 1;
}
.cat-header-arrow { font-size: 9px; color: var(--ink3); transition: transform .2s; cursor: pointer; flex-shrink: 0; }
.cat-header-arrow.collapsed { transform: rotate(-90deg); }
.cat-header-name-input {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--amber-dark);
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: 'DM Sans', sans-serif;
  padding: 0;
  cursor: text;
}
.cat-header-name-input:focus {
  background: var(--white);
  border-radius: 4px;
  padding: 1px 5px;
  box-shadow: 0 0 0 2px var(--amber-glow);
}
.cat-header-count { font-size: 10px; color: var(--ink3); flex-shrink: 0; }
.cat-group-items.collapsed { display: none; }

/* ── INGREDIENT LAYOUT ── */
.ing-layout { display: grid; grid-template-columns: 220px 1fr 270px; gap: 16px; align-items: start; }

/* ── REPORT TABLE ── */
table.rpt th { background: var(--navy); }

/* ── MISC ── */
code, .mono {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--navy);
}

/* ── SCROLLBAR GLOBAL ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink4); }

/* ── COLLAPSIBLE SIDEBAR SECTIONS ── */
.section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  padding: 4px 0 8px;
}
.section-toggle .sec-label { margin: 0; }
.section-toggle-arrow {
  font-size: 11px;
  color: var(--ink3);
  transition: transform .2s;
  flex-shrink: 0;
  line-height: 1;
}
.section-toggle-arrow.collapsed { transform: rotate(-90deg); }
.section-body {
  overflow: hidden;
  transition: max-height .25s ease, opacity .2s ease;
  opacity: 1;
}
.section-body.collapsed {
  max-height: 0 !important;
  opacity: 0;
}

/* ── CATALOG UPLOAD WRAP — styled file button ── */
.cat-upload-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.cat-upload-wrap input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  font-size: 0;
}

/* ════════════════════════════════════════════════
   MOBILE RESPONSIVE — breakpoint 768px
   ════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ── Header ── */
  .header { height: auto; flex-wrap: wrap; }
  .header-brand {
    padding: 12px 16px;
    border-right: none;
    border-bottom: 1px solid var(--border-lt);
    width: 100%;
  }
  .header-nav {
    padding: 0 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
    border-bottom: 1px solid var(--border-lt);
  }
  .header-nav::-webkit-scrollbar { display: none; }
  .nav-tab { padding: 0 12px; font-size: 12px; white-space: nowrap; }
  .nav-tab .tab-icon { font-size: 12px; }
  .header-right { padding: 8px 16px; width: 100%; justify-content: space-between; }
  .rest-pill { max-width: 100%; font-size: 11px; }

  /* ── Page layout — stack sidebar above content ── */
  .page-wrap { flex-direction: column; height: auto; min-height: calc(100vh - 64px); }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-lt);
    padding: 16px;
    gap: 12px;
    box-shadow: none;
  }
  .content { padding: 16px; overflow-y: visible; }
  .content.centered { padding: 16px; }

  /* ── Two column grids → single column ── */
  .two-col { grid-template-columns: 1fr !important; }
  .metrics-row.cols2,
  .metrics-row.cols3,
  .metrics-row.cols4 { grid-template-columns: 1fr 1fr !important; }
  .ing-layout { grid-template-columns: 1fr !important; }

  /* ── Page head — stack on mobile ── */
  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 16px;
  }
  .page-head div:last-child { display: flex; flex-wrap: wrap; gap: 8px; }

  /* ── Step pills ── */
  .step-pills { gap: 4px; }
  .sp { font-size: 11px; padding: 4px 10px; }

  /* ── Cards ── */
  .card-head { flex-wrap: wrap; gap: 8px; }

  /* ── Tables — horizontal scroll ── */
  .ing-main, table.it, table.rpt, .opt-tbl {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Ingredient layout ── */
  #dish-nav, #ing-right { display: none; }
  #ing-center { width: 100%; }

  /* ── Metrics ── */
  .metric .m-val { font-size: 26px; }

  /* ── Buttons ── */
  .btn.full { font-size: 13px; padding: 10px; }

  /* ── Chat ── */
  .chat-inp { flex-wrap: wrap; }
  .chat-inp input { width: 100%; }

  /* ── Upload zone ── */
  .upload-zone { padding: 20px 12px; }

  /* ── Catalog bar ── */
  .catalog-bar { flex-wrap: wrap; gap: 8px; }

  /* ── Add row ── */
  .add-row { grid-template-columns: 1fr 1fr !important; gap: 6px; }

  /* ── Batch editor ── */
  .batch-editor-toolbar { flex-wrap: wrap; }
}

/* ── Extra small — phones under 480px ── */
@media (max-width: 480px) {
  .header-brand-text .name { font-size: 15px; }
  .header-brand img { height: 32px; }
  .metrics-row.cols2,
  .metrics-row.cols3,
  .metrics-row.cols4 { grid-template-columns: 1fr !important; }
  .page-head h2 { font-size: 22px; }
  .content, .sidebar { padding: 12px; }
  .nav-tab { padding: 0 10px; font-size: 11px; }
}
