:root {
  color-scheme: light;
  font-family: "DM Sans", "Segoe UI", sans-serif;
  background: #f3f7fa;
  color: #102b46;
  --line: #d5e0e8;
  --muted: #516777;
  --accent: #145b64;
  --accent-dark: #114852;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: 1rem; line-height: 1.5; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
button, a, summary, input, select, textarea { touch-action: manipulation; }
:focus-visible { outline: 3px solid #14878d; outline-offset: 3px; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.16; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.85rem, 4.5vw, 2.9rem); letter-spacing: -.055em; }
h2 { font-size: 1.25rem; letter-spacing: -.025em; }
h3 { font-size: 1.125rem; }
.shell { width: min(70rem, calc(100% - 2.5rem)); margin-inline: auto; }
.muted { color: var(--muted); }

.top { background: #102b46; color: #fff; }
.top-inner, .brand, .profile { display: flex; align-items: center; gap: .75rem; }
.top-inner { justify-content: space-between; min-height: 4.75rem; }
.brand { font-weight: 800; text-decoration: none; letter-spacing: -.025em; }
.brand img { display: block; border-radius: .5rem; }
.profile { justify-content: flex-end; font-size: .875rem; overflow-wrap: anywhere; }
.profile strong { display: inline-block; padding-left: .3rem; color: #b6e5df; }
.back { font-size: .875rem; }

.signin { min-height: min(44rem, calc(100dvh - 4.75rem)); display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; gap: clamp(2rem, 6vw, 6rem); padding-block: 3rem; max-width: 59rem; }
.signin-intro h1 { font-size: clamp(2.6rem, 6.5vw, 4.45rem); }
.signin-intro p { max-width: 32ch; margin-top: 1.1rem; color: var(--muted); font-size: 1.08rem; }
.login { padding: clamp(1.25rem, 4vw, 2rem); }
.login h2 { font-size: 1.5rem; }
.login-note { margin-top: 1.1rem; font-size: .875rem; }
.login button { width: 100%; }
.card { min-width: 0; border: 1px solid var(--line); border-radius: .95rem; background: #fff; padding: 1.25rem; }
.card h2 + p { margin-top: .5rem; }
.card p + .primary { margin-top: 1rem; }
.stack { display: grid; gap: 1rem; margin-top: 1.15rem; }
.stack > button { justify-self: start; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
label { display: grid; gap: .38rem; font-size: .9rem; font-weight: 650; }
input:not([type=hidden]), textarea, select {
  width: 100%; min-height: 2.8rem; padding: .62rem .75rem; border: 1px solid #a9bfcb;
  border-radius: .5rem; background: #fff; color: #102b46; font-size: 1rem; font-weight: 400;
}
textarea { resize: vertical; }
select {
  appearance: none; padding-right: 2.3rem; background-image: linear-gradient(45deg, transparent 50%, #516777 50%), linear-gradient(135deg, #516777 50%, transparent 50%);
  background-position: right 1.15rem center, right .85rem center; background-size: .3rem .3rem; background-repeat: no-repeat;
}
.primary, .secondary {
  display: inline-flex; justify-content: center; align-items: center; min-height: 2.75rem; padding: .55rem 1rem;
  border-radius: .55rem; border: 1px solid transparent; text-decoration: none; font-weight: 700; line-height: 1.2; font-size: .9rem;
}
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-dark); }
.secondary { border-color: var(--line); background: #fff; color: #102b46; }
.secondary:hover { background: #edf4f7; }
.top .secondary { background: transparent; border-color: #698597; color: #fff; }
.top .secondary:hover { background: #1d3c55; }
.message { padding: .75rem 1rem; margin-block: .85rem 1rem; border-radius: .55rem; border: 1px solid; }
.error { color: #892c21; background: #fff4f0; border-color: #edc4bc; }
.success { color: #1d5b45; background: #ecfbf3; border-color: #b6dec8; }

.tabs { display: flex; flex-wrap: wrap; gap: .35rem 1rem; padding-top: .7rem; border-bottom: 1px solid var(--line); }
.tabs a { display: flex; align-items: center; min-height: 2.75rem; padding: .4rem .5rem; text-decoration: none; font-size: .9rem; font-weight: 650; color: var(--muted); border-bottom: 3px solid transparent; }
.tabs a[aria-current], .tabs a:hover { border-bottom-color: var(--accent); color: var(--accent-dark); }
.dashboard { padding-block: 1.75rem 3rem; }
.page-heading, .section-heading, .order-heading, .account-heading { display: flex; justify-content: space-between; align-items: center; gap: .65rem 1rem; flex-wrap: wrap; }
.page-heading { margin-bottom: 1.25rem; }
.section-heading { margin-bottom: .85rem; }
.section-heading a, .edit-link, .lines a { color: var(--accent-dark); font-size: .9rem; font-weight: 700; }
.form-card { max-width: 40rem; margin-bottom: 1.25rem; }
.metrics, .orders, .columns { display: grid; gap: 1rem; }
.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 1.55rem; }
.metric { display: grid; gap: .2rem; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: .75rem; background: #fff; text-decoration: none; }
a.metric:hover, .metric.selected { border-color: var(--accent); background: #e8f5f2; }
.metric span, dt { font-size: .875rem; color: var(--muted); }
.metric strong { font-size: 1.65rem; line-height: 1.2; }
.orders, .columns { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.order-heading { flex-wrap: nowrap; align-items: flex-start; }
.badge { flex-shrink: 0; padding: .21rem .6rem; border-radius: 2rem; font-size: .875rem; font-weight: 650; color: #354c66; background: #edf2f7; }
.badge.active { color: #184c74; background: #e5f0fc; }
.badge.revision { color: #71440b; background: #fff1d5; }
.badge.done { color: #1b5a43; background: #e5f5eb; }
.order-meta { display: flex; flex-wrap: wrap; gap: .6rem 1rem; margin-block: 1rem; }
.order-meta > div { flex: 1 1 7rem; min-width: 0; }
.order-meta dd, .notes { overflow-wrap: anywhere; }
.order-meta dd { font-size: .95rem; font-weight: 650; }
.progress { display: flex; align-items: center; gap: .65rem; }
progress { width: 100%; height: .65rem; accent-color: var(--accent); }
.progress strong { min-width: 3ch; font-size: .875rem; }
details { margin-top: .9rem; }
summary { padding-block: .25rem; color: var(--accent-dark); font-size: .9rem; font-weight: 650; }
.details { margin-block: .6rem; }
.notes { white-space: pre-wrap; }
.edit-link { display: inline-block; margin-top: .6rem; }
.quote { display: grid; gap: .25rem; padding: 1rem; margin-top: 1.3rem; border-radius: .65rem; background: #e8f5f2; color: var(--accent-dark); }
.quote strong { font-size: clamp(1.6rem, 6vw, 2.25rem); line-height: 1.15; overflow-wrap: anywhere; }
.lines { list-style: none; margin: .75rem 0 0; padding: 0; }
.lines li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding-block: .7rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.lines li:last-child { border-bottom: 0; }
.accounts li { display: block; }
.accounts details { margin-top: .35rem; }
.assignment-editor {
  min-inline-size: 0;
  margin: 0;
  padding: .8rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
}
.assignment-editor legend { padding-inline: .3rem; font-weight: 700; }
.assignment-editor > .muted { font-size: .9rem; }
.assignment-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: .6rem;
  padding-block: .8rem;
  border-bottom: 1px solid var(--line);
}
.assignment-row-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  font-weight: 650;
}
.assignment-row-actions .secondary { min-height: 2.25rem; }
.assignment-transfer-field { grid-column: 1 / -1; }
.assignment-amounts { display: flex; flex-wrap: wrap; gap: .25rem .85rem; }
.assignment-amounts span { color: var(--muted); }
.assignment-amounts strong { color: #102b46; white-space: nowrap; }
.assignment-editor > button { margin-top: .8rem; }
.assignment-total { margin-top: .6rem; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.assignment-total[data-invalid] { color: #892c21; }
.assignment-heading { margin: 1rem 0 0; scroll-margin-top: 4.5rem; }
.assignment-breakdown {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin-top: .35rem;
  font-size: .875rem;
}
.assignment-breakdown th, .assignment-breakdown td {
  border-bottom: 1px solid var(--line);
  padding: .45rem .25rem;
  text-align: right;
  overflow-wrap: anywhere;
  vertical-align: top;
}
.assignment-breakdown thead th { color: var(--muted); vertical-align: bottom; }
.assignment-breakdown th:first-child { width: 28%; text-align: left; }
.assignment-breakdown small { display: block; color: var(--muted); }
.assignment-breakdown tfoot { font-weight: 750; }
.assignment-breakdown .transfer-overage, .assignment-amounts .transfer-overage { color: #892c21; }
.commission-transfers { margin-top: .85rem; }
.commission-transfers form { margin-top: .65rem; }
.commission-transfers label { overflow-wrap: anywhere; }
.commission-filter { display: flex; flex-wrap: wrap; align-items: end; gap: .65rem; margin-bottom: 1.2rem; }
.commission-filter label { width: min(15rem, 100%); }
.commission-metrics { margin-bottom: .65rem; }
.commission-metrics dd, .commission-amounts dd { font-weight: 750; overflow-wrap: anywhere; }
.commission-metrics dd { font-size: clamp(1.05rem, 2.5vw, 1.55rem); }
.commission-note { margin-bottom: 1rem; font-size: .9rem; }
.commission-person .section-heading { margin-bottom: .75rem; }
.commission-person h2 { min-width: 0; }
.commission-person .transfer-overage { margin: .7rem 0 0; color: #892c21; }
.hall-of-fame { max-width: 46rem; }
.hall-of-fame > p + p, .hall-of-fame-table { margin-top: .9rem; }
.hall-of-fame-table th, .hall-of-fame-table td { padding: .65rem .4rem; }
.hall-of-fame-table th:first-child { width: 5rem; }
.hall-of-fame-table td:first-child, .hall-of-fame-table th:nth-child(2) { text-align: left; }
.hall-of-fame-table th:last-child { width: 38%; }
.hall-of-fame-leader { background: #edf7f3; font-weight: 750; }
.order-price-editor > .fields { margin-block: .35rem .85rem; }
.payment-shortcuts { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .85rem; }
.payment-shortcuts button:disabled { opacity: .55; cursor: default; }
.price-breakdown {
  margin-top: 1rem;
  padding: clamp(.85rem, 3vw, 1.3rem);
  border: 1px solid #d1e2d2;
  border-radius: .8rem;
  background: #eef5ed;
  color: #184d41;
}
.price-breakdown h3 { margin-bottom: .9rem; }
.price-breakdown dl > div, .detail-progress p {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .6rem 1rem;
}
.price-breakdown dl > div { padding-block: .22rem; }
.price-breakdown dt { color: inherit; font-size: .95rem; }
.price-breakdown dd { font-weight: 650; text-align: right; overflow-wrap: anywhere; }
.price-breakdown .price-total {
  margin-block: .55rem;
  padding-block: .6rem;
  border-block: 1px dashed #a6c3ae;
  font-weight: 750;
}
.price-total dd { font-size: clamp(1.1rem, 4.6vw, 1.6rem); }
.price-unit, .price-error, .order-updated { margin-top: .65rem; font-size: .875rem; }
.price-error { color: #892c21; }
.order-detail { margin-top: .75rem; }
.order-detail-meta { display: grid; gap: .5rem; margin-block: 1rem; }
.order-detail-meta > div { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: .5rem 1rem; }
.order-detail-meta dd { overflow-wrap: anywhere; font-weight: 650; }
.detail-progress p { margin-bottom: .3rem; }
.detail-progress progress { display: block; }
.customer-quota { display: grid; gap: .25rem; margin-top: 1rem; padding: .8rem 1rem; border-radius: .65rem; background: #e8f5f2; color: #155c4b; }
.customer-quota a { font-weight: 700; }
.order-updated + .notes { margin-top: .35rem; }
.order-dialog {
  width: min(45rem, calc(100% - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: #fff;
  color: inherit;
}
.order-dialog::backdrop { background: #102b467d; }
.order-dialog-header {
  display: flex;
  position: sticky;
  top: 0;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  padding: .75rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.order-dialog [data-dialog-body] { padding: 0 1rem 1rem; }
.order-editor-dialog .form-card { max-width: none; margin: 0; border: 0; }
.order-editor-dialog .order-editor-header, .order-editor-dialog .order-editor-actions {
  position: sticky;
  z-index: 1;
  background: #fff;
}
.order-editor-dialog .order-editor-header { top: 0; padding-block: .65rem; border-bottom: 1px solid var(--line); }
.order-editor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .5rem;
}
.order-editor-dialog .order-editor-actions { bottom: 0; padding-block: .65rem; border-top: 1px solid var(--line); }

@media (max-width: 700px) {
  .signin { grid-template-columns: 1fr; align-content: start; max-width: 33rem; }
  .signin-intro br { display: none; }
  .orders, .columns { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
}
@media (max-width: 380px) {
  .shell { width: calc(100% - 1.5rem); }
  .profile span { max-width: 6rem; }
  .card { padding: .9rem; }
  .fields { grid-template-columns: 1fr; }
}
