/* Tulsi Creation - User Management UI
   Blue/neutral theme, mobile-first, SaaS-style */

:root {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-sidebar-bg: #1e293b;
  --color-sidebar-text: #e2e8f0;
  --color-sidebar-active: #2563eb;
  --color-card-bg: #fff;
  --color-border: #e2e8f0;
  --color-text: #334155;
  --color-text-muted: #64748b;
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --color-badge-info: #0ea5e9;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --sidebar-width: 240px;
  --topbar-height: 56px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body.app-body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: #f1f5f9;
}

/* Public one-page website */
.landing {
  background: #f3efe6;
  color: #0f172a;
}

.landing a { color: inherit; }

.landing-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.landing-header {
  position: sticky;
  top: 0;
  z-index: 80;
  backdrop-filter: blur(10px);
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.landing-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}

.landing-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  min-width: 0;
}

.landing-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #22c55e, #2563eb);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 950;
}

.landing-brand-text {
  display: grid;
  min-width: 0;
  line-height: 1.15;
}

.landing-brand-text strong {
  color: #f8fafc;
}

.landing-brand-sub {
  color: rgba(226, 232, 240, 0.85);
  font-weight: 800;
  font-size: 0.85rem;
}

.landing-nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.landing-nav a {
  text-decoration: none;
  font-weight: 900;
  color: rgba(226, 232, 240, 0.95);
  padding: 0.35rem 0.4rem;
  border-radius: 10px;
}

.landing-nav a:hover {
  background: rgba(148, 163, 184, 0.16);
}

.landing-cta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Header buttons on dark background */
.landing-header .btn-outline {
  border-color: rgba(226, 232, 240, 0.55);
  color: rgba(248, 250, 252, 0.98);
}

.landing-header .btn-outline:hover {
  background: rgba(148, 163, 184, 0.18);
}

.landing-header .btn-outline:active {
  transform: translateY(1px);
}

.landing-hero {
  position: relative;
  padding: 2.8rem 0 2.1rem;
  overflow: hidden;
  background-image: var(--hero-bg);
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.landing-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.82), rgba(15, 23, 42, 0.55));
}

.landing-hero-content {
  position: relative;
}

.landing-hero-box {
  max-width: 720px;
  border-radius: 18px;
  padding: 1.35rem 1.35rem;
  background: rgba(243, 239, 230, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.20);
}

.landing-kicker {
  display: inline-flex;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: rgba(255, 255, 255, 0.65);
  font-weight: 900;
  font-size: 0.85rem;
  color: rgba(15, 23, 42, 0.9);
}

.landing-title {
  margin: 0.85rem 0 0;
  font-weight: 1000;
  font-size: clamp(2.3rem, 5vw, 3.5rem);
  letter-spacing: -0.02em;
}

.landing-tagline {
  margin: 0.5rem 0 0;
  font-weight: 900;
  font-size: 1.25rem;
  color: rgba(15, 23, 42, 0.9);
}

.landing-lede {
  margin: 0.85rem 0 0;
  color: rgba(15, 23, 42, 0.78);
  font-weight: 750;
  max-width: 58ch;
}

.landing-hero-actions {
  margin-top: 1.15rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.landing-badges {
  margin-top: 1.15rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.landing-pill {
  border: 1px solid rgba(15, 23, 42, 0.16);
  background: rgba(255, 255, 255, 0.65);
  color: rgba(15, 23, 42, 0.88);
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.85rem;
}

.landing-section {
  padding: 2.4rem 0;
  background: #f3efe6;
  border-top: 1px solid rgba(15, 23, 42, 0.10);
}

.landing-section-head h2 {
  margin: 0;
  font-weight: 1000;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

.landing-section-head p {
  margin: 0.6rem 0 0;
  color: rgba(15, 23, 42, 0.78);
  font-weight: 750;
  max-width: 70ch;
}

.landing-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.landing-feature {
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  border-radius: 18px;
  padding: 1.15rem 1.15rem;
  box-shadow: 0 10px 26px rgba(2, 6, 23, 0.08);
}

.landing-feature-title {
  font-weight: 950;
}

.landing-feature-text {
  margin-top: 0.45rem;
  color: rgba(15, 23, 42, 0.72);
  font-weight: 700;
}

.landing-founder {
  background: #efe8db;
}

.landing-founder-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 1.5rem;
  align-items: center;
}

.landing-founder-img {
  width: 100%;
  height: 360px;
  object-fit: cover;
  border-radius: 22px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.14);
  display: block;
}

.landing-founder-photo-inner {
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.6);
  min-height: 340px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.landing-founder-initials {
  width: 124px;
  height: 124px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.95), rgba(37, 99, 235, 0.95));
  display: grid;
  place-items: center;
  font-weight: 1000;
  font-size: 2.2rem;
  color: #0b1220;
}

.landing-founder-photo-hint {
  position: absolute;
  bottom: 0.85rem;
  left: 0.85rem;
  right: 0.85rem;
  text-align: center;
  color: rgba(226, 232, 240, 0.8);
  font-weight: 800;
  font-size: 0.9rem;
}

.landing-founder-name {
  margin: 0.35rem 0 0;
  font-weight: 1000;
  font-size: 1.85rem;
}

.landing-founder-role {
  margin-top: 0.25rem;
  font-weight: 850;
  color: rgba(15, 23, 42, 0.74);
}

.landing-founder-points {
  margin-top: 1rem;
  display: grid;
  gap: 0.35rem;
  color: rgba(15, 23, 42, 0.86);
  font-weight: 750;
}

.landing-quote {
  margin: 1.15rem 0 0;
  padding: 1rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  color: rgba(15, 23, 42, 0.88);
  font-weight: 750;
  line-height: 1.65;
}

.landing-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.landing-card {
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  border-radius: 18px;
  padding: 0.95rem 0.95rem 1rem;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(2, 6, 23, 0.08);
}

.landing-card-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  display: block;
}

.landing-card-title { margin-top: 0.55rem; font-weight: 950; font-size: 1.05rem; }
.landing-card-text { margin-top: 0.35rem; color: rgba(15, 23, 42, 0.72); font-weight: 700; }

.landing-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
  align-items: start;
}

.landing-why-card {
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  border-radius: 18px;
  padding: 1.15rem 1.15rem;
  box-shadow: 0 10px 26px rgba(2, 6, 23, 0.08);
}

.landing-why-card-title { font-weight: 950; font-size: 1.05rem; }
.landing-why-card-text { margin-top: 0.5rem; color: rgba(15, 23, 42, 0.72); font-weight: 700; }
.landing-why-card-badges { margin-top: 0.9rem; display:flex; flex-wrap:wrap; gap:0.5rem; }

.landing-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.landing-step {
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  border-radius: 18px;
  padding: 1.15rem 1.15rem;
  box-shadow: 0 10px 26px rgba(2, 6, 23, 0.08);
}

.landing-step-img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  display: block;
  margin-bottom: 0.75rem;
}

.landing-step-num {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.35);
  display: grid;
  place-items: center;
  font-weight: 1000;
}

.landing-step-title { margin-top: 0.65rem; font-weight: 950; }
.landing-step-text { margin-top: 0.35rem; color: rgba(15, 23, 42, 0.72); font-weight: 700; }

.landing-contact {
  background: #efe8db;
  padding-bottom: 3.2rem;
}

.landing-contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: stretch;
}

.landing-contact-text { margin-top: 0.5rem; color: rgba(15, 23, 42, 0.75); font-weight: 750; }

.landing-contact-card {
  margin-top: 0;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 22px rgba(2, 6, 23, 0.10);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.landing-contact-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid rgba(15, 23, 42, 0.10);
}

.landing-contact-card-inner {
  padding: 1.15rem 1.15rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.landing-contact-row { display:grid; gap:0.25rem; margin-bottom: 0.85rem; }
.landing-contact-label { color: rgba(15, 23, 42, 0.62); font-weight: 950; font-size: 0.85rem; }
.landing-contact-value { font-weight: 800; color: rgba(15, 23, 42, 0.92); }
.landing-contact-value a { text-decoration: none; border-bottom: 1px dashed rgba(15, 23, 42, 0.35); }
.landing-contact-actions {
  display: grid;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 0.35rem;
}

.landing-map {
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 12px 22px rgba(2, 6, 23, 0.10);
}

.landing-contact-left,
.landing-contact-right,
.landing-contact-card,
.landing-map { height: 100%; }
.landing-contact-card,
.landing-map {
  min-height: 560px;
}

.landing-map iframe { width: 100%; height: 100%; min-height: 560px; border: 0; }

/* Align the two columns visually (remove the "floating" look) */
/* Ensure contact row aligns with map row */
.landing-contact-grid > * { margin-top: 1rem; }
.landing-contact-card, .landing-map { margin-top: 0; }

@media (max-width: 900px) {
  .landing-contact-card,
  .landing-map {
    min-height: 0;
  }
  .landing-map iframe {
    min-height: 320px;
  }
}

.landing-footer {
  padding: 2rem 0;
  border-top: 1px solid rgba(15, 23, 42, 0.10);
  background: #0f172a;
}

.landing-footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
  align-items: start;
}

.landing-footer-brand { font-weight: 1000; font-size: 1.05rem; }

.landing-footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-end;
}

.landing-footer-links a { text-decoration: none; font-weight: 900; color: rgba(226, 232, 240, 0.9); }

.landing-footer-copy { grid-column: 1 / -1; margin-top: 0.75rem; }

.landing-wa {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.85rem 1.05rem;
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.22);
  background: #22c55e;
  color: #0b1220;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-weight: 1000;
}

.landing-gallery {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.6rem;
}

.landing-gallery-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  display: block;
}

.landing-call-btn { display: none; }

.landing [data-reveal] {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 250ms ease, transform 250ms ease;
}

.landing [data-reveal].is-revealed { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .landing-nav { display: none; }
  .landing-grid-3 { grid-template-columns: 1fr; }
  .landing-founder-grid { grid-template-columns: 1fr; }
  .landing-cards { grid-template-columns: 1fr; }
  .landing-grid-2 { grid-template-columns: 1fr; }
  .landing-steps { grid-template-columns: 1fr; }
  .landing-contact-grid { grid-template-columns: 1fr; }
  .landing-footer-grid { grid-template-columns: 1fr; }
  .landing-footer-links { align-items: flex-start; }
  .landing-call-btn { display: inline-flex; }
  .landing-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Labour UI (minimal, large tap targets) */
.labour-shell {
  max-width: 680px;
  margin: 0 auto;
  padding: 1rem;
}

/* Worker hierarchy accordion (mobile-first) */
.worker-accordion-root,
.worker-accordion-group {
  display: grid;
  gap: 0.65rem;
}

.worker-accordion-item {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.worker-accordion-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 0.9rem;
  background: #fff;
  border: none;
  cursor: pointer;
  text-align: left;
}

.worker-accordion-btn-top {
  padding: 1rem 1rem;
}

.worker-acc-arrow {
  flex: 0 0 auto;
  font-weight: 900;
  color: var(--color-text-muted);
}

.worker-acc-title {
  flex: 1 1 auto;
  font-weight: 900;
  font-size: 1.02rem;
  color: var(--color-text);
}

.worker-acc-meta {
  flex: 0 0 auto;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.worker-accordion-panel {
  padding: 0.7rem 0.8rem 0.9rem;
  background: #f8fafc;
  border-top: 1px solid var(--color-border);
}

.worker-accordion-btn.is-loading {
  opacity: 0.7;
}

.labour-header {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.labour-title {
  font-size: 1.25rem;
  font-weight: 800;
}

.labour-subtitle {
  margin-top: 0.25rem;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.labour-actions {
  margin-bottom: 1rem;
}

.labour-cards {
  display: grid;
  gap: 0.75rem;
}

.labour-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.labour-card-title {
  font-size: 1.1rem;
  font-weight: 800;
}

.labour-card-meta {
  margin-top: 0.25rem;
  color: var(--color-text-muted);
}

.labour-card-cta {
  margin-top: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
}

.labour-btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}

.labour-btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.labour-btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
}

.labour-btn-big {
  width: 100%;
  padding: 1.1rem 1rem;
  font-size: 1.05rem;
}

.labour-ops {
  display: grid;
  gap: 0.75rem;
}

.labour-op {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
}

.labour-op-name {
  font-weight: 900;
  font-size: 1.1rem;
}

.labour-op-status {
  margin-top: 0.25rem;
  color: var(--color-text-muted);
  font-weight: 700;
}

.labour-op-done-meta {
  margin-top: 0.5rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.labour-toast {
  border-radius: 12px;
  padding: 0.9rem 1rem;
  font-weight: 900;
  margin-bottom: 0.75rem;
  animation: slideIn 0.25s ease;
}

.labour-toast-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.labour-toast-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Progress bars */
.progress {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: 999px;
}

body.app-body img {
  max-width: 100%;
}

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-card-bg);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  padding: 2rem;
}

.login-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-logo {
  display: inline-block;
  width: 48px;
  height: 48px;
  line-height: 48px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 1.25rem;
}

.login-header h1 {
  margin: 0.75rem 0 0.25rem;
  font-size: 1.5rem;
  color: var(--color-text);
}

.login-header p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.login-form .form-group {
  margin-bottom: 1rem;
}

/* App layout with sidebar */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  color: var(--color-sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-brand {
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
}

.sidebar-title {
  font-weight: 600;
  font-size: 1rem;
}

.sidebar-header-mobile {
  display: none;
}

.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--color-sidebar-text);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem;
  margin: -0.25rem 0 0;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  color: var(--color-sidebar-text);
  text-decoration: none;
  transition: background 0.15s;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.08);
}

.sidebar-link.active {
  background: rgba(37, 99, 235, 0.2);
  color: #fff;
}

.sidebar-icon {
  opacity: 0.9;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.sidebar-logout {
  width: 100%;
  padding: 0.5rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--color-sidebar-text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.sidebar-logout:hover {
  background: rgba(255,255,255,0.1);
}

.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-height);
  background: var(--color-card-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 0 1rem 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin: 0 -0.25rem 0 0;
}

.topbar-menu-btn:hover {
  background: #f1f5f9;
}

.topbar-menu-icon {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
}

.topbar-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  flex: 1;
  min-width: 0;
}

.topbar-actions {
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  padding: 1.5rem;
  min-width: 0;
}

/* Cards */
.card {
  background: var(--color-card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  min-width: 0;
}

.table-card.card {
  overflow: visible;
}

.card-body {
  padding: 1.5rem;
}

.card-body.p-0 {
  padding: 0;
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card-label {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
}

/* Today card: two KPIs, numbers aligned, short labels below */
.card-today-bundles .card-stat-split {
  display: flex;
  align-items: stretch;
  margin-top: 0.5rem;
  gap: 0;
}

.card-stat-split-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

.card-stat-split-item:first-child {
  padding-right: 0.875rem;
}

.card-stat-split-item:last-child {
  padding-left: 0.875rem;
}

.card-stat-split-value {
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.card-stat-split-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.card-stat-split-rule {
  width: 1px;
  flex-shrink: 0;
  background: var(--color-border);
  align-self: stretch;
}

.dashboard-actions {
  margin-top: 1rem;
}

/* Analytics dashboard layout */
.dash-meta {
  margin-bottom: 1rem;
}
.dash-meta-title {
  font-weight: 950;
  font-size: 1.25rem;
}
.dash-meta-subtitle {
  margin-top: 0.15rem;
  color: var(--color-text-muted);
  font-weight: 700;
  font-size: 0.9rem;
}

.dash-section {
  margin-bottom: 1.5rem;
}
.dash-section-title {
  font-weight: 950;
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

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

.dash-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.dash-kpi {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 0.9rem;
  min-width: 0;
}
.dash-kpi-label {
  color: var(--color-text-muted);
  font-weight: 800;
  font-size: 0.82rem;
}
.dash-kpi-value {
  margin-top: 0.25rem;
  font-weight: 950;
  font-size: 1.2rem;
}

.dash-chart-title {
  font-weight: 900;
  margin-bottom: 0.5rem;
}
.dash-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.5rem;
  align-items: end;
}
.dash-bars-wide {
  grid-template-columns: repeat(15, minmax(0, 1fr));
}
.dash-bar {
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-items: end;
  gap: 0.25rem;
  min-width: 0;
}

.dash-bar-btn {
  background: transparent;
  border: none;
  padding: 0;
  text-align: inherit;
  cursor: pointer;
}

.dash-bar-btn:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 4px;
  border-radius: 12px;
}

.dash-bar-selected .dash-bar-fill {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25);
}

.dash-chart-detail {
  margin: 0.25rem 0 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hidden { display: none !important; }
.dash-bar-fill {
  width: 100%;
  background: #60a5fa;
  border-radius: 10px 10px 6px 6px;
  min-height: 6px;
}
.dash-bar-fill-danger {
  background: #f87171;
}
.dash-bar-label {
  text-align: center;
  font-weight: 900;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.dash-bar-value {
  text-align: center;
  font-weight: 900;
  font-size: 0.75rem;
}

.dash-mini-title {
  font-weight: 950;
  margin-bottom: 0.5rem;
}
.mini-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}
.mini-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: #fff;
}
.mini-name {
  font-weight: 900;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-badge {
  flex-shrink: 0;
}

.audit-timeline-scroll {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.lot-progress-list {
  display: grid;
  gap: 0.9rem;
}
.lot-progress-item {
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 1rem;
  background: #fff;
}
.lot-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.lot-progress-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.lot-progress-meta {
  margin-top: 0.5rem;
  color: var(--color-text-muted);
  font-weight: 800;
  font-size: 0.85rem;
}

@media (max-width: 1100px) {
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-bars-wide { grid-template-columns: repeat(10, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .dash-grid-2 { grid-template-columns: 1fr; }
  .dash-bars { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}

/* Worker mobile-first "My Pending Work" */
.worker-shell {
  max-width: 760px;
  margin: 0 auto;
}

.worker-fab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 120;
  border-radius: 999px;
  padding: 0.85rem 1.05rem;
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.22);
  background: #0f172a;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-weight: 950;
  cursor: pointer;
}

.worker-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.45);
  z-index: 110;
}

.worker-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 115;
  background: #fff;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  box-shadow: 0 -18px 40px rgba(2, 6, 23, 0.25);
  transform: translateY(110%);
  transition: transform 180ms ease;
  max-height: 78vh;
  overflow: hidden;
}

.worker-drawer.is-open {
  transform: translateY(0);
}

.worker-drawer-inner {
  padding: 0.9rem 1rem 1rem;
}

.worker-logs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.worker-logs-title {
  font-weight: 950;
  font-size: 1.05rem;
}

.worker-logs-subtitle {
  margin-top: 0.15rem;
  color: var(--color-text-muted);
  font-weight: 800;
  font-size: 0.85rem;
}

.worker-logs-close {
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.worker-logs-body {
  padding-top: 0.75rem;
  overflow: auto;
  max-height: calc(78vh - 84px);
}

.worker-logs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.worker-log-item {
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 0.75rem 0.75rem;
  background: #fff;
}

.worker-log-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  line-height: 1.25;
}

.worker-log-op {
  font-weight: 900;
}

.worker-log-meta {
  margin-top: 0.45rem;
  font-weight: 800;
  font-size: 0.9rem;
}

.worker-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.worker-title {
  font-weight: 950;
  font-size: 1.25rem;
}

.worker-subtitle {
  margin-top: 0.2rem;
  color: var(--color-text-muted);
  font-weight: 800;
  font-size: 0.9rem;
}

.worker-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  min-width: 260px;
}

.worker-kpi {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 0.65rem 0.75rem;
}
.worker-kpi-label {
  color: var(--color-text-muted);
  font-weight: 900;
  font-size: 0.75rem;
}
.worker-kpi-value {
  font-weight: 950;
  font-size: 1.1rem;
  margin-top: 0.15rem;
}

.worker-quick {
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: #fff;
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.06);
}
.worker-quick-muted { background: #f8fafc; }
.worker-quick-label { color: var(--color-text-muted); font-weight: 900; font-size: 0.85rem; }
.worker-quick-name { font-weight: 950; font-size: 1.15rem; margin-top: 0.25rem; }
.worker-quick-meta { margin-top: 0.25rem; color: var(--color-text-muted); font-weight: 800; font-size: 0.9rem; }
.worker-quick-right { display: grid; gap: 0.5rem; }
.worker-timer { background:#fff; border:1px solid #e2e8f0; border-radius:14px; padding:0.75rem; }
.worker-timer-label { color: var(--color-text-muted); font-weight: 900; font-size: 0.8rem; }
.worker-timer-value { font-weight: 950; font-size: 1.05rem; margin-top: 0.15rem; }

.worker-filters {
  position: sticky;
  top: 0.75rem;
  z-index: 5;
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.worker-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.worker-tab {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0.65rem 0.6rem;
  border-radius: 14px;
  border: 1px solid #cbd5e1;
  background: #fff;
  text-decoration: none;
  font-weight: 950;
  color: #0f172a;
  font-size: 0.9rem;
}
.worker-tab.active {
  border-color: rgba(37, 99, 235, 0.35);
  background: #dbeafe;
  color: #1d4ed8;
}

.worker-search {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.worker-search .form-input { flex: 1; }

.worker-task-list {
  display: grid;
  gap: 0.75rem;
}

.worker-task {
  position: relative;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.06);
  display: grid;
  grid-template-columns: 10px 1fr;
}
.worker-task-strip { background: #cbd5e1; }
.worker-task-main {
  padding: 0.95rem 1rem 0.75rem;
}
.worker-task-name {
  font-weight: 950;
  font-size: 1.15rem;
}
.worker-task-meta {
  margin-top: 0.35rem;
  color: var(--color-text-muted);
  font-weight: 850;
  font-size: 0.95rem;
}
.worker-task-status {
  margin-top: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.worker-task-action {
  padding: 0 1rem 1rem;
  grid-column: 2 / -1;
}

.worker-task-lock {
  margin-top: 0.55rem;
  font-weight: 800;
  font-size: 0.9rem;
  line-height: 1.35;
}

.worker-task-pending .worker-task-strip { background: #94a3b8; }
.worker-task-in_progress .worker-task-strip { background: #f59e0b; }
.worker-task-done .worker-task-strip { background: #16a34a; }

@media (max-width: 900px) {
  .worker-quick { grid-template-columns: 1fr; }
  .worker-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; min-width: 0; }
}


/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.02s ease, background 0.15s ease, border 0.15s ease;
}

.btn-primary {
  background: var(--color-info);
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #cbd5e1;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.btn-outline:hover {
  background: #f1f5f9;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 1rem 1rem;
  font-size: 1.05rem;
  border-radius: 14px;
}

.btn-success { background: var(--color-success); color: #fff; }
.btn-warning { background: var(--color-warning); color: #111827; }
.btn-danger { background: var(--color-danger); color: #fff; }

.btn[disabled],
button.btn[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn[disabled]:active,
button.btn[disabled]:active {
  transform: none;
}

.btn:active { transform: translateY(1px); }
.w-full { width: 100%; }

/* Semantic colors */
:root {
  --color-info: #2563eb;
  --color-success: #16a34a;
  --color-warning: #f59e0b;
  --color-danger: #dc2626;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.78rem;
  border: 1px solid transparent;
}
.badge-info { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.badge-success { background: #dcfce7; border-color: #86efac; color: #166534; }
.badge-warning { background: #ffedd5; border-color: #fdba74; color: #9a3412; }
.badge-danger { background: #fee2e2; border-color: #fecaca; color: #991b1b; }

.card.card-info { border-left: 6px solid var(--color-info); }
.card.card-primary { border-left: 6px solid var(--color-info); }
.card.card-success { border-left: 6px solid var(--color-success); }
.card.card-warning { border-left: 6px solid var(--color-warning); }
.card.card-danger { border-left: 6px solid var(--color-danger); }

.panel {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.06);
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
}
.panel-title { font-weight: 950; font-size: 1.1rem; margin: 0; }
.panel-subtitle { margin-top: 0.15rem; color: var(--color-text-muted); font-weight: 700; font-size: 0.9rem; }
.panel-body { padding: 1.25rem; }

.kv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.kv { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: 1rem; }
.kv-label { color: var(--color-text-muted); font-weight: 800; font-size: 0.85rem; }
.kv-value { margin-top: 0.25rem; font-weight: 950; font-size: 1.05rem; }

.topbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.topbar-user-meta { text-align: right; }
.topbar-user-name { font-weight: 950; font-size: 0.95rem; line-height: 1.1; }
.topbar-user-type { color: var(--color-text-muted); font-weight: 800; font-size: 0.8rem; }
.topbar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 1px solid #cbd5e1;
}
.topbar-logout { white-space: nowrap; }

.table-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.link { color: var(--color-primary); font-weight: 800; text-decoration: none; }
.link:hover { text-decoration: underline; }
.muted { color: var(--color-text-muted); }

@media (max-width: 900px) {
  .kv-grid { grid-template-columns: 1fr; }
  .topbar-user-meta { display: none; }
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 1rem;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-input-sm {
  max-width: 200px;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
}

.form-select-sm {
  max-width: 140px;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-checkbox {
  width: 1rem;
  height: 1rem;
}

.form-check-label {
  margin: 0;
  font-weight: normal;
}

.form-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Bundle size distribution UI */
.size-distribution {
  display: grid;
  gap: 0.55rem;
}

.size-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: #fff;
}

.size-code {
  font-weight: 950;
  min-width: 3.5rem;
}

.size-qty {
  flex: 1;
}

.size-qty .form-input {
  width: 100%;
}

/* Lot size selection */
.size-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.size-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.7rem;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: #fff;
}

.size-checkbox {
  width: 18px;
  height: 18px;
}

.size-code-label {
  font-weight: 950;
}

@media (max-width: 600px) {
  .size-checkbox-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.alert-success {
  background: #dcfce7;
  color: #166534;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
}

.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* Toast-style alerts (optional) */
.main-content .alert {
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.error-list {
  margin: 0;
  padding-left: 1.25rem;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -1rem;
  padding: 0 1rem;
  max-width: 100%;
  width: 100%;
}

/* Keep table borders/rounded corners clean inside cards */
.card .card-body.p-0 .table-wrapper {
  margin: 0;
  padding: 0;
}

.card .card-body.p-0 .table {
  min-width: 100%;
}

.card .card-body.p-0 {
  overflow: hidden;
  border-radius: inherit;
}

.card .card-body.p-0 .table th:first-child {
  border-top-left-radius: 10px;
}

.card .card-body.p-0 .table th:last-child {
  border-top-right-radius: 10px;
}

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

.table th,
.table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  word-break: break-word;
  overflow-wrap: break-word;
}

.table th {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  background: #f8fafc;
}

.table th.num,
.table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.inventory-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.table-actions {
  white-space: nowrap;
}

.table-actions .btn {
  margin-right: 0.5rem;
}

/* Mobile-only user cards (replace table on small screens) */
.user-cards-mobile {
  display: none;
}

.user-card-mobile {
  padding: 1rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.user-card-mobile:last-of-type {
  border-bottom: none;
}

.user-card-mobile-main {
  flex: 1;
  min-width: 0;
}

.user-card-mobile-name {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.user-card-mobile-email {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  word-break: break-all;
}

.user-card-mobile-meta {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.user-card-mobile-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}


/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-secondary {
  background: #f1f5f9;
  color: #64748b;
}

.badge-info {
  background: #e0f2fe;
  color: #0369a1;
}

/* Users toolbar & filters */
.users-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.pagination-wrap {
  padding: 1rem;
  border-top: 1px solid var(--color-border);
}

.pagy-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagy-nav a,
.pagy-nav span {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--color-text);
  font-size: 0.9rem;
}

.pagy-nav a:hover {
  background: #f1f5f9;
}

.pagy-nav .active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--color-text-muted);
}

.empty-state .btn {
  margin-top: 1rem;
}

/* Profile / detail */
.profile-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1.5rem;
  margin: 0;
}

.profile-dl dt {
  font-weight: 500;
  color: var(--color-text-muted);
}

.profile-dl dd {
  margin: 0;
}

.profile-title {
  margin: 0 0 1rem;
  font-size: 1.25rem;
}

.detail-actions {
  margin-bottom: 1rem;
  display: flex;
  gap: 0.75rem;
}

.page-actions {
  margin-bottom: 1rem;
}

/* Operations list */
.operations-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.operations-list-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
}

.operations-list-item:last-child {
  border-bottom: none;
}

.operations-list-position {
  flex-shrink: 0;
  width: 2rem;
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.operations-list-name {
  flex: 1;
  min-width: 0;
  font-weight: 500;
}

.operations-list-item .btn {
  flex-shrink: 0;
}

/* Size-wise bundle panels: stack content so undo buttons stay inside the card */
.operations-list--size-wise .operations-list-item--size-wise {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
}

.size-wise-op-main {
  min-width: 0;
  width: 100%;
}

.size-wise-op-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
}

.size-wise-op-name {
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
}

.size-wise-op-meta {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
  word-break: normal;
  overflow-wrap: break-word;
}

.size-wise-op-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  width: 100%;
}

.size-wise-op-actions form {
  display: inline-block;
  margin: 0;
}

.size-wise-op-actions .btn {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (min-width: 400px) {
  .size-wise-op-actions .btn {
    width: auto;
    max-width: none;
  }
}

.bundle-size-grid > .panel {
  min-width: 0;
}

/* Lot pricing rows */
.pricing-rows {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.pricing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.pricing-title {
  font-weight: 700;
}

.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 220px 120px;
  gap: 0.75rem;
  align-items: start;
  padding: 0.5rem 0;
}

.pricing-grid-head {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  border-bottom: 1px solid var(--color-border);
}

.pricing-row {
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 0;
}

.pricing-actions {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .pricing-grid {
    grid-template-columns: 1fr;
  }
  .pricing-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .operations-list-item:not(.operations-list-item--size-wise) {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .operations-list-item:not(.operations-list-item--size-wise) .operations-list-name {
    width: 100%;
    order: 2;
    padding-left: 2.5rem;
  }

  .operations-list-item:not(.operations-list-item--size-wise) .btn {
    margin-left: auto;
  }
}

/* Mobile: sidebar backdrop overlay */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 150;
  transition: opacity 0.2s;
}

.sidebar-backdrop-hidden {
  opacity: 0;
  pointer-events: none;
}

body.sidebar-overlay-open {
  overflow: hidden;
}

/* ========== Mobile responsive ========== */
@media (max-width: 768px) {
  .topbar-menu-btn {
    display: flex;
  }

  .sidebar-backdrop {
    display: block;
  }

  .sidebar-backdrop:not(.sidebar-backdrop-hidden) {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    width: min(280px, 85vw);
    max-width: 280px;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    box-shadow: none;
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  }

  .sidebar-header-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .sidebar-header-mobile .sidebar-title {
    margin: 0;
    font-size: 1rem;
  }

  .sidebar-close-btn {
    display: block;
  }

  .sidebar-brand {
    display: none;
  }

  .sidebar-title-desktop {
    display: none;
  }

  .sidebar-nav {
    padding: 0.5rem 0;
  }

  .sidebar-link {
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
  }

  .sidebar-footer {
    padding: 1rem 1.25rem;
  }

  .sidebar-user {
    font-size: 0.85rem;
  }

  .sidebar-logout {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }

  .main-wrapper {
    margin-left: 0;
    min-width: 0;
  }

  .main-content {
    padding: 1rem;
  }

  .topbar {
    padding: 0 1rem;
    min-height: var(--topbar-height);
  }

  .topbar-title {
    font-size: 1.1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-cards {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .card-value {
    font-size: 1.5rem;
  }

  .users-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .users-toolbar .btn-primary {
    width: 100%;
    text-align: center;
  }

  .filter-form {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .filter-form .form-input,
  .filter-form .form-input-sm,
  .filter-form .form-select,
  .filter-form .form-select-sm {
    max-width: none;
    width: 100%;
  }

  /* On mobile: show card list, hide table */
  .user-cards-mobile {
    display: block;
  }

  .table-wrapper {
    display: none;
  }

  .table {
    font-size: 0.85rem;
    min-width: 560px;
  }

  .table th,
  .table td {
    padding: 0.5rem 0.5rem;
  }

  .table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .table-actions .btn {
    margin-right: 0;
  }

  .detail-actions {
    flex-wrap: wrap;
  }

  .detail-actions .btn {
    flex: 1;
    min-width: 0;
  }

  .profile-dl {
    grid-template-columns: 1fr;
    gap: 0.25rem 0;
  }

  .profile-dl dt {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
  }

  .profile-dl dt:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }

  .pagination-wrap {
    padding: 0.75rem 1rem;
  }

  .pagy-nav {
    justify-content: center;
  }

  .pagy-nav a,
  .pagy-nav span {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
  }

  .card-body {
    padding: 1rem;
  }

  .empty-state {
    padding: 2rem 1rem;
  }
}

@media (max-width: 480px) {
  body.app-body {
    font-size: 15px;
  }

  .login-page {
    padding: 0.75rem;
    align-items: flex-start;
    padding-top: 2rem;
  }

  .login-card {
    padding: 1.25rem;
    margin: 0 auto;
  }

  .login-header h1 {
    font-size: 1.25rem;
  }

  .sidebar-brand,
  .sidebar-nav,
  .sidebar-footer {
    padding-left: 0;
    padding-right: 0;
  }

  .main-content {
    padding: 0.75rem;
  }

  .form-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .form-actions .btn {
    width: 100%;
  }

  .btn {
    padding: 0.6rem 1rem;
  }

  .card-value {
    font-size: 1.35rem;
  }
}
