/* ShopHand design system — shared across app pages */

:root {
  --sh-primary: #1f7ae0;
  --sh-primary-hover: #1a6bc7;
  --sh-primary-soft: #e8f2fc;
  --sh-primary-border: #9dc4f0;
  --sh-primary-rgb: 31, 122, 224;
  --sh-bg: #f4f7fb;
  --sh-surface: #ffffff;
  --sh-border: #e2e8f0;
  --sh-text: #0f172a;
  --sh-muted: #64748b;
  --sh-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --sh-shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --sh-radius: 10px;
  --sh-radius-lg: 14px;
  --sh-sidebar-w: 15.5rem;
  --sh-sidebar-w-compact: 4.5rem;
  --sh-content-max: 90rem;

  /* App responsive tiers — use in @media (max-width: calc(var(--bp-sm) - 1px)) etc. */
  --bp-sm: 640px;
  --bp-md: 1024px;
  --bp-lg: 1440px;

  /* Kanban hues — company blue unchanged; other columns slightly toned down, still vivid */
  --col-intake: #1f7ae0;
  --col-diagnostics: #d9b836;
  --col-in-progress: #ef7e45;
  --col-ready-for-review: #3ebf66;
  --col-intake-soft: #e8f2fc;
  --col-diagnostics-soft: #fbf6e4;
  --col-in-progress-soft: #fef0e8;
  --col-ready-for-review-soft: #ecfdf3;

  --bg: var(--sh-bg);
  --card: var(--sh-surface);
  --border: var(--sh-border);
  --text: var(--sh-text);
  --muted: var(--sh-muted);
  --accent: var(--sh-primary);

  --sh-font: "Sofia Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sh-font-body: var(--sh-font);
  --sh-font-display: var(--sh-font);

  --sh-select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --sh-select-arrow-focus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231f7ae0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

body {
  font-family: var(--sh-font);
  margin: 0;
  padding: 0;
  background: var(--sh-bg);
  color: var(--sh-text);
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Dropdowns — custom appearance (no native gray system chrome) */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0.55rem 2.35rem 0.55rem 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--sh-text);
  background-color: var(--sh-surface);
  background-image: var(--sh-select-arrow);
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 1rem 1rem;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  box-shadow: var(--sh-shadow-sm);
  cursor: pointer;
  color-scheme: light;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease,
    background-image 0.15s ease;
}

select::-ms-expand {
  display: none;
}

select:hover:not(:disabled) {
  border-color: var(--sh-primary-border);
  background-color: #fafcff;
}

select:focus {
  outline: none;
  border-color: var(--sh-primary);
  background-color: var(--sh-surface);
  background-image: var(--sh-select-arrow-focus);
  box-shadow: 0 0 0 3px rgba(var(--sh-primary-rgb), 0.16), var(--sh-shadow-sm);
}

select:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  background-color: #f8fafc;
  color: var(--sh-muted);
}

option,
optgroup {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sh-text);
  background: var(--sh-surface);
  cursor: pointer;
}

/* Compact selects in invoice / payment toolbars */
.invoice-inline-form select,
#job-modal-item-form select,
#job-modal-payment-form select {
  font-size: 0.8125rem;
  min-height: 2.05rem;
  height: 2.05rem;
  padding: 0 2rem 0 0.55rem;
  border-radius: 8px;
}

/* Custom dropdown (shophand-select.js) — replaces native open menu */
.sh-select {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 0.25rem;
}

.sh-select:first-child,
label + .sh-select,
.job-modal-assign-row .sh-select,
.page-toolbar .sh-select {
  margin-top: 0;
}

.job-modal-details-edit .sh-select {
  margin-top: 0.2rem;
}

.job-modal-assign-controls .sh-select {
  display: block;
  width: auto;
  max-width: min(11rem, calc(100% - 5.5rem));
  min-width: 5.5rem;
  flex: 1 1 auto;
  margin-top: 0;
}

.page-toolbar .sh-select {
  width: auto;
  min-width: 9.5rem;
  flex-shrink: 0;
}

.sh-select select.sh-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  box-shadow: none !important;
  background: none !important;
}

.sh-select-trigger {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.55rem 2.35rem 0.55rem 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-align: left;
  color: var(--sh-text);
  background-color: var(--sh-surface);
  background-image: var(--sh-select-arrow);
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 1rem 1rem;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  box-shadow: var(--sh-shadow-sm);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease,
    background-image 0.15s ease;
}

.sh-select-trigger:hover:not(:disabled) {
  border-color: var(--sh-primary-border);
  background-color: #f0f6fc;
}

.sh-select-trigger.is-focused,
.sh-select.is-open .sh-select-trigger {
  outline: none;
  border-color: var(--sh-primary);
  background-color: var(--sh-surface);
  background-image: var(--sh-select-arrow-focus);
  box-shadow: 0 0 0 3px rgba(var(--sh-primary-rgb), 0.16), var(--sh-shadow-sm);
}

.sh-select-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  background-color: #f8fafc;
  color: var(--sh-muted);
}

.sh-select-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 10050;
  max-height: 15rem;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  box-shadow: var(--sh-shadow-md);
}

.sh-select-menu[hidden] {
  display: none !important;
}

.sh-select-option {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  color: var(--sh-text);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.sh-select-option:hover,
.sh-select-option:focus {
  outline: none;
  background: #f0f6fc;
}

.sh-select-option.is-selected,
.sh-select-option[aria-selected="true"] {
  background: var(--sh-primary-soft);
  color: var(--sh-primary);
}

.sh-select--compact .sh-select-trigger {
  font-size: 0.8125rem;
  min-height: 2.05rem;
  height: 2.05rem;
  padding: 0 2rem 0 0.55rem;
  border-radius: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sh-select-menu--floating {
  right: auto;
}

#job-modal-payment-form .sh-select.is-open,
#job-modal-item-form .sh-select.is-open,
.invoice-inline-form .sh-select.is-open {
  z-index: 10061;
}

/* Invoice / payment toolbars — custom selects must keep branded trigger/menu, not action buttons */
.invoice-inline-form .sh-select,
#job-modal-item-form .sh-select,
#job-modal-payment-form .sh-select {
  margin-top: 0;
  min-width: 0;
  width: 100%;
}

.invoice-inline-form .sh-select-trigger,
.invoice-inline-form .sh-select-option,
#job-modal-item-form .sh-select-trigger,
#job-modal-item-form .sh-select-option,
#job-modal-payment-form .sh-select-trigger,
#job-modal-payment-form .sh-select-option {
  font-weight: 500;
}

.sh-brand-text,
.app-header-greeting h1,
.kanban-column-header h3,
.sh-btn-primary,
.sh-btn-secondary,
.sh-btn-support,
.sh-btn-new-job,
.kanban-add-job,
.job-card-title,
section.panel h2,
.auth-card h1,
.customer-main,
#customerDetailPanelTitle,
#create-job-submit,
#saveTaxBtn,
#saveDisplayNameBtn,
#createInviteBtn {
  font-family: var(--sh-font-display);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sh-sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--sh-surface);
  border-right: 1px solid var(--sh-border);
  padding: 1.25rem 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
}

.sidebar-sign-out {
  display: none;
}

.sh-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0 0.35rem 1.15rem;
  text-decoration: none;
  color: var(--sh-primary);
}

.sh-logo-mark {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  border: 2px dashed var(--sh-primary-border);
  background: var(--sh-primary-soft);
  flex-shrink: 0;
}

.sh-logo-img {
  width: 2.1rem;
  height: 2.1rem;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.sh-brand:has(.sh-logo-img) .sh-logo-mark {
  display: none;
}

.sh-brand-text {
  color: var(--sh-primary);
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--sh-text);
  text-decoration: none;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.sidebar-link .sh-nav-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  opacity: 0.55;
}

.sidebar-link .sh-nav-icon--img {
  display: block;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.sidebar-link > span:not(.sh-nav-icon):not(.sh-nav-badge) {
  flex: 1;
  min-width: 0;
}

.sh-nav-badge {
  margin-left: auto;
  flex-shrink: 0;
  align-self: center;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.32rem;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  text-align: center;
  background: var(--sh-primary);
  color: #fff;
  border-radius: 999px;
}

.sh-nav-badge[hidden] {
  display: none !important;
}

.sidebar-link.active .sh-nav-badge {
  background: var(--sh-primary);
  color: #fff;
}

.sidebar-link:hover:not(:disabled) {
  background: #f8fafc;
}

.sidebar-link.active {
  background: var(--sh-primary-soft);
  color: var(--sh-primary);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--sh-primary);
}

.sidebar-link.active .sh-nav-icon { opacity: 1; }

.sidebar-link--nav-restricted,
.sidebar-nav .sidebar-link[hidden] {
  display: none !important;
  visibility: hidden !important;
}

button.sidebar-link:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.company-switch {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--sh-border);
}

.company-switch-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--sh-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.company-switch select {
  width: 100%;
  font-size: 0.8125rem;
}

.sh-support-card {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--sh-border);
}

.sh-support-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  padding: 1rem 0.75rem 0.85rem;
  background: linear-gradient(180deg, #f8fafc 0%, var(--sh-surface) 100%);
}

.sh-support-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0 0 0.5rem;
  padding: 0;
}

.sh-support-logo img {
  width: 7.25rem;
  height: 7.25rem;
  object-fit: contain;
  display: block;
}

.sh-support-inner p {
  margin: 0 0 0.75rem;
  width: 100%;
  font-size: 0.8rem;
  color: var(--sh-muted);
  line-height: 1.4;
  text-align: center;
}

.sh-support-inner strong { color: var(--sh-text); }

.sh-btn-support {
  align-self: stretch;
  width: 100%;
  padding: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: var(--sh-primary);
  color: #fff;
  cursor: pointer;
  opacity: 1;
}

.sh-btn-support:disabled {
  background: var(--sh-primary);
  color: #fff;
  cursor: not-allowed;
  opacity: 0.72;
}

.main-content {
  display: flex;
  flex-direction: column;
  padding: 1.35rem 1.5rem 2rem;
  min-width: 0;
  min-height: 100vh;
  box-sizing: border-box;
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.app-header-greeting h1 {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.app-header-greeting p {
  margin: 0.35rem 0 0;
  font-size: 1.05rem;
  color: var(--sh-muted);
  line-height: 1.4;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.app-header-actions #signOutBtn {
  flex-shrink: 0;
  font-size: 0.95rem;
  padding: 0.5rem 1.05rem;
  min-height: 2.5rem;
  line-height: 1.2;
  white-space: nowrap;
}

.app-header-actions .sh-profile-chip {
  max-width: min(14rem, 38vw);
  min-width: 0;
}

.app-header-actions .sh-profile-meta {
  min-width: 0;
  max-width: 100%;
}

.app-header-actions .sh-profile-name,
.app-header-actions .sh-profile-shop {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sh-icon-btn {
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--sh-border);
  border-radius: 10px;
  background: var(--sh-surface);
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sh-muted);
}

.sh-icon-btn.is-active {
  cursor: pointer;
  color: var(--sh-text);
}

.sh-icon-btn.is-active:hover {
  background: #f4f4f5;
}

.sh-icon-btn svg { width: 1.15rem; height: 1.15rem; }

.sh-notify-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--sh-primary);
  color: #fff;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sh-profile-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
  width: max-content;
  max-width: min(100%, 28rem);
  padding: 0.35rem 0.65rem 0.35rem 0.35rem;
  border: 1px solid var(--sh-border);
  border-radius: 10px;
  background: var(--sh-surface);
  cursor: pointer;
  user-select: none;
}

.sh-profile-chip:hover {
  background: #f4f4f5;
}

.sh-profile-chip:focus-visible {
  outline: 2px solid var(--sh-primary);
  outline-offset: 2px;
}

.sh-profile-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: linear-gradient(
    145deg,
    var(--sh-avatar-light, #4a96e8) 0%,
    var(--sh-avatar-base, var(--sh-primary)) 48%,
    var(--sh-avatar-dark, var(--sh-primary-hover)) 100%
  );
  color: #fff;
  font-family: var(--sh-font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 2px 8px rgba(var(--sh-avatar-rgb, var(--sh-primary-rgb)), 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sh-avatar {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
  font-weight: 600;
  user-select: none;
  box-sizing: border-box;
}

.sh-avatar--md {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.8125rem;
}

.sh-avatar--sm {
  width: 2.125rem;
  height: 2.125rem;
  font-size: 0.8125rem;
}

.sh-avatar--neutral {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.sh-avatar--neutral.sh-avatar--muted {
  color: #94a3b8;
}

.sh-avatar--customer {
  background: linear-gradient(
    145deg,
    #4a96e8 0%,
    var(--sh-primary) 48%,
    var(--sh-primary-hover) 100%
  );
  color: #fff;
  font-family: var(--sh-font-display);
  font-weight: 600;
  letter-spacing: 0.03em;
  border: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 2px 8px rgba(var(--sh-primary-rgb), 0.28);
}

.sh-avatar--customer.sh-avatar--muted {
  color: rgba(255, 255, 255, 0.5);
}

.sh-avatar--member {
  background: linear-gradient(
    145deg,
    var(--sh-avatar-light, #4a96e8) 0%,
    var(--sh-avatar-base, #0f766e) 48%,
    var(--sh-avatar-dark, #0d6559) 100%
  );
  color: #fff;
  font-family: var(--sh-font-display);
  font-weight: 600;
  letter-spacing: 0.03em;
  border: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 2px 8px rgba(var(--sh-avatar-rgb, 15, 118, 110), 0.28);
}

.sh-avatar--member.sh-avatar--muted {
  color: rgba(255, 255, 255, 0.5);
}

.sh-profile-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.sh-profile-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.sh-profile-shop {
  font-size: 0.72rem;
  color: var(--sh-muted);
  white-space: nowrap;
}

.sh-profile-chevron {
  display: none;
}

.sh-btn-primary {
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: var(--sh-primary);
  color: #fff;
  cursor: pointer;
  font-family: var(--sh-font);
  white-space: nowrap;
}

.sh-btn-primary:hover { background: var(--sh-primary-hover); }

.sh-btn-secondary {
  padding: 0.45rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sh-font);
  border: 1px solid var(--sh-border);
  border-radius: 8px;
  background: var(--sh-surface);
  color: var(--sh-text);
}

.sh-btn-secondary:hover { background: #f8fafc; }

#userEmail, #shopLabel { display: none; }

#dashboard-load-error {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--sh-radius);
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.88rem;
}

.dashboard-scale-warning {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--sh-radius);
  border: 1px solid #fcd34d;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.88rem;
  line-height: 1.45;
}

.list-scale-warning {
  margin: 0 0 1rem;
  padding: 0.55rem 0.8rem;
  border-radius: var(--sh-radius);
  border: 1px solid #fcd34d;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.85rem;
  line-height: 1.4;
}

.job-board-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-lg);
  padding: 1.15rem 1.2rem 1.25rem;
  box-shadow: var(--sh-shadow-sm);
}

.job-board-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
}

.kanban-search-wrap {
  position: relative;
  flex: 0 1 22rem;
  width: 100%;
  max-width: 22rem;
}

.kanban-job-search {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--sh-border);
  border-radius: 8px;
  font-size: 0.9rem;
  font: inherit;
  color: inherit;
  background: var(--sh-surface);
}

.kanban-job-search:focus {
  outline: none;
  border-color: var(--sh-primary-border);
  box-shadow: 0 0 0 3px var(--sh-primary-soft);
}

.kanban-job-search::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 0.85rem;
  height: 0.85rem;
  margin-left: 0.25rem;
  cursor: pointer;
  opacity: 0.38;
  background-color: #94a3b8;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.kanban-job-search::-webkit-search-cancel-button:hover {
  cursor: pointer;
  opacity: 0.62;
}

.kanban-job-search::-moz-search-clear-button {
  cursor: pointer;
  opacity: 0.38;
}

.kanban-job-search::-moz-search-clear-button:hover {
  cursor: pointer;
  opacity: 0.62;
}

.job-board-toolbar .sh-btn-new-job {
  flex-shrink: 0;
}

.kanban-search-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 10050;
  max-height: 15rem;
  overflow-y: auto;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  box-shadow: var(--sh-shadow-md);
}

.kanban-search-menu[hidden] {
  display: none !important;
}

.kanban-search-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  text-align: left;
  color: var(--sh-text);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.kanban-search-option:hover,
.kanban-search-option:focus,
.kanban-search-option.is-active {
  outline: none;
  background: #f0f6fc;
}

.kanban-search-option.is-active {
  background: var(--sh-primary-soft);
}

.kanban-search-option-name {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
}

.kanban-search-option-meta {
  font-size: 0.75rem;
  color: var(--sh-muted);
  line-height: 1.3;
}

.kanban-search-empty {
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  color: var(--sh-muted);
}

.sh-btn-new-job {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 2.85rem;
  padding: 0 1.4rem;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(var(--sh-primary-rgb), 0.35);
}

.sh-btn-new-job:hover {
  box-shadow: 0 4px 14px rgba(var(--sh-primary-rgb), 0.4);
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: stretch;
  flex: 1;
  min-height: calc(100vh - 11.5rem);
}

.kanban--loading .kanban-cards {
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.kanban-column {
  container-type: inline-size;
  container-name: kanban-col;
  background: #f8fafc;
  border: 1px solid var(--sh-border);
  border-top: 4px solid var(--col-accent, var(--sh-border));
  border-radius: var(--sh-radius);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.85rem 0.85rem 0.65rem;
  /* Reserve two title lines so wrapped headers do not shift drop zones */
  min-height: calc(0.85rem + 0.65rem + 2 * 1.2rem * 1.25);
  box-sizing: border-box;
}

.kanban-column-heading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex: 1;
}

.kanban-column-icon {
  flex-shrink: 0;
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.kanban-column-icon svg {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.kanban-column--intake .kanban-column-icon {
  background: var(--col-intake-soft);
  color: var(--col-intake);
}

.kanban-column--diagnostics_parts .kanban-column-icon {
  background: var(--col-diagnostics-soft);
  color: var(--col-diagnostics);
}

.kanban-column--in_progress .kanban-column-icon {
  background: var(--col-in-progress-soft);
  color: var(--col-in-progress);
}

.kanban-column--ready_for_review .kanban-column-icon {
  background: var(--col-ready-for-review-soft);
  color: var(--col-ready-for-review);
}

.kanban-column-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--sh-text);
  line-height: 1.25;
  min-width: 0;
  align-self: center;
}

.kanban-col-title-short {
  display: none;
}

.kanban-count {
  flex-shrink: 0;
  align-self: center;
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  min-width: 1.75rem;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  border-radius: 999px;
  background: var(--col-count-bg, #eef2f6);
  color: var(--col-count-text, #475569);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.kanban-column--intake {
  --col-accent: var(--col-intake);
  --col-count-bg: var(--col-intake-soft);
  --col-count-text: var(--col-intake);
}

.kanban-column--diagnostics_parts {
  --col-accent: var(--col-diagnostics);
  --col-count-bg: var(--col-diagnostics-soft);
  --col-count-text: var(--col-diagnostics);
}

.kanban-column--in_progress {
  --col-accent: var(--col-in-progress);
  --col-count-bg: var(--col-in-progress-soft);
  --col-count-text: var(--col-in-progress);
}

.kanban-column--ready_for_review {
  --col-accent: var(--col-ready-for-review);
  --col-count-bg: var(--col-ready-for-review-soft);
  --col-count-text: var(--col-ready-for-review);
}

.kanban-count--wide {
  width: auto;
  min-width: 1.75rem;
  padding-inline: 0.45rem;
}

.kanban-column-drop {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0 0.65rem 0.55rem;
  min-height: calc(100vh - 15rem);
  border-radius: 0;
  background: transparent;
}

.kanban-drop-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 1.25rem 0.85rem;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--sh-muted);
  border: 2px dashed var(--sh-primary-border);
  border-radius: 8px;
  background: linear-gradient(
    180deg,
    rgba(var(--sh-primary-rgb), 0.12) 0%,
    rgba(255, 255, 255, 0.65) 100%
  );
  pointer-events: none;
  z-index: 0;
}

.kanban-column-drop:has(.job-card) .kanban-drop-hint {
  opacity: 0;
  visibility: hidden;
}

body.kanban-dragging .kanban-drop-hint {
  visibility: visible;
  opacity: 1;
  border-color: var(--sh-primary);
  color: var(--sh-primary-hover);
  background: var(--sh-primary-soft);
}

.kanban-column-drop.drop-active .kanban-drop-hint {
  visibility: visible;
  opacity: 1;
  border-color: var(--sh-primary);
  border-style: solid;
  color: var(--sh-primary-hover);
  background: var(--sh-primary-soft);
}

.kanban-empty {
  position: relative;
  z-index: 2;
  margin: 0.35rem 0.35rem 0;
  padding: 0.5rem 0.65rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sh-primary-hover);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  pointer-events: none;
}

.kanban-empty[hidden] { display: none !important; }

.kanban-cards {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
  min-height: 100%;
  padding: 0.35rem;
  box-sizing: border-box;
  pointer-events: none;
}

.kanban-column-drop:has(.job-card) .kanban-cards {
  background: #f8fafc;
}

.kanban-column-drop.drop-active {
  outline: 2px solid var(--sh-primary);
  outline-offset: -2px;
  border-radius: 8px;
}

.kanban-add-job {
  margin: 0.25rem 0.65rem 0.65rem;
  padding: 0.35rem;
  border: none;
  background: none;
  color: var(--sh-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
}

.kanban-add-job:hover { text-decoration: underline; }

.job-card {
  --card-accent: var(--col-intake);
  position: relative;
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  padding: 0.75rem 0.7rem;
  box-shadow: var(--sh-shadow-sm);
  cursor: grab;
  user-select: none;
  pointer-events: auto;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.job-card:hover {
  box-shadow: var(--sh-shadow-md);
  transform: translateY(-1px);
}

.job-card--search-highlight,
.job-card--search-highlight:hover {
  box-shadow:
    0 0 0 3px var(--sh-primary),
    0 8px 20px rgba(var(--sh-primary-rgb), 0.22);
}

.job-card[aria-grabbed="true"] { opacity: 0.55; cursor: grabbing; }

.job-card--intake { --card-accent: var(--col-intake); }
.job-card--diagnostics_parts { --card-accent: var(--col-diagnostics); }
.job-card--in_progress { --card-accent: var(--col-in-progress); }
.job-card--ready_for_review { --card-accent: var(--col-ready-for-review); }

.job-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-right: 1.35rem;
}

.job-card-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
}

.job-card-initials {
  flex-shrink: 0;
}

.job-card-title {
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.25;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-card-top-end {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
  margin-right: 0.15rem;
}

.job-card-remove {
  position: absolute;
  top: 0.3rem;
  right: 0.35rem;
  z-index: 2;
  min-width: 1.35rem;
  min-height: 1.35rem;
  padding: 0.15rem 0.25rem;
  margin: 0;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.job-card:hover .job-card-remove {
  color: var(--sh-muted);
}

.job-card-remove:hover {
  color: #475569;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 4px;
}

.job-card-assign-avatar {
  align-self: flex-start;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* Narrow kanban columns (~4-up on laptop): shorter column titles, single-line headers */
@container kanban-col (max-width: 19rem) {
  .kanban-column-header {
    min-height: calc(0.85rem + 0.65rem + max(2.125rem, 1.05rem * 1.25));
  }

  .kanban-column-heading h3 {
    flex: 1;
    min-width: 0;
  }

  .kanban-column-header h3 {
    font-size: 1.05rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .kanban-col-title-long {
    display: none;
  }

  .kanban-col-title-short {
    display: inline;
  }

  /* Customer initials bubble steals width; tech assign bubble stays */
  .job-card-initials {
    display: none;
  }

  .job-card-head {
    gap: 0;
  }

  .job-card-title {
    white-space: nowrap;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    -webkit-box-orient: unset;
  }

  .job-card-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .job-card-badges {
    width: 100%;
  }

  .job-card-hint {
    display: none;
  }

  .job-card-meta-date {
    display: none;
  }
}

.job-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  font-size: 0.78rem;
  color: var(--sh-muted);
  line-height: 1.35;
  margin-bottom: 0.45rem;
  min-width: 0;
}

.job-card-meta-line,
.job-card-meta-phone,
.job-card-meta-date {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.job-card-meta-date {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.job-card-meta-phone {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.job-card-title.muted,
.job-card-meta.muted {
  font-style: italic;
  color: var(--sh-muted);
}

.job-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  margin-top: 0.35rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.job-card-badges {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.38rem;
  min-width: 0;
}

.job-card-badges [data-job-badge="payment"] {
  order: 1;
}

.job-card-badges [data-job-badge="pickup"] {
  order: 2;
}

.job-card-badges [data-job-badge="rush"] {
  order: 0;
}

.job-card--rush {
  box-shadow: inset 0 3px 0 0 #f59e0b;
}

.job-card-badge,
.job-card-pill,
.job-card-pickup-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  font-family: var(--sh-font-display);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
  padding: 0.2rem 0.55rem 0.2rem 0.2rem;
  border-radius: 999px;
  border: none;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: none;
}

.job-card-badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 999px;
  line-height: 0;
  background: rgba(255, 255, 255, 0.76);
}

.job-card-badge-icon svg {
  width: 0.68rem;
  height: 0.68rem;
  display: block;
}

.job-card-badge-label {
  padding-right: 0.08rem;
}

.job-card-badge--paid,
.job-card-pill--paid {
  background: #ecfdf5;
  color: #047857;
}

.job-card-badge--paid .job-card-badge-icon,
.job-card-pill--paid .job-card-badge-icon {
  color: #059669;
}

.job-card-badge--unpaid,
.job-card-pill--unpaid {
  background: #fff1f2;
  color: #be123c;
}

.job-card-badge--unpaid .job-card-badge-icon,
.job-card-pill--unpaid .job-card-badge-icon {
  color: #e11d48;
}

.job-card-badge--pickup,
.job-card-pickup-badge {
  background: #fffbeb;
  color: #b45309;
}

.job-card-badge--pickup .job-card-badge-icon,
.job-card-pickup-badge .job-card-badge-icon {
  color: #d97706;
}

.job-card-badge--rush {
  background: #fff7ed;
  color: #c2410c;
}

.job-card-badge--rush .job-card-badge-icon {
  color: #ea580c;
}

.job-card-badge--rush .job-card-badge-icon svg {
  width: 0.72rem;
  height: 0.72rem;
}

.job-card-pill:not(.job-card-pill--paid):not(.job-card-pill--unpaid) {
  background: #eef2f6;
  color: #475569;
  padding-inline: 0.55rem;
}

.job-card-pill:not(.job-card-pill--paid):not(.job-card-pill--unpaid) .job-card-badge-icon {
  display: none;
}

.job-modal-review-actions {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--sh-border);
}

.review-actions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.review-action-btn {
  font-family: var(--sh-font-display);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--sh-primary-border);
  background: var(--sh-primary-soft);
  color: var(--sh-primary-hover);
  cursor: pointer;
}

.review-action-btn:hover:not(:disabled) {
  filter: brightness(1.04);
}

.review-action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.review-action-btn--pickup-ready {
  background: #fef4d4;
  color: #8f6918;
  border-color: #f5e6a8;
}

.review-action-btn--pickup-ready:hover:not(:disabled) {
  background: #fdeeb8;
  filter: none;
}

.review-action-btn--send-invoices {
  background: var(--sh-surface);
  color: var(--sh-text);
  border-color: var(--sh-border);
}

.review-action-btn--send-invoices:hover:not(:disabled) {
  background: #f4f4f5;
}

.job-modal-rush-row {
  margin-top: 0.75rem;
  margin-bottom: 1.1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.job-modal-rush-btn {
  font-family: var(--sh-font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  min-height: 2.05rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #c2410c;
  cursor: pointer;
  box-sizing: border-box;
}

.job-modal-rush-btn:hover:not(:disabled) {
  background: #ffedd5;
}

.job-modal-rush-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.job-modal-rush-btn--active {
  background: #fef4d4;
  color: #8f6918;
  border-color: #f5e6a8;
}

.job-modal-rush-btn--active:hover:not(:disabled) {
  background: #fdeeb8;
}

.invoices-intro {
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.invoices-table-wrap {
  overflow-x: auto;
}

.invoices-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.invoices-table th,
.invoices-table td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--sh-border);
}

.invoices-table th {
  font-family: var(--sh-font-display);
  font-weight: 600;
  color: var(--sh-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.invoices-row {
  cursor: pointer;
}

.invoices-row:hover {
  background: var(--sh-primary-soft);
}

.invoices-row:focus-visible {
  outline: 2px solid var(--sh-primary);
  outline-offset: -2px;
}

.invoices-pdf-cell {
  width: 4.5rem;
  text-align: center;
}

.invoices-pdf-btn {
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--sh-border);
  background: var(--sh-surface);
  color: var(--sh-primary);
  cursor: pointer;
}

.invoices-pdf-btn:hover {
  background: var(--sh-primary-soft);
  border-color: var(--sh-primary-border);
}

.invoice-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.invoice-list-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: none;
  border-bottom: 1px solid var(--sh-border);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition: background 0.12s ease;
}

.invoice-list-row:hover {
  background: var(--sh-primary-soft);
}

.invoice-list-row:focus-visible {
  outline: 2px solid var(--sh-primary-border);
  outline-offset: -2px;
}

.invoice-list-main {
  flex: 1;
  min-width: 0;
}

.invoice-list-title {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.35;
}

.invoice-list-meta {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--sh-muted);
}

.invoice-list-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.invoice-list-total {
  font-weight: 700;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.invoice-list-row .invoices-pdf-btn {
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .invoice-list-row {
    flex-wrap: wrap;
  }

  .invoice-list-end {
    flex-direction: row;
    align-items: center;
    width: 100%;
    justify-content: space-between;
  }
}

.settings-address-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .settings-address-row {
    grid-template-columns: 1fr;
  }
}

#invoice-profile-form textarea {
  width: 100%;
  max-width: none;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  resize: vertical;
  min-height: 4.5rem;
  line-height: 1.45;
}

#settings-pane-invoices.panel {
  max-width: 34rem;
}

#settings-pane-invoices .settings-pane-intro {
  margin-bottom: 1.35rem;
  line-height: 1.5;
}

.settings-pane-jump-link {
  display: inline;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--sh-primary);
  text-decoration: underline;
  text-underline-offset: 0.12em;
  cursor: pointer;
}

.settings-pane-jump-link:hover {
  color: var(--sh-primary-hover);
}

.settings-pane-jump-link:focus-visible {
  outline: 2px solid var(--sh-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

#invoice-profile-form .settings-form-section {
  margin-bottom: 0;
  padding-bottom: 1.35rem;
  margin-top: 1.35rem;
  border-bottom: 1px solid var(--sh-border);
}

#invoice-profile-form .settings-form-section:first-of-type {
  margin-top: 0;
}

#invoice-profile-form .settings-form-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

#invoice-profile-form .settings-form-section h3 {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

#invoice-profile-form label {
  margin-top: 0.85rem;
}

#invoice-profile-form .settings-form-section > label:first-of-type {
  margin-top: 0;
}

#invoice-profile-form .settings-address-row {
  margin-top: 0.85rem;
  gap: 0.65rem;
}

#invoice-profile-form .settings-address-field label,
#invoice-profile-form .settings-field-label {
  margin-top: 0;
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

#invoice-profile-form input,
#invoice-profile-form textarea {
  max-width: none;
  width: 100%;
  margin-top: 0.35rem;
}

#invoice-profile-form .settings-field-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--sh-muted);
  line-height: 1.45;
  font-weight: 400;
}

#invoice-profile-form .settings-field-hint strong {
  font-weight: 600;
  color: var(--sh-text);
}

#invoice-profile-form .settings-label-optional {
  font-weight: 500;
  color: #94a3b8;
}

#invoice-profile-form .settings-form-actions {
  margin-top: 1.5rem;
  padding-top: 0.25rem;
}

#invoice-profile-form .settings-save-status {
  margin-top: 0.85rem;
  font-size: 0.875rem;
}

.job-card-hint {
  font-size: 0.625rem;
  color: #94a3b8;
  letter-spacing: 0.02em;
  margin-left: auto;
  flex-shrink: 0;
  font-weight: 500;
}

section.panel {
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-lg);
  padding: 1.15rem 1.2rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--sh-shadow-sm);
  max-width: 36rem;
}

section.panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.panel-hint {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--sh-muted);
  line-height: 1.45;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sh-muted);
  margin-top: 0.55rem;
}

label:first-of-type { margin-top: 0; }

input,
textarea {
  width: 100%;
  max-width: 22rem;
  padding: 0.5rem 0.75rem;
  margin-top: 0.25rem;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--sh-text);
  background: var(--sh-surface);
  box-shadow: var(--sh-shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select {
  margin-top: 0.25rem;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--sh-primary);
  box-shadow: 0 0 0 3px rgba(var(--sh-primary-rgb), 0.16), var(--sh-shadow-sm);
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--sh-bg);
}

.auth-card {
  width: 100%;
  max-width: 26rem;
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-lg);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--sh-shadow-md);
}

.auth-card .sh-brand {
  justify-content: center;
  padding-bottom: 1.35rem;
  gap: 0.75rem;
}

.auth-card .sh-logo-mark,
.auth-card .sh-logo-img {
  width: 4.5rem;
  height: 4.5rem;
}

.auth-card .sh-brand-text {
  font-size: 2.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.auth-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
}

.auth-card > p:not(.auth-footer) {
  margin: 0 0 1.25rem;
  text-align: center;
  color: var(--sh-muted);
  font-size: 0.9rem;
}

.auth-card label { max-width: none; }
.auth-card input { max-width: none; }
.auth-card form { margin: 0; }

/* Password field with show/hide toggle */
.sh-password-field {
  position: relative;
  display: block;
  width: 100%;
  max-width: none;
  margin-top: 0.25rem;
}

label + .sh-password-field {
  margin-top: 0.25rem;
}

.sh-password-field input {
  width: 100%;
  margin-top: 0;
  padding-right: 2.65rem;
  box-sizing: border-box;
}

.sh-password-toggle {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--sh-muted);
  cursor: pointer;
  display: block;
  flex-shrink: 0;
  overflow: hidden;
  transition: color 0.2s ease;
}

.sh-password-toggle:hover {
  color: var(--sh-text);
}

.sh-password-toggle:active {
  color: var(--sh-primary);
}

.sh-password-toggle:focus-visible {
  outline: none;
  color: var(--sh-primary);
  box-shadow: 0 0 0 2px rgba(var(--sh-primary-rgb), 0.35);
}

.sh-password-toggle-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.sh-password-toggle-icon svg {
  width: 1.125rem;
  height: 1.125rem;
  display: block;
}

.sh-password-toggle-icon--show {
  opacity: 0;
  transform: scale(0.88);
}

.sh-password-toggle[aria-pressed="true"] .sh-password-toggle-icon--hide {
  opacity: 0;
  transform: scale(0.88);
}

.sh-password-toggle[aria-pressed="true"] .sh-password-toggle-icon--show {
  opacity: 1;
  transform: scale(1);
}

.sh-password-toggle[aria-pressed="false"] .sh-password-toggle-icon--hide {
  opacity: 1;
  transform: scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .sh-password-toggle-icon {
    transition: opacity 0.15s ease;
    transform: none !important;
  }
}
.auth-card .sh-btn-primary {
  width: 100%;
  margin-top: 1rem;
  margin-bottom: 0;
  padding: 0.65rem;
}

@keyframes sh-auth-autofill-start {
  from { opacity: 1; }
  to { opacity: 1; }
}

.auth-card input:-webkit-autofill {
  animation-name: sh-auth-autofill-start;
}

.auth-footer {
  margin: 0.875rem 0 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--sh-muted);
  line-height: 1.4;
}

.auth-footer a {
  color: var(--sh-primary);
  font-weight: 600;
  text-decoration: none;
}

.auth-pwa-install,
.auth-pwa-install-hint {
  margin: 0.625rem 0 0;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--sh-muted);
  line-height: 1.45;
}

.auth-pwa-install-btn {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sh-primary);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-pwa-install-btn:hover {
  color: var(--sh-primary-hover);
}

.auth-pwa-install-hint strong {
  font-weight: 600;
  color: var(--sh-text);
}

/* --- Small alert / confirm dialog (replaces native alert/confirm) --- */
.sh-dialog[hidden] {
  display: none !important;
}

.sh-dialog {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.sh-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 0;
}

.sh-dialog-panel {
  position: relative;
  z-index: 1;
  width: min(22rem, calc(100vw - 2rem));
  max-height: min(80vh, 24rem);
  overflow: auto;
  margin: 0;
  padding: 1.1rem 1.15rem 1rem;
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-lg);
  box-shadow: var(--sh-shadow-md);
}

.sh-dialog-title {
  margin: 0 0 0.5rem;
  font-family: var(--sh-font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--sh-text);
}

.sh-dialog-message {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--sh-text);
  white-space: pre-wrap;
}

.sh-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.sh-dialog-actions .sh-btn-primary,
.sh-dialog-actions .sh-btn-secondary {
  min-width: 5rem;
}

.sh-dialog.is-danger .sh-dialog-btn-danger {
  background: #b91c1c;
}

.sh-dialog.is-danger .sh-dialog-btn-danger:hover {
  background: #991b1b;
}

.job-modal[hidden],
.create-job-modal[hidden],
.invite-modal[hidden] { display: none !important; }

.job-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  padding: 1rem;
}

.job-modal-backdrop,
.create-job-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 0;
}

.invite-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem 1rem;
}

.invite-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
}

.job-modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(44rem, 94vw);
  margin: 0 auto 2rem;
  background: var(--sh-surface);
  border-radius: var(--sh-radius-lg);
  border: 1px solid var(--sh-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}

.create-job-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.create-job-modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 36rem;
  max-height: none;
  overflow: visible;
  margin: 0;
  padding: 1rem 1.15rem 1.1rem;
  background: var(--sh-surface);
  border-radius: var(--sh-radius-lg);
  border: 1px solid var(--sh-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}

.create-job-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.create-job-modal-head h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-family: var(--sh-font-display);
}

#create-job-close {
  border: none;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: var(--sh-bg, #f8fafc);
  color: var(--sh-muted);
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
}

#create-job-close:hover {
  color: var(--sh-text);
  background: #e4e4e7;
}

/* New job ticket — compact sheet (fits viewport without scroll on typical screens) */
.create-job-sheet {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.create-job-cols {
  display: grid;
  gap: 0.5rem 0.6rem;
}

.create-job-cols--2 {
  grid-template-columns: 1fr 1fr;
}

.create-job-cols--align-start {
  align-items: start;
}

.create-job-cols--company-tax {
  align-items: stretch;
}

.create-job-field--tax-exempt {
  display: flex;
  flex-direction: column;
}

.create-job-switch-slot {
  flex: 1;
  display: flex;
  align-items: center;
  margin-top: 0.3rem;
  min-height: 2.25rem;
}

.create-job-switch-slot .sh-switch {
  margin-top: 0;
}

.create-job-cols--3 {
  grid-template-columns: repeat(3, 1fr);
}

.create-job-cols--assign {
  grid-template-columns: 1.4fr 1fr;
  align-items: end;
}

.create-job-modal .create-job-field label {
  display: block;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--sh-text);
}

.create-job-modal .create-job-field input,
.create-job-modal .create-job-field select {
  margin-top: 0.3rem;
}

.create-job-modal .create-job-field .sh-select {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
}

.create-job-field--full {
  width: 100%;
}

.create-job-field--full input {
  display: block;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.create-job-form--sheet .create-job-field input,
.create-job-form--sheet .create-job-field select {
  display: block;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.create-job-form--sheet .create-job-field input:focus,
.create-job-form--sheet .create-job-field select:focus {
  outline: none;
  border-color: var(--sh-primary);
  box-shadow: 0 0 0 2px rgba(var(--sh-primary-rgb), 0.12);
}

.create-job-note {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--sh-muted);
}

.create-job-note strong {
  color: var(--sh-text);
  font-weight: 600;
}

.create-job-form-actions {
  margin-top: 0.8rem;
  padding-top: 0;
  border-top: none;
}

/* Subtle field grouping — same look as other labels, no box or dividers */
.sh-field-group {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
}

.sh-field-group-label {
  display: block;
  margin: 0.15rem 0 0.1rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--sh-muted);
}

.create-job-modal .sh-field-group-label {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--sh-text);
  line-height: 1.25;
}

.create-job-modal .sh-field-group:has(> .sh-field-group-label) {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0.05rem;
  padding: 0.7rem 0.75rem 0.75rem;
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 42%);
  border: 1px solid var(--sh-border);
}

.create-job-modal .sh-field-group:has(> .sh-field-group-label) .sh-field-group-label {
  margin-bottom: 0.35rem;
}

.create-job-modal .sh-field-group:has(> .sh-field-group-label) .create-job-cols {
  margin-top: 0;
}

.create-job-modal .sh-field-group:has(> .sh-field-group-label) .create-job-cols + .create-job-cols {
  margin-top: 0.5rem;
}

.create-job-modal .sh-field-group .create-job-field label,
.create-job-modal .sh-field-group > label {
  display: block;
  margin-top: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--sh-text);
}

.sh-field-group-hint {
  margin: 0.25rem 0 0;
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--sh-muted);
}

.sh-field-group--disabled {
  opacity: 0.55;
}

/* Tax exempt pill switch (button — not affected by form input width rules) */
.sh-switch {
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: #d4d4d8;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.sh-switch[aria-checked="true"] {
  background: var(--sh-primary);
  box-shadow: inset 0 0 0 1px var(--sh-primary);
}

.sh-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.sh-switch[aria-checked="true"] .sh-switch-knob {
  transform: translateX(1.25rem);
}

.sh-switch:focus-visible {
  outline: 2px solid var(--sh-primary-border);
  outline-offset: 2px;
}

.sh-switch:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.job-modal-details-edit .sh-field-group {
  margin-top: 0.35rem;
}

.job-modal-details-edit .sh-field-group-label {
  margin-top: 0.25rem;
}

.job-modal-details-edit .sh-field-group > label {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sh-text);
}

@media (max-width: 520px) {
  .create-job-modal-panel {
    width: min(36rem, calc(100vw - 1.5rem));
    max-width: min(36rem, calc(100vw - 1.5rem));
  }

  .create-job-cols--2,
  .create-job-cols--3,
  .create-job-cols--assign {
    grid-template-columns: 1fr;
  }
}

.invite-modal-panel {
  position: relative;
  width: 100%;
  max-width: 24rem;
  margin-top: 6vh;
  padding: 1rem 1.1rem;
  background: var(--sh-surface);
  border-radius: var(--sh-radius-lg);
  border: 1px solid var(--sh-border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.invite-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.invite-modal-actions button:not(.sh-btn-primary) {
  padding: 0.45rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--sh-border);
  background: var(--sh-surface);
  font-family: inherit;
}

.invite-modal-actions .sh-btn-primary {
  border: none;
  background: var(--sh-primary);
  color: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(var(--sh-primary-rgb), 0.28);
}

.invite-modal-actions .sh-btn-primary:hover {
  background: var(--sh-primary-hover);
  box-shadow: 0 4px 14px rgba(var(--sh-primary-rgb), 0.35);
}

#inviteModalLink {
  max-width: none;
  font-size: 0.78rem;
  font-family: ui-monospace, monospace;
}

#customerSearch { max-width: none; }

#customersList {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
}

#customersList li {
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.5rem;
  background: var(--sh-surface);
}

#customersList li button {
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--sh-text);
  cursor: pointer;
}

#customersList li button:hover {
  color: var(--sh-primary);
}

.customer-main {
  font-weight: 600;
  font-size: 0.95rem;
}

.customer-sub {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--sh-muted);
  font-family: var(--sh-font-body);
}

#customersList li a {
  color: var(--sh-primary);
  font-weight: 600;
  text-decoration: none;
}

#saveTaxBtn,
#saveDisplayNameBtn,
#createInviteBtn {
  margin-top: 0.85rem;
  padding: 0.5rem 1rem;
  background: var(--sh-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sh-font-display);
}

#create-job-submit {
  display: block;
  width: 100%;
  margin-top: 0;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  background: var(--sh-primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--sh-font-display);
  box-shadow: 0 2px 8px rgba(var(--sh-primary-rgb), 0.35);
}

#create-job-submit:hover {
  background: var(--sh-primary-hover);
  box-shadow: 0 4px 14px rgba(var(--sh-primary-rgb), 0.4);
}

/* --- Page layout: customers, invoices, settings --- */
.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.page-toolbar .page-search {
  flex: 1 1 12rem;
  min-width: 10rem;
  max-width: 22rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--sh-border);
  border-radius: 8px;
  font-size: 0.9rem;
}

.page-toolbar select {
  width: auto;
  min-width: 9.5rem;
  flex-shrink: 0;
}

.data-card {
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-lg);
  box-shadow: var(--sh-shadow-sm);
  overflow: hidden;
}

.data-card-header {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--sh-border);
}

.data-card-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-family: var(--sh-font-display);
}

.data-card-body {
  padding: 0.5rem 0;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--sh-muted);
}

.empty-state-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--sh-text);
  font-family: var(--sh-font-display);
}

.customers-split {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  height: calc(100vh - 11rem);
  max-height: calc(100vh - 11rem);
  min-height: 0;
}

.customers-toolbar-card {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.customers-index-card {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
}

.customer-detail-card {
  grid-column: 2;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
}

@media (max-width: 1023px) {
  .customers-split {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(12rem, 1fr);
    height: auto;
    max-height: none;
  }

  .customers-toolbar-card {
    grid-column: 1;
    grid-row: 1;
  }

  .customer-detail-card {
    grid-column: 1;
    grid-row: 2;
    max-height: none;
  }

  .customers-index-card {
    grid-column: 1;
    grid-row: 3;
    max-height: min(48vh, 28rem);
  }
}

.customers-toolbar-card,
.customers-index-card,
.customer-detail-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.customers-index-header {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex-shrink: 0;
}

.customers-index-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.customers-index-head-row h2 {
  margin: 0;
}

.customers-index-head-row select {
  width: auto;
  min-width: 8.5rem;
  flex-shrink: 0;
}

.customers-search-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--sh-border);
  border-radius: 8px;
  font-size: 0.9rem;
  font: inherit;
  color: inherit;
  background: var(--sh-surface);
}

.customers-list-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0;
}

.customers-list {
  min-height: 0;
}

.customers-no-match {
  padding: 1.25rem 1.15rem;
}

.customer-detail-card {
  padding: 0;
}

.customer-detail-head {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--sh-border);
  flex-shrink: 0;
  background: var(--sh-surface);
}

.customer-detail-head-title {
  margin: 0;
  font-size: 1.05rem;
  font-family: var(--sh-font-display);
  line-height: 1.3;
}

.customer-detail-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.customer-detail-empty {
  padding: 1rem 1.15rem;
  margin: 0;
  font-size: 0.9rem;
  color: var(--sh-muted);
  line-height: 1.45;
}

.customer-detail-empty p {
  margin: 0;
}

.customer-detail-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.customer-detail-profile {
  padding: 1rem 1.15rem 1.15rem;
  background: var(--sh-surface);
  border-bottom: 1px solid var(--sh-border);
  flex-shrink: 0;
}

.customer-info-heading {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sh-muted);
  font-family: var(--sh-font-display);
}

.customer-info-list {
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.customer-info-row {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
}

.customer-info-row dt {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--sh-muted);
}

.customer-info-row dd {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--sh-text);
  word-break: break-word;
}

.customer-jobs-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 1.25rem 1.15rem 1rem;
  border-top: 4px solid var(--sh-primary-soft);
}

@media (max-width: 639px) {
  .customer-info-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

.customer-jobs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  flex-shrink: 0;
}

.customer-jobs-head h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sh-muted);
  font-family: var(--sh-font-display);
}

.customer-jobs-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sh-muted);
}

.customer-jobs-empty {
  margin: 0;
  font-size: 0.88rem;
  color: var(--sh-muted);
}

.customer-jobs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.customer-job-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  background: var(--sh-surface);
  box-shadow: var(--sh-shadow-sm);
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.customer-job-card:hover {
  background: var(--sh-primary-soft);
  box-shadow: var(--sh-shadow-md);
}

.customer-job-card-title {
  font-weight: 600;
  font-size: 0.92rem;
  min-width: 0;
}

.customer-job-card-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.customer-job-card-date {
  font-size: 0.78rem;
  color: var(--sh-muted);
  white-space: nowrap;
}

.customer-row-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 1.15rem;
  border: none;
  border-bottom: 1px solid var(--sh-border);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.customer-row-btn:hover,
.customer-row-btn.is-selected {
  background: var(--sh-primary-soft);
}

.customer-row-btn:last-child {
  border-bottom: none;
}

.customer-main {
  font-weight: 600;
  font-size: 0.95rem;
}

.customer-sub {
  font-size: 0.8rem;
  color: var(--sh-muted);
  margin-top: 0.15rem;
}

.customer-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--sh-primary-hover);
  background: var(--sh-primary-soft);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.status-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  text-transform: capitalize;
}

.status-badge--draft {
  background: #f1f5f9;
  color: #475569;
}

.status-badge--sent {
  background: var(--sh-primary-soft);
  color: var(--sh-primary-hover);
}

.status-badge--paid {
  background: #dcf5e4;
  color: #1a8f4c;
}

.status-badge--void {
  background: #fee8e8;
  color: #a84848;
}

.invoices-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
}

.invoices-row td:last-child {
  text-align: right;
}

.invoices-open-hint {
  font-size: 0.75rem;
  color: var(--sh-muted);
  margin-left: 0.35rem;
}

.settings-layout {
  display: grid;
  grid-template-columns: 11.5rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.settings-nav-picker {
  display: contents;
}

.settings-picker-btn {
  display: none;
}

.settings-picker-panel {
  display: block;
  min-width: 0;
}

.settings-picker-leading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.settings-picker-icon {
  flex-shrink: 0;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sh-primary-soft);
  color: var(--sh-primary);
}

.settings-picker-icon svg {
  width: 1.1rem;
  height: 1.1rem;
}

.settings-picker-text {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.settings-picker-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sh-muted);
}

.settings-picker-summary {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sh-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-picker-chevron {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: rotate(45deg);
  margin-top: -0.15rem;
  flex-shrink: 0;
  transition: transform 0.15s ease, margin 0.15s ease;
}

.settings-picker-btn.is-open .settings-picker-chevron {
  transform: rotate(-135deg);
  margin-top: 0.12rem;
}

.settings-subnav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-lg);
  padding: 0.5rem;
  box-shadow: var(--sh-shadow-sm);
}

.settings-layout.is-profile-only {
  grid-template-columns: minmax(0, 1fr);
}

.settings-layout.is-profile-only .settings-nav-picker {
  display: none;
}

.settings-subnav-link[hidden],
.settings-pane[hidden],
.settings-owner-only[hidden] {
  display: none !important;
}

@media (max-width: 1023px) {
  .settings-layout {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .settings-nav-picker {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .settings-picker-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--sh-border);
    border-radius: 12px;
    background: var(--sh-surface);
    box-shadow: var(--sh-shadow-sm);
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
  }

  .settings-picker-btn:hover {
    border-color: #cbd5e1;
  }

  .settings-picker-btn.is-open {
    border-color: var(--sh-primary);
    box-shadow: 0 0 0 1px var(--sh-primary);
  }

  .settings-picker-panel {
    margin-top: 0.4rem;
  }

  .settings-picker-panel[hidden] {
    display: none;
  }

  .settings-picker-panel:not([hidden]) .settings-subnav {
    border-radius: 12px;
    box-shadow: var(--sh-shadow-md);
    max-height: min(18rem, 42vh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.4rem;
    gap: 0.2rem;
  }

  .settings-subnav {
    flex-direction: column;
    flex-wrap: nowrap;
    overflow-x: visible;
    overflow-y: visible;
  }

  .settings-subnav-link {
    flex: 0 0 auto;
    width: 100%;
    white-space: nowrap;
    min-height: 2.75rem;
    display: flex;
    align-items: center;
  }

  .settings-pane.panel > h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .settings-pane.panel {
    position: relative;
    padding: 1rem 1rem 1.1rem;
  }

  .settings-profile-fields {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .settings-profile-preview {
    width: 3rem;
    height: 3rem;
    font-size: 1rem;
  }

  .settings-pane .sh-btn-primary,
  .settings-pane .sh-btn-secondary,
  .settings-pane button.sh-btn-primary,
  .settings-pane button.sh-btn-secondary,
  #tax-form .sh-btn-primary,
  #tax-form button[type="submit"] {
    width: 100%;
    min-height: 2.75rem;
  }

  .settings-subscription-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-subscription-actions .sh-btn-primary,
  .settings-subscription-actions .sh-btn-secondary {
    width: 100%;
  }

  .settings-address-row {
    grid-template-columns: 1fr;
  }

  #settings-pane-pricing .settings-pricing-table-wrap {
    overflow: visible;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
  }

  #settings-pane-pricing .settings-pricing-mobile-list {
    display: block;
  }

  #settings-pane-pricing .settings-pricing-table--desktop {
    display: none !important;
  }

  #createInviteBtn {
    width: 100%;
    min-height: 2.75rem;
  }

  .settings-pane input[type="text"],
  .settings-pane input[type="number"],
  .settings-pane input[type="email"],
  .settings-pane textarea,
  .settings-pane select {
    width: 100%;
    max-width: none;
    min-height: 2.75rem;
    box-sizing: border-box;
  }
}

@media (min-width: 1024px) {
  .settings-picker-btn {
    display: none;
  }

  .settings-picker-panel[hidden] {
    display: block !important;
  }
}

.settings-subnav-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--sh-text);
  cursor: pointer;
  font-family: var(--sh-font-display);
}

.settings-subnav-link:hover {
  background: var(--sh-primary-soft);
}

.settings-subnav-link.is-active {
  background: var(--sh-primary-soft);
  color: var(--sh-primary-hover);
  font-weight: 600;
}

.settings-pane {
  display: none;
}

.settings-pane.is-active {
  display: block;
}

.settings-pane .panel {
  margin-bottom: 1rem;
}

.settings-profile-fields {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin: 0.75rem 0 1rem;
}

.settings-profile-preview {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  font-size: 0.9rem;
}

.settings-profile-inputs {
  flex: 1;
  min-width: 0;
}

.settings-profile-inputs label:first-of-type {
  margin-top: 0;
}

.settings-profile-color {
  margin: 0 0 1.15rem;
  padding: 1rem 0 0;
  border-top: 1px solid var(--sh-border);
}

.settings-profile-color-title {
  margin: 0 0 0.35rem;
  font-family: var(--sh-font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--sh-text);
}

.settings-profile-color-hint {
  margin: 0 0 0.65rem;
}

.settings-avatar-color-dropdown-wrap {
  position: relative;
  max-width: 22rem;
}

.settings-avatar-color-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--sh-border);
  border-radius: 12px;
  background: var(--sh-surface);
  box-shadow: var(--sh-shadow-sm);
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.settings-avatar-color-trigger:hover {
  border-color: #cbd5e1;
}

.settings-avatar-color-trigger.is-open,
.settings-avatar-color-trigger:focus-visible {
  border-color: var(--sh-primary);
  box-shadow: 0 0 0 1px var(--sh-primary);
  outline: none;
}

.settings-avatar-color-trigger-leading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.settings-avatar-color-trigger-text {
  display: flex;
  flex-direction: column;
  gap: 0.06rem;
  min-width: 0;
}

.settings-avatar-color-trigger-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sh-muted);
}

.settings-avatar-color-trigger-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--sh-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-avatar-color-dot {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--swatch-color, var(--sh-primary));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 1px 3px rgba(15, 23, 42, 0.14);
}

.settings-avatar-color-dot--trigger {
  width: 1.65rem;
  height: 1.65rem;
}

.settings-avatar-color-menu {
  position: absolute;
  z-index: 120;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border: 1px solid var(--sh-border);
  border-radius: 12px;
  background: var(--sh-surface);
  box-shadow: var(--sh-shadow-md);
  max-height: min(16.5rem, 42vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.settings-avatar-color-menu[hidden] {
  display: none;
}

.settings-avatar-color-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.55rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: var(--sh-text);
  text-align: left;
  transition: background 0.12s ease;
}

.settings-avatar-color-option:hover,
.settings-avatar-color-option:focus-visible {
  background: var(--sh-primary-soft);
  outline: none;
}

.settings-avatar-color-option.is-selected {
  background: var(--sh-primary-soft);
}

.settings-avatar-color-option-name {
  flex: 1;
  min-width: 0;
  font-size: 0.92rem;
  font-weight: 500;
}

.settings-avatar-color-option-check {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  border-radius: 999px;
  border: 2px solid var(--sh-border);
  background: var(--sh-surface);
  position: relative;
}

.settings-avatar-color-option.is-selected .settings-avatar-color-option-check {
  border-color: var(--sh-primary);
  background: var(--sh-primary);
}

.settings-avatar-color-option.is-selected .settings-avatar-color-option-check::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: 0.28rem;
  height: 0.5rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

.settings-form-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--sh-border);
}

.settings-form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.settings-form-section h3 {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  font-family: var(--sh-font-display);
  color: var(--sh-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-subscription-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  align-items: center;
}

.settings-subscription-actions .sh-btn-primary,
.settings-subscription-actions .sh-btn-secondary {
  width: auto;
  max-width: none;
  margin: 0;
  flex: 0 1 auto;
}

.settings-subscription-cancel {
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--sh-border);
  max-width: 36rem;
}

.settings-subscription-cancel .panel-hint {
  margin-bottom: 0.75rem;
}

.settings-subscription-cancel-btn {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fff;
}

.settings-subscription-cancel-btn:hover {
  color: #991b1b;
  border-color: #fca5a5;
  background: #fef2f2;
}

/* Company price catalog — Settings */
#settings-pane-pricing.panel {
  max-width: none;
}

.settings-pricing-add-form .settings-form-section.settings-pricing-add-card {
  margin-bottom: 0;
  border-bottom: none;
}

.settings-pricing-add-card {
  padding: 1.25rem 1.4rem 1.35rem;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-lg);
  background: linear-gradient(180deg, #f8fafc 0%, var(--sh-surface) 100%);
  box-shadow: var(--sh-shadow-sm);
}

.settings-pricing-add-card h3 {
  margin-bottom: 1rem;
}

.settings-pricing-add-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 1.15rem;
  width: 100%;
}

.settings-pricing-fields-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.settings-pricing-add-grid {
  display: grid;
  grid-template-columns:
    minmax(7rem, 8.25rem)
    minmax(10rem, 1fr)
    minmax(6.25rem, 7.5rem)
    minmax(5.75rem, 9rem);
  gap: 1rem 1.15rem;
  align-items: end;
}

.settings-pricing-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.settings-pricing-field label {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.2;
}

.settings-pricing-field input,
.settings-pricing-field select {
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: 2.35rem;
  box-sizing: border-box;
}

.settings-pricing-field .sh-select {
  width: 100%;
  margin: 0;
}

.settings-pricing-field .sh-select-trigger {
  min-height: 2.35rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  box-sizing: border-box;
}

.settings-pricing-add-hint {
  margin: 0.5rem 0 0.1rem;
  padding: 0 0 0.15rem;
  max-width: 100%;
  font-size: 0.68rem;
  font-weight: 400;
  color: #94a3b8;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-pricing-form-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
  margin: 1.31rem 0 0;
  padding: 0;
}

.settings-pricing-form-actions .sh-btn-primary,
.settings-pricing-form-actions .sh-btn-secondary {
  width: 100%;
  min-width: 7.25rem;
  min-height: 2.35rem;
  margin: 0;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  white-space: nowrap;
  box-sizing: border-box;
}

.settings-pricing-list-section {
  margin-top: 1.5rem;
  padding-top: 0.25rem;
}

.settings-pricing-list-section h3 {
  margin-bottom: 0.65rem;
}

.settings-pricing-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  background: var(--sh-surface);
}

.settings-pricing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.settings-pricing-table th,
.settings-pricing-table td {
  padding: 0.55rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--sh-border);
  vertical-align: middle;
}

.settings-pricing-table th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sh-muted);
  background: #f8fafc;
}

.settings-pricing-table tbody tr:last-child td {
  border-bottom: none;
}

.settings-pricing-col-type {
  width: 12%;
  white-space: nowrap;
}

.settings-pricing-col-name {
  width: 46%;
}

.settings-pricing-col-price {
  width: 14%;
  white-space: nowrap;
}

.settings-pricing-col-code {
  width: 14%;
  white-space: nowrap;
}

.settings-pricing-actions-col {
  width: 14%;
  text-align: right;
}

.settings-pricing-actions-cell {
  text-align: right;
  white-space: nowrap;
}

.settings-pricing-row-btn {
  margin: 0 0 0 0.35rem;
  padding: 0.2rem 0.45rem;
  border: none;
  background: transparent;
  color: var(--sh-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border-radius: 4px;
}

.settings-pricing-row-btn:hover {
  background: var(--sh-primary-soft);
}

.settings-pricing-row-btn--danger {
  color: #b91c1c;
}

.settings-pricing-row-btn--danger:hover {
  background: #fef2f2;
}

/* Company pricing — compact list (tablet/mobile settings) */
.settings-pricing-mobile-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
}

.settings-pricing-item {
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  background: var(--sh-surface);
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.65rem;
}

.settings-pricing-item:last-child {
  margin-bottom: 0;
}

.settings-pricing-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.settings-pricing-item-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.35;
}

.settings-pricing-item-price {
  flex-shrink: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.settings-pricing-item-meta {
  margin-top: 0.3rem;
  font-size: 0.8125rem;
  color: var(--sh-muted);
  line-height: 1.35;
}

.settings-pricing-quick-code {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--sh-text);
}

.settings-pricing-item-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--sh-border);
}

.settings-pricing-item-actions .settings-pricing-row-btn {
  flex: 1 1 0;
  margin: 0;
  min-height: 2.5rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  background: var(--sh-surface);
}

.settings-pricing-item-actions .settings-pricing-row-btn:hover {
  background: var(--sh-primary-soft);
}

.settings-pricing-item-actions .settings-pricing-row-btn--danger {
  border-color: #fecaca;
  background: #fff;
}

.settings-pricing-item-actions .settings-pricing-row-btn--danger:hover {
  background: #fef2f2;
}

@media (max-width: 1023px) {
  #settings-pane-pricing .panel-hint {
    font-size: 0.8125rem;
    line-height: 1.45;
  }

  .settings-pricing-add-toolbar {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
  }

  .settings-pricing-fields-wrap {
    flex: 1 1 auto;
    width: 100%;
  }

  .settings-pricing-add-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 0.85rem;
  }

  .settings-pricing-field--name,
  .settings-pricing-field--code {
    grid-column: 1 / -1;
  }

  .settings-pricing-add-hint {
    white-space: normal;
    font-size: 0.75rem;
    margin-top: 0.4rem;
  }

  .settings-pricing-form-actions {
    flex-direction: column;
    flex: 1 1 auto;
    width: 100%;
    margin-top: 0.85rem;
  }

  .settings-pricing-form-actions .sh-btn-primary,
  .settings-pricing-form-actions .sh-btn-secondary {
    width: 100%;
    flex: none;
    min-height: 2.75rem;
  }

  .settings-pricing-add-card {
    padding: 1rem 1rem 1.1rem;
  }

  .settings-pricing-list-section {
    margin-top: 1.25rem;
  }
}

@media (max-width: 639px) {
  .settings-pricing-add-grid {
    grid-template-columns: 1fr;
  }

  .settings-pricing-field--name,
  .settings-pricing-field--code {
    grid-column: auto;
  }

  .settings-pricing-add-card h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }
}

/* Finances dashboard (owner-only) */
.finances-page .list-scale-warning {
  margin-bottom: 0.75rem;
}

.finances-page .finances-toolbar {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--sh-border);
}

.finances-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
}

.finances-period-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sh-muted);
  margin: 0;
  flex: 0 0 auto;
}

.finances-period-hint {
  margin: 0;
  min-width: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--sh-muted);
}

.finances-toolbar-row .sh-select {
  min-width: 11rem;
  margin-top: 0;
  flex: 0 0 auto;
}

.finances-loading {
  margin: 0 0 1.5rem;
  font-size: 0.875rem;
}

.finances-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.finances-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
}

.finances-kpi-card {
  padding: 1.2rem 1.25rem 1.15rem;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-lg);
  background: var(--sh-surface);
  box-shadow: var(--sh-shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.finances-kpi-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #334155;
  margin-bottom: 0.15rem;
}

.finances-kpi-value {
  font-family: var(--sh-font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--sh-text);
  line-height: 1.2;
  margin: 0.1rem 0 0.2rem;
}

.finances-kpi-value--count {
  font-variant-numeric: tabular-nums;
}

.finances-kpi-note {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.4;
  margin-top: 0.15rem;
}

.finances-section-card {
  margin: 0;
}

.finances-section-header {
  padding: 1.1rem 1.25rem 1rem;
}

.finances-section-header h2 {
  font-size: 1rem;
  line-height: 1.3;
}

.finances-section-hint {
  margin: 0.4rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--sh-muted);
}

.finances-card-body {
  padding: 1rem 1.25rem 1.15rem;
}

.finances-card-body--table {
  padding-top: 0.65rem;
  padding-bottom: 0.35rem;
}

.finances-card-body--chart {
  padding: 0.85rem 1rem 1rem;
  container-type: inline-size;
  container-name: finances-trends;
}

.finances-month-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.75rem;
}

.finances-month-card {
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  background: #f8fafc;
  min-width: 0;
}

.finances-month-card--current {
  border-color: #93c5fd;
  background: #eff6ff;
}

.finances-month-label {
  margin: 0 0 0.15rem;
  font-size: 0.76rem;
  color: var(--sh-muted);
}

.finances-month-cash {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.finances-month-change {
  margin: 0.12rem 0 0;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}

.finances-change--up {
  color: #166534;
}

.finances-change--down {
  color: #b91c1c;
}

.finances-change--flat {
  color: var(--sh-muted);
}

.finances-monthly-trend {
  display: block;
  width: 100%;
  margin: 0.5rem 0 0.85rem;
}

.finances-chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
}

.finances-chart-toolbar-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--sh-muted);
}

.finances-chart-toggle {
  display: inline-flex;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  overflow: hidden;
  background: #f8fafc;
}

.finances-chart-toggle-btn {
  margin: 0;
  padding: 0.35rem 0.7rem;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--sh-muted);
  cursor: pointer;
}

.finances-chart-toggle-btn + .finances-chart-toggle-btn {
  border-left: 1px solid var(--sh-border);
}

.finances-chart-toggle-btn--active {
  background: #eff6ff;
  color: #1d4ed8;
}

.finances-chart-toggle-btn:hover {
  background: #f1f5f9;
}

.finances-chart-toggle-btn--active:hover {
  background: #eff6ff;
}

.finances-trend-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.finances-trend-stat {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  background: #f8fafc;
  min-width: 0;
}

.finances-trend-stat-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--sh-muted);
  line-height: 1.25;
  margin-bottom: 0.2rem;
}

.finances-trend-stat-value {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Monthly trends: reflow when the card is narrower than a comfortable 6-across strip (~1280px laptop) */
@container finances-trends (max-width: 65rem) {
  .finances-month-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .finances-trend-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finances-trend-stat-value {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  .finances-month-cash {
    font-size: 0.92rem;
  }
}

@container finances-trends (max-width: 34rem) {
  .finances-month-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finances-trend-summary {
    grid-template-columns: 1fr;
  }

  .finances-chart-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .finances-chart-toggle {
    align-self: flex-start;
  }
}

.finances-trend-drill {
  margin: 0.75rem 0 0.5rem;
  padding: 0.75rem 0.85rem 0.5rem;
  border: 1px solid #93c5fd;
  border-radius: var(--sh-radius);
  background: #f8fafc;
}

.finances-trend-drill-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.finances-trend-drill-head h3 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.3;
}

.finances-trend-drill-close {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
}

.finances-trend-drill-table {
  font-size: 0.8rem;
}

.finances-trend-datatable {
  margin-top: 0.65rem;
  font-size: 0.8rem;
}

.finances-trend-datatable summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--sh-muted);
  padding: 0.25rem 0;
}

.finances-trend-datatable summary:hover {
  color: var(--sh-text);
}

.finances-trend-datatable table {
  margin-top: 0.5rem;
}

.finances-cash-line-chart {
  display: grid;
  grid-template-columns: 2.85rem minmax(0, 1fr);
  column-gap: 0.45rem;
  width: 100%;
  align-items: end;
}

.finances-cash-line-yaxis {
  position: relative;
  height: 8.75rem;
  flex-shrink: 0;
}

.finances-cash-line-ylabel {
  position: absolute;
  right: 0;
  font-size: 0.68rem;
  line-height: 1.2;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.finances-cash-line-ylabel--max {
  top: 0;
}

.finances-cash-line-ylabel--zero {
  bottom: 0;
}

.finances-cash-line-main {
  min-width: 0;
}

.finances-cash-line-plot {
  position: relative;
  height: 8.75rem;
}

.finances-cash-line-hits {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.finances-cash-line-hit {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.75rem;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  transform: translateX(-50%);
}

.finances-cash-line-hit--start {
  transform: translateX(0);
}

.finances-cash-line-hit--end {
  transform: translateX(-100%);
}

.finances-cash-line-hit:hover,
.finances-cash-line-hit:focus {
  outline: none;
  background: rgba(31, 122, 224, 0.08);
}

.finances-cash-line-hit--active {
  background: rgba(31, 122, 224, 0.14);
}

.finances-cash-line-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 10.5rem;
  max-width: 13.5rem;
  padding-bottom: 0.5rem;
  transform: translate(-50%, -100%);
  pointer-events: none;
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .finances-cash-line-tooltip {
    transition: opacity 0.12s ease, transform 0.12s ease;
  }

  .finances-cash-line-tooltip--visible {
    opacity: 1;
  }

  .finances-cash-line-tooltip--visible:not(.finances-cash-line-tooltip--edge-start):not(
      .finances-cash-line-tooltip--edge-end
    ) {
    transform: translate(-50%, calc(-100% - 2px));
  }
}

.finances-cash-line-tooltip:not([hidden]) {
  opacity: 1;
}

.finances-cash-line-tooltip--edge-start {
  transform: translate(0, -100%);
}

.finances-cash-line-tooltip--edge-end {
  transform: translate(-100%, -100%);
}

.finances-cash-line-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.12rem;
  width: 0;
  height: 0;
  margin-left: -6px;
  border: 6px solid transparent;
  border-top-color: var(--sh-surface);
  filter: drop-shadow(0 1px 0 var(--sh-border));
}

.finances-cash-line-tooltip--edge-start::after {
  left: 1.35rem;
  margin-left: 0;
}

.finances-cash-line-tooltip--edge-end::after {
  left: auto;
  right: 1.35rem;
  margin-left: 0;
}

.finances-chart-tip {
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-top: 2px solid var(--sh-primary);
  border-radius: var(--sh-radius-lg);
  box-shadow: var(--sh-shadow-md), 0 16px 40px rgba(15, 23, 42, 0.1);
  padding: 0.65rem 0.8rem 0.55rem;
  overflow: hidden;
}

.finances-chart-tip-date {
  margin: 0 0 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.25;
  color: var(--sh-muted);
}

.finances-chart-tip-amount {
  margin: 0 0 0.45rem;
  font-family: var(--sh-font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--sh-text);
}

.finances-chart-tip-amount--positive {
  color: #166534;
}

.finances-chart-tip-amount--empty {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--sh-muted);
}

.finances-chart-tip-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.2rem 0.75rem;
  margin: 0;
  padding: 0.45rem 0 0;
  border-top: 1px solid var(--sh-border);
}

.finances-chart-tip-meta dt {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--sh-muted);
}

.finances-chart-tip-meta dd {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--sh-text);
}

.finances-chart-tip-hint {
  margin: 0.45rem 0 0;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--sh-border);
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.3;
  color: #94a3b8;
}

.finances-cash-line-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.finances-cash-line-xlabels {
  position: relative;
  height: 1.35rem;
  margin-top: 0.2rem;
  overflow: hidden;
}

.finances-cash-line-xlabels--even {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.2rem;
  height: auto;
  min-height: 1.2rem;
  padding-top: 0.15rem;
}

.finances-cash-line-xlabel {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  max-width: 3.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.68rem;
  line-height: 1.2;
  color: var(--sh-muted);
  text-align: center;
}

.finances-cash-line-xlabels--even .finances-cash-line-xlabel {
  position: static;
  transform: none;
  flex: 0 1 auto;
  min-width: 0;
  max-width: none;
  font-size: 0.625rem;
  letter-spacing: -0.01em;
}

.finances-cash-line-xlabels--even .finances-cash-line-xlabel--start,
.finances-cash-line-xlabels--even .finances-cash-line-xlabel--end {
  transform: none;
  text-align: center;
}

.finances-cash-line-xlabel--start {
  transform: translateX(0);
}

.finances-cash-line-xlabel--end {
  transform: translateX(-100%);
}

.finances-cash-line-grid {
  stroke: var(--sh-border);
  stroke-width: 1;
}

.finances-cash-line-area {
  fill: rgba(31, 122, 224, 0.1);
}

.finances-cash-line-path {
  fill: none;
  stroke: #1f7ae0;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.finances-month-billed-wrap {
  margin-top: 0.25rem;
}

.finances-month-billed-card {
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  padding: 0.7rem 0.8rem 0.35rem;
  background: #fff;
}

.finances-month-billed-title {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sh-muted);
}

.finances-billed-wrap {
  margin: 0;
}

.finances-billed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
}

.finances-billed-head {
  display: none;
}

.finances-billed-item {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--sh-border);
}

.finances-billed-item:last-child {
  border-bottom: none;
  padding-bottom: 0.1rem;
}

.finances-billed-item-title {
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1.35;
}

.finances-billed-item-meta {
  margin-top: 0.18rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--sh-muted);
  font-variant-numeric: tabular-nums;
}

.finances-billed-gap {
  font-weight: 700;
  color: var(--sh-text);
}

.finances-billed-dt {
  display: none;
}

@media (min-width: 1024px) {
  .finances-billed-head {
    display: grid;
    grid-template-columns: 4.75rem 5.75rem 5.75rem 5.75rem;
    column-gap: 0.65rem;
    padding: 0 0 0.5rem;
    border-bottom: 1px solid var(--sh-border);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--sh-muted);
  }

  .finances-billed-head-num {
    text-align: right;
  }

  .finances-billed-item {
    display: grid;
    grid-template-columns: 4.75rem 5.75rem 5.75rem 5.75rem;
    column-gap: 0.65rem;
    align-items: center;
    padding: 0.5rem 0;
  }

  .finances-billed-item-main {
    display: none;
  }

  .finances-billed-dt {
    display: block;
    min-width: 0;
  }

  .finances-billed-dt-month {
    font-weight: 700;
    white-space: nowrap;
  }

  .finances-billed-dt-num {
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
}

.finances-inline-empty {
  text-align: center;
  padding: 1.25rem 1rem 1.35rem;
  color: var(--sh-muted);
  font-size: 0.875rem;
  line-height: 1.45;
}

.finances-inline-empty p {
  margin: 0;
}

.finances-inline-empty-title {
  margin: 0 0 0.35rem !important;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--sh-text);
}

.finances-shop-empty {
  margin-top: 0.5rem;
  padding: 2.75rem 1.5rem;
}

.finances-trend {
  display: flex;
  flex-direction: column;
}

.finances-trend-row {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr) auto;
  gap: 0.85rem 1rem;
  align-items: center;
  padding: 0.65rem 0;
  border-top: 1px solid #eef2f6;
}

.finances-trend-row:first-child {
  border-top: none;
  padding-top: 0.1rem;
}

.finances-trend-row:last-child {
  padding-bottom: 0.15rem;
}

.finances-trend-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--sh-muted);
  white-space: nowrap;
  line-height: 1.35;
  min-width: 0;
}

.finances-trend-track {
  height: 0.5rem;
  min-width: 0;
  border-radius: 999px;
  background: #e8eef4;
  overflow: hidden;
}

.finances-trend-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #1f7ae0 0%, #3b9bff 100%);
  min-width: 0;
  transition: width 0.2s ease;
}

.finances-trend-amt {
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--sh-text);
  white-space: nowrap;
  line-height: 1.35;
  min-width: 4.75rem;
}

.finances-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 0;
}

.finances-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.finances-breakdown-table th,
.finances-breakdown-table td {
  padding: 0.6rem 0.15rem;
  border-bottom: 1px solid var(--sh-border);
  text-align: left;
  vertical-align: middle;
}

.finances-breakdown-table tbody tr:last-child td {
  border-bottom: none;
  padding-bottom: 0.35rem;
}

.finances-breakdown-table thead th {
  padding-top: 0;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--sh-border);
}

.finances-breakdown-table th {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sh-muted);
}

.finances-breakdown-empty {
  color: var(--sh-muted);
  font-style: italic;
  padding-top: 0.75rem !important;
  padding-bottom: 0.75rem !important;
}

.finances-num-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-right: 0 !important;
}

.finances-split-wrap {
  margin: 0;
}

.finances-split-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.finances-split-head {
  display: none;
}

.finances-split-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--sh-border);
  font-size: 0.875rem;
}

.finances-split-item:last-child {
  border-bottom: none;
  padding-bottom: 0.1rem;
}

.finances-split-label {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  line-height: 1.35;
}

.finances-split-amount {
  flex-shrink: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.finances-split-empty {
  padding: 0.65rem 0;
  font-size: 0.875rem;
  color: var(--sh-muted);
  font-style: italic;
  border-bottom: none;
}

@media (min-width: 1024px) {
  .finances-split-head {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 1rem;
    padding: 0 0 0.55rem;
    border-bottom: 1px solid var(--sh-border);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--sh-muted);
  }

  .finances-split-head-amt {
    text-align: right;
  }
}

.finances-ar-wrap {
  margin: 0;
}

.finances-ar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.finances-ar-head {
  display: none;
}

.finances-ar-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--sh-border);
  font-size: 0.875rem;
}

.finances-ar-item:last-child {
  border-bottom: none;
  padding-bottom: 0.15rem;
}

.finances-ar-item-main {
  flex: 1;
  min-width: 0;
}

.finances-ar-item-title {
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1.35;
}

.finances-ar-item-meta {
  margin-top: 0.18rem;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--sh-muted);
  font-variant-numeric: tabular-nums;
}

.finances-ar-item-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  flex-shrink: 0;
  text-align: right;
}

.finances-ar-item-balance {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  color: #b45309;
  white-space: nowrap;
}

.finances-ar-dt {
  display: none;
}

.finances-ar-balance {
  font-weight: 700;
  color: #b45309;
}

.finances-ar-link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--sh-primary);
  text-decoration: none;
  white-space: nowrap;
  display: inline-block;
  padding: 0.15rem 0;
}

.finances-ar-link:hover {
  text-decoration: underline;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 1023px) {
  .finances-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finances-month-strip {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.6rem;
    overflow-x: auto;
    padding-bottom: 0.3rem;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .finances-month-card {
    flex: 0 0 8.75rem;
    scroll-snap-align: start;
  }

  .finances-trend-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .finances-trend-stat {
    padding: 0.6rem 0.7rem;
  }

  .finances-trend-stat-label {
    font-size: 0.7rem;
    line-height: 1.35;
  }

  .finances-trend-stat-value {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
  }

  .finances-cash-line-ylabel--zero {
    display: none;
  }

  .finances-cash-line-xlabels--even {
    min-height: 1.35rem;
    padding-left: 0.1rem;
    padding-right: 0.1rem;
  }

  .finances-cash-line-xlabels--even .finances-cash-line-xlabel {
    font-size: 0.6rem;
  }

  .finances-breakdown-table th,
  .finances-breakdown-table td {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }

  .finances-detail-grid {
    grid-template-columns: 1fr;
  }

  .finances-card-body--table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .finances-kpi-note {
    line-height: 1.45;
  }
}

@media (min-width: 1024px) {
  .finances-ar-head {
    display: grid;
    grid-template-columns: 5.25rem minmax(10rem, 1fr) 5.5rem 5.5rem 5.75rem 4.85rem;
    column-gap: 0.65rem;
    padding: 0 0 0.55rem;
    border-bottom: 1px solid var(--sh-border);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--sh-muted);
  }

  .finances-ar-head-num {
    text-align: right;
  }

  .finances-ar-head-action {
    text-align: right;
  }

  .finances-ar-item {
    display: grid;
    grid-template-columns: 5.25rem minmax(10rem, 1fr) 5.5rem 5.5rem 5.75rem 4.85rem;
    column-gap: 0.65rem;
    align-items: center;
    padding: 0.6rem 0;
  }

  .finances-ar-item-main,
  .finances-ar-item-end {
    display: none;
  }

  .finances-ar-dt {
    display: block;
    min-width: 0;
  }

  .finances-ar-dt-invoice {
    font-weight: 700;
    white-space: nowrap;
  }

  .finances-ar-dt-job {
    line-height: 1.4;
  }

  .finances-ar-dt-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .finances-ar-dt-action {
    text-align: right;
  }
}

@media (max-width: 639px) {
  .finances-toolbar-row .sh-select {
    flex: 1 1 10rem;
    min-width: 0;
  }

  .finances-stack {
    gap: 1.25rem;
  }

  .finances-kpi-grid,
  .finances-detail-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .finances-kpi-card {
    padding: 1.05rem 1.1rem;
  }

  .finances-card-body {
    padding: 0.85rem 1rem 1rem;
  }

  .finances-month-strip {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }

  .finances-month-card {
    flex: 0 0 9.25rem;
  }

  .finances-trend-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finances-cash-line-chart {
    grid-template-columns: 2.5rem minmax(0, 1fr);
    column-gap: 0.35rem;
  }

  .finances-cash-line-yaxis,
  .finances-cash-line-plot {
    height: 7.75rem;
  }

  .finances-cash-line-ylabel,
  .finances-cash-line-xlabel {
    font-size: 0.64rem;
  }

  .finances-cash-line-ylabel--zero {
    display: none;
  }

  .finances-cash-line-xlabels--even .finances-cash-line-xlabel {
    font-size: 0.58rem;
  }

  .finances-chart-tip-amount {
    font-size: 1rem;
  }

  .finances-cash-line-hit {
    width: 1.35rem;
  }

  .finances-trend-drill-table {
    display: block;
    overflow-x: auto;
  }

  .finances-trend-row {
    grid-template-columns: 5.75rem minmax(0, 1fr) auto;
    gap: 0.65rem 0.75rem;
    padding: 0.55rem 0;
  }

  .finances-trend-amt {
    min-width: 4.25rem;
    font-size: 0.78rem;
  }
}

/* Invoice line price catalog autocomplete */
.price-catalog-search-wrap {
  position: relative;
  min-width: 0;
}

.price-catalog-search-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 10060;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  max-height: 14rem;
  overflow-y: auto;
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  box-shadow: var(--sh-shadow-md);
}

.price-catalog-search-menu[hidden] {
  display: none !important;
}

.price-catalog-search-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
}

/* Kanban row wrappers: participate in parent grid via display: contents */
.kanban-row {
  display: contents;
}

@media (max-width: 639px) {
  .kanban {
    grid-template-columns: 1fr;
  }

  .sh-profile-meta {
    display: none;
  }
}

/* Tablet: compact header + 2×2 kanban with in-column scroll */
@media (min-width: 640px) and (max-width: 1023px) {
  .app-header {
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
  }

  .app-header-greeting {
    flex: 1;
    min-width: 0;
  }

  .app-header-greeting h1 {
    font-size: 1.45rem;
  }

  .app-header-greeting p {
    display: none;
  }

  .app-header-actions {
    flex-wrap: nowrap;
    gap: 0.5rem;
  }

  .app-header-actions .sh-profile-shop {
    display: none;
  }

  .app-header-actions .sh-profile-chip {
    max-width: 9.5rem;
    padding: 0.35rem 0.5rem 0.35rem 0.35rem;
  }

  .app-header-actions #signOutBtn {
    font-size: 0.875rem;
    padding: 0.45rem 0.75rem;
    min-height: 2.25rem;
  }

  .kanban {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    min-height: 0;
    align-items: start;
  }

  .kanban-column-drop {
    flex: 1 1 auto;
    min-height: 7rem;
    max-height: min(30vh, 18rem);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .job-card-initials {
    display: none;
  }

  .job-card-head {
    gap: 0;
  }

  .job-card-title {
    white-space: nowrap;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    -webkit-box-orient: unset;
  }
}

/* Notifications bell */
.sh-notify-wrap {
  position: relative;
}

.sh-notify-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: min(26.5rem, calc(100vw - 1.5rem));
  max-height: min(28rem, calc(100vh - 6rem));
  overflow: hidden;
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-lg);
  box-shadow: var(--sh-shadow-md), 0 16px 40px rgba(15, 23, 42, 0.1);
  z-index: 50;
}

/* display:flex must not override the hidden attribute (was keeping panel always visible) */
.sh-notify-panel[hidden] {
  display: none !important;
}

.sh-notify-panel:not([hidden]) {
  display: flex;
  flex-direction: column;
}

.sh-notify-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--sh-border);
  background: linear-gradient(180deg, #fafbfd 0%, var(--sh-surface) 100%);
  flex-shrink: 0;
}

.sh-notify-panel-title {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.sh-notify-panel-heading {
  font-family: var(--sh-font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  color: var(--sh-text);
}

.sh-notify-panel-count {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--sh-primary);
}

.sh-notify-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--sh-muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.sh-notify-close svg {
  width: 1rem;
  height: 1rem;
}

.sh-notify-close:hover {
  background: #f1f5f9;
  color: var(--sh-text);
}

.sh-notify-row {
  display: flex;
  align-items: stretch;
  position: relative;
  border-bottom: 1px solid var(--sh-border);
}

.sh-notify-row:last-child {
  border-bottom: none;
}

.sh-notify-row .sh-notify-item {
  flex: 1;
  min-width: 0;
}

.sh-notify-dismiss {
  flex-shrink: 0;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  margin-right: 0.5rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--sh-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.sh-notify-dismiss svg {
  width: 0.85rem;
  height: 0.85rem;
}

.sh-notify-row:hover .sh-notify-dismiss,
.sh-notify-dismiss:focus-visible {
  opacity: 1;
}

.sh-notify-dismiss:hover {
  background: #f1f5f9;
  color: var(--sh-text);
}

@media (hover: none) {
  .sh-notify-dismiss {
    opacity: 0.5;
  }
}

.sh-notify-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.sh-notify-item {
  width: 100%;
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  text-align: left;
  padding: 0.75rem 0.65rem 0.75rem 1rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  position: relative;
  transition: background 0.12s ease;
}

.sh-notify-item:hover {
  background: #f8fafc;
}

.sh-notify-item.is-unread {
  background: rgba(var(--sh-primary-rgb), 0.04);
}

.sh-notify-item.is-unread:hover {
  background: rgba(var(--sh-primary-rgb), 0.07);
}

.sh-notify-item.is-unread::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65rem;
  bottom: 0.65rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--sh-primary);
}

.sh-notify-kind {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--sh-muted);
}

.sh-notify-kind svg {
  width: 1.05rem;
  height: 1.05rem;
}

.sh-notify-kind--message {
  background: #ede9fe;
  color: #6d28d9;
}

.sh-notify-kind--job_assigned {
  background: var(--sh-primary-soft);
  color: var(--sh-primary);
}

.sh-notify-kind--job_ready_for_review {
  background: #dcfce7;
  color: #15803d;
}

.sh-notify-kind--default {
  background: #f1f5f9;
  color: var(--sh-muted);
}

.sh-notify-item-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
  padding-right: 0.35rem;
}

.sh-notify-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.sh-notify-item-title {
  font-weight: 600;
  font-size: 0.84rem;
  line-height: 1.3;
  color: var(--sh-text);
}

.sh-notify-item-text {
  font-size: 0.8rem;
  color: var(--sh-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sh-notify-item-time {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--sh-muted);
  white-space: nowrap;
}

.sh-notify-empty {
  margin: 0;
  padding: 2rem 1.25rem 2.25rem;
  text-align: center;
  font-size: 0.84rem;
  color: var(--sh-muted);
  line-height: 1.45;
}

.sh-notify-empty::before {
  content: "";
  display: block;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 0.75rem;
  border-radius: 12px;
  background: var(--sh-primary-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f7ae0' stroke-width='2'%3E%3Cpath d='M18 8A6 6 0 006 8c0 7-3 9-3 9h18s-3-2-3-9'/%3E%3Cpath d='M13.73 21a2 2 0 01-3.46 0'/%3E%3C/svg%3E") center / 1.25rem no-repeat;
}

/* Messages page — team chat + direct message cards */
.messages-page-layout {
  display: grid;
  grid-template-columns: minmax(11.5rem, 15rem) minmax(0, 1fr);
  gap: 1rem;
  min-height: calc(100vh - 11rem);
  max-height: calc(100vh - 11rem);
}

.messages-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
  overflow: hidden;
}

.messages-sidebar-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sh-muted);
}

.messages-dm-picker {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

.messages-dm-picker-btn {
  display: none;
}

.messages-dm-picker-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.messages-dm-picker-leading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.messages-dm-picker-icon {
  flex-shrink: 0;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sh-primary-soft);
  color: var(--sh-primary);
}

.messages-dm-picker-icon svg {
  width: 1.1rem;
  height: 1.1rem;
}

.messages-dm-picker-text {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.messages-dm-picker-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sh-muted);
}

.messages-dm-picker-summary {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sh-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages-dm-picker-trail {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.messages-dm-picker-badge {
  margin-left: 0;
}

.messages-dm-picker-chevron {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: rotate(45deg);
  margin-top: -0.15rem;
  transition: transform 0.15s ease, margin 0.15s ease;
}

.messages-dm-picker-btn.is-open .messages-dm-picker-chevron {
  transform: rotate(-135deg);
  margin-top: 0.12rem;
}

.messages-dm-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  padding-right: 0.15rem;
}

.messages-dm-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 0.65rem;
  border: 1px solid var(--sh-border);
  border-radius: 12px;
  background: var(--sh-surface);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.messages-dm-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.messages-dm-card.is-active {
  border-color: var(--sh-primary);
  box-shadow: 0 0 0 1px var(--sh-primary);
}

.messages-dm-card-avatar {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
}

.messages-dm-card-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.messages-dm-card-badge {
  margin-left: auto;
  flex-shrink: 0;
}

.messages-dm-card-name {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages-dm-card-role {
  font-size: 0.68rem;
  color: var(--sh-muted);
  text-transform: capitalize;
}

.messages-team-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--sh-border);
  border-radius: 14px;
  background: var(--sh-surface);
  overflow: hidden;
}

.messages-team-head {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--sh-border);
  flex-shrink: 0;
}

.messages-team-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.messages-team-head .panel-hint {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
}

.messages-team-scroll,
.messages-dm-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 0;
  background: #f8fafc;
}

.messages-date-divider {
  align-self: center;
  margin: 0.65rem 0 0.45rem;
  padding: 0.2rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  background: #e2e8f0;
  border-radius: 999px;
}

.messages-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  max-width: min(82%, 18rem);
}

.messages-team-scroll .messages-msg-row {
  max-width: min(62%, 24rem);
}

.messages-team-scroll {
  gap: 0.55rem;
}

.messages-team-scroll .messages-msg-bubble {
  font-size: 0.98rem;
  line-height: 1.45;
  padding: 0.52rem 0.82rem;
}

.messages-team-scroll .messages-msg-row.is-mine .messages-msg-bubble {
  font-size: 1rem;
  line-height: 1.5;
  padding: 0.55rem 0.88rem;
}

.messages-team-scroll .messages-msg-sender {
  font-size: 0.74rem;
}

.messages-team-scroll .messages-msg-time {
  font-size: 0.7rem;
}

.messages-msg-row.is-mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.messages-msg-row.is-theirs {
  align-self: flex-start;
}

.messages-msg-avatar {
  flex-shrink: 0;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
}

.messages-msg-bubble-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
  max-width: 100%;
  width: fit-content;
}

.messages-msg-sender {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--sh-muted);
  padding-left: 0.15rem;
}

.messages-msg-row.is-mine .messages-msg-sender {
  text-align: right;
  padding-right: 0.15rem;
  padding-left: 0;
}

.messages-msg-bubble {
  padding: 0.45rem 0.7rem;
  border-radius: 1rem;
  font-size: 0.88rem;
  line-height: 1.4;
  word-break: break-word;
}

.messages-msg-row.is-mine .messages-msg-bubble {
  background: var(--sh-primary);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

.messages-msg-row.is-theirs .messages-msg-bubble {
  background: #e2e8f0;
  color: var(--sh-text);
  border-bottom-left-radius: 0.25rem;
}

.messages-msg-time {
  font-size: 0.65rem;
  color: #94a3b8;
  padding: 0 0.2rem;
}

.messages-msg-row.is-mine .messages-msg-time {
  text-align: right;
}

.messages-compose {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--sh-border);
  background: var(--sh-surface);
  flex-shrink: 0;
  align-items: center;
}

.messages-compose input {
  flex: 1;
  min-width: 0;
}

.messages-compose--team {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem;
  padding: 0.85rem 1rem;
  width: 100%;
  box-sizing: border-box;
  align-items: center;
}

.messages-compose--team .messages-compose-send {
  flex-shrink: 0;
  min-width: 4.75rem;
  padding: 0.6rem 1.1rem;
}

.messages-compose--team input {
  width: 100%;
  min-width: 0;
  max-width: none;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--sh-border);
  border-radius: 10px;
  background: #f8fafc;
  font: inherit;
  font-size: 0.9rem;
}

.messages-compose--team input:focus {
  outline: none;
  border-color: var(--sh-primary-border);
  background: var(--sh-surface);
  box-shadow: 0 0 0 3px var(--sh-primary-soft);
}

.messages-team-empty {
  margin: auto;
  text-align: center;
  color: var(--sh-muted);
  font-size: 0.88rem;
  padding: 2rem 1rem;
}

/* Direct message modal (centered) */
.messages-dm-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.messages-dm-modal[hidden] {
  display: none !important;
}

.messages-dm-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
}

.messages-dm-modal-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 26rem;
  max-height: min(85vh, 36rem);
  min-height: 0;
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.messages-dm-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--sh-border);
  flex-shrink: 0;
}

.messages-dm-modal-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.messages-dm-close {
  border: none;
  background: none;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  color: var(--sh-muted);
  padding: 0.15rem 0.35rem;
}

.messages-dm-close:hover {
  color: var(--sh-text);
}

.messages-compose--dm {
  gap: 0.65rem;
  padding: 0.85rem 1rem;
}

.messages-compose--dm .messages-compose-send {
  flex-shrink: 0;
  order: -1;
  min-width: 4.75rem;
  padding: 0.6rem 1.1rem;
}

.messages-compose--dm input {
  flex: 1;
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--sh-border);
  border-radius: 10px;
  background: #f8fafc;
  font: inherit;
  font-size: 0.9rem;
  max-width: none;
}

.messages-compose--dm input:focus {
  outline: none;
  border-color: var(--sh-primary);
  box-shadow: 0 0 0 2px rgba(var(--sh-primary-rgb), 0.12);
  background: var(--sh-surface);
}

/* Shop calendar */
.calendar-page {
  display: flex;
  justify-content: stretch;
  align-items: flex-start;
  width: 100%;
  padding: 0.5rem 0 2rem;
  min-height: calc(100vh - 10rem);
}

.calendar-board {
  width: 100%;
  max-width: none;
  margin: 0;
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-lg);
  box-shadow: var(--sh-shadow-md);
  padding: 1.25rem 1.35rem 1.35rem;
}

.calendar-board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.calendar-nav-btn {
  min-width: 2.5rem;
  padding: 0.35rem 0.65rem;
}

.calendar-month-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  min-width: 10rem;
  text-align: center;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  margin-bottom: 0.85rem;
  font-size: 0.78rem;
  color: var(--sh-muted);
}

.calendar-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cal-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.cal-dot--scheduled { background: #059669; }
.cal-dot--promise { background: #dc2626; }
.cal-dot--parts { background: var(--col-diagnostics); }
.cal-dot--note { background: var(--sh-primary); }

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--sh-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--sh-border);
  border: 1px solid var(--sh-border);
  border-radius: 10px;
  overflow: hidden;
}

.calendar-cell {
  min-width: 0;
  min-height: clamp(5.5rem, 10vw, 7.5rem);
  max-width: 100%;
  overflow: hidden;
  background: var(--sh-surface);
  border: none;
  padding: 0.35rem 0.4rem 0.3rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  transition: background 0.12s ease;
}

.calendar-cell:hover {
  background: #f8fafc;
}

.calendar-cell--pad {
  background: #f8fafc;
  cursor: default;
  min-height: clamp(5.5rem, 10vw, 7.5rem);
}

.calendar-cell.is-today {
  background: var(--sh-primary-soft);
  box-shadow: inset 0 0 0 2px var(--sh-primary-border);
}

.calendar-cell.is-today:hover {
  background: #e3f0fc;
}

.calendar-cell-num {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--sh-text);
  line-height: 1.2;
}

.calendar-cell-chips {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.25rem;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.calendar-chip {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.25;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-chip--scheduled_job {
  background: #d1fae5;
  color: #047857;
}

.calendar-chip--job_promise {
  background: #fee2e2;
  color: #991b1b;
}

.calendar-chip--parts_delivery {
  background: #faf0e0;
  color: #8a6520;
}

.calendar-chip--note {
  background: var(--sh-primary-soft);
  color: var(--sh-primary-hover);
}

.calendar-chip-more {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font-size: 0.62rem;
  color: var(--sh-muted);
  padding-left: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-day-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.calendar-day-modal[hidden] {
  display: none !important;
}

.calendar-day-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

.calendar-day-modal-panel {
  position: relative;
  width: min(26rem, 100%);
  max-height: min(90vh, 40rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--sh-surface);
  border-radius: var(--sh-radius-lg);
  border: 1px solid var(--sh-border);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18);
  padding: 1.1rem 1.25rem 1.15rem;
}

.calendar-day-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: 0.65rem;
}

.calendar-day-modal-body .calendar-day-events-list {
  min-height: 9rem;
  max-height: min(20rem, 38vh);
  overflow-y: auto;
  scrollbar-gutter: stable both-edges;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  background: #f8fafc;
  padding: 0.55rem;
  box-shadow: inset 0 -10px 10px -10px rgba(15, 23, 42, 0.08);
  align-items: stretch;
}

.calendar-day-modal-body .calendar-day-events-list .calendar-event-card,
.calendar-day-modal-body .calendar-day-events-list .calendar-day-empty {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-left: 0;
  margin-right: 0;
}

.calendar-day-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.calendar-day-modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.3;
}

.calendar-day-modal-close {
  border: none;
  background: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--sh-muted);
  padding: 0.15rem 0.35rem;
}

.calendar-day-schedule {
  margin-bottom: 1rem;
}

.calendar-day-schedule-intro {
  margin-bottom: 0.65rem;
}

.calendar-day-schedule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.calendar-day-schedule-head .calendar-day-add-label {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.calendar-day-view-all-tags {
  flex: 0 0 auto;
  padding: 0.32rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}

.calendar-tags-modal {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.calendar-tags-modal[hidden] {
  display: none !important;
}

.calendar-tags-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
}

.calendar-tags-modal-panel {
  position: relative;
  width: min(28rem, 100%);
  max-height: min(85vh, 36rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--sh-surface);
  border-radius: var(--sh-radius-lg);
  border: 1px solid var(--sh-border);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.2);
}

.calendar-tags-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem 0.85rem;
  border-bottom: 1px solid var(--sh-border);
}

.calendar-tags-modal-head h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
  font-family: var(--sh-font-display);
  color: var(--sh-text);
}

.calendar-tags-modal-close {
  border: none;
  background: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--sh-muted);
  padding: 0.15rem 0.35rem;
}

.calendar-tags-modal-close:hover {
  color: var(--sh-text);
}

.calendar-tags-modal-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.85rem 1.15rem 1.1rem;
  overflow-y: auto;
}

.calendar-tags-modal-empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--sh-muted);
  text-align: center;
  padding: 1.5rem 0.5rem;
}

.calendar-tags-modal-card {
  margin: 0;
}

.calendar-day-events-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 16rem;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.calendar-day-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--sh-muted);
}

.calendar-event-card {
  border: 1px solid var(--sh-border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: #fafbfc;
}

.calendar-event-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.calendar-event-title {
  margin: 0;
  font-weight: 600;
  font-size: 0.9rem;
}

.calendar-event-body {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--sh-muted);
  line-height: 1.4;
}

.calendar-event-job-link {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sh-primary);
  text-decoration: none;
}

.calendar-event-job-link:hover {
  text-decoration: underline;
}

.calendar-event-delete {
  border: none;
  background: none;
  color: var(--sh-muted);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.2rem;
}

.calendar-event-delete:hover {
  color: #b91c1c;
}

.calendar-day-add-form {
  flex-shrink: 0;
  margin-top: auto;
  border-top: 1px solid var(--sh-border);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.calendar-day-add-form .cal-field-title,
.calendar-day-add-form .cal-field-body {
  position: relative;
  z-index: 1;
}

.calendar-day-add-form .cal-field-title:focus-within,
.calendar-day-add-form .cal-field-body:focus-within {
  z-index: 10055;
}

.calendar-day-add-actions {
  margin-top: 0.45rem;
  padding-top: 0.15rem;
}

.calendar-day-add-actions .sh-btn-primary {
  width: 100%;
  margin: 0;
  padding: 0.65rem 1rem;
}

.calendar-day-field-hint {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--sh-muted);
  line-height: 1.35;
}

.calendar-day-add-form label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sh-muted);
  margin-top: 0.25rem;
}

.calendar-day-add-label {
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--sh-text);
}

.calendar-day-add-form input,
.calendar-day-add-form textarea {
  width: 100%;
  max-width: none;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  font: inherit;
  box-shadow: var(--sh-shadow-sm);
}

.calendar-day-add-form select {
  width: 100%;
  max-width: none;
}

/* Closed state matches native select; open menu uses global .sh-select-menu / .sh-select-option */
.calendar-day-add-form .sh-select {
  width: 100%;
  max-width: none;
  margin-top: 0;
}

.calendar-day-add-form .sh-select-trigger {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 2.4375rem;
  margin: 0;
  padding: 0 2.35rem 0 0.75rem;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--sh-text);
  background-color: var(--sh-surface);
  background-image: var(--sh-select-arrow);
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 1rem 1rem;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  box-shadow: var(--sh-shadow-sm);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease,
    background-image 0.15s ease;
}

.calendar-day-add-form .sh-select-trigger:hover:not(:disabled) {
  border-color: var(--sh-primary-border);
  background-color: #fafcff;
}

.calendar-day-add-form .sh-select-trigger.is-focused,
.calendar-day-add-form .sh-select.is-open .sh-select-trigger {
  outline: none;
  border-color: var(--sh-primary);
  background-color: var(--sh-surface);
  background-image: var(--sh-select-arrow-focus);
  box-shadow: 0 0 0 3px rgba(var(--sh-primary-rgb), 0.16), var(--sh-shadow-sm);
}

.calendar-day-add-form textarea {
  resize: vertical;
  min-height: 3rem;
}

@media (max-width: 639px) {
  .calendar-board {
    padding: 0.85rem;
    max-width: 100%;
  }

  .calendar-cell {
    min-height: 5.5rem;
    padding: 0.25rem;
  }

  .calendar-cell--pad {
    min-height: 5.5rem;
  }

  .calendar-chip {
    font-size: 0.65rem;
  }

  .calendar-weekdays span {
    font-size: 0.62rem;
  }
}

@media (max-width: 1023px) {
  .messages-page-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    max-height: none;
    min-height: calc(100vh - 10rem);
  }

  .messages-sidebar {
    flex-shrink: 0;
    overflow: visible;
  }

  .messages-sidebar-title {
    display: none;
  }

  .messages-dm-picker-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--sh-border);
    border-radius: 12px;
    background: var(--sh-surface);
    box-shadow: var(--sh-shadow-sm);
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
  }

  .messages-dm-picker-btn:hover {
    border-color: #cbd5e1;
  }

  .messages-dm-picker-btn.is-open {
    border-color: var(--sh-primary);
    box-shadow: 0 0 0 1px var(--sh-primary);
  }

  .messages-dm-picker-panel {
    margin-top: 0.4rem;
    border: 1px solid var(--sh-border);
    border-radius: 12px;
    background: var(--sh-surface);
    box-shadow: var(--sh-shadow-md);
    padding: 0.4rem;
    max-height: min(14.5rem, 38vh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .messages-dm-picker-panel[hidden] {
    display: none;
  }

  .messages-dm-cards {
    flex-direction: column;
    flex-wrap: nowrap;
    overflow-x: visible;
    overflow-y: visible;
    padding-bottom: 0;
    gap: 0.35rem;
  }

  .messages-dm-card {
    min-width: 0;
    width: 100%;
    border-radius: 10px;
    padding: 0.55rem 0.6rem;
  }

  .messages-team-panel {
    min-height: min(24rem, calc(100vh - 14rem));
    flex: 1;
  }

  .messages-team-scroll .messages-msg-row {
    max-width: min(78%, 22rem);
  }

  .messages-dm-modal-panel {
    max-width: 100%;
    max-height: min(92vh, none);
  }
}

@media (min-width: 1024px) {
  .messages-dm-picker-panel[hidden] {
    display: flex !important;
  }
}

/* Parts tab (PartsTech search) */
.parts-page .parts-connect-banner,
.parts-page .parts-stub-banner {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--sh-radius-md, 8px);
  font-size: 0.9rem;
}

.parts-connect-banner {
  background: rgba(185, 28, 28, 0.08);
  color: #991b1b;
  border: 1px solid rgba(185, 28, 28, 0.2);
}

.parts-stub-banner {
  background: rgba(29, 78, 216, 0.08);
  color: #1e40af;
  border: 1px solid rgba(29, 78, 216, 0.2);
}

.parts-context-card {
  margin-bottom: 1rem;
}

.parts-context-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem 1.15rem;
}

.parts-context-field label,
.parts-context-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sh-text-muted, #64748b);
  margin-bottom: 0.35rem;
}

.parts-vehicle-summary {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
}

.parts-search-form {
  padding: 1rem 1.15rem 1.15rem;
  margin-bottom: 1rem;
}

.parts-search-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.parts-search-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.parts-search-row input[type="search"] {
  flex: 1 1 14rem;
  min-width: 0;
}

.parts-search-status {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--sh-text-muted, #64748b);
}

.parts-search-status.is-error {
  color: var(--sh-danger, #b91c1c);
}

.parts-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
}

.parts-result-card {
  display: flex;
  flex-direction: column;
  background: var(--sh-surface, #fff);
  border: 1px solid var(--sh-border, #e2e8f0);
  border-radius: var(--sh-radius-md, 8px);
  overflow: hidden;
  box-shadow: var(--sh-shadow-sm, 0 1px 2px rgba(15, 23, 42, 0.06));
}

.parts-result-card--stub {
  border-style: dashed;
}

.parts-result-card-image {
  aspect-ratio: 4 / 3;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.parts-result-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.parts-result-card-image-placeholder {
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
}

.parts-result-card-body {
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.parts-result-card-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.parts-result-card-meta,
.parts-result-card-supplier {
  margin: 0;
  font-size: 0.82rem;
  color: var(--sh-text-muted, #64748b);
}

.parts-result-card-availability {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: #166534;
}

.parts-result-card-price {
  margin: 0.25rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.parts-result-card-actions {
  margin-top: auto;
  padding-top: 0.5rem;
}

.settings-partstech-form label {
  display: block;
  margin-top: 0.75rem;
  font-weight: 600;
}

.settings-partstech-form input {
  width: 100%;
  max-width: 22rem;
  margin-top: 0.35rem;
}

.settings-partstech-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.job-modal-find-parts-btn {
  text-decoration: none;
  font-size: 0.875rem;
  white-space: nowrap;
}

@media (max-width: 639px) {
  .parts-context-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== App responsive system (mobile / tablet / desktop / wide) ===== */

.sh-nav-toggle {
  display: none;
  flex-shrink: 0;
  min-width: 2.75rem;
  min-height: 2.75rem;
  cursor: pointer;
}

.sh-nav-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

.sh-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 190;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
}

.sh-nav-overlay:not([hidden]) {
  display: block;
}

.sh-nav-close {
  display: none;
}

.sidebar-drawer-head {
  display: contents;
}

/* Tablet: icon rail */
@media (min-width: 640px) and (max-width: 1023px) {
  .app-shell {
    grid-template-columns: var(--sh-sidebar-w-compact) minmax(0, 1fr);
  }

  /* Plain-text nav links (before JS icons) must not flash labels over the rail */
  .sidebar-nav .sidebar-link:not(:has(.sh-nav-icon)) {
    font-size: 0;
    line-height: 0;
    color: transparent;
    overflow: hidden;
  }

  .sidebar-nav:not(.sidebar-nav--ready) .sidebar-link:not(.sidebar-link--nav-restricted) {
    visibility: hidden;
  }

  .sidebar-nav.sidebar-nav--ready .sidebar-link:not(.sidebar-link--nav-restricted) {
    visibility: visible;
  }

  .sidebar {
    padding-left: 0.45rem;
    padding-right: 0.45rem;
  }

  .sh-brand {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  .sh-brand-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .sidebar-link {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .sidebar-link > span:not(.sh-nav-icon):not(.sh-nav-badge) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .company-switch-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .sh-support-card {
    display: none;
  }

  .main-content {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Mobile: drawer nav */
@media (max-width: 639px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    width: min(18rem, 88vw);
    max-height: none;
    border-right: 1px solid var(--sh-border);
    border-bottom: none;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--sh-shadow-md);
  }

  body.sh-nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-drawer-head {
    --drawer-head-h: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-shrink: 0;
    min-height: var(--drawer-head-h);
    padding: max(0.65rem, env(safe-area-inset-top)) 0.5rem 0.85rem 0.65rem;
  }

  .sidebar-drawer-head .sh-brand {
    display: flex;
    align-items: center;
    padding: 0;
    margin: 0;
    min-width: 0;
    flex: 1;
    gap: 0.6rem;
    min-height: var(--drawer-head-h);
  }

  .sidebar-drawer-head .sh-logo-img,
  .sidebar-drawer-head .sh-logo-mark {
    width: var(--drawer-head-h);
    height: var(--drawer-head-h);
    flex-shrink: 0;
  }

  .sidebar-drawer-head .sh-brand-text {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.025em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    align-self: center;
    margin: 0;
    padding: 0.06em 0 0;
  }

  .sh-nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: center;
    width: 2.125rem;
    height: 2.125rem;
    margin: 0;
    padding: 0;
    border: 1px solid var(--sh-border);
    border-radius: 8px;
    background: var(--sh-surface);
    color: var(--sh-muted);
    cursor: pointer;
    box-shadow: var(--sh-shadow-sm);
    transition:
      color 0.12s ease,
      background 0.12s ease,
      border-color 0.12s ease;
  }

  .sh-nav-close svg {
    width: 1rem;
    height: 1rem;
    display: block;
  }

  .sh-nav-close:hover {
    color: var(--sh-text);
    background: #f8fafc;
    border-color: #cbd5e1;
  }

  .sh-nav-close:focus-visible {
    outline: 2px solid var(--sh-primary);
    outline-offset: 2px;
  }

  .sh-nav-toggle {
    display: flex;
  }

  .app-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto;
    align-items: center;
    column-gap: 0.5rem;
    row-gap: 0;
    margin-bottom: 0.85rem;
  }

  .sh-nav-toggle {
    grid-column: 1;
    grid-row: 1;
  }

  .app-header-greeting {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .app-header-greeting h1 {
    font-size: 1.125rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .app-header-greeting p {
    display: none;
  }

  .app-header-actions {
    grid-column: 3;
    grid-row: 1;
    width: auto;
    justify-content: flex-end;
    gap: 0.35rem;
  }

  .app-header-actions #signOutBtn {
    display: none;
  }

  .app-header-actions .sh-profile-chip {
    border: none;
    background: transparent;
    padding: 0;
    max-width: none;
  }

  .app-header-actions .sh-profile-meta {
    display: none;
  }

  /* Bell anchor is narrow — pin panel to viewport insets so it does not spill left */
  .sh-notify-panel {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 3.65rem);
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    left: max(0.75rem, env(safe-area-inset-left, 0px));
    width: auto;
    max-width: none;
    max-height: min(24rem, calc(100dvh - env(safe-area-inset-top, 0px) - 5rem));
    z-index: 210;
  }

  .sidebar-sign-out {
    display: block;
    margin-top: auto;
    margin-left: 0.65rem;
    margin-right: 0.65rem;
    margin-bottom: max(1rem, env(safe-area-inset-bottom));
    width: calc(100% - 1.3rem);
    min-height: 2.75rem;
  }

  .job-card-hint {
    display: none;
  }

  .main-content {
    padding: 1rem 0.85rem 1.5rem;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }

  .sh-support-card {
    display: none;
  }

  .job-board-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .kanban-search-wrap {
    flex: 1 1 auto;
    max-width: none;
  }

  .job-board-toolbar .sh-btn-new-job {
    width: auto;
    align-self: flex-start;
    min-height: 2.25rem;
    padding: 0 0.85rem;
    font-size: 0.875rem;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(var(--sh-primary-rgb), 0.28);
  }

  .create-job-modal {
    align-items: center;
    justify-content: flex-start;
    padding: max(0.85rem, env(safe-area-inset-top))
      max(0.75rem, env(safe-area-inset-right))
      max(0.85rem, env(safe-area-inset-bottom))
      max(0.75rem, env(safe-area-inset-left));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .create-job-modal .create-job-modal-panel {
    width: min(36rem, calc(100vw - 1.5rem));
    max-width: min(36rem, calc(100vw - 1.5rem));
    max-height: min(88dvh, calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 1.75rem));
    height: auto;
    min-height: 0;
    margin: auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: var(--sh-radius-lg);
    border: 1px solid var(--sh-border);
    padding: 1rem 1rem 0;
    box-sizing: border-box;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  }

  .create-job-modal .create-job-modal-head {
    flex-shrink: 0;
  }

  .create-job-modal .create-job-form--sheet {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .create-job-modal .create-job-sheet {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding-bottom: 0.5rem;
  }

  .create-job-modal .create-job-form-actions {
    flex-shrink: 0;
    margin-top: 0;
    padding: 0.75rem 0 1rem;
    border-top: 1px solid var(--sh-border);
    background: var(--sh-surface);
  }

  .create-job-modal .create-job-form-actions .sh-btn-primary {
    width: 100%;
    min-height: 2.75rem;
  }

  .create-job-cols--2,
  .create-job-cols--3 {
    grid-template-columns: 1fr;
  }

  .customers-index-card {
    max-height: min(48vh, 22rem);
  }

  .customer-detail-card {
    min-height: 12rem;
  }

  .settings-layout {
    gap: 0.75rem;
  }

  .finances-toolbar-row .sh-select {
    flex: 1 1 100%;
    min-width: 0;
  }

  .finances-kpi-grid,
  .finances-detail-grid {
    grid-template-columns: 1fr;
  }

  .sh-icon-btn {
    min-width: 2.75rem;
    min-height: 2.75rem;
  }

  .parts-search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .parts-search-row .sh-btn-primary {
    width: 100%;
    min-height: 2.75rem;
  }

  .parts-results-grid {
    grid-template-columns: 1fr;
  }

  .sidebar-link {
    min-height: 2.75rem;
  }
}

/* Desktop: full sidebar (default styles) */
@media (min-width: 1024px) {
  .sh-support-card {
    display: block;
  }
}

/* Wide: use full viewport (sidebar + main); optional cap only on ultra-wide */
@media (min-width: 1440px) {
  .app-shell {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    box-shadow: none;
  }

  .main-content {
    max-width: none;
    flex: 1 1 auto;
  }
}

