/* Cilantro application workspace: demo, owner CMS and installer. Shares tokens.css. */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; background: #fff; }
.app.is-collapsed { grid-template-columns: 76px 1fr; }
.app-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); padding: 16px 12px 20px; display: flex; flex-direction: column; gap: 14px; background: linear-gradient(180deg, #fff 0%, var(--sage-3) 100%); }
.app-side__brand { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 8px; }
.app-side__brand img { height: 22px; width: auto; }
.app-side__group { font: 600 0.7rem/1 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); padding: 12px 12px 6px; margin: 0; }
.app-side nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.app-side nav a { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-size: 0.89rem; font-weight: 500; }
.app-side nav a:hover { background: rgba(220, 232, 213, 0.6); color: var(--forest); }
.app-side nav a[aria-current=page] { background: #fff; color: var(--forest); font-weight: 600; box-shadow: var(--shadow-1); border: 1px solid var(--line); }
.app-side nav a .ic { color: var(--herb); }
.app-side__foot { margin-top: auto; display: grid; gap: 8px; padding: 8px; }
.app.is-collapsed .app-side__group, .app.is-collapsed .app-side nav a span, .app.is-collapsed .app-side__foot .lbl, .app.is-collapsed .app-side__brand img { display: none; }
.app.is-collapsed .app-side nav a { justify-content: center; padding: 10px; }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px clamp(16px, 3vw, 32px); border-bottom: 1px solid var(--line); }
.app-top .grow { flex: 1; }
.app-search { position: relative; flex: 1; max-width: 420px; }
.app-search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.app-search input { padding-left: 38px; min-height: 40px; border-radius: var(--r-pill); background: var(--sage-3); border-color: transparent; }
.app-search__results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-3); padding: 6px; max-height: 60vh; overflow-y: auto; z-index: 40; }
.app-search__results a { display: flex; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: var(--r-xs); text-decoration: none; color: var(--ink); font-size: 0.88rem; }
.app-search__results a:hover, .app-search__results a:focus { background: var(--sage-2); }
.app-content { padding: clamp(18px, 3vw, 32px); flex: 1; }
.app-footer { padding: 16px clamp(16px, 3vw, 32px); border-top: 1px solid var(--line); font-size: 0.78rem; color: var(--ink-3); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.demo-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--r-pill); background: var(--sage); color: var(--forest); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
.demo-badge .dot { color: var(--herb); }
.loc-select { min-height: 40px; border-radius: var(--r-pill); padding-left: 14px; font-weight: 600; width: auto; max-width: 220px; }
.side-toggle { display: inline-flex; }
.mobile-only { display: none; }
@media (max-width: 960px) {
  .app, .app.is-collapsed { grid-template-columns: 1fr; }
  .app-side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 80; transform: translateX(-100%); transition: transform 0.25s var(--ease); background: #fff; box-shadow: var(--shadow-3); }
  .app.side-open .app-side { transform: none; }
  .app.is-collapsed .app-side__group, .app.is-collapsed .app-side nav a span, .app.is-collapsed .app-side__brand img { display: initial; }
  .mobile-only { display: inline-flex; }
  .desk-only { display: none !important; }
  .app-search { max-width: none; }
}
.side-scrim { position: fixed; inset: 0; background: rgba(32, 36, 32, 0.25); z-index: 70; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); margin: 0; letter-spacing: -0.025em; }
.page-head p { margin: 6px 0 0; color: var(--ink-3); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; gap: 6px; font-size: 0.78rem; color: var(--ink-3); margin-bottom: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--forest); }
.crumbs span + span::before, .crumbs a + span::before, .crumbs a + a::before { content: "/"; margin-right: 6px; color: var(--line-2); }

.panel { border: 1px solid var(--line); border-radius: var(--r-card); background: #fff; padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel__head h2 { font-size: 1.05rem; margin: 0; letter-spacing: -0.01em; }
.panel--sage { background: var(--sage-3); border-color: transparent; }
.panel--flush { padding: 0; overflow: hidden; }
.panel--flush .panel__head { padding: 16px 20px 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-1-2 { grid-template-columns: 1fr 2fr; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-2-1, .grid-1-2, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid-2, .grid-4 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 16px; }

.kpi { border: 1px solid var(--line); border-radius: 20px; padding: 16px 18px; background: #fff; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi__label { font-size: 0.78rem; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.kpi__value { font: 700 1.6rem/1.15 var(--font-head); letter-spacing: -0.02em; color: var(--charcoal); font-variant-numeric: tabular-nums; }
.kpi__meta { font-size: 0.76rem; color: var(--ink-3); }
.kpi__meta .up { color: var(--danger); }
.kpi__meta .down { color: var(--ok); }
a.kpi { text-decoration: none; color: inherit; transition: border-color 0.2s, box-shadow 0.2s; }
a.kpi:hover { border-color: var(--herb); box-shadow: var(--shadow-1); }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fff; position: sticky; top: 0; }
.table th button.sort { border: 0; background: none; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; padding: 0; display: inline-flex; gap: 4px; align-items: center; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--sage-3); }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table a.row-link { color: var(--charcoal); font-weight: 600; text-decoration: none; }
.table a.row-link:hover { color: var(--forest); text-decoration: underline; }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--line-2); }
.table-compact td, .table-compact th { padding: 7px 10px; }
.thumb { width: 44px; height: 44px; border-radius: 12px; overflow: hidden; flex: none; background: var(--sage-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.cell-flex { display: flex; align-items: center; gap: 12px; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty .icon-chip { margin: 0 auto 12px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input, .toolbar .select { min-height: 40px; width: auto; }
.toolbar .grow { flex: 1; min-width: 180px; }
.seg { display: inline-flex; padding: 4px; background: var(--sage-2); border-radius: var(--r-pill); gap: 2px; flex-wrap: wrap; }
.seg a, .seg button { padding: 7px 14px; border-radius: var(--r-pill); font-size: 0.83rem; font-weight: 600; color: var(--ink-2); text-decoration: none; border: 0; background: none; cursor: pointer; }
.seg a[aria-current=true], .seg button[aria-pressed=true] { background: #fff; color: var(--forest); box-shadow: var(--shadow-1); }
.pager { display: flex; gap: 6px; justify-content: flex-end; align-items: center; margin-top: 14px; font-size: 0.85rem; color: var(--ink-3); }

.icon-chip { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; background: var(--sage-2); color: var(--forest); flex: none; }
.icon-chip--sm { width: 32px; height: 32px; border-radius: 10px; }

.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.recipe-card { border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; text-decoration: none; color: var(--ink); background: #fff; display: flex; flex-direction: column; transition: transform 0.2s var(--ease), box-shadow 0.2s; }
.recipe-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); color: var(--ink); }
.recipe-card__photo { aspect-ratio: 4 / 3; background: var(--sage-2); overflow: hidden; }
.recipe-card__body { padding: 14px 16px 16px; display: grid; gap: 4px; }
.recipe-card__body strong { font-family: var(--font-head); font-size: 0.98rem; line-height: 1.3; }

.meter { height: 8px; border-radius: 6px; background: var(--sage-2); overflow: hidden; min-width: 80px; }
.meter i { display: block; height: 100%; background: var(--herb); border-radius: 6px; }
.meter.is-low i { background: #C4862A; }
.meter.is-out i { background: var(--danger); }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 0.9rem; margin: 0; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; font-weight: 500; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-size: 0.88rem; font-weight: 600; color: var(--ink-3); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a[aria-current=page] { color: var(--forest); border-color: var(--forest); }

.chart { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.78rem; color: var(--ink-2); margin-top: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-tip { position: fixed; pointer-events: none; background: var(--charcoal); color: #fff; font-size: 0.78rem; padding: 6px 9px; border-radius: 8px; z-index: 100; white-space: nowrap; }

.matrix-quad { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quad { border-radius: 18px; padding: 14px 16px; min-height: 120px; }
.quad h3 { font-size: 0.95rem; margin: 0 0 6px; display: flex; justify-content: space-between; }
.quad ul { margin: 0; padding-left: 18px; font-size: 0.84rem; }
.quad--star { background: var(--ok-bg); }
.quad--plowhorse { background: var(--info-bg); }
.quad--puzzle { background: var(--warn-bg); }
.quad--dog { background: #F3F4F3; }
.me-star { background: var(--ok-bg); color: var(--ok); }
.me-plowhorse { background: var(--info-bg); color: var(--info); }
.me-puzzle { background: var(--warn-bg); color: var(--warn); }
.me-dog { background: #F1F3F1; color: var(--ink-3); }

.board { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; }
.board__col { background: var(--sage-3); border-radius: 20px; padding: 12px; min-height: 200px; }
.board__col h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin: 4px 6px 10px; display: flex; justify-content: space-between; }
.task { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 10px; }
.task strong { display: block; font-family: var(--font-head); }
.task .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn-touch { min-height: 48px; padding: 12px 20px; font-size: 0.95rem; }

.count-row { display: grid; grid-template-columns: 1fr 140px 110px; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.count-row input { min-height: 48px; font-size: 1.05rem; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .count-row { grid-template-columns: 1fr 110px; } .count-row .var { grid-column: 1 / -1; } }

.label-sheet { display: flex; flex-wrap: wrap; gap: 14px; }
.kitchen-label { width: 2in; min-height: 2in; border: 1px dashed var(--line-2); border-radius: 8px; padding: 10px 12px; font-size: 9pt; line-height: 1.35; background: #fff; color: #000; display: flex; flex-direction: column; gap: 3px; }
.kitchen-label.size-3x2 { width: 3in; min-height: 2in; }
.kitchen-label.size-4x3 { width: 4in; min-height: 3in; font-size: 10pt; }
.kitchen-label strong { font-size: 11pt; font-family: var(--font-head); }
.kitchen-label .qr { width: 56px; height: 56px; align-self: flex-end; margin-top: auto; }

.dialog { border: 0; padding: 0; border-radius: var(--r-card); box-shadow: var(--shadow-3); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); }
.dialog::backdrop { background: rgba(32, 36, 32, 0.32); }
.dialog__body { padding: 22px 24px; }
.dialog__head { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px 0; }
.dialog__head h2 { font-size: 1.15rem; margin: 0; }
.dialog__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 24px 20px; }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { .dialog::backdrop { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); } }

.toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: grid; gap: 8px; }
.toast { background: var(--charcoal); color: #fff; padding: 12px 16px; border-radius: 14px; font-size: 0.88rem; box-shadow: var(--shadow-3); max-width: 360px; }

.sim-note { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--info-bg); color: var(--info); font-size: 0.85rem; margin-bottom: 14px; }
.help-text { font-size: 0.82rem; color: var(--ink-3); }

/* Creative Studio */
.cs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.cs-card { border: 1px solid var(--line); border-radius: 20px; overflow: hidden; text-decoration: none; color: var(--ink); background: #fff; }
.cs-card:hover { border-color: var(--herb); color: var(--ink); }
.cs-card__img { aspect-ratio: 4 / 3; background: var(--sage-2); overflow: hidden; }
.cs-card__body { padding: 12px 14px; display: grid; gap: 4px; }
.cs-prompt { position: relative; }
.cs-prompt textarea { font: 400 0.86rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; min-height: 150px; }
.dropzone { display: block; border: 2px dashed var(--line-2); border-radius: 20px; padding: 26px; text-align: center; background: var(--sage-3); transition: border-color 0.2s, background 0.2s; cursor: pointer; }
.dropzone.is-over { border-color: var(--herb); background: var(--sage-2); }
.crop-stage { position: relative; display: inline-block; overflow: hidden; max-width: 100%; user-select: none; touch-action: none; }
.crop-stage img { max-width: 100%; max-height: 420px; display: block; border-radius: 12px; }
.crop-box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(32, 36, 32, 0.45); cursor: move; border-radius: 4px; }
.crop-box i { position: absolute; width: 14px; height: 14px; background: #fff; border-radius: 3px; right: -7px; bottom: -7px; cursor: nwse-resize; }
.focal-dot { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; border: 3px solid #fff; background: var(--herb); box-shadow: 0 2px 8px rgba(0,0,0,0.3); pointer-events: none; }

/* Auth and installer */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: #fff; }
.auth__form { display: flex; flex-direction: column; justify-content: center; padding: clamp(24px, 6vw, 80px); max-width: 560px; width: 100%; margin: 0 auto; }
.auth__photo { padding: 16px; }
.auth__photo > div { height: 100%; border-radius: var(--r-hero); overflow: hidden; background: var(--sage-2); }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth__photo { display: none; } }
.installer { min-height: 100vh; background: radial-gradient(100% 70% at 80% 0%, var(--sage-2) 0%, #fff 55%); padding: clamp(20px, 5vw, 56px) 16px; }
.installer__card { max-width: 760px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: var(--r-card-lg); box-shadow: var(--shadow-3); padding: clamp(22px, 4vw, 44px); }
.installer__steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 28px; flex-wrap: wrap; }
.installer__steps li { font-size: 0.75rem; font-weight: 600; padding: 5px 11px; border-radius: var(--r-pill); background: #F3F4F3; color: var(--ink-3); }
.installer__steps li.is-done { background: var(--ok-bg); color: var(--ok); }
.installer__steps li.is-current { background: var(--forest); color: #fff; }
.req-list { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 8px; }
.req-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; font-size: 0.9rem; }
.req-list .st { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px; }
.req-list .ok .st { background: var(--ok-bg); color: var(--ok); }
.req-list .bad .st { background: var(--danger-bg); color: var(--danger); }
.req-list .opt .st { background: var(--warn-bg); color: var(--warn); }
.progress-list { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 6px; }
.progress-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--sage-3); font-size: 0.9rem; }
.progress-list li.is-run { background: var(--info-bg); }
.progress-list li.is-done { background: var(--ok-bg); }
.progress-list li.is-fail { background: var(--danger-bg); }
.progress-bar { height: 8px; border-radius: 6px; background: var(--sage-2); overflow: hidden; margin-bottom: 16px; }
.progress-bar i { display: block; height: 100%; width: 0; background: var(--forest); transition: width 0.4s var(--ease); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.86em; background: var(--sage-3); padding: 2px 6px; border-radius: 6px; }

@media print {
  .app-side, .app-top, .app-footer, .no-print, .toast-wrap { display: none !important; }
  .app { display: block; }
  .app-content { padding: 0; }
  .panel { border: 0; padding: 0; }
  .kitchen-label { border: 1px solid #000; break-inside: avoid; }
  body { font-size: 11pt; }
}
