:root { --app-navy:#071a33; --app-navy-light:#123653; --app-red:#b7191f; --app-red-dark:#8e1117; --app-cream:#f6f0e8; --app-surface:#fbf8f4; --app-border:#d8cec2; --app-muted:#667085; --app-pale-red:#fbeaec; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.current-demo { height: 100vh; overflow: hidden; color: var(--app-navy); background: var(--app-cream); font-family: "Segoe UI", Arial, sans-serif; font-size: 16px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-header { height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 18px 14px 22px; color: white; background: var(--app-navy); border-bottom: 4px solid var(--app-red); }
.app-title { display: flex; align-items: center; gap: 13px; min-width: 330px; color: white; text-decoration: none; }
.app-title img { width: 49px; height: 49px; border-radius: 8px; }
.app-title span { display: flex; flex-direction: column; }
.app-title strong { font-size: 26px; line-height: 1.1; }
.app-title small { margin-top: 3px; color: #d5dee8; font-size: 13px; }
.app-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.app-header-actions button, .guided-actions button, .guided-actions a, .app-button { min-height: 40px; padding: 8px 16px; color: var(--app-navy); background: white; border: 1px solid var(--app-border); border-radius: 7px; font-weight: 600; text-decoration: none; }
.app-header-actions .primary, .guided-actions .primary, .app-button.primary { color: white; background: var(--app-red); border-color: var(--app-red-dark); font-weight: 700; }
.demo-flag { padding: 7px 9px; color: #f2c16f; border: 1px solid #35516b; border-radius: 5px; font-size: 11px; font-weight: 800; letter-spacing: .05em; }
.app-shell { height: calc(100vh - 88px); display: grid; grid-template-columns: 310px minmax(0,1fr); }
.app-sidebar { min-height: 0; background: var(--app-navy); }
.app-sidebar nav { height: 100%; overflow-y: auto; padding: 4px 0 18px; scrollbar-color: #49647f var(--app-navy); }
.app-sidebar button { display: block; width: calc(100% - 20px); min-height: 45px; margin: 6px 10px 2px; padding: 11px 14px; color: white; background: var(--app-navy-light); border: 1px solid var(--app-navy-light); border-radius: 7px; text-align: left; font-weight: 600; }
.app-sidebar button:hover { opacity: .9; }
.app-sidebar button.active { background: var(--app-red); border-color: var(--app-red-dark); font-weight: 700; }
.app-main { min-width: 0; overflow: auto; padding: 22px 22px 150px; background: var(--app-cream); }
.page-wrap { max-width: none; margin: 10px; }
.page-title { margin: 10px 4px; color: var(--app-navy); font-size: 30px; line-height: 1.2; }
.page-description { margin: 2px 4px 8px; color: var(--app-muted); line-height: 1.45; }
.section-title { margin: 20px 4px 8px; color: var(--app-red); font-size: 20px; }
.app-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0; margin: 4px; }
.app-card { margin: 6px; padding: 16px; background: white; border: 1px solid var(--app-border); border-radius: 10px; }
.metric-card { width: 245px; min-height: 112px; }
.metric-card strong { display: block; color: var(--app-red); font-size: 32px; }
.metric-card span { color: var(--app-muted); }
.field-card { min-width: 280px; }
.field-card label, .compact-field label { display: block; margin: 0 2px 4px; font-weight: 600; }
.field-card input, .field-card select, .field-card textarea, .compact-field input, .compact-field select { width: 100%; min-height: 38px; padding: 8px 10px; color: var(--app-navy); background: white; border: 1px solid var(--app-border); border-radius: 0; }
.compact-fields { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.compact-field { margin: 4px; }
.app-button { display: inline-flex; align-items: center; justify-content: center; min-width: 150px; margin: 4px; }
.app-table-wrap { margin: 4px; overflow: auto; border: 1px solid var(--app-border); background: white; }
.app-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.app-table th { padding: 10px; color: white; background: var(--app-navy); border-right: 1px solid var(--app-navy-light); text-align: left; font-weight: 600; white-space: nowrap; }
.app-table td { height: 44px; padding: 9px 10px; color: var(--app-navy); border-bottom: 1px solid var(--app-border); }
.app-table tbody tr:nth-child(odd) { background: var(--app-surface); }
.app-table tbody tr.selected { background: var(--app-pale-red); }
.app-table input[type="checkbox"], .app-table input[type="radio"] { width: 18px; height: 18px; accent-color: var(--app-red); }
.status-text { font-weight: 600; }
.status-text.pending { color: #8a5c00; }
.scenario-block { margin: 6px; padding: 16px; color: white; background: var(--app-navy); border: 1px solid var(--app-red); border-left-width: 5px; border-radius: 10px; }
.scenario-block strong { color: white; }
.scenario-block p { margin-bottom: 0; color: #dce5ee; }
.question-card h3 { margin: 0 0 10px; color: var(--app-red); }
.answer-row { display: flex; gap: 9px; align-items: flex-start; margin: 5px 0; padding: 8px; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 7px; }
.answer-row input { margin-top: 3px; accent-color: var(--app-red); }
.notice-card { border-left: 5px solid var(--app-red); }
.tab-strip { display: flex; flex-wrap: wrap; margin: 10px 4px 0; border-bottom: 1px solid var(--app-border); }
.tab-strip button { min-height: 40px; padding: 8px 15px; color: var(--app-navy); background: #ece7e1; border: 1px solid var(--app-border); border-bottom: 0; }
.tab-strip button.active { background: white; font-weight: 700; }
.guided-panel { position: fixed; right: 24px; bottom: 22px; z-index: 20; width: min(630px, calc(100vw - 48px)); padding: 14px 16px; background: white; border: 2px solid var(--app-red); border-radius: 10px; box-shadow: 0 12px 34px rgba(7,26,51,.24); }
.guided-panel.collapsed { width: auto; padding: 8px 10px; }
.guided-panel.collapsed .guided-heading span, .guided-panel.collapsed .guided-heading strong, .guided-panel.collapsed p, .guided-panel.collapsed .guided-actions > :not(#guide-toggle) { display: none; }
.guided-heading { display: flex; align-items: baseline; gap: 12px; }
.guided-heading span { color: var(--app-red); font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.guided-heading strong { font-size: 18px; }
.guided-panel p { margin: 5px 0 10px; color: var(--app-muted); font-size: 14px; }
.guided-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.guided-actions > span { margin-right: 4px; color: var(--app-muted); font-size: 13px; }
.guided-actions button, .guided-actions a { min-height: 34px; padding: 6px 11px; font-size: 13px; }
.current-toast { position: fixed; left: 330px; bottom: 24px; z-index: 30; max-width: 440px; padding: 13px 17px; color: white; background: var(--app-navy-light); border-left: 5px solid var(--app-red); opacity: 0; transform: translateY(12px); transition: .18s ease; pointer-events: none; }
.current-toast.show { opacity: 1; transform: translateY(0); }
.read-only-notice { display: flex; gap: 10px; align-items: center; margin: 6px; padding: 10px 13px; color: #6c1c22; background: var(--app-pale-red); border: 1px solid #dfaeb1; border-radius: 7px; font-size: 14px; }
.read-only-notice strong { white-space: nowrap; }
.subtab-strip { display: flex; flex-wrap: wrap; gap: 3px; margin: 12px 4px 0; border-bottom: 1px solid var(--app-border); }
.subtab-strip button { min-height: 40px; padding: 8px 14px; color: var(--app-navy); background: #eee9e3; border: 1px solid var(--app-border); border-bottom: 0; }
.subtab-strip button.active { background: white; font-weight: 700; }
.summary-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 6px; }
.summary-grid .app-card { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.form-grid .wide { grid-column: 1 / -1; }
.check-grid { display: grid; grid-template-columns: repeat(3,minmax(180px,1fr)); gap: 7px; margin-top: 8px; }
.check-tile { display: flex; gap: 8px; align-items: center; min-height: 42px; padding: 8px 10px; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 7px; }
.check-tile input { width: 18px; height: 18px; accent-color: var(--app-red); }
.builder-layout { display: grid; grid-template-columns: 330px minmax(0,1fr); gap: 12px; }
.builder-bank { align-self: start; max-height: 680px; overflow: hidden; }
.builder-item { margin: 7px 0; padding: 10px; background: var(--app-surface); border: 1px solid var(--app-border); }
.flow-divider { margin: 10px 6px; padding: 11px; color: var(--app-red); background: var(--app-pale-red); border: 1px dashed var(--app-red); text-align: center; font-style: italic; }
.permission-table td:not(:first-child), .permission-table th:not(:first-child) { text-align: center; }
.permission-table input { accent-color: var(--app-red); }
.help-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.help-topic h3 { margin: 0 0 5px; color: var(--app-red); }
.help-topic ol { margin: 8px 0 0; padding-left: 22px; color: var(--app-muted); }
.profile-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.tag { padding: 5px 8px; color: var(--app-navy); background: #edf1f5; border: 1px solid #cbd3dc; border-radius: 5px; font-size: 13px; }
.status-chip { display: inline-block; padding: 4px 8px; border-radius: 5px; font-size: 12px; font-weight: 700; }
.status-chip.pending { color: #765000; background: #fff0cc; }
.status-chip.approved { color: #17613e; background: #dff4e8; }
.status-chip.returned { color: #812128; background: var(--app-pale-red); }
.readonly-field, [data-readonly-control] { cursor: not-allowed; }
input:disabled, select:disabled, textarea:disabled { color: var(--app-navy); background: #f5f3f0; opacity: 1; cursor: not-allowed; }
.app-button.readonly { color: #596679; background: #eceff2; border-color: #c9cfd6; }
@media (max-width: 1100px) {
  .builder-layout, .profile-layout { grid-template-columns: 1fr; }
  .summary-grid, .check-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 1180px) {
  .demo-flag { display: none; }
  .app-shell { grid-template-columns: 250px minmax(0,1fr); }
  .app-title { min-width: 285px; }
  .app-title strong { font-size: 22px; }
  .current-toast { left: 270px; }
}
@media (max-width: 820px) {
  body.current-demo { height: auto; overflow: auto; }
  .app-header { height: auto; min-height: 82px; flex-wrap: wrap; }
  .app-header-actions { width: 100%; justify-content: flex-start; overflow-x: auto; }
  .app-shell { height: auto; min-height: calc(100vh - 82px); grid-template-columns: 1fr; }
  .app-sidebar { position: sticky; top: 0; z-index: 10; }
  .app-sidebar nav { display: flex; height: auto; overflow-x: auto; padding: 4px; }
  .app-sidebar button { width: auto; min-width: max-content; margin: 3px; }
  .app-sidebar .nav-collapse { display: none; }
  .app-main { overflow: visible; padding: 14px 10px 190px; }
  .compact-fields { grid-template-columns: 1fr; }
  .summary-grid, .check-grid, .form-grid, .help-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .current-toast { left: 20px; }
}
