/* Shared components: buttons, badges and callouts. Loaded after site.css and usability.css,
   so these rules are the final word for the app; the marketing site keeps its own
   .sales-* button rules, which are more specific. */

/* Buttons: three tiers plus a danger variant.
   - .btn-primary            one per view: the page's main action
   - .btn-outline-primary    tonal: a useful action that is not the main one (row actions, card actions)
   - .btn-outline-secondary  neutral: everything else (.btn-outline-dark and .btn-light map here)
   - .btn-link               quiet text action */
.btn {
  font-weight: 600;
  letter-spacing: 0;
}

/* Bootstrap drives :active and :disabled from these variables with more specific selectors. */
.btn-primary {
  --bs-btn-active-bg: var(--color-primary-strong);
  --bs-btn-active-border-color: var(--color-primary-strong);
  --bs-btn-disabled-bg: var(--color-primary);
  --bs-btn-disabled-border-color: var(--color-primary);
}

.btn-outline-primary {
  --bs-btn-active-bg: var(--blue-200);
  --bs-btn-active-border-color: transparent;
  --bs-btn-active-color: var(--color-primary-strong);
  --bs-btn-disabled-bg: var(--color-primary-soft);
  --bs-btn-disabled-border-color: transparent;
  --bs-btn-disabled-color: var(--color-primary-strong);
}

.btn-outline-secondary,
.btn-outline-dark,
.btn-light {
  --bs-btn-active-bg: var(--neutral-75);
  --bs-btn-active-border-color: var(--neutral-400);
  --bs-btn-active-color: var(--color-ink);
  --bs-btn-disabled-bg: var(--color-surface);
  --bs-btn-disabled-border-color: var(--color-line-strong);
  --bs-btn-disabled-color: var(--color-muted);
}

.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 1px 2px rgba(21, 32, 51, 0.14);
  color: var(--white);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--color-primary-strong);
  border-color: var(--color-primary-strong);
  color: var(--white);
}

.btn-outline-primary {
  background: var(--color-primary-soft);
  border-color: transparent;
  color: var(--color-primary-strong);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus-visible {
  background: var(--blue-100);
  border-color: transparent;
  color: var(--color-primary-strong);
}

.btn-outline-primary:active,
.btn-outline-primary.active {
  background: var(--blue-200);
  border-color: transparent;
  color: var(--color-primary-strong);
}

.btn-outline-secondary,
.btn-outline-dark,
.btn-light {
  background: var(--color-surface);
  border-color: var(--color-line-strong);
  color: var(--color-ink);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible,
.btn-outline-dark:hover,
.btn-outline-dark:focus-visible,
.btn-light:hover,
.btn-light:focus-visible {
  background: var(--color-surface-muted);
  border-color: var(--neutral-400);
  color: var(--color-ink);
}

.btn-outline-secondary:active,
.btn-outline-dark:active,
.btn-light:active {
  background: var(--neutral-75);
  border-color: var(--neutral-400);
  color: var(--color-ink);
}

.btn-outline-danger {
  background: var(--color-surface);
  border-color: var(--red-200);
  color: var(--color-danger);
}

.btn-outline-danger:hover,
.btn-outline-danger:focus-visible {
  background: var(--color-danger-soft);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

/* Top-bar "Needs attention" link: a status shortcut, not the page's main action. */
.btn-attention {
  background: var(--color-warning-soft);
  border-color: var(--amber-200);
  color: var(--amber-800);
}

.btn-attention:hover,
.btn-attention:focus-visible {
  background: var(--amber-100);
  border-color: var(--amber-500);
  color: var(--amber-800);
}

/* Badges: soft-filled pill with a leading dot, one fixed semantic palette.
   The C# side emits several names per meaning (action-badge-reply / -info, ...); they all map here. */
.action-badge,
.workspace-simple .attention-label {
  align-items: center;
  background: var(--neutral-75);
  border: 0;
  border-radius: var(--radius-pill);
  color: var(--neutral-700);
  display: inline-flex;
  font-size: var(--fs-xs);
  font-weight: 600;
  gap: 0.375rem;
  letter-spacing: 0;
  line-height: 1.2;
  min-height: 22px;
  padding: 2px 8px;
  text-transform: none;
  white-space: nowrap;
}

.action-badge::before,
.workspace-simple .attention-label::before {
  background: currentColor;
  border-radius: 50%;
  content: "";
  flex: 0 0 auto;
  height: 6px;
  width: 6px;
}

.action-badge:empty,
.workspace-simple .attention-label:empty {
  display: none;
}

:is(.action-badge, .workspace-simple .attention-label):is(.action-badge-info, .action-badge-reply, .action-badge-needs-reply, .action-badge-primary, .action-badge-review, .action-badge-manager-review) {
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
}

:is(.action-badge, .workspace-simple .attention-label):is(.action-badge-warning, .action-badge-approval, .action-badge-approvals) {
  background: var(--color-warning-soft);
  color: var(--amber-800);
}

:is(.action-badge, .workspace-simple .attention-label):is(.action-badge-danger, .action-badge-sms, .action-badge-sms-issues, .action-badge-overdue, .action-badge-stale) {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

:is(.action-badge, .workspace-simple .attention-label).action-badge-success {
  background: var(--color-success-soft);
  color: var(--green-700);
}

/* A blue pill on a selected (blue-tinted) row would vanish, so lift it onto white there. */
.workspace-simple .simple-conversation-row.active :is(.action-badge-info, .action-badge-reply, .action-badge-needs-reply, .action-badge-primary, .action-badge-review, .action-badge-manager-review) {
  background: var(--white);
}

/* Callouts and cards: tint and a 1px border instead of coloured edge stripes. */
.workspace-simple .sidebar-link.active {
  background: var(--color-primary-soft);
  border-left: 0;
  box-shadow: none;
  color: var(--color-primary-strong);
  padding-left: 0.72rem;
}

.workspace-simple .simple-flash {
  border: 1px solid;
  border-radius: var(--radius-sm);
}

.workspace-simple .simple-flash-success { border-color: var(--green-200); }
.workspace-simple .simple-flash-danger { border-color: var(--red-200); }

.workspace-simple .simple-request-actionbar {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
}

.workspace-simple .simple-thread article,
.workspace-simple .simple-message-scroll article.internal-note {
  border: 1px solid var(--color-line-soft);
  border-radius: var(--radius-sm);
}

.workspace-simple .simple-thread article.internal,
.workspace-simple .simple-message-scroll article.internal-note {
  border-color: var(--amber-200);
}

.workspace-simple .simple-composer form > .simple-delivery-route,
.workspace-simple .simple-inbox-composer form > .simple-delivery-route {
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-sm);
}

.workspace-simple .simple-delivery-route.delivery-route-fallback { border-color: var(--amber-200); }
.workspace-simple .simple-delivery-route.delivery-route-portal { border-color: var(--red-200); }

.workspace-simple .simple-summary-note {
  border-left: 0;
  padding-left: 0;
}

.workspace-simple .simple-conversation-row.active {
  box-shadow: none;
}

.workspace-simple .settings-tabs .nav-link,
.workspace-simple .settings-tabs .nav-link.active {
  border-left: 0;
}

.workspace-simple .settings-tabs .nav-link.active {
  color: var(--color-primary-strong);
}

/* Metric tiles: urgency shows in the number, not a red top edge. */
.workspace-simple .simple-metric-rail a.urgent,
.workspace-simple .simple-metric-rail a.active {
  border-top: 0;
  padding-top: 0.7rem;
}

.workspace-simple .simple-metric-rail a.urgent strong {
  color: var(--color-danger);
}

.workspace-simple .simple-metric-rail a.active {
  background: var(--color-primary-soft);
}

/* Cards: one elevation (--shadow-card, set through the legacy shadow aliases in tokens.css)
   and one radius. Anything nested inside a card stays flat. */
.workspace-simple .settings-workbench {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.workspace-simple .settings-tabs,
.workspace-simple .settings-panel .surface,
.workspace-simple .settings-panel .readiness-card {
  box-shadow: none;
}

.workspace-simple .settings-panel .surface,
.workspace-simple .settings-panel .nav-preview-card {
  border-radius: var(--radius-sm);
}

/* Overlays are the only things above card level. */
.ss-toast,
.workspace-simple .simple-more-menu > div {
  box-shadow: var(--shadow-overlay);
}

.workspace-simple .simple-more-menu > div {
  border-color: var(--color-line);
  border-radius: var(--radius-sm);
}

/* Form fields (app and customer pages; the marketing forms keep their own look). */
:is(.app-shell-body, .customer-shell-body) .form-control,
:is(.app-shell-body, .customer-shell-body) .form-select {
  background-color: var(--color-surface);
  border-color: var(--color-line-strong);
  border-radius: var(--radius-sm);
  color: var(--color-ink);
}

:is(.app-shell-body, .customer-shell-body) .form-control:hover,
:is(.app-shell-body, .customer-shell-body) .form-select:hover {
  border-color: var(--neutral-400);
}

:is(.app-shell-body, .customer-shell-body) .form-control:focus,
:is(.app-shell-body, .customer-shell-body) .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
  outline: none;
}

:is(.app-shell-body, .customer-shell-body) .form-control::placeholder {
  color: var(--color-muted);
  opacity: 1;
}

:is(.app-shell-body, .customer-shell-body) :is(.form-control, .form-select):disabled,
:is(.app-shell-body, .customer-shell-body) .form-control[readonly] {
  background-color: var(--color-surface-muted);
  color: var(--color-muted);
}

:is(.app-shell-body, .customer-shell-body) :is(.form-control, .form-select).is-invalid {
  border-color: var(--color-danger);
}

:is(.app-shell-body, .customer-shell-body) :is(.form-control, .form-select).is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.18);
}

:is(.app-shell-body, .customer-shell-body) .form-check-input:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

:is(.app-shell-body, .customer-shell-body) .form-check-input:focus {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

/* Top bar: labelled chips at the same height as the small buttons. */
.workspace-simple .topbar-actions .btn,
.workspace-simple .topbar-actions .form-select,
.workspace-simple .topbar-health {
  border-radius: var(--radius-sm);
}

.workspace-simple .topbar-health {
  background: var(--color-surface);
  border-color: var(--color-line-strong);
  color: var(--amber-800);
  font-weight: 600;
}

.workspace-simple .topbar-health:hover {
  background: var(--color-warning-soft);
  border-color: var(--amber-200);
}

.workspace-simple .topbar-health .topbar-chip-label {
  color: var(--color-ink);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.topbar-chip-short {
  display: none;
}

@media (max-width: 720px) {
  .workspace-simple .topbar-actions .btn {
    font-size: var(--fs-sm);
  }

  .topbar-chip-long {
    display: none;
  }

  .topbar-chip-short {
    display: inline;
  }
}

/* Workspace notice: an in-page callout that can be hidden for a week, not a permanent banner. */
.workspace-simple .simple-operational-alert {
  border: 1px solid var(--amber-200);
  border-radius: var(--radius-md);
  box-shadow: none;
  gap: 0.75rem;
  margin: 0 auto 1rem;
  max-width: 1500px;
  min-height: 0;
  padding: 0.4rem 0.4rem 0.4rem 0.875rem;
}

.workspace-simple .simple-operational-alert[hidden],
.workspace-simple .app-content:has(.simple-composer, .simple-inbox-composer) > .simple-operational-alert {
  display: none;
}

.workspace-simple .simple-operational-alert > div {
  flex: 1 1 auto;
  min-width: 0;
}

.alert-dismiss {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--amber-800);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: var(--fs-lg);
  height: 32px;
  justify-content: center;
  line-height: 1;
  width: 32px;
}

.alert-dismiss:hover {
  background: var(--amber-100);
}

/* Kickers: Simple views keep at most one, and only where it carries data (request number,
   a panel label). The Advanced views' .eyebrow labels get the same quiet treatment:
   sentence case, muted, no tracking. Check-in and the portal use the same style; the
   marketing pages' .sales-eyebrow is sentence case too, in brand blue. */
.app-shell-body .eyebrow,
.customer-shell-body .eyebrow,
.workspace-simple .simple-kicker,
.lane-kicker {
  color: var(--color-muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.workspace-simple .simple-request-summary > h2 {
  font-size: var(--fs-md);
  margin: 0;
}

.workspace-simple .simple-request-summary dt,
.workspace-simple .simple-summary-note strong {
  font-weight: 600;
  text-transform: none;
}

/* Brand: one mark everywhere. The blue tile with an ink edge and an orange offset is the
   marketing logo (.sales-brand-mark); the app sidebar, mobile header and auth pages use it too. */
.brand-mark,
.app-shell .brand-mark,
.app-shell .brand-mark-premium {
  align-items: center;
  background: var(--color-primary);
  border: 2px solid var(--color-brand-ink);
  border-radius: 6px;
  box-shadow: 2px 2px 0 var(--color-accent);
  color: var(--white);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: var(--fs-md);
  font-weight: var(--fw-display);
  height: 30px;
  justify-content: center;
  line-height: 1;
  width: 30px;
}

.sidebar-brand strong,
.mobile-brand > span:last-child,
.auth-brand {
  font-weight: var(--fw-display);
}

/* Focused auth layout: brand and a way back, nothing that competes with signing in. */
.auth-header,
.auth-footer {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1050px;
  padding: 1.25rem 28px;
}

.auth-header {
  border-bottom: 1px solid var(--color-line);
  max-width: none;
  padding-left: max(28px, calc((100% - 1050px) / 2 + 28px));
  padding-right: max(28px, calc((100% - 1050px) / 2 + 28px));
  background: var(--color-surface);
}

.auth-brand {
  align-items: center;
  color: var(--color-brand-ink);
  display: inline-flex;
  font-size: var(--fs-lg);
  gap: 10px;
  text-decoration: none;
}

.auth-brand:hover {
  color: var(--color-brand-ink);
}

.auth-header a:not(.auth-brand),
.auth-footer,
.auth-footer a {
  color: var(--color-muted);
  font-size: var(--fs-sm);
}

.auth-footer nav {
  display: flex;
  gap: 1.25rem;
}

/* Customer pages lead with the shop's own name and logo; ShopStatus signs off at the bottom. */
.customer-powered-by {
  color: var(--color-muted);
  font-size: var(--fs-xs);
  padding: 1.5rem 16px 2rem;
  text-align: center;
}

.customer-powered-by a {
  color: inherit;
  font-weight: var(--fw-semibold);
}

.portal-status-hero > div > .eyebrow {
  color: var(--color-ink);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}

.public-step-note {
  color: var(--color-muted);
  font-size: var(--fs-sm);
  margin: 0 0 1rem;
}

.public-step-note strong {
  color: var(--color-ink);
  font-weight: var(--fw-semibold);
}
