/* BMI white glass with graphite navigation. Base files own layout and logic. */
html { color-scheme: light; background: #e5e9ed; }

.bmi-theme {
  --bg-start: #cbd3da;
  --bg-mid: #e5e9ed;
  --bg-end: #cbd4dd;
  --ink: #242b32;
  --muted: #586774;
  --line: #647c922b;
  --line-dark: #ffffffc7;
  --surface: #f6f8fa;
  --surface-raised: #ffffff;
  --field-surface: #ffffff;
  --field-focus: #ffffff;
  --field-border: #9caebd;
  --button-surface: #edf2f6;
  --button-hover: #ffffff;
  --button-border: #a9b9c6;
  --brand-red: #e90e00;
  --selected: #ece8fa;
  --selection-edge: #7862b4;
  --cost-accent: #27695f;
  --cost-tint: #e4f1ed;
  --sell-accent: #964436;
  --sell-tint: #faece6;
  --green: #176d46;
  --red: #b32a22;
  --amber: #856000;
  --shadow: inset 0 1px 0 #ffffff, inset 0 -1px 0 #ffffff66, 0 8px 24px #364a5e0e;
  --shadow-strong: inset 0 1px 0 #ffffff, 0 24px 64px #253a522b;
  --radius: 8px;
  color: var(--ink);
  color-scheme: light;
  background-color: var(--bg-mid);
  background-image:
    linear-gradient(118deg, transparent 5%, #ffffffa6 24%, #ffffff14 42%, transparent 60%),
    linear-gradient(32deg, #c5cfd9 0%, #e5eaee 34%, #f4f6f8 60%, #c8d2dc 100%);
  background-attachment: fixed;
}

.bmi-theme::before, .bmi-theme::after { content: none; display: none; }

.bmi-theme .topbar,
.bmi-theme .portal-topbar {
  --ink: #f3f4f5;
  --muted: #c4ccd3;
  --field-surface: #30353a;
  --field-focus: #393f45;
  --field-border: #7b8791;
  --button-surface: #3a4046;
  --button-hover: #505961;
  --button-border: #78858f;
  color: var(--ink);
  color-scheme: dark;
  background: #25272be8;
  border-bottom: 1px solid #ffffff38;
  box-shadow: inset 0 1px 0 #ffffff20, 0 3px 14px #00000026;
  -webkit-backdrop-filter: blur(24px) saturate(110%);
  backdrop-filter: blur(24px) saturate(110%);
}

.bmi-theme .brand-logo { display: block; width: 74px; height: 31px; object-fit: contain; flex: 0 0 74px; }
.bmi-theme .brand { flex-shrink: 0; }
.bmi-theme .brand strong { font-weight: 700; font-size: 13px; }
.bmi-theme .auth-brand .brand-logo { width: 98px; height: 40px; flex-basis: 98px; }
.bmi-theme .auth-brand {
  --ink: #f3f4f5;
  --muted: #c4ccd3;
  color: var(--ink);
  background: linear-gradient(110deg, #ffffff0d, #ffffff00), #292e33;
  margin: -22px -22px 4px;
  padding: 18px 22px;
  border-radius: 6px 6px 0 0;
}

.bmi-theme .panel,
.bmi-theme .auth-card,
.bmi-theme .modal-panel {
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-top-color: #ffffff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .bmi-theme .panel,
  .bmi-theme .auth-card,
  .bmi-theme .modal-panel {
    background: linear-gradient(125deg, #ffffff59, #ffffff00 55%), #f8fafb94;
    -webkit-backdrop-filter: blur(24px) saturate(110%);
    backdrop-filter: blur(24px) saturate(110%);
  }
}

.bmi-theme .auth-card { border-top: 2px solid var(--brand-red); box-shadow: var(--shadow-strong); }
.bmi-theme .panel-title { font-weight: 700; }
.bmi-theme .panel-head { background: #ffffff26; border-color: var(--line); }

/* Opaque editing controls keep small text legible over the glass surfaces. */
.bmi-theme input,
.bmi-theme select,
.bmi-theme textarea,
.bmi-theme output {
  background: var(--field-surface);
  border-color: var(--field-border);
  border-radius: 5px;
  color: var(--ink);
  box-shadow: inset 0 1px 2px #4055690a, 0 1px 0 #ffffff66;
}
.bmi-theme select option { background: var(--field-surface); color: var(--ink); }
.bmi-theme input::placeholder, .bmi-theme textarea::placeholder { color: var(--muted); opacity: 1; }
.bmi-theme input:focus, .bmi-theme select:focus, .bmi-theme textarea:focus {
  border-color: #c95847;
  background: var(--field-focus);
  outline: 2px solid #edb2a888;
  outline-offset: 1px;
  box-shadow: inset 0 1px 2px #4055690a;
}
.bmi-theme input[type=checkbox] { accent-color: var(--brand-red); box-shadow: none; }

.bmi-theme button {
  background: linear-gradient(180deg, #ffffff26, #ffffff00), var(--button-surface);
  color: var(--ink);
  border-color: var(--button-border);
  border-radius: 6px;
  box-shadow: inset 0 1px 0 #ffffff66, 0 1px 2px #34485a0a;
  font-weight: 600;
}
.bmi-theme button:hover { background: var(--button-hover); border-color: #899eae; }
.bmi-theme button:focus-visible { outline: 2px solid #cd6b5a; outline-offset: 2px; }
.bmi-theme .primary-button {
  background: linear-gradient(180deg, #ffffff08, #ffffff00), #d41b0e;
  color: #fff;
  border-color: #c82114;
  font-weight: 700;
}
.bmi-theme .primary-button:hover { background: #bd180c; border-color: #ac190e; }
.bmi-theme .danger-button { color: var(--red); }
.bmi-theme button:disabled, .bmi-theme input:disabled,
.bmi-theme select:disabled, .bmi-theme textarea:disabled {
  opacity: 1;
  background: #e9eef2;
  color: #667580;
  border-color: #bbc7d0;
  box-shadow: none;
}

.bmi-theme .section-toggle {
  background: linear-gradient(100deg, #ffffff66, #ffffff00), #eef3f780;
  border-radius: 0;
  border-color: var(--line);
  box-shadow: inset 0 1px 0 #ffffffb3;
}
.bmi-theme .section-toggle:hover { background: #ffffff99; }
.bmi-theme .meta-content, .bmi-theme .meta-section,
.bmi-theme #termsSection, .bmi-theme .rate-row { border-color: var(--line); }

.bmi-theme .table-wrap { background: #ffffff26; border-color: var(--line); border-radius: 0; }
.bmi-theme th, .bmi-theme td { border-color: #647c9224; }
.bmi-theme th, .bmi-theme .service-column-row th {
  background: #eaf0f4;
  color: #465b6a;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  font-weight: 600;
}
.bmi-theme .calc-table td { background: #ffffff80; }
.bmi-theme #linesTable .service-row:nth-child(even) td { background: #eff4f880; }
.bmi-theme #linesTable .service-row:hover td { background: #e4eef4; }
.bmi-theme #linesTable .service-row[aria-selected=true] td { background: var(--selected); }
.bmi-theme #linesTable .service-row[aria-selected=true] td:first-child { box-shadow: inset 3px 0 var(--selection-edge); }
.bmi-theme #linesTable .select-service { background: transparent; color: var(--ink); font-weight: 600; box-shadow: none; }
.bmi-theme #linesTable .select-service:focus-visible { outline-offset: 0; }
.bmi-theme .calc-table tr.inactive td { color: #667580; background: #edf1f4; }
.bmi-theme #linesTable tr.inactive .select-service { color: #667580; }
.bmi-theme .computed { font-weight: 500; }

.bmi-theme #linesTable .supplier-row td {
  background: linear-gradient(110deg, #ffffff66, #ffffff00), #dce6eda6;
  border-top: 2px solid #bacbd68c;
  box-shadow: inset 0 1px 0 #ffffffb3;
}
.bmi-theme .supplier-name { font-weight: 600; }
.bmi-theme .supplier-meta { color: #566c7b; }
.bmi-theme .supplier-total b { color: #344d5d; font-weight: 600; }
.bmi-theme .supplier-head .icon-button { background: #ffffff99; border-radius: 5px; }
.bmi-theme .supplier-head .icon-button:hover { background: #ffffff; }
.bmi-theme .add-supplier-row td, .bmi-theme .add-service-row td { background: #ffffff40; }
.bmi-theme .add-supplier-row button, .bmi-theme .add-service-row button {
  background: #f2f8f599;
  color: #38685e;
  border-style: solid;
  border-color: #99bdb28c;
  border-radius: 5px;
}
.bmi-theme .add-service-row button:hover { background: #e7f3ed; border-color: #7ba698; }
.bmi-theme .add-supplier-row button { background: #ffffff99; color: #364c5c; border-color: #a5b8c78c; }
.bmi-theme .add-supplier-row button:hover { background: #edf3f7; border-color: #879fad; }
.bmi-theme .delete-service, .bmi-theme .delete-supplier { color: var(--red); border-radius: 5px; }

.bmi-theme .service-editor {
  background: linear-gradient(115deg, #ffffff59, #ffffff00), #eaf0f580;
  border-color: #a8bcc966;
  box-shadow: inset 1px 0 0 #ffffffb3;
}
.bmi-theme .editor-field { color: #536571; }
.bmi-theme .editor-supplier { color: var(--muted); }
.bmi-theme .editor-head { padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.bmi-theme .editor-cost h3 { background: var(--cost-tint); color: var(--cost-accent); border-left: 3px solid #87b1a3; }
.bmi-theme .editor-sell h3 { background: var(--sell-tint); color: var(--sell-accent); border-left: 3px solid #d6a293; }
.bmi-theme .editor-result > span:first-child { color: var(--muted); }
.bmi-theme .editor-cost [data-output="costBase"] { color: var(--cost-accent); }
.bmi-theme .editor-sell [data-output="revenueBase"] { color: var(--sell-accent); }
.bmi-theme #linesTable th:nth-child(4) { background: var(--cost-tint); color: var(--cost-accent); }
.bmi-theme #linesTable th:nth-child(5) { background: var(--sell-tint); color: var(--sell-accent); }
.bmi-theme #linesTable th:nth-child(6) { background: #eaf2e9; color: #466949; }

.bmi-theme .summary-panel {
  background: linear-gradient(100deg, #ffffff59, #ffffff00), #f8fafbbf;
  border-top-color: #b8cad6b3;
  box-shadow: inset 0 1px 0 #ffffff;
}
.bmi-theme .kpi { background: transparent; border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.bmi-theme .kpi:last-child { border-right: 0; }
.bmi-theme #kpiRevenue { color: var(--sell-accent); }
.bmi-theme #kpiCost { color: var(--cost-accent); }
.bmi-theme .margin-status { background: #e9f4ed99; border-color: #a6c7b866; border-radius: 5px; }
.bmi-theme .mini-table { border-radius: 0; background: #ffffff66; }
.bmi-theme .mini-table td { background: #ffffff66; }

.bmi-theme .calc-card, .bmi-theme .user-row, .bmi-theme .access-row {
  background: linear-gradient(115deg, #ffffff59, #ffffff00), #ffffff80;
  border-color: #ffffffd9;
  border-radius: 6px;
  box-shadow: inset 0 1px 0 #ffffff;
}
.bmi-theme .calc-card { border-top: 2px solid #9fb3c1; }
.bmi-theme .permission-pill { background: #e2f0e9; color: #346657; border-radius: 4px; }
.bmi-theme .modal-backdrop { background: #25344047; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.bmi-theme .modal-panel { background-color: #f6f8faed; box-shadow: var(--shadow-strong); }

.bmi-theme .help-button {
  background: #ffffff66;
  border: 1px solid #8fa7b78c;
  color: #597487;
  border-radius: 50%;
  box-shadow: none;
}
.bmi-theme .help-button:hover, .bmi-theme .help-button:focus-visible { background: #ffffff; outline-color: #c47764; }
.bmi-theme .field-help-dialog {
  background: linear-gradient(120deg, #ffffff66, #ffffff00), #f6f8faf5;
  color: var(--ink);
  border-color: #ffffffcc;
  border-radius: 8px;
  box-shadow: var(--shadow-strong);
}
.bmi-theme .field-help-dialog::backdrop { background: #25344047; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.bmi-theme .field-help-head { background: #eaf0f4; border-color: var(--line); }
.bmi-theme .field-help-body h3 { color: var(--sell-accent); }
.bmi-theme a { color: #a3372c; }
.bmi-theme a:hover { color: #762b22; }

.bmi-theme :is(.topbar, .portal-topbar) .help-button { background: #ffffff0a; color: #c4ccd3; border-color: #8495a18c; }
.bmi-theme :is(.topbar, .portal-topbar) .help-button:hover { background: #ffffff20; }
.bmi-theme :is(.topbar, .portal-topbar) a { color: #ffb9ad; }
.bmi-theme :is(.topbar, .portal-topbar) :disabled { background: #30353a; color: #bbc4cc; border-color: #707d88; }

@media (prefers-reduced-transparency: reduce) {
  .bmi-theme { background-image: none; }
  .bmi-theme .panel, .bmi-theme .auth-card, .bmi-theme .modal-panel,
  .bmi-theme .service-editor,
  .bmi-theme .summary-panel, .bmi-theme .field-help-dialog {
    background: #f6f8fa;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .bmi-theme .topbar, .bmi-theme .portal-topbar {
    background: #292e33;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .bmi-theme .modal-backdrop, .bmi-theme .field-help-dialog::backdrop {
    background: #253440b3;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (max-width: 1120px) {
  .bmi-theme .topbar .brand { width: 190px; flex-shrink: 1; }
}
