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

:root {
  --indigo-950: #1e1b4b;
  --indigo-900: #312e81;
  --indigo-800: #3730a3;
  --indigo-600: #4f46e5;
  --indigo-400: #818cf8;
  --indigo-100: #e0e7ff;
  --indigo-50:  #eef2ff;

  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50:  #f8fafc;
  --white:     #ffffff;

  --green-dark:   #166534;
  --green-mid:    #16a34a;
  --green-bg:     #dcfce7;
  --green-border: #bbf7d0;

  --amber-dark:   #92400e;
  --amber-mid:    #d97706;
  --amber-bg:     #fef9c3;
  --amber-border: #fde68a;

  --red-dark:     #991b1b;
  --red-mid:      #dc2626;
  --red-bg:       #fee2e2;
  --red-border:   #fecaca;

  --blue-dark:    #1e3a5f;
  --blue-bg:      #dbeafe;
  --blue-border:  #bfdbfe;

  --purple-dark:  #4c1d95;
  --purple-bg:    #ede9fe;
  --purple-border:#ddd6fe;

  --sidebar-w:    220px;
  --topbar-h:     56px;

  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-pill: 9999px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);

  --trans: 0.15s ease;
}

html { font-size: 15px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--slate-900);
  background: var(--slate-50);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; }


/* --------------------------------------------
   LAYOUT SHELL
-------------------------------------------- */

.layout-shell {
  display: flex;
  min-height: 100vh;
}

/* -- SIDEBAR -- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--indigo-950);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--trans);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.sidebar-logo .logo-text {
  font-size: 17px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.3px;
}
.sidebar-logo .logo-text span { color: var(--indigo-400); }
.sidebar-logo .logo-tagline {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  margin-top: 2px;
}

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

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(255,255,255,0.28);
  padding: 14px 16px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  margin: 1px 8px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.55);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--trans);
  text-decoration: none;
}
.nav-link:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.9);
}
.nav-link.active {
  background: var(--indigo-900);
  color: var(--white);
}
.nav-link .nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.65;
}
.nav-link.active .nav-icon,
.nav-link:hover .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 6px 0 10px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* -- MAIN AREA -- */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* -- TOPBAR -- */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* Hamburger — hidden on desktop */
.hamburger {
  display: none;
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--slate-600);
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hamburger:hover { background: var(--slate-100); }

.breadcrumb {
  font-size: 13.5px;
  color: var(--slate-500);
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb-sep { color: var(--slate-300); }
.breadcrumb-cur { color: var(--slate-900); font-weight: 600; }

.notif-btn {
  position: relative;
  width: 34px; height: 34px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--slate-500);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--trans);
}
.notif-btn:hover { background: var(--slate-100); color: var(--slate-700); }
.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--red-mid);
  border-radius: 50%;
  border: 2px solid var(--white);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: var(--radius-md);
  transition: background var(--trans);
}
.user-chip:hover { background: var(--slate-100); }
.user-av {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--indigo-900);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--slate-900); line-height: 1.2; }
.user-role { font-size: 11px; color: var(--slate-400); }

/* -- PAGE CONTENT -- */
.page-content {
  flex: 1;
  padding: 24px;
}

/* -- PAGE HEADER -- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 12px;
}
.page-header-text {}
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.page-subtitle {
  font-size: 13px;
  color: var(--slate-400);
  margin-top: 3px;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}


/* --------------------------------------------
   BUTTONS
-------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--trans);
  white-space: nowrap;
  line-height: 1;
  text-decoration: none;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-sm  { padding: 6px 12px; font-size: 12.5px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg  { padding: 10px 20px; font-size: 14.5px; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }

.btn-primary {
  background: var(--indigo-900);
  color: var(--white);
  border-color: var(--indigo-900);
}
.btn-primary:hover { background: var(--indigo-800); border-color: var(--indigo-800); }

.btn-secondary {
  background: var(--white);
  color: var(--slate-600);
  border-color: var(--slate-200);
}
.btn-secondary:hover { background: var(--slate-50); color: var(--slate-900); border-color: var(--slate-300); }

.btn-ghost {
  background: transparent;
  color: var(--slate-500);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--slate-100); color: var(--slate-700); }

.btn-danger {
  background: var(--red-bg);
  color: var(--red-dark);
  border-color: var(--red-border);
}
.btn-danger:hover { background: var(--red-mid); color: var(--white); border-color: var(--red-mid); }

.btn-success {
  background: var(--green-bg);
  color: var(--green-dark);
  border-color: var(--green-border);
}
.btn-success:hover { background: var(--green-mid); color: var(--white); border-color: var(--green-mid); }

.btn-warning {
  background: var(--amber-bg);
  color: var(--amber-dark);
  border-color: var(--amber-border);
}


/* --------------------------------------------
   BADGES
-------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-pending       { background: var(--amber-bg);  color: var(--amber-dark);  border-color: var(--amber-border); }
.badge-confirmed     { background: var(--blue-bg);   color: var(--blue-dark);   border-color: var(--blue-border); }
.badge-in-progress   { background: var(--purple-bg); color: var(--purple-dark); border-color: var(--purple-border); }
.badge-completed     { background: var(--green-bg);  color: var(--green-dark);  border-color: var(--green-border); }
.badge-approved      { background: var(--green-bg);  color: var(--green-dark);  border-color: var(--green-border); }
.badge-rejected      { background: var(--red-bg);    color: var(--red-dark);    border-color: var(--red-border); }
.badge-draft         { background: var(--slate-100); color: var(--slate-600);   border-color: var(--slate-200); }
.badge-active        { background: var(--blue-bg);   color: var(--blue-dark);   border-color: var(--blue-border); }
.badge-ok            { background: var(--green-bg);  color: var(--green-dark);  border-color: var(--green-border); }
.badge-low           { background: var(--amber-bg);  color: var(--amber-dark);  border-color: var(--amber-border); }
.badge-critical      { background: var(--red-bg);    color: var(--red-dark);    border-color: var(--red-border); }


/* --------------------------------------------
   CARDS
-------------------------------------------- */

.card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-900);
}
.card-body { padding: 20px; }

/* Stat card */
.stat-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-xs);
}
.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--slate-400);
  margin-bottom: 8px;
}
.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.5px;
  line-height: 1;
}
.stat-sub { font-size: 12.5px; color: var(--slate-400); margin-top: 6px; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}


/* --------------------------------------------
   TABLES
-------------------------------------------- */

.table-wrapper {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--slate-100);
  gap: 10px;
  flex-wrap: wrap;
}
.table-toolbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-900);
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}
.data-table thead tr {
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
}
.data-table th {
  padding: 10px 16px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--slate-400);
  text-align: left;
  white-space: nowrap;
}
.data-table th.right,
.data-table td.right { text-align: right; }
.data-table td {
  padding: 13px 16px;
  font-size: 14px;
  color: var(--slate-800);
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--slate-50); }
.data-table .col-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Monospace for order/PO numbers */
.mono {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12.5px;
  color: var(--indigo-800);
  font-weight: 500;
}

/* Initials avatar in table rows */
.initials-av {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--indigo-100);
  color: var(--indigo-900);
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}
.cell-with-av {
  display: flex;
  align-items: center;
  gap: 9px;
}

/* Table footer / pagination */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--slate-100);
  font-size: 13px;
  color: var(--slate-400);
  flex-wrap: wrap;
  gap: 8px;
}
.pagination {
  display: flex;
  gap: 4px;
}
.page-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-200);
  background: var(--white);
  color: var(--slate-600);
  font-size: 12.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--trans);
}
.page-btn:hover { background: var(--slate-100); color: var(--slate-900); }
.page-btn.active {
  background: var(--indigo-900);
  border-color: var(--indigo-900);
  color: var(--white);
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }


/* --------------------------------------------
   FILTERS BAR
-------------------------------------------- */

.filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  background: var(--white);
  transition: border-color var(--trans);
  min-width: 200px;
}
.search-box:focus-within { border-color: var(--indigo-400); }
.search-box svg { width: 15px; height: 15px; color: var(--slate-400); flex-shrink: 0; }
.search-box input {
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--slate-900);
  background: transparent;
  width: 100%;
}
.search-box input::placeholder { color: var(--slate-300); }
.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  color: var(--slate-600);
  background: var(--white);
  outline: none;
  cursor: pointer;
  transition: border-color var(--trans);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.filter-select:focus { border-color: var(--indigo-400); }


/* --------------------------------------------
   FORMS
-------------------------------------------- */

.form-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  padding: 24px;
  max-width: 720px;
}
.form-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--slate-400);
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--slate-100);
}
.form-section-title:first-child { margin-top: 0; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-600);
}
.form-label .req { color: var(--red-mid); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  color: var(--slate-900);
  background: var(--white);
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
  appearance: none;
}
.form-control:focus {
  border-color: var(--indigo-400);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.form-control::placeholder { color: var(--slate-300); }
.form-control.is-invalid { border-color: var(--red-mid); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,0.12); }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

textarea.form-control { resize: vertical; min-height: 90px; }

.form-hint  { font-size: 12px; color: var(--slate-400); }
.form-error { font-size: 12px; color: var(--red-mid); }

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--slate-100);
}

/* Checkbox grid (for multi-process worker selection) */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--trans);
  font-size: 13.5px;
  color: var(--slate-700);
  user-select: none;
}
.checkbox-item:hover { background: var(--indigo-50); border-color: var(--indigo-400); }
.checkbox-item input[type="checkbox"] { accent-color: var(--indigo-800); width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }
.checkbox-item:has(input:checked) {
  background: var(--indigo-50);
  border-color: var(--indigo-400);
  color: var(--indigo-900);
  font-weight: 500;
}


/* --------------------------------------------
   FLASH MESSAGES
-------------------------------------------- */

.flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  margin-bottom: 18px;
  border: 1px solid transparent;
  border-left-width: 4px;
}
.flash svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.flash-success {
  background: var(--green-bg);
  border-color: var(--green-border);
  border-left-color: var(--green-mid);
  color: var(--green-dark);
}
.flash-error {
  background: var(--red-bg);
  border-color: var(--red-border);
  border-left-color: var(--red-mid);
  color: var(--red-dark);
}
.flash-info {
  background: var(--blue-bg);
  border-color: var(--blue-border);
  border-left-color: #2563eb;
  color: var(--blue-dark);
}
.flash-warning {
  background: var(--amber-bg);
  border-color: var(--amber-border);
  border-left-color: var(--amber-mid);
  color: var(--amber-dark);
}


/* --------------------------------------------
   EMPTY STATE
-------------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 24px;
  text-align: center;
}
.empty-icon {
  width: 52px; height: 52px;
  background: var(--slate-100);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--slate-400);
}
.empty-icon svg { width: 24px; height: 24px; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--slate-800); margin-bottom: 5px; }
.empty-state p  { font-size: 13.5px; color: var(--slate-400); margin-bottom: 20px; max-width: 320px; line-height: 1.5; }


/* --------------------------------------------
   LOGIN PAGE
-------------------------------------------- */

body.login-body { background: var(--slate-100); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-page { display: flex; min-height: 100vh; width: 100%; }
.login-brand {
  width: 40%;
  background: var(--indigo-950);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 52px;
}
.login-brand-logo { font-size: 28px; font-weight: 800; color: var(--white); letter-spacing: -0.5px; margin-bottom: 12px; }
.login-brand-logo span { color: var(--indigo-400); }
.login-brand-tagline { font-size: 15px; color: rgba(255,255,255,0.5); line-height: 1.6; margin-bottom: 36px; }
.login-feature {
  font-size: 13px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-feature::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--indigo-400);
  border-radius: 50%;
  flex-shrink: 0;
}
.login-form-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--white);
}
.login-box { width: 100%; max-width: 380px; }
.login-title { font-size: 24px; font-weight: 700; color: var(--slate-900); letter-spacing: -0.3px; margin-bottom: 4px; }
.login-subtitle { font-size: 14px; color: var(--slate-400); margin-bottom: 32px; }
.login-submit {
  width: 100%;
  justify-content: center;
  padding: 11px;
  font-size: 14.5px;
}


/* --------------------------------------------
   PROCESS STEP PROGRESS (order detail)
-------------------------------------------- */

.step-timeline { display: flex; flex-direction: column; gap: 0; }
.step-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  position: relative;
}
.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 13px;
  top: 38px;
  bottom: -12px;
  width: 2px;
  background: var(--slate-100);
}
.step-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid var(--slate-200);
  background: var(--white);
  color: var(--slate-400);
  position: relative;
  z-index: 1;
}
.step-dot.done   { background: var(--green-bg);  border-color: var(--green-mid);   color: var(--green-dark); }
.step-dot.active { background: var(--indigo-50); border-color: var(--indigo-600);  color: var(--indigo-800); }
.step-dot.reject { background: var(--red-bg);    border-color: var(--red-mid);     color: var(--red-dark); }
.step-body { flex: 1; padding-top: 3px; }
.step-title { font-size: 14px; font-weight: 600; color: var(--slate-900); margin-bottom: 2px; }
.step-meta  { font-size: 12.5px; color: var(--slate-400); }


/* --------------------------------------------
   MY WORK CARDS (worker dashboard)
-------------------------------------------- */

.work-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.work-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  padding: 18px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--trans);
}
.work-card:hover { box-shadow: var(--shadow-md); }
.work-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}
.work-card-order { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--indigo-800); font-weight: 500; }
.work-card-title { font-size: 15px; font-weight: 600; color: var(--slate-900); margin: 4px 0 2px; }
.work-card-sub   { font-size: 13px; color: var(--slate-500); }
.work-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
  padding: 12px;
  background: var(--slate-50);
  border-radius: var(--radius-md);
}
.work-meta-item {}
.work-meta-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--slate-400); margin-bottom: 2px; }
.work-meta-value { font-size: 14px; font-weight: 600; color: var(--slate-800); }
.work-card-actions { display: flex; gap: 8px; }
.work-card-actions .btn { flex: 1; justify-content: center; }


/* --------------------------------------------
   NOTIFICATIONS DROPDOWN
-------------------------------------------- */

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  z-index: 200;
  overflow: hidden;
}
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--slate-100);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--slate-900);
}
.notif-item {
  padding: 11px 16px;
  border-bottom: 1px solid var(--slate-50);
  font-size: 13px;
  color: var(--slate-700);
  line-height: 1.4;
  cursor: pointer;
  transition: background var(--trans);
}
.notif-item:hover { background: var(--slate-50); }
.notif-item.unread { background: var(--indigo-50); }
.notif-item:last-child { border-bottom: none; }
.notif-time { font-size: 11.5px; color: var(--slate-400); margin-top: 3px; }


/* --------------------------------------------
   MOBILE RESPONSIVE
-------------------------------------------- */

@media (max-width: 768px) {

  /* Sidebar becomes a slide-in drawer */
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  }

  /* Main area fills full width */
  .main-area { margin-left: 0; }

  /* Show hamburger */
  .hamburger { display: flex; }

  /* Topbar adjustments */
  .topbar { padding: 0 14px; }
  .user-name, .user-role { display: none; }

  /* Page content padding reduced */
  .page-content { padding: 14px; }

  /* Page header stacks */
  .page-header { flex-direction: column; gap: 10px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }

  /* Filters stack */
  .filters-bar { flex-direction: column; align-items: stretch; }
  .search-box  { min-width: unset; width: 100%; }
  .filter-select { width: 100%; }

  /* Stat grid: 2 columns on phone */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value { font-size: 24px; }

  /* Table horizontal scroll */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 500px; }

  /* Work cards single column */
  .work-cards { grid-template-columns: 1fr; }

  /* Form grid single column */
  .form-grid { grid-template-columns: 1fr; }
  .form-card { padding: 16px; }

  /* Login page: brand panel hides, form full width */
  .login-brand { display: none; }
  .login-form-area { padding: 40px 20px; background: var(--white); }
  .login-page { background: var(--white); }

  /* Checkbox grid: 2 columns */
  .checkbox-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  html { font-size: 14px; }

  .stat-grid { grid-template-columns: 1fr 1fr; }

  .data-table th,
  .data-table td { padding: 10px 12px; font-size: 13px; }

  .page-title { font-size: 17px; }

  .checkbox-grid { grid-template-columns: 1fr 1fr; }

  .work-card-meta { grid-template-columns: 1fr; }
}

/* Compatibility layer for legacy page markup */
.card {
  padding: 20px;
}
.card-header {
  margin: -20px -20px 16px -20px;
}
.table-wrap {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}
.table-wrap thead tr {
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
}
.table-wrap th {
  padding: 10px 16px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--slate-400);
  text-align: left;
  white-space: nowrap;
}
.table-wrap td {
  padding: 13px 16px;
  font-size: 14px;
  color: var(--slate-800);
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}
.table-wrap tbody tr:last-child td { border-bottom: none; }
.table-wrap tbody tr:hover { background: var(--slate-50); }
.code {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12.5px;
  color: var(--indigo-800);
  font-weight: 500;
}
.form-group {
  margin-bottom: 14px;
}
label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--slate-600);
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  color: var(--slate-900);
  background: var(--white);
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--indigo-400);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
@media (max-width: 768px) {
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 500px; }
}

/* Final spacing polish */
.page-content > .card,
.page-content > .table-wrapper,
.page-content > .table-wrap,
.page-content > .form-card {
  margin-bottom: 20px;
}

.page-content > :last-child {
  margin-bottom: 0;
}

.card p,
.card ul,
.card ol,
.card .form-group {
  margin-bottom: 12px;
}

.card p:last-child,
.card ul:last-child,
.card ol:last-child,
.card .form-group:last-child {
  margin-bottom: 0;
}

.table-actions,
.col-actions,
.form-actions,
.page-actions {
  gap: 8px;
}

@media (max-width: 768px) {
  .page-content > .card,
  .page-content > .table-wrapper,
  .page-content > .table-wrap,
  .page-content > .form-card {
    margin-bottom: 14px;
  }
}

/* Design module */
.design-shell {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.design-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.design-stat {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  padding: 16px;
}

.design-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-400);
  margin-bottom: 8px;
  font-weight: 700;
}

.design-stat-value {
  font-size: 16px;
  color: var(--slate-900);
  font-weight: 700;
}

.design-details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.design-media {
  width: 100%;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.design-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.design-media-detail {
  max-width: 380px;
  aspect-ratio: 4 / 5;
  margin-bottom: 12px;
}

.design-media-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 220px;
  font-size: 13px;
  color: var(--slate-500);
}

.design-color-list {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.design-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  background: var(--slate-100);
  color: var(--slate-700);
  border: 1px solid var(--slate-200);
}

.design-block-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-900);
}

.design-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.design-gallery-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.design-gallery-card .design-media {
  border: none;
  border-bottom: 1px solid var(--slate-200);
  border-radius: 0;
  aspect-ratio: 4 / 5;
}

.design-gallery-card .design-media-fallback {
  min-height: 0;
}

.design-card-body {
  padding: 14px;
}

.design-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1.3;
}

.design-card-code {
  margin-top: 4px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  color: var(--indigo-800);
}

.design-card-meta {
  margin-top: 10px;
  margin-bottom: 10px;
}

.design-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.design-meta-label {
  font-size: 12px;
  color: var(--slate-500);
}

.design-meta-value {
  font-size: 12px;
  color: var(--slate-900);
  font-weight: 600;
}

.inline-form {
  display: inline;
}

.text-muted {
  color: var(--slate-500);
  font-size: 13px;
}

@media (max-width: 1100px) {
  .design-details-grid {
    grid-template-columns: 1fr;
  }

  .design-media-detail {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .design-summary-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .design-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (max-width: 560px) {
  .design-gallery-grid {
    grid-template-columns: 1fr;
  }
}

/* Reports dashboard */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.report-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  padding: 16px;
  transition: transform var(--trans), box-shadow var(--trans), border-color var(--trans);
  display: flex;
  flex-direction: column;
  min-height: 156px;
}

.report-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--indigo-400);
}

.report-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--indigo-100);
  color: var(--indigo-900);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.report-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--slate-900);
}

.report-card-desc {
  font-size: 13px;
  color: var(--slate-500);
  margin-top: 6px;
  line-height: 1.45;
  flex: 1;
}

.report-card-link {
  margin-top: 12px;
  color: var(--indigo-900);
  font-size: 12px;
  font-weight: 600;
}

/* Shared two-column layout helper */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.grid-2:last-child {
  margin-bottom: 0;
}

.report-table-wrapper {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Additional status badge variants */
.badge-inactive      { background: var(--slate-100); color: var(--slate-600); border-color: var(--slate-200); }
.badge-on-time       { background: var(--green-bg); color: var(--green-dark); border-color: var(--green-border); }
.badge-open          { background: var(--blue-bg); color: var(--blue-dark); border-color: var(--blue-border); }
.badge-late          { background: var(--red-bg); color: var(--red-dark); border-color: var(--red-border); }
.badge-delayed-open  { background: var(--amber-bg); color: var(--amber-dark); border-color: var(--amber-border); }

/* Master module polish */
.compact-card {
  padding: 8px;
}

.module-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.module-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  background: var(--white);
  color: var(--slate-600);
  font-size: 13.5px;
  font-weight: 600;
  transition: all var(--trans);
}

.module-link:hover {
  border-color: var(--indigo-400);
  color: var(--indigo-900);
  background: var(--indigo-50);
}

.module-link.active {
  background: var(--indigo-900);
  border-color: var(--indigo-900);
  color: var(--white);
  box-shadow: var(--shadow-xs);
}

.module-link-label {
  white-space: nowrap;
}

.modern-accent {
  border-color: var(--slate-200);
  box-shadow: var(--shadow-xs);
}

.modern-accent .card-header {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.page-content .modern-accent .form-actions {
  grid-column: 1 / -1;
  margin-top: 2px;
  padding-top: 0;
  border-top: 0;
  justify-content: flex-start;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--slate-300);
  display: inline-block;
  vertical-align: middle;
  margin-right: 7px;
}

.sortable-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.sortable-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px dashed var(--slate-300);
  border-radius: var(--radius-md);
  background: var(--slate-50);
  cursor: grab;
}

.sortable-item:last-child {
  margin-bottom: 0;
}

.sortable-item:active {
  cursor: grabbing;
}

@media (max-width: 768px) {
  .module-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-link {
    padding: 9px 10px;
    font-size: 13px;
  }

  .table-actions {
    display: flex;
  }
}

@media (max-width: 480px) {
  .module-nav {
    grid-template-columns: 1fr 1fr;
  }
}

/* Status badge dot removal */
.badge-dot {
  display: none !important;
}

.badge::before {
  content: none !important;
  display: none !important;
}

.badge {
  gap: 0;
}

/* Stock manager enhancements */
.badge-healthy { background: var(--green-bg); color: var(--green-dark); border-color: var(--green-border); }
.badge-untracked { background: var(--slate-100); color: var(--slate-600); border-color: var(--slate-200); }
.badge-role-stock_manager { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

.low-stock-row {
  background: rgba(220, 38, 38, 0.05);
}

.stock-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

@media (max-width: 1000px) {
  .stock-dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .stock-dashboard-grid {
    grid-template-columns: 1fr;
  }
}
.badge-received      { background: var(--green-bg); color: var(--green-dark); border-color: var(--green-border); }
.badge-stock-manager { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }

/* Master inline edit rows */
.edit-row td {
  background: var(--slate-50);
  border-top: none;
}

.inline-edit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  padding: 8px 0;
}

.inline-edit-grid-wide {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.inline-edit-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

@media (max-width: 900px) {
  .inline-edit-grid,
  .inline-edit-grid-wide {
    grid-template-columns: 1fr;
  }
}

/* Global page loader and submit lock */
.app-loader {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.app-loader.show {
  display: flex;
}

.app-loader-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  color: var(--slate-800);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
}

.loader-spinner,
.btn-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(99, 102, 241, 0.22);
  border-top-color: var(--indigo-900);
  animation: appSpin 0.7s linear infinite;
  flex-shrink: 0;
}

.btn.is-loading {
  pointer-events: none;
  opacity: 0.8;
}

@keyframes appSpin {
  to { transform: rotate(360deg); }
}
