/* ============================================================================
   The application shell.
   ----------------------------------------------------------------------------
   Recovered from commit 03a81f2^, which deleted 1327 lines from src/style.css
   as collateral damage in a commit whose subject was "Add blog: Git as Database".
   Every rule below styles an element src/main.ts mounts, so an unstyled shell
   meant the live demo opened as a default 300x150 iframe in the top left corner
   with the loading text overflowing it. That is what a visitor saw when they
   pressed the primary call to action.

   Token names are remapped onto brand/tokens.css. Nothing else was changed.
   ========================================================================= */

.app-root {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.app-topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}
.app-topbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-topbar__pin {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--paper-sunk);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}
.app-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 550;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.app-back:hover {
  background: var(--paper-sunk);
  color: var(--ink);
}
.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
}
.erp-container {
  flex: 1;
  min-width: 0;
  display: flex;
}
.erp-frame {
  flex: 1;
  min-width: 0;
  border: none;
  background: var(--paper);
}
.copilot-drawer {
  display: flex;
  flex: none;
  flex-direction: column;
  width: 400px;
  border-left: 1px solid var(--rule);
  background: var(--paper);
}
.copilot-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid var(--rule);
}
.copilot-drawer__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 650;
}
.copilot-drawer__title > svg {
  color: var(--accent);
}
.copilot-drawer__status {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--btn-ink);
  font-size: 0.7rem;
  font-weight: 600;
}
.copilot-drawer__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding: 18px;
}
.copilot-drawer__foot {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--rule);
  background: var(--paper);
}
.copilot-drawer {
    position: fixed;
    top: 60px;
    right: 0;
    bottom: 0;
    z-index: 30;
    width: min(100%, 400px);
  }
.copilot-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 7px 5px 13px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper-sunk);
}
.copilot-toggle__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
}
.copilot-toggle__label svg {
  color: var(--accent);
}
.copilot-setup {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.copilot-setup__lead {
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.55;
}
.copilot-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex: none;
}
.switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.switch input:checked + .slider {
  background: var(--accent);
}
.switch input:checked + .slider::before {
  transform: translateX(16px);
}
.switch input:focus-visible + .slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--rule);
  transition: background-color 0.15s ease;
}
.slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.15s ease;
}
.copilot-input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  font-size: 0.9rem;
}
.copilot-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}
.copilot-input:disabled {
  background: var(--paper-sunk);
  color: var(--ink-faint);
  cursor: not-allowed;
}

/* ---- the pieces the recovery could not reach ---------------------------- */
/* An iframe with no size is 300x150. This is the single rule whose absence
   broke the demo. */
#app-root { background: var(--paper); color: var(--ink); }
#app-root[hidden] { display: none !important; }
.app-topbar__inner { width: min(100% - 2.5rem, var(--shell)); margin-inline: auto; }
.app-body { flex: 1 1 auto; display: flex; min-height: 0; }
.erp-container { flex: 1 1 auto; display: flex; min-height: 0; }
.erp-frame { flex: 1 1 auto; width: 100%; height: 100%; min-height: calc(100dvh - 61px); border: 0; display: block; background: var(--paper); }
.app-back:hover { background: var(--paper-sunk); color: var(--ink); }

/* the copilot drawer sits beside the frame and collapses under it on narrow screens */
.copilot-drawer { width: min(380px, 34vw); border-left: 1px solid var(--rule); background: var(--paper-sunk);
                  display: flex; flex-direction: column; min-height: 0; }
.copilot-drawer[hidden] { display: none !important; }
@media (max-width: 900px) { .app-body { flex-direction: column; } .copilot-drawer { width: 100%; border-left: 0; border-top: 1px solid var(--rule); max-height: 45dvh; } }

/* the toggle */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; cursor: pointer; background: var(--rule); border-radius: 999px; transition: background .18s var(--ease); }
.slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: var(--ink);
                  border-radius: 50%; transition: transform .18s var(--ease); }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(16px); background: var(--btn-ink); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.copilot-toggle { display: flex; align-items: center; gap: .55rem; }
.copilot-toggle__label { display: inline-flex; align-items: center; gap: .35rem; font-size: var(--t-small); color: var(--ink-soft); }


/* ============================================================================
   Copilot panel internals.
   Recovered from src/style.css at 03a81f2^, where 1,327 lines were deleted by a
   commit that only meant to add a blog post. Every colour has been remapped from
   the old --color-* names onto brand/tokens.css, so nothing here hardcodes a hex.
   These classes are produced by src/copilot/copilotPanel.ts.
   ========================================================================= */

.copilot-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 0.9rem;
  line-height: 1.55;
}
.chat-user {
  align-self: flex-end;
  border-bottom-right-radius: 2px;
  background: var(--accent);
  color: #ffffff;
}
.chat-assistant {
  align-self: flex-start;
  width: 100%;
  border: 1px solid var(--rule);
  border-bottom-left-radius: 2px;
  background: var(--paper-sunk);
}
.chat-thinking {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.chat-provenance {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.chat-chip {
  padding: 5px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--paper-sunk);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.chat-chip:hover {
  border-color: var(--accent);
  color: var(--btn-ink);
}
.model-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--paper-sunk);
}
.model-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.model-card__name {
  font-size: 0.9rem;
  font-weight: 650;
}
.model-card__size {
  flex: none;
  padding: 2px 9px;
  border-radius: var(--r-lg);
  background: var(--accent-wash);
  color: var(--btn-ink);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.model-card__good {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.model-card__runtime {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
}
.model-card__actions {
  display: flex;
  gap: 8px;
}
.copilot-progress__label {
  font-size: 0.82rem;
  color: var(--ink-soft);
}
/* ============================================================
   A2UI rendered components
   ============================================================ */

.a2ui-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.a2ui-row {
  flex-direction: row;
  gap: 12px;
  flex-wrap: wrap;
}
.a2ui-column {
  flex-direction: column;
  gap: 12px;
}
.a2ui-grid {
  flex-direction: row;
  gap: 12px;
  flex-wrap: wrap;
}
.a2ui-header {
  margin-bottom: 4px;
}
.a2ui-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.a2ui-card {
  padding: 18px;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--paper-sunk);
}
.a2ui-card-title {
  margin-bottom: 4px;
  font-size: 1rem;
  font-weight: 650;
}
.a2ui-card-subtitle {
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: var(--ink-faint);
}
.a2ui-heading {
  font-weight: 700;
  letter-spacing: -0.02em;
}
.a2ui-h1 { font-size: 1.5rem; }
.a2ui-h2 { font-size: 1.25rem; }
.a2ui-h3 { font-size: 1.1rem; }
.a2ui-h4 { font-size: 1rem; }
.a2ui-h5 { font-size: 0.95rem; }
.a2ui-h6 { font-size: 0.9rem; }
.a2ui-text {
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.a2ui-text-caption {
  font-size: 0.8rem;
  color: var(--ink-faint);
}
.a2ui-text-muted {
  color: var(--ink-faint);
}
.a2ui-text-code {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--paper-sunk);
  font-size: 0.82em;
}
.a2ui-metric {
  flex: 1;
  min-width: 150px;
  padding: 14px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--paper-sunk);
}
.a2ui-metric-label {
  font-size: 0.75rem;
  font-weight: 550;
  color: var(--ink-faint);
}
.a2ui-metric-value {
  margin-top: 2px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.a2ui-metric-change {
  margin-top: 4px;
  font-size: 0.75rem;
}
.a2ui-trend-up { color: var(--verified); }
.a2ui-trend-down { color: var(--ink-soft); }
.a2ui-notice {
  padding: 12px 14px;
  border: 1px solid;
  border-radius: var(--r-md);
  font-size: 0.85rem;
}
.a2ui-notice-info    { border-color: #bae6fd; background: var(--accent-wash); color: #1e40af; }
.a2ui-notice-warning { border-color: #fde68a; background: var(--paper-lift); color: #92400e; }
.a2ui-notice-success { border-color: #86efac; background: var(--accent-wash); color: #166534; }
.a2ui-notice-error   { border-color: #fca5a5; background: var(--paper-lift); color: #991b1b; }
.a2ui-notice-title {
  display: block;
  margin-bottom: 2px;
}
.a2ui-notice-message {
  margin: 0;
}
.a2ui-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
}
.a2ui-table {
  width: 100%;
  border-collapse: collapse;
}
.a2ui-table caption {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
}
.a2ui-table th,
.a2ui-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  font-size: 0.85rem;
  white-space: nowrap;
}
.a2ui-table tr:last-child td {
  border-bottom: none;
}
.a2ui-table th {
  color: var(--ink-faint);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.a2ui-chart-title {
  margin-bottom: 10px;
  font-size: 0.9rem;
  font-weight: 650;
}
.a2ui-chart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.8rem;
}
.a2ui-chart-item:last-child {
  margin-bottom: 0;
}
.a2ui-chart-label {
  flex: none;
  width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
}
.a2ui-chart-bar-track {
  flex: 1;
  height: 8px;
  border-radius: var(--r-lg);
  background: var(--paper-lift);
  overflow: hidden;
}
.a2ui-chart-bar-fill {
  height: 100%;
  border-radius: var(--r-lg);
  background: var(--accent);
}
.a2ui-chart-value {
  flex: none;
  width: 64px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
}
.a2ui-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.a2ui-btn-primary { background: var(--accent); color: #ffffff; }
.a2ui-btn-primary:hover { background: var(--accent-quiet); }
.a2ui-btn-secondary { border-color: var(--rule); background: var(--paper-sunk); color: var(--ink); }
.a2ui-btn-secondary:hover { background: var(--paper-sunk); }
.a2ui-btn-outline { border-color: var(--rule); background: transparent; color: var(--accent); }
.a2ui-btn-outline:hover { background: var(--accent-wash); }
.a2ui-divider {
  margin: 4px 0;
  border: none;
  border-top: 1px solid var(--rule);
}
.a2ui-error,
.a2ui-unknown {
  font-size: 0.85rem;
  color: var(--ink-soft);
}
