
:root {
  --bg: #eef7fc;
  --surface: #ffffff;
  --ink: #101820;
  --muted: #657887;
  --line: #d3e4ee;
  --primary: #06618f;
  --primary-dark: #044968;
  --accent: #f06418;
  --amber: #c7831f;
  --blue: #0b6fa8;
  --soft-blue: #e6f4fb;
  --soft-orange: #fff0e8;
  --soft-green: #e7f4eb;
  --soft-red: #fff0ed;
  --soft-amber: #fff5dd;
  --shadow: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.direct-client-field.is-hidden {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 22px;
  background: #fbfdff;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.sidebar::-webkit-scrollbar {
  width: 10px;
}

.sidebar::-webkit-scrollbar-track {
  background: #eef7fc;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #bdd6e5;
  border-radius: 999px;
  border: 2px solid #eef7fc;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 0 0 auto;
}

.brand-logo {
  width: 58px;
  height: 58px;
  object-fit: cover;
  object-position: center 43%;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.brand strong,
.brand span {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.brand span {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.login-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-blue);
  flex: 0 0 auto;
  min-width: 0;
}

.cloud-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8f3;
  flex: 0 0 auto;
  min-width: 0;
}

.cloud-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.cloud-panel label {
  color: #325062;
  font-size: 0.78rem;
}

.cloud-panel input {
  width: 100%;
}

.cloud-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cloud-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #c2ced6;
}

.cloud-dot.online {
  background: #62a77d;
}

.login-panel label {
  color: #325062;
  font-size: 0.8rem;
  font-weight: 700;
}

.login-panel select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid #bdd6e5;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.sidebar .primary-button,
.sidebar .ghost-button,
.sidebar select {
  width: 100%;
  max-width: 100%;
}

.login-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.nav-list {
  display: grid;
  gap: 7px;
  min-width: 0;
  flex: 0 0 auto;
}

.nav-button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  color: #304654;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}

.nav-button:hover,
.nav-button.active {
  background: var(--soft-orange);
  color: #9b3a09;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.75rem;
  line-height: 1.02;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.account-area {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
  justify-content: flex-end;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.user-badge:hover,
.user-badge[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 0 0 1px #c8ddea, 0 10px 26px rgba(15, 43, 60, 0.08);
}

.user-badge span {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.user-badge strong,
.user-badge small {
  display: block;
}

.user-badge small {
  color: var(--muted);
}

.account-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 40;
  width: min(420px, calc(100vw - 36px));
  max-height: min(78vh, 760px);
  overflow-y: auto;
  display: grid;
  gap: 0;
  padding: 0;
  border: 1px solid #c9deea;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(14, 44, 62, 0.2);
  overflow: hidden auto;
}

.account-menu::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 28px;
  width: 14px;
  height: 14px;
  border-left: 1px solid #c9deea;
  border-top: 1px solid #c9deea;
  background: #f7fbfe;
  transform: rotate(45deg);
}

.account-menu.is-hidden {
  display: none;
}

.account-menu-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid #d8e8f1;
  background: linear-gradient(180deg, #f7fbfe 0%, #ffffff 100%);
}

.account-menu-head strong,
.account-menu-head small {
  display: block;
}

.account-menu-head small {
  color: var(--muted);
  margin-top: 2px;
}

.account-menu > .helper-text {
  margin: 0;
  padding: 12px 18px;
  border-bottom: 1px solid #e3eef5;
  background: #fbfdff;
}

.account-form {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-top: 0;
  border-bottom: 1px solid #e3eef5;
}

.account-form label {
  display: grid;
  gap: 6px;
  color: #304654;
  font-size: 0.86rem;
  font-weight: 800;
}

.account-form input,
.account-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c8d9e3;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 11px;
  font-weight: 650;
}

.account-form select:disabled {
  background: #f4f8fb;
  color: var(--muted);
}

.compact-button {
  width: 100%;
  min-height: 42px;
}

.compact-action {
  min-width: 110px;
  min-height: 38px;
  padding: 0 14px;
}

.tight-heading {
  margin-bottom: 0;
}

.two-factor-setup {
  display: grid;
  gap: 10px;
}

.two-factor-setup.is-hidden {
  display: none;
}

.two-factor-qr {
  display: grid;
  place-items: center;
  min-height: 110px;
  padding: 10px;
  border: 1px dashed #bdd6e5;
  border-radius: 8px;
  background: #f7fcff;
}

.two-factor-qr svg,
.two-factor-qr img {
  max-width: 180px;
  width: 100%;
  height: auto;
}

.account-menu > .danger-button {
  margin: 16px 18px 18px;
  width: calc(100% - 36px);
}

.view {
  display: none;
}

.active-view {
  display: grid;
  gap: 22px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.metric-card,
.status-card,
.goal-card,
section,
.deduction-preview,
.bom-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.bom-card {
  padding: 0;
  overflow: hidden;
}

.bom-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}

.bom-card summary::-webkit-details-marker {
  display: none;
}

.bom-card summary small {
  color: var(--muted);
  font-weight: 600;
}

.bom-card[open] summary {
  border-bottom: 1px solid var(--line);
  background: var(--soft-blue);
}

.bom-list {
  margin: 0;
  padding: 10px 16px 14px;
  list-style: none;
  display: grid;
  gap: 8px;
}

.bom-list li {
  display: flex;
  gap: 8px;
  color: var(--ink);
  font-size: 0.95rem;
}

.bom-list li span {
  color: var(--primary);
  font-weight: 700;
}

.metric-card {
  padding: 18px;
  background: #fbfdff;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.85rem;
}

.metric-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

section {
  padding: 18px;
}

#dashboardView section {
  overflow: hidden;
}

#dashboardView .table-wrap {
  max-height: 320px;
  overflow: auto;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#componentInventoryPanel > .section-heading > .button-row { max-width: 100%; min-width: 0; }

.stack {
  display: grid;
  gap: 12px;
}

.bar-chart {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  font-size: 0.86rem;
}

.bar-label {
  color: #304654;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  grid-column: 1 / -1;
  height: 10px;
  border-radius: 999px;
  background: #edf6fb;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: #7db8d6;
}

.bar-value {
  color: var(--muted);
  font-weight: 800;
  text-align: right;
}

.donut-wrap {
  display: grid;
  gap: 12px;
}

.legend-list {
  display: grid;
  gap: 12px;
}

.legend-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  color: #304654;
  font-size: 0.9rem;
}

.legend-item span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #7db8d6;
}

.legend-swatch.orange {
  background: #f6b48b;
}

.legend-swatch.gray {
  background: #b8cbd6;
}

.legend-meter {
  grid-column: 1 / -1;
  height: 10px;
  border-radius: 999px;
  background: #edf6fb;
  overflow: hidden;
}

.legend-meter-fill {
  height: 100%;
  border-radius: inherit;
  background: #7db8d6;
}

.legend-meter-fill.orange {
  background: #f6b48b;
}

.legend-meter-fill.gray {
  background: #b8cbd6;
}

.stacked-chart {
  display: grid;
  gap: 14px;
}

.stage-row {
  display: grid;
  gap: 6px;
}

.stage-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #304654;
  font-size: 0.86rem;
  font-weight: 800;
}

.chat-preview {
  display: grid;
  gap: 12px;
  max-height: 300px;
  overflow: auto;
  padding-right: 4px;
}

.chat-bubble {
  padding: 12px;
  border-radius: 8px;
  background: #f6fbfe;
  border: 1px solid var(--line);
}

.chat-bubble p {
  margin-bottom: 0;
  line-height: 1.45;
}

.mini-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mini-kpi {
  padding: 14px;
  border-radius: 8px;
  background: #f8fbfd;
  border: 1px solid var(--line);
}

.mini-kpi span {
  color: var(--muted);
  display: block;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.mini-kpi strong {
  display: block;
  margin-top: 6px;
  font-size: 1.45rem;
}

.status-card,
.goal-card {
  padding: 14px;
  box-shadow: none;
}

.board-bom-list {
  display: grid;
  gap: 12px;
}

.board-bom-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  padding: 14px;
  background: var(--soft-green);
  color: var(--ink);
}

.board-bom-card.active {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.board-bom-card h3 {
  margin-bottom: 6px;
}

.board-bom-card p {
  margin-bottom: 6px;
  color: var(--ink);
  line-height: 1.45;
}

.board-bom-link {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.86rem;
}

.bom-detail-card {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow);
}

.status-card p,
.goal-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.status-card.low {
  background: var(--soft-red);
  border-color: #efc1b8;
}

.status-card.watch {
  background: var(--soft-amber);
  border-color: #ead095;
}

.status-card.good {
  background: var(--soft-green);
  border-color: #bed8ca;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.inventory-scroll {
  max-height: 520px;
  overflow: auto;
}

.board-scroll {
  max-height: 420px;
  overflow: auto;
}

.tracking-scroll {
  max-height: 360px;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}

th {
  color: #43504b;
  background: #f7f8f5;
  font-size: 0.74rem;
  text-transform: uppercase;
}

.inventory-scroll th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.board-scroll th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.tracking-scroll th {
  position: sticky;
  top: 0;
  z-index: 1;
}

tr:last-child td {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #edf1ee;
  color: #31403a;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.pill.good {
  background: var(--soft-green);
  color: var(--primary-dark);
}

.pill.warn {
  background: var(--soft-amber);
  color: #68420b;
}

.pill.low {
  background: var(--soft-red);
  color: #8f2d20;
}

.onboarding-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.compact-metric {
  padding: 14px;
}

.compact-metric span,
.compact-metric p {
  color: var(--muted);
}

.compact-metric strong {
  display: block;
  margin: 6px 0 4px;
  color: var(--ink);
  font-size: 1.6rem;
}

.onboarding-card,
.knowledge-card,
.empty-state {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.onboarding-card.is-due {
  border-color: #f3c37a;
  background: #fffaf1;
}

.onboarding-card-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.onboarding-card-top h3,
.empty-state p {
  margin-bottom: 0;
}

.onboarding-card select {
  width: 100%;
}

.knowledge-attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-blue);
}

.knowledge-attachment strong,
.knowledge-attachment span {
  display: block;
}

.knowledge-attachment span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.84rem;
}

.knowledge-actions {
  display: inline-flex;
  gap: 8px;
  flex: 0 0 auto;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 10px;
  margin-bottom: 14px;
}

.app-footer {
  margin-top: 28px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.app-footer strong {
  display: block;
  color: var(--ink);
}

.footer-app-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.footer-app-link {
  min-height: 36px;
  border: 1px solid #c8ddea;
  border-radius: 999px;
  padding: 0 12px;
  background: #f7fbfe;
  color: #24495a;
  font-size: 0.84rem;
  font-weight: 800;
}

.footer-app-link:hover,
.footer-app-link.active {
  background: var(--soft-orange);
  border-color: #f4cbb8;
  color: #9b3a09;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: #3f4b46;
  font-size: 0.82rem;
  font-weight: 800;
}

input,
select,
textarea {
  min-width: 0;
  min-height: 42px;
  border: 1px solid #cbd4ce;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 11px;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(6, 97, 143, 0.25);
  outline-offset: 1px;
}

textarea {
  padding: 11px;
  line-height: 1.45;
  resize: vertical;
}

.wide-field {
  grid-column: 1 / -1;
}

.deduction-preview {
  padding: 12px;
  box-shadow: none;
  background: #f7f8f5;
  color: #394641;
  line-height: 1.45;
}

.primary-button,
.ghost-button {
  min-height: 42px;
  border-radius: 6px;
  font-weight: 800;
}

.primary-button {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

.primary-button:hover {
  background: var(--primary-dark);
}

.ghost-button {
  margin-top: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: #304654;
  flex: 0 0 auto;
  white-space: normal;
  line-height: 1.2;
  padding: 8px 10px;
}

.ghost-button:hover {
  background: var(--soft-blue);
}

.goal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 13px 15px;
  border-radius: 8px;
  background: #111916;
  color: #fff;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.helper-text {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.inline-control {
  min-height: 34px;
  min-width: 150px;
  padding: 0 8px;
}

.danger-button,
.small-button {
  min-height: 34px;
  border-radius: 6px;
  font-weight: 800;
}

.icon-button {
  width: 36px;
  min-width: 36px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 1.05rem;
  line-height: 1;
}

.button-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}

.field-label-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.field-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex: 0 0 auto;
}

.small-button {
  border: 1px solid var(--primary);
  background: var(--soft-blue);
  color: var(--primary-dark);
}

.danger-button {
  border: 1px solid #f0b9ad;
  background: var(--soft-red);
  color: #9b2c1c;
}

.message-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 8px;
}

body.inventory-only {
  background: #fff;
}

body.inventory-only .app-shell {
  display: block;
  min-height: 100vh;
}

body.inventory-only .sidebar,
body.inventory-only .topbar,
body.inventory-only #productionView > .split-layout {
  display: none;
}

body.inventory-only .workspace {
  padding: 18px;
}

body.inventory-only #productionView.active-view {
  display: block;
}

body.inventory-only #productionView > #inventorySplit {
  display: block;
}

body.inventory-only #productionView > #inventorySplit > section {
  display: none;
}

body.inventory-only #componentInventoryPanel {
  display: block;
  min-height: calc(100vh - 36px);
  padding: 22px;
  border: 0;
  box-shadow: none;
}

body.inventory-only #componentInventoryPanel .section-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

body.inventory-only .inventory-scroll {
  max-height: calc(100vh - 132px);
}

body.inventory-only table {
  min-width: 1000px;
}

body.standalone-inventory {
  min-height: 100vh;
  background: #fff;
}

.inventory-page {
  padding: 18px;
}

.standalone-inventory #componentInventoryPanel {
  min-height: calc(100vh - 36px);
  padding: 22px;
  border: 0;
  box-shadow: none;
}

.standalone-inventory #componentInventoryPanel .section-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.full-inventory-scroll {
  max-height: calc(100vh - 146px);
}

.standalone-inventory table {
  min-width: 1000px;
}

body.standalone-bom {
  min-height: 100vh;
  background: #fff;
}

.bom-page {
  padding: 18px;
}

.standalone-bom section {
  min-height: calc(100vh - 36px);
  padding: 22px;
  border: 0;
  box-shadow: none;
}

.standalone-bom .section-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.full-bom-scroll {
  max-height: calc(100vh - 146px);
}

.standalone-bom table {
  min-width: 840px;
}

body.standalone-tracking {
  min-height: 100vh;
  background: #fff;
}

.tracking-page {
  padding: 18px;
}

.standalone-tracking section {
  min-height: calc(100vh - 36px);
  padding: 22px;
  border: 0;
  box-shadow: none;
}

.standalone-tracking .section-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.full-tracking-scroll {
  max-height: calc(100vh - 146px);
  overflow: auto;
}

.standalone-tracking table {
  min-width: 1000px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.muted-cell {
  color: var(--muted);
}

.locked {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ghost-button {
    margin-top: 0;
  }

  .metric-grid,
  .dashboard-grid,
  .goal-grid,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1280px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .user-badge {
    justify-content: flex-start;
  }

  .form-grid,
  .nav-list {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .bar-value {
    text-align: left;
  }

  .mini-kpi-grid {
    grid-template-columns: 1fr;
  }
}
.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 420px);
  gap: 24px;
  align-items: center;
  padding: 36px;
  background:
    linear-gradient(135deg, rgba(235, 248, 246, 0.92), rgba(246, 250, 255, 0.96)),
    #f6faf9;
}

.auth-screen.is-hidden,
.app-shell.is-locked {
  display: none;
}

.auth-brand {
  max-width: 560px;
}

.auth-logo {
  width: min(280px, 72vw);
  height: auto;
  margin-bottom: 24px;
}

.auth-brand h1 {
  margin: 6px 0 0;
  color: #1f3d4a;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.05;
}

.auth-card {
  display: grid;
  gap: 16px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(49, 112, 108, 0.14);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(45, 73, 87, 0.12);
}

.auth-card h2 {
  margin: 0;
  color: #1f3d4a;
}

.auth-card label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  color: #39525d;
}

.auth-card input {
  width: 100%;
}

.password-field span {
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 8px;
  align-items: center;
}

.password-field .icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: #28736c;
  font-weight: 800;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

.auth-card.is-hidden {
  display: none;
}

.session-panel {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(49, 112, 108, 0.12);
}

.session-panel small,
.session-panel p {
  margin: 0;
  color: #667b84;
}

@media (max-width: 820px) {
  .auth-screen {
    grid-template-columns: 1fr;
    padding: 22px;
  }
}
.current-goals-section,
.assigned-goals-section {
  display: grid;
  gap: 16px;
}

.assigned-goals-section {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid #cfe5f0;
  border-radius: 8px;
  background: linear-gradient(180deg, #f7fcff 0%, #fff8f3 100%);
}

.goal-editor-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #cbdfe9;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(15, 91, 121, 0.08);
}

.current-goal-card {
  border-color: #f5c8ad;
  background: #fffaf6;
}

.goal-card-top,
.goal-meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.goal-card-top h3 {
  margin: 4px 0 0;
  color: #10202f;
}

.goal-meta-row {
  justify-content: flex-start;
  flex-wrap: wrap;
  color: #5b7280;
  font-size: 0.9rem;
}

.goal-credit-badge {
  min-width: 90px;
  padding: 8px 10px;
  border: 1px solid #b9d9e8;
  border-radius: 999px;
  background: #eef8fc;
  color: #0f5b79;
  font-weight: 800;
  text-align: center;
}

.goal-editor-card textarea,
.goal-editor-card input,
.goal-editor-card select {
  width: 100%;
}

.goal-editor-card textarea:disabled,
.goal-editor-card input:disabled,
.goal-editor-card select:disabled {
  color: #607684;
  background: #f6fafc;
}

#goalCards.goal-grid {
  display: block;
}

#goalsView .current-goals-section,
#goalsView .assigned-goals-section {
  width: 100%;
  max-width: 1180px;
}

#goalsView .current-goals-section {
  margin-bottom: 24px;
}

#goalsView .goal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: 18px;
}

#goalsView .goal-editor-card {
  min-width: 0;
}

#goalsView .goal-card-top {
  align-items: flex-start;
}

#goalsView .goal-card-top > div:first-child {
  min-width: 0;
}

#goalsView .goal-card-top h3 {
  overflow-wrap: anywhere;
}

#goalsView .form-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.goal-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(310px, 100%), 1fr));
  gap: 18px;
}

.goal-summary-card {
  min-height: 250px;
  padding: 22px;
  border: 1px solid #cbdfe9;
  border-radius: 8px;
  background: #ffffff;
  color: #5b7280;
  box-shadow: 0 8px 20px rgba(15, 91, 121, 0.05);
}

.goal-summary-card h3 {
  margin: 0;
  color: #071320;
  font-size: 1.15rem;
}

.goal-summary-card p {
  margin: 8px 0;
  line-height: 1.45;
}

.goal-summary-card strong {
  color: #506776;
}

.goal-summary-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.goal-assignment-section {
  width: 100%;
  max-width: 1180px;
  margin-top: 24px;
  padding: 18px;
  border: 1px solid #f2cdb7;
  border-radius: 8px;
  background: #fff8f3;
}

.goal-assignment-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #cfe5f0;
  border-radius: 8px;
  background: #ffffff;
}

.goal-assignment-card textarea,
.goal-assignment-card input,
.goal-assignment-card select {
  width: 100%;
}

#goalsView .goal-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}

.goal-tab-card {
  min-height: 0;
  padding: 16px;
}

.goal-tab-card p {
  margin: 6px 0;
  font-size: 0.96rem;
}

.goal-summary-top small {
  display: block;
  margin-top: 4px;
  color: #607684;
}

.goal-status-chip {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid #bdd8e5;
  border-radius: 999px;
  background: #eef8fc;
  color: #0f5b79;
  font-size: 0.78rem;
  font-weight: 800;
}

.goal-status-chip.done {
  border-color: #b9dfcb;
  background: #f0fbf4;
  color: #24754d;
}

.goal-status-chip.due {
  border-color: #f4c7ac;
  background: #fff7f1;
  color: #b34b16;
}

.goal-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.empty-goal-card {
  border-style: dashed;
  background: #fbfdfe;
}

.agent-profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid #cfe0ea;
  border-radius: 8px;
  background: #ffffff;
}

.agent-profile-card img,
.agent-photo-placeholder {
  width: 84px;
  height: 84px;
  flex: 0 0 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #b9d9e8;
  background: #eef8fc;
}

.agent-photo-placeholder {
  display: grid;
  place-items: center;
  color: #0f5b79;
  font-size: 1.4rem;
  font-weight: 800;
}

.agent-profile-card h3 {
  margin: 0 0 6px;
}

.agent-profile-card p {
  margin: 3px 0;
  color: #5b7280;
}

.certificate-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid #d9e7ef;
  border-radius: 8px;
  background: #f8fbfd;
}

.certificate-edit-grid label {
  gap: 4px;
  font-size: 0.85rem;
}

.certificate-edit-grid input {
  width: 100%;
  min-width: 0;
}

#knowledgeCards .knowledge-card { min-width: 0; overflow-wrap: anywhere; }
.knowledge-body { white-space: pre-wrap; }
.knowledge-guide summary { cursor: pointer; color: #08688b; font-weight: 600; padding: 12px 0; min-height: 44px; }
.knowledge-guide summary:focus-visible { outline: 2px solid #08688b; outline-offset: 3px; }
.knowledge-guide ol { padding-left: 24px; margin: 8px 0 16px; }
.knowledge-guide li { padding-left: 4px; margin-bottom: 14px; line-height: 1.6; }
#knowledgeCards .icon-button, #goalCards .icon-button { min-width: 44px; min-height: 44px; }

@media (max-width: 760px) {
  #goalsView .goal-card-top {
    display: grid;
  }

  #goalsView .goal-credit-badge {
    width: fit-content;
  }
}
