/* Coatly.pl — design system (pure CSS, działa z Tailwind CDN) */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #ea580c;
  --accent-soft: #fff7ed;
  --success: #059669;
  --danger: #dc2626;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 12px 32px -8px rgba(15, 23, 42, 0.12);
  --header-h: 3.5rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body, .app-shell {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

body.app-shell {
  overflow-x: clip;
}

/* —— Przyciski —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.625rem 1.125rem;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6 0%, var(--primary) 100%);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 0.5rem 0.75rem;
}

.btn-ghost:hover { background: rgba(15, 23, 42, 0.05); color: var(--text); }

/* —— Wyszukiwarka live —— */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
}

.search-bar-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  display: flex;
}

.search-bar-input {
  width: 100%;
  font-family: var(--font);
  font-size: 0.9375rem;
  padding: 0.625rem 2.25rem 0.625rem 2.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-bar-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-bar-clear {
  position: absolute;
  right: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #64748b;
  text-decoration: none;
  font-size: 1.25rem;
  line-height: 1;
}

.search-bar-clear:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* —— Filtry (chipy) —— */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.filter-chip:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.filter-chip--active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.filter-chip--blue.filter-chip--active { background: #2563eb; border-color: #2563eb; }
.filter-chip--indigo.filter-chip--active { background: #4f46e5; border-color: #4f46e5; }
.filter-chip--red.filter-chip--active { background: #dc2626; border-color: #dc2626; }
.filter-chip--dark.filter-chip--active { background: #334155; border-color: #334155; }
.filter-chip--muted { color: #64748b; }

.filter-chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.25);
}

.filter-chip:not(.filter-chip--active) .filter-chip-count {
  background: var(--primary);
  color: #fff;
}

.filter-chip--red:not(.filter-chip--active) .filter-chip-count { background: #dc2626; }
.filter-chip--indigo:not(.filter-chip--active) .filter-chip-count { background: #4f46e5; }

.filter-chip-count--muted {
  background: #e2e8f0 !important;
  color: #475569 !important;
}

.filter-chip-divider {
  width: 1px;
  height: 1.25rem;
  background: #e2e8f0;
  margin: 0 0.125rem;
}

/* —— Karta zlecenia (lista) —— */
.order-card-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.order-card-aside {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  flex-shrink: 0;
  width: 100%;
  max-width: 11.5rem;
}

@media (min-width: 640px) {
  .order-card-aside {
    width: 11.5rem;
  }
}

.order-card-status-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.order-card-status {
  flex-shrink: 0;
}

.order-card-status .badge-select {
  width: 100%;
  min-width: 0;
}

.order-card-cta-wrap form {
  margin: 0;
}

.order-card-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.375rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font);
  line-height: 1.25;
  border-radius: 0.5rem;
  text-decoration: none;
  text-align: center;
  border: none;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}

.order-card-cta:active {
  transform: scale(0.98);
}

.order-card-cta--ready {
  color: #fff;
  background: #059669;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.35);
}

.order-card-cta--ready:hover {
  background: #047857;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.4);
}

.order-card-cta--release {
  color: #fff;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.35);
}

.order-card-cta--release:hover {
  filter: brightness(1.05);
}

.order-card-cta--start {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.35);
}

.order-card-cta--start:hover {
  background: var(--primary-dark);
}

.order-card-link {
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.order-card-link:hover .font-semibold {
  color: var(--primary);
}

.order-card-extra-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
}

.order-card-extra-link:hover {
  text-decoration: underline;
}

/* —— Pasek akcji (karta zlecenia) —— */
.workflow-bar {
  margin-bottom: 1.25rem;
  padding: 1rem 1.125rem;
  border-radius: var(--radius-lg);
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.workflow-bar-kicker {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  margin: 0 0 0.625rem;
}

.workflow-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.workflow-bar-hint {
  margin: 0.625rem 0 0;
  font-size: 0.75rem;
  color: #94a3b8;
}

.workflow-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  padding: 0.5625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font);
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.25;
  transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
}

.workflow-cta:active {
  transform: scale(0.98);
}

.workflow-cta-icon {
  font-size: 0.8125rem;
  opacity: 0.9;
}

.workflow-cta--ready {
  background: #059669;
  color: #fff;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.28);
}

.workflow-cta--ready:hover {
  background: #047857;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.32);
}

.workflow-cta--release {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #fff;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.28);
}

.workflow-cta--release:hover {
  filter: brightness(1.05);
}

.workflow-cta--secondary {
  background: #fff;
  color: #334155;
  border: 1px solid #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.workflow-cta--secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.order-released-banner {
  margin-bottom: 1.25rem;
  padding: 1rem 1.125rem;
  border-radius: var(--radius-lg);
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

/* —— Karty —— */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card:hover { box-shadow: var(--shadow); }

/* —— Formularze —— */
.input {
  width: 100%;
  font-family: var(--font);
  font-size: 0.9375rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

label.field-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}

/* —— Badge statusów —— */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 9999px;
}

.badge-nowe { background: #e0f2fe; color: #0369a1; }
.badge-w_produkcji { background: #fef3c7; color: #b45309; }
.badge-zaplanowane { background: #e0e7ff; color: #4338ca; }
.badge-gotowe { background: #d1fae5; color: #047857; }
.badge-wydane { background: #f1f5f9; color: #475569; }
.badge-anulowane { background: #fee2e2; color: #b91c1c; }

select.badge-select {
  appearance: auto;
  -webkit-appearance: menulist;
  cursor: pointer;
  width: auto;
  min-width: 8rem;
  border: none;
  font-weight: 700;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 9999px;
  padding: 0.35rem 1.75rem 0.35rem 0.75rem;
  line-height: 1.25;
}

select.badge-select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* —— Nagłówek aplikacji —— */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.app-header-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-logo {
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.app-logo span { color: var(--primary); }

.app-nav {
  display: flex;
  gap: 0.125rem;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.app-nav-mobile-extras {
  display: none;
}

.app-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}

.app-nav-toggle:hover {
  background: #f1f5f9;
  color: var(--text);
}

.app-nav-toggle-icon--close {
  display: none;
}

.app-nav-toggle[aria-expanded="true"] .app-nav-toggle-icon--open {
  display: none;
}

.app-nav-toggle[aria-expanded="true"] .app-nav-toggle-icon--close {
  display: block;
}

.app-nav a {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}

.app-nav a:hover { background: #f1f5f9; color: var(--text); }

.app-nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.25rem;
  font-size: 0.625rem;
  font-weight: 800;
  background: var(--danger);
  color: #fff;
  border-radius: 9999px;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.notif-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  list-style: none;
}

.notif-btn::-webkit-details-marker { display: none; }

.notif-btn:hover { background: #f1f5f9; color: var(--text); }

.notif-dot {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.2rem;
  font-size: 0.5625rem;
  font-weight: 800;
  background: var(--danger);
  color: #fff;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 899px) {
  .app-header {
    height: auto;
  }

  .app-header-inner {
    flex-wrap: wrap;
    align-items: center;
    height: auto;
    min-height: var(--header-h);
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
  }

  .app-logo {
    flex: 1;
    min-width: 0;
  }

  .app-header-actions {
    margin-left: auto;
  }

  .app-header-actions-desktop {
    display: none !important;
  }

  .app-nav-toggle {
    display: flex;
  }

  .app-nav {
    display: none;
    order: 10;
    width: 100%;
    flex: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.125rem;
    padding: 0.375rem 0 0.125rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--border);
  }

  .app-nav.is-open {
    display: flex;
  }

  .app-nav a,
  .app-nav-mobile-link {
    white-space: normal;
    width: 100%;
    padding: 0.625rem 0.75rem;
    box-sizing: border-box;
  }

  .app-nav-mobile-extras {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    margin-top: 0.375rem;
    padding-top: 0.375rem;
    border-top: 1px solid var(--border);
  }

  .app-nav-mobile-extras form {
    margin: 0;
  }

  .app-nav-mobile-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: var(--font);
    color: var(--muted);
    text-decoration: none;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    text-align: left;
    box-sizing: border-box;
  }

  .app-nav-mobile-link:hover,
  .app-nav-mobile-logout:hover {
    background: #f1f5f9;
    color: var(--text);
  }

  body.app-nav-open {
    overflow: hidden;
  }
}

.notif-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.375rem);
  width: 18rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.375rem 0;
  font-size: 0.875rem;
}

.notif-menu a {
  display: block;
  padding: 0.5rem 0.875rem;
  text-decoration: none;
  color: var(--text);
}

.notif-menu a:hover { background: #f8fafc; }

.flash-success {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: #ecfdf5;
  color: #047857;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid #a7f3d0;
}

.flash-error {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid #fecaca;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
}

/* —— Magazyn farb —— */
.paint-list { border-radius: var(--radius-lg); }

.paint-list-head,
.paint-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(5rem, 0.75fr) minmax(0, 1fr) 2rem;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 0.75rem 1.25rem;
}

.paint-list-head {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.paint-row {
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.paint-row:last-child { border-bottom: none; }

.paint-row:hover { background: #f8fafc; }

.paint-row--low { background: #fef2f2; }
.paint-row--low:hover { background: #fee2e2; }

.paint-row-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.paint-color-badge {
  flex-shrink: 0;
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  background: #e2e8f0;
  color: #334155;
}

.paint-color-badge--ral { background: #dbeafe; color: #1d4ed8; }
.paint-color-badge--ncs { background: #dcfce7; color: #15803d; }
.paint-color-badge--inne { background: #fef3c7; color: #b45309; }

.paint-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.paint-row-name {
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.paint-row-code {
  font-size: 0.8125rem;
  color: var(--muted);
}

.paint-row-mfr,
.paint-row-loc {
  font-size: 0.875rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.paint-row-qty {
  font-size: 0.9375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.paint-row-alert {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.paint-row-chevron {
  text-align: right;
  font-size: 1.25rem;
  line-height: 1;
  color: #94a3b8;
}

@media (max-width: 768px) {
  .paint-list-head { display: none; }
  .paint-row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.35rem 0.75rem;
    padding: 1rem 1.25rem;
  }
  .paint-row-main { grid-column: 1 / -1; }
  .paint-row-mfr { grid-column: 1; font-size: 0.8125rem; }
  .paint-row-qty { grid-column: 2; text-align: right; }
  .paint-row-loc { grid-column: 1; font-size: 0.8125rem; }
  .paint-row-chevron { grid-column: 2; grid-row: 2 / 4; align-self: center; }
}

[data-theme="dark"] .paint-list-head { background: #0b1120; }
[data-theme="dark"] .paint-row:hover { background: #1e293b; }
[data-theme="dark"] .paint-row--low { background: rgba(220, 38, 38, 0.08); }

/* —— Ustawienia —— */
.settings-layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.settings-nav {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.settings-nav-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.5rem;
  padding: 0 0.5rem;
}

.settings-nav a {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  transition: background 0.12s, color 0.12s;
}

.settings-nav a:hover {
  background: #f1f5f9;
  color: var(--primary);
}

.settings-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-width: 0;
}

.settings-section {
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.settings-section-head {
  margin-bottom: 1rem;
}

.settings-section-head h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.settings-section-head p {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
}

.settings-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.settings-panel + .settings-panel {
  margin-top: 1rem;
}

.settings-panel h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.settings-panel-desc {
  font-size: 0.875rem;
  color: var(--muted);
  margin: -0.25rem 0 1rem;
}

.settings-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.settings-quick-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.125rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.settings-quick-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.settings-quick-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--primary);
}

.settings-quick-desc {
  font-size: 0.8125rem;
  color: var(--muted);
}

.settings-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }
  .settings-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .settings-nav-title {
    width: 100%;
  }
  .settings-nav a {
    font-size: 0.8125rem;
    padding: 0.375rem 0.625rem;
    background: #f8fafc;
  }
}

[data-theme="dark"] .settings-nav a:hover { background: #1e293b; }
[data-theme="dark"] .settings-nav a { background: transparent; }

/* —— Zdjęcia: podgląd i lightbox —— */
.photo-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.photo-preview-item {
  position: relative;
  width: 6.5rem;
}

.photo-preview-thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #f8fafc;
  cursor: zoom-in;
}

.photo-preview-thumb img {
  display: block;
  width: 100%;
  height: 6.5rem;
  object-fit: cover;
}

.photo-preview-remove {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  border: none;
  background: #dc2626;
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-lightbox.hidden {
  display: none;
}

.photo-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
}

.photo-lightbox-inner {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 56rem);
  max-height: 90vh;
}

.photo-lightbox-inner img {
  display: block;
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.photo-lightbox-close {
  position: absolute;
  top: -2rem;
  right: 0;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
}

/* —— Workflow modals —— */
.workflow-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.workflow-modal.hidden {
  display: none;
}

.workflow-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
}

.workflow-modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.workflow-modal-panel-wide {
  max-width: 52rem;
}

body.workflow-modal-open {
  overflow: hidden;
}

/* —— Zużycie farby: ile zostało / ile zużył —— */
.paint-usage-entry {
  margin-top: 0.25rem;
}

.paint-usage-stock {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.85rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%);
  border: 1px solid #e0f2fe;
}

.paint-usage-stock-label {
  font-size: 0.75rem;
  color: #64748b;
}

.paint-usage-stock-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.paint-usage-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.paint-usage-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  border: 2px solid #e2e8f0;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.paint-usage-mode-btn:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.paint-usage-mode-btn.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.paint-usage-mode-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
}

.paint-usage-mode-hint {
  font-size: 0.6875rem;
  line-height: 1.35;
  color: #64748b;
}

.paint-usage-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.paint-usage-input-row .input {
  flex: 1;
  font-size: 1.125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.paint-usage-unit {
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748b;
  min-width: 1.5rem;
}

.paint-usage-result {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.paint-usage-result-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.paint-usage-result-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.paint-usage-result--ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.paint-usage-result--ok .paint-usage-result-value {
  color: #047857;
}

.paint-usage-result--error {
  background: #fef2f2;
  border-color: #fecaca;
}

.paint-usage-result--error .paint-usage-result-value {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #b91c1c;
}

[data-theme="dark"] .paint-usage-stock {
  background: linear-gradient(135deg, #0c4a6e33 0%, #1e293b 100%);
  border-color: #334155;
}

[data-theme="dark"] .paint-usage-mode-btn {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .paint-usage-mode-btn.is-active {
  background: #1e3a5f;
  border-color: #3b82f6;
}

[data-theme="dark"] .paint-usage-result {
  background: #1e293b;
  border-color: #334155;
}

/* —— Wykres przychodu (pulpit) —— */
.revenue-chart-card {
  margin-bottom: 2rem;
  padding: 1.25rem 1.5rem 1.25rem;
}

.revenue-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.revenue-chart-kicker {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  margin: 0;
}

.revenue-chart-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #047857;
  margin: 0.25rem 0 0;
  line-height: 1.2;
}

.revenue-chart-sub {
  font-size: 0.8125rem;
  color: #64748b;
  margin: 0.25rem 0 0;
}

.revenue-chart-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.revenue-chart-badge--up {
  background: #dcfce7;
  color: #15803d;
}

.revenue-chart-badge--down {
  background: #fee2e2;
  color: #b91c1c;
}

.revenue-chart-wrap {
  padding: 0.25rem 0 0.5rem;
}

.revenue-chart-plot {
  width: 100%;
  line-height: 0;
}

.revenue-chart-svg {
  width: 100%;
  height: 6.5rem;
  display: block;
}

.revenue-chart-grid {
  stroke: #e2e8f0;
  stroke-width: 1;
}

.revenue-chart-months {
  position: relative;
  height: 1.5rem;
  margin-top: 0.625rem;
}

.revenue-chart-month {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  letter-spacing: normal;
}

.revenue-chart-month--current {
  color: #0f172a;
  font-weight: 600;
  background: #f1f5f9;
  padding: 0.2rem 0.45rem;
  border-radius: 0.375rem;
}

/* —— Filtry zleceń —— */
.order-filters {
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.order-filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.order-filter-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  min-width: 3.5rem;
}

/* —— Karta zlecenia (lista) v2 —— */
.order-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.order-card-main {
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  display: block;
}

.order-card-number {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin-right: 0.5rem;
}

.order-card-main:hover .order-card-number {
  color: var(--primary);
}

.order-card-badge {
  font-size: 0.625rem;
  vertical-align: middle;
}

.order-card-meta {
  display: block;
  font-size: 0.8125rem;
  color: #64748b;
  margin-top: 0.25rem;
}

.order-card-price {
  display: inline-block;
  margin-top: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #047857;
}

.order-card-actions {
  flex-shrink: 0;
}

.order-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

.order-card-status-form {
  flex: 0 0 auto;
}

.order-card-status-form .badge-select {
  min-width: 8rem;
  font-size: 0.75rem;
}

.order-card-foot-link {
  font-size: 0.8125rem;
  color: #64748b;
  text-decoration: none;
}

.order-card-foot-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* —— Terminarz —— */
.calendar-page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.calendar-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.calendar-auto-week-note {
  font-size: 0.75rem;
  color: var(--primary);
  margin: 0.375rem 0 0;
}

.calendar-auto-week-note a {
  color: inherit;
  text-decoration: underline;
}

.calendar-week-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .calendar-week-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .calendar-week-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1280px) {
  .calendar-week-grid {
    grid-template-columns: repeat(7, 1fr);
  }
}

.calendar-day {
  display: flex;
  flex-direction: column;
  min-height: 5rem;
  padding: 0.5rem;
}

.calendar-day--today {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
  background: #eff6ff;
}

.calendar-day-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.3rem;
  margin-bottom: 0.375rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid #f1f5f9;
}

.calendar-day--today .calendar-day-head {
  border-bottom-color: #dbeafe;
}

.calendar-day-today-label {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  background: #dbeafe;
  padding: 0.125rem 0.375rem;
  border-radius: 999px;
}

.calendar-day-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
}

.calendar-day-date {
  font-size: 0.8125rem;
  color: var(--muted);
}

.calendar-day-count {
  margin-left: auto;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted);
  background: #f1f5f9;
  padding: 0.125rem 0.375rem;
  border-radius: 999px;
}

.calendar-day-empty {
  font-size: 0.75rem;
  color: #cbd5e1;
  margin: 0.25rem 0 0;
}

.calendar-day-orders {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.calendar-order {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: #f8fafc;
  border: 1px solid #eef2f6;
  border-radius: 8px;
  padding: 0.3rem 0.35rem 0.3rem 0.45rem;
  border-left-width: 3px;
  border-left-style: solid;
}

.calendar-order--nowe { border-left-color: #0369a1; }
.calendar-order--w_produkcji { border-left-color: #b45309; }
.calendar-order--zaplanowane { border-left-color: #4338ca; }
.calendar-order--gotowe { border-left-color: #047857; }
.calendar-order--wydane { border-left-color: #94a3b8; }
.calendar-order--anulowane { border-left-color: #b91c1c; }

.calendar-order:hover {
  background: #fff;
  border-color: #dbeafe;
}

.calendar-order-link {
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  line-height: 1.2;
}

.calendar-order-link:hover .calendar-order-number {
  color: var(--primary);
}

.calendar-order-number {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-order-client {
  display: block;
  font-size: 0.625rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-order-status {
  flex-shrink: 0;
}

.calendar-status-select {
  min-width: 0 !important;
  width: 4.75rem;
  max-width: 4.75rem;
  font-size: 0.5625rem !important;
  padding: 0.15rem 1.1rem 0.15rem 0.35rem !important;
  line-height: 1.15 !important;
  letter-spacing: 0.02em;
  box-sizing: border-box;
}

/* —— Karta pojedynczego zlecenia —— */
.order-page-head {
  margin-bottom: 1rem;
}

.order-page-back {
  font-size: 0.875rem;
  color: var(--primary);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.order-page-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.order-page-status-badge {
  font-size: 0.8125rem;
  padding: 0.375rem 0.75rem;
}

.order-status-card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  justify-content: space-between;
}

.order-status-form-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.order-status-workflow {
  flex: 1;
  min-width: 12rem;
}

.workflow-bar--compact {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
}

.workflow-bar--compact .workflow-bar-actions {
  justify-content: flex-end;
}

.order-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (min-width: 640px) {
  .order-summary-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.order-summary-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  margin: 0;
}

.order-summary-value {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0.25rem 0 0;
}

.order-summary-value--price {
  color: var(--primary);
  font-size: 1.125rem;
}

.order-summary-value--warn {
  color: #d97706;
}

.order-panel {
  padding: 0.875rem 1rem;
}

.order-summary-note {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
  line-height: 1.5;
}

.order-summary-edit {
  font-size: 0.8125rem;
}

.order-summary-edit-trigger {
  color: var(--primary);
  cursor: pointer;
  list-style: none;
}

.order-summary-edit-trigger::-webkit-details-marker {
  display: none;
}

.order-pdf-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.order-pdf-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
}

.order-section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 3.5rem;
  background: var(--bg);
  z-index: 10;
  padding-top: 0.25rem;
}

.order-section-link {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}

.order-section-link:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.order-section-link--active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.order-section {
  margin-bottom: 2.5rem;
  scroll-margin-top: 6rem;
}

.order-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.order-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.order-section-head .order-section-title {
  margin-bottom: 0;
}

.order-section-title--upper {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.contact-channel--locked .contact-channel-preview {
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}

.contact-channel--locked .contact-channel-preview .input,
.contact-channel--locked .contact-channel-preview .btn {
  cursor: not-allowed;
}

.contact-channel-cta {
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border, #e2e8f0);
}

.order-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.order-item-card {
  padding: 0.75rem 1rem;
}

.order-item-summary-v2 {
  cursor: pointer;
  list-style: none;
}

.order-item-summary-v2::-webkit-details-marker {
  display: none;
}

.order-item-display {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.order-item-display-main strong {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
}

.order-item-qty {
  display: block;
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: 0.125rem;
}

.order-item-swatch {
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.order-item-meta-line {
  margin: 0.375rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
}

.order-item-price-line {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #047857;
}

.order-item-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
  font-size: 0.875rem;
}

.order-item-card--readonly .order-item-note {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.order-item-card[open] .order-item-summary-v2 {
  margin-bottom: 0;
}

.order-item-summary {
  cursor: pointer;
  list-style: none;
}

.order-item-card[open] .order-item-summary {
  margin-bottom: 0.25rem;
}

/* —— Dark mode —— */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --surface: #151f32;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #1e293b;
}

[data-theme="dark"] .app-shell { background: var(--bg); color: var(--text); }
[data-theme="dark"] .app-header { background: rgba(21, 31, 50, 0.9); }
[data-theme="dark"] .app-nav-toggle:hover { background: #1e293b; }
[data-theme="dark"] .app-nav-mobile-link:hover,
[data-theme="dark"] .app-nav-mobile-logout:hover { background: #1e293b; }
[data-theme="dark"] .card { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .input { background: #0b1120; border-color: #334155; color: var(--text); }
[data-theme="dark"] .app-nav a:hover { background: #1e293b; }

/* —— Legal pages —— */
.legal-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 40;
}

.legal-header-inner {
  max-width: 52rem;
  margin: 0 auto;
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.legal-logo {
  font-weight: 800;
  font-size: 1.125rem;
  color: var(--text);
  text-decoration: none;
}

.legal-logo span { color: #2563eb; }

.legal-nav {
  display: flex;
  gap: 0.75rem;
  flex: 1;
  flex-wrap: wrap;
}

.legal-nav a {
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
}

.legal-nav a:hover,
.legal-nav a.is-active {
  color: #2563eb;
}

.legal-cta {
  font-size: 0.875rem;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
}

.legal-page {
  max-width: 52rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.legal-page h1 {
  font-size: 1.75rem;
  margin: 0 0 0.5rem;
}

.legal-meta {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0 0 1.5rem;
}

.legal-prose {
  line-height: 1.65;
  font-size: 0.9375rem;
}

.legal-prose h2 {
  font-size: 1.125rem;
  margin: 2rem 0 0.75rem;
}

.legal-prose h3 {
  font-size: 1rem;
  margin: 1.25rem 0 0.5rem;
}

.legal-prose p { margin: 0 0 0.75rem; }

.legal-prose ul,
.legal-prose ol {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.legal-prose li { margin-bottom: 0.35rem; }

.legal-prose a {
  color: #2563eb;
  text-decoration: underline;
}

.legal-footer-links {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

.legal-site-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* —— Cookie consent banner —— */
.cookie-consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.96);
  color: #e2e8f0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
}

.cookie-consent-inner {
  max-width: 52rem;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.cookie-consent-text {
  flex: 1;
  min-width: 16rem;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.cookie-consent-text a {
  color: #93c5fd;
}

.cookie-consent-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

/* —— Auth consent checkboxes —— */
.auth-consents {
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: #64748b;
  cursor: pointer;
}

.auth-consent input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.auth-consent a {
  color: #2563eb;
}

.auth-consent-optional {
  color: #94a3b8;
}

/* —— Mobile / tablet UX —— */
.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.item-qty-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .item-qty-grid {
    grid-template-columns: minmax(4rem, 1fr) minmax(4rem, 1fr) minmax(0, 2fr);
  }

  .item-qty-grid .item-qty-desc {
    grid-column: auto;
  }
}

.item-qty-grid .item-qty-desc {
  grid-column: 1 / -1;
}

.std-op-row,
.custom-op-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.375rem;
}

@media (max-width: 639px) {
  .std-op-row,
  .custom-op-row {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8fafc;
  }

  .std-op-row > span:first-child {
    font-weight: 600;
  }

  .custom-op-row .remove-custom-op {
    align-self: flex-start;
    padding: 0.25rem 0;
  }
}

@media (min-width: 640px) {
  .std-op-row {
    display: grid;
    grid-template-columns: 1fr 7rem 6rem;
    gap: 0.75rem;
    align-items: center;
    padding: 0;
    border: none;
    background: transparent;
  }

  .custom-op-row {
    display: grid;
    grid-template-columns: 1fr 6rem 6rem auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0;
    border: none;
    background: transparent;
  }
}

.btn-sticky-mobile {
  position: sticky;
  z-index: 20;
  bottom: 1rem;
  box-shadow: var(--shadow);
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .btn-sticky-mobile {
    bottom: calc(1rem + env(safe-area-inset-bottom));
  }
}

@media (max-width: 899px) {
  .input,
  .search-bar-input,
  select.input,
  textarea.input {
    font-size: 1rem;
  }

  select.badge-select {
    font-size: 0.8125rem;
    min-width: 0;
    max-width: 100%;
  }

  .order-status-card-row {
    flex-direction: column;
    align-items: stretch;
  }

  .order-status-form {
    width: 100%;
  }

  .order-status-form .badge-select {
    width: 100%;
    max-width: 100%;
  }

  .order-status-workflow {
    flex: none;
    min-width: 0;
    width: 100%;
  }

  .workflow-bar--compact .workflow-bar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .workflow-bar--compact .workflow-cta,
  .workflow-bar--compact .workflow-bar-actions form {
    width: 100%;
    justify-content: center;
  }

  .order-section-nav {
    top: var(--header-h);
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }

  .order-section {
    scroll-margin-top: 5.5rem;
  }

  .settings-nav {
    top: calc(var(--header-h) + 0.5rem);
    max-height: calc(100vh - var(--header-h) - 2rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .workflow-modal {
    padding: 0.75rem;
    align-items: flex-end;
  }

  .workflow-modal-panel {
    max-height: 85vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .photo-lightbox-close {
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(15, 23, 42, 0.65);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .paint-row-name {
    white-space: normal;
  }

  .paint-row {
    padding: 0.875rem 1rem;
  }

  .calendar-page-actions .btn {
    flex: 1 1 auto;
    min-width: calc(50% - 0.25rem);
    justify-content: center;
  }
}

@media (max-width: 639px) {
  .card {
    padding: 0.875rem 1rem;
  }

  .order-filters {
    padding: 0.75rem;
  }

  .order-page-title-row h1 {
    font-size: 1.375rem;
  }

  .client-order-card {
    flex-direction: column;
    align-items: stretch;
  }

  .client-order-card .badge-select {
    width: 100%;
  }
}

.dashboard-stat-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 640px) and (max-width: 1279px) {
  .dashboard-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .dashboard-stat-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

[data-theme="dark"] .btn-secondary { background: #1e293b; border-color: #334155; color: var(--text); }
[data-theme="dark"] .std-op-row,
[data-theme="dark"] .custom-op-row {
  background: #0f172a;
}

@media (min-width: 640px) {
  [data-theme="dark"] .std-op-row,
  [data-theme="dark"] .custom-op-row {
    background: transparent;
  }
}
