@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 400;
  font-display: swap;
  src: url('fonts/plex-sans-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 500;
  font-display: swap;
  src: url('fonts/plex-sans-500.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 600;
  font-display: swap;
  src: url('fonts/plex-sans-600.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 500;
  font-display: swap;
  src: url('fonts/plex-mono-500.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 600;
  font-display: swap;
  src: url('fonts/plex-mono-600.woff2') format('woff2');
}

* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; }
/* Horizontal split: the org bar spans the top; the sidebar and the main panel share the row below. */
#app { display: grid; grid-template-columns: 260px 1fr; grid-template-rows: auto 1fr; height: 100vh; }
#org-bar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #ccc; background: #f7f7f7; }
#sidebar { grid-row: 2; grid-column: 1; min-height: 0; border-right: 1px solid #ccc; padding: 12px; overflow-y: auto; }
#new-request-btn { width: 100%; margin-bottom: 12px; padding: 8px; }
.step-header { font-size: 11px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.05em; color: #888; margin: 16px 0 4px; }
.step-header:first-of-type { margin-top: 0; }
.thread-item { display: flex; align-items: center; gap: 6px; padding: 8px; border-radius: 6px; margin: 4px 0; cursor: pointer; }
.thread-item:hover { background: #eee; }
.thread-item.selected { background: #dde; }
.thread-main { flex: 1; min-width: 0; }
.thread-title { font-weight: bold; }
.thread-status { font-size: 12px; color: #555; }
.thread-delete-btn { flex: 0 0 auto; padding: 2px 7px; background: none; border: 1px solid #ccc; border-radius: 4px; color: #888; line-height: 1; }
.thread-delete-btn:hover { background: #fdd; border-color: #c33; color: #c33; }
#main-panel { grid-row: 2; grid-column: 2; min-height: 0; padding: 20px; overflow-y: auto; }
#error-banner { background: #fdd; border: 1px solid #c33; padding: 10px; margin-bottom: 12px; border-radius: 4px; }
#status-banner { background: #eef; border: 1px solid #88a; padding: 10px; margin-bottom: 12px; border-radius: 4px; }
#not-authorized-banner { background: #fdd; border: 1px solid #c33; padding: 10px; margin-bottom: 12px; border-radius: 4px; }
.staff-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.tab-btn { padding: 6px 12px; cursor: pointer; border: 1px solid #ccc; background: #f5f5f5; }
.tab-btn.active { background: #fff; font-weight: bold; }
pre.code-view { background: #f5f5f5; padding: 12px; overflow-x: auto; white-space: pre-wrap; border-radius: 4px; }
textarea.feedback { width: 100%; height: 70px; margin: 8px 0; font-family: inherit; }
button { padding: 8px 14px; cursor: pointer; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.deploy-btn { background: #c33; color: white; border: none; }
button.decline-btn { background: none; border: 1px solid #c33; color: #c33; margin-left: 8px; }
button.busy::after { content: " ..."; }
.coverage-row.under-threshold { color: #c33; font-weight: bold; }
.conflict { margin: 10px 0; }
.conflict select { margin-left: 8px; }
.deployment-error-note { font-size: 12px; color: #a55; font-weight: bold; margin-bottom: 4px; }
.components-header { font-size: 13px; color: #444; margin: 4px 0 10px; }
.component { margin-bottom: 16px; }
.component h3 { font-size: 13px; margin: 0 0 4px; font-weight: 600; }
.warnings { border-left: 3px solid #e0a800; padding: 4px 10px; margin-bottom: 10px; font-size: 13px; }
.component-summary { margin: 4px 0 10px; font-size: 13px; }
.component-summary dt { font-weight: 600; color: #444; }
.component-summary dd { margin: 0 0 6px 12px; white-space: pre-wrap; }
.org-failures-note { font-size: 12px; color: #666; margin: 2px 0 6px; }
.admin-permission-set-note { font-size: 12px; color: #666; margin: 2px 0 6px; }
.org-coverage { font-size: 12px; color: #666; }
.pending-note { font-size: 12px; color: #666; font-style: italic; margin-bottom: 4px; }
.history-panel { margin-top: 24px; border-top: 1px solid #ccc; padding-top: 8px; }
.history-panel > summary { cursor: pointer; font-weight: bold; }
.history-event { margin: 6px 0; padding: 4px 8px; border: 1px solid #ddd; border-radius: 4px; }
.history-event > summary { cursor: pointer; }
.history-detail { padding: 6px 0; font-size: 13px; }
.history-block { margin: 8px 0; padding: 8px 10px; border-left: 4px solid #999; border-radius: 3px; }
.history-block-label { font-size: 11px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.history-block-text { white-space: pre-wrap; }
.history-block.original-request { background: #eef4ff; border-left-color: #2b6cb0; }
.history-block.original-request .history-block-label { color: #2b6cb0; }
.history-block.plan-summary { background: #f5f5f5; border-left-color: #999; color: #444; }
.history-block.plan-summary .history-block-label { color: #666; }
.thread-archive-btn { flex: 0 0 auto; padding: 2px 7px; background: none; border: 1px solid #ccc; border-radius: 4px; color: #666; font-size: 11px; }
.thread-archive-btn:hover { background: #eef; border-color: #88a; }
.archived-toggle { width: 100%; margin-top: 12px; padding: 6px; background: none; border: 1px dashed #aaa; color: #555; }
#ledger-btn { width: 100%; margin-bottom: 12px; padding: 8px; }
.ledger-table { border-collapse: collapse; width: 100%; }
.ledger-table th, .ledger-table td { border-bottom: 1px solid #ddd; padding: 6px 8px; text-align: left; }
.ledger-row { cursor: pointer; }
.ledger-row:hover { background: #eee; }
#usage-btn { width: 100%; margin-bottom: 12px; padding: 8px; }
.usage-month { margin: 16px 0 24px; }
.usage-bar { height: 10px; background: #eee; border-radius: 5px; overflow: hidden; margin: 4px 0 8px; }
.usage-bar-fill { height: 100%; background: #6a8; }
.usage-bar-fill.full { background: #c33; }
.badge { font-size: 11px; background: #eee; border: 1px solid #ccc; border-radius: 3px; padding: 1px 5px; margin-left: 6px; }

.auth-screen { grid-column: 1 / -1; grid-row: 1 / -1; min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #F3F4F6; font-family: 'IBM Plex Sans', sans-serif; color: #14161A; }
.auth-card { max-width: 360px; width: 100%; box-sizing: border-box; background: #FFFFFF; border: 1px solid #E5E7EB; border-radius: 16px; box-shadow: 0 1px 2px rgba(16,24,40,0.04); padding: 40px 36px; display: flex; flex-direction: column; gap: 24px; }
.auth-card.auth-card-register { padding: 36px 36px 32px; gap: 20px; }
.auth-brand { display: flex; flex-direction: column; gap: 6px; }
.auth-logo { font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 20px; letter-spacing: -0.02em; }
.auth-tagline { font-size: 12px; color: #6B7280; margin-top: -2px; }
.auth-subtitle { font-size: 13px; color: #6B7280; }
.auth-error { background: #FEF2F2; border: 1px solid #FECACA; border-radius: 10px; padding: 10px 12px; font-size: 13px; color: #B42318; }
.auth-fields { display: flex; flex-direction: column; gap: 16px; }
.auth-card-register .auth-fields { gap: 14px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field span { font-size: 13px; font-weight: 500; color: #374151; }
.auth-field input { height: 40px; box-sizing: border-box; border: 1px solid #D1D5DB; border-radius: 10px; padding: 0 12px; font-size: 14px; font-family: inherit; color: #14161A; background: #FFFFFF; }
.auth-field input::placeholder { color: #9CA3AF; }
.auth-field input:focus { outline: none; border-color: #3730A9; }
.auth-hint { font-size: 12px; color: #9CA3AF; }
.auth-optional { color: #9CA3AF; font-weight: 400; }
.auth-checkbox { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: #374151; line-height: 1.4; }
.auth-checkbox input { margin-top: 3px; width: 15px; height: 15px; accent-color: #3730A9; }
.auth-checkbox a { color: #3730A9; font-weight: 600; }
.auth-submit { height: 42px; border: none; border-radius: 10px; background: #3730A9; color: #FFFFFF; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; }
.auth-divider { height: 1px; background: #E5E7EB; }
.auth-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: #6B7280; }
.auth-switch-center { justify-content: center; }
.auth-switch a { font-size: 13px; font-weight: 600; color: #3730A9; }

.terms-page { max-width: 600px; margin: 0 auto; padding: 44px 48px; box-sizing: border-box; font-family: 'IBM Plex Sans', sans-serif; color: #14161A; background: #FFFFFF; display: flex; flex-direction: column; gap: 20px; }
.terms-back { font-size: 13px; color: #6B7280; font-weight: 500; text-decoration: none; }
.terms-back:hover { opacity: 0.8; }
.terms-header { display: flex; align-items: baseline; justify-content: space-between; }
.terms-title { margin: 0; font-size: 24px; font-family: 'IBM Plex Mono', monospace; font-weight: 600; }
.terms-version-pill { font-size: 12px; color: #6B7280; background: #F3F4F6; padding: 4px 10px; border-radius: 999px; }
.terms-banner { background: #FFF7ED; border: 1px solid #FED7AA; border-radius: 10px; padding: 12px 16px; font-size: 13px; color: #9A3412; line-height: 1.5; }
.terms-sections { display: flex; flex-direction: column; gap: 16px; font-size: 14px; line-height: 1.6; color: #374151; }
.terms-section-heading { font-size: 14px; margin: 0 0 6px; color: #14161A; }
.terms-page-embedded { margin: 0; max-width: 480px; max-height: 90vh; overflow-y: auto; border: 1px solid #E5E7EB; border-radius: 16px; box-shadow: 0 1px 2px rgba(16,24,40,0.04); }
.terms-actions { display: flex; justify-content: flex-end; }

#feedback-link-bar { font-size: 12px; color: #666; margin-bottom: 8px; }
#feedback-link-bar a { color: #2b6cb0; }
