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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f4f8;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1e293b;
}

/* ── Auth card ─────────────────────────────────────────────────────────────── */

.card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
}

.card-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.card-logo h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1d4ed8;
  letter-spacing: -0.5px;
}

.card-logo p {
  font-size: 0.875rem;
  color: #64748b;
  margin-top: 0.25rem;
}

/* ── Form elements ─────────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 1.1rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.35rem;
}

input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  font-size: 0.95rem;
  color: #1e293b;
  background: #f9fafb;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: #fff;
}

input[type="file"] {
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  color: #374151;
}

/* ── Button ────────────────────────────────────────────────────────────────── */

.btn {
  width: 100%;
  padding: 0.7rem;
  background: #2563eb;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.15s;
}

.btn:hover  { background: #1d4ed8; }
.btn:active { background: #1e40af; }
.btn:disabled { background: #93c5fd; cursor: not-allowed; }

/* ── Feedback messages ─────────────────────────────────────────────────────── */

.msg {
  font-size: 0.875rem;
  margin-top: 0.9rem;
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  display: none;
}

.msg.error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fca5a5; display: block; }
.msg.success { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; display: block; }

/* ── Footer link ───────────────────────────────────────────────────────────── */

.card-footer {
  text-align: center;
  margin-top: 1.4rem;
  font-size: 0.875rem;
  color: #64748b;
}

.card-footer a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.card-footer a:hover { text-decoration: underline; }

/* ── App layout (dashboard + inner pages) ──────────────────────────────────── */

body.app {
  display: block;
  background: #f0f4f8;
  min-height: 100vh;
}

/* Navbar */
.navbar {
  background: #1d4ed8;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 1.5rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-right: auto;
  color: #fff;
  text-decoration: none;
}

.navbar-logo {
  height: 40px;
  width: auto;
  max-width: 120px;
  object-fit: cover;
  object-position: center;
  border-radius: 3px;
  flex-shrink: 0;
}

.nav-link {
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.3rem 0.5rem;
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover,
.nav-link.active {
  color: #fff;
  background: rgba(255,255,255,0.15);
}

.btn-logout {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 0.3rem 0.9rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-logout:hover { background: rgba(255,255,255,0.22); }

/* Page content */
.page-content {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.page-subtitle {
  color: #64748b;
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

/* ── Page header row (title + action button) ───────────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

/* ── Inline buttons (not full-width) ──────────────────────────────────────── */

.btn-primary {
  display: inline-block;
  padding: 0.55rem 1.2rem;
  background: #2563eb;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: #1d4ed8; }

.btn-secondary {
  display: inline-block;
  padding: 0.55rem 1.2rem;
  background: #fff;
  color: #374151;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: #f1f5f9; }

.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-edit   { background: #eff6ff; color: #1d4ed8; }
.btn-edit:hover { background: #dbeafe; }
.btn-delete { background: #fef2f2; color: #b91c1c; }
.btn-delete:hover { background: #fee2e2; }

/* ── Form panel (add / edit) ───────────────────────────────────────────────── */

.panel {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  display: none;
}
.panel.open { display: block; }

.panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 1.25rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.25rem;
}

.form-grid .form-group.full { grid-column: 1 / -1; }

textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #1e293b;
  background: #f9fafb;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
  background: #fff;
}

.panel-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* ── Data table ────────────────────────────────────────────────────────────── */

.table-wrap {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  background: #f8fafc;
  border-bottom: 1.5px solid #e2e8f0;
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

.td-actions { display: flex; gap: 0.5rem; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #94a3b8;
  font-size: 0.9rem;
}

/* ── Pagination controls ───────────────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1rem;
  min-height: 2rem;
}

.pagination:empty { margin-top: 0; }

.pagination-info {
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 500;
}

.pagination .btn-sm { background: #fff; border: 1.5px solid #d1d5db; color: #374151; }
.pagination .btn-sm:hover:not(:disabled) { background: #f1f5f9; }
.pagination .btn-sm:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Stat cards ────────────────────────────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.25rem 1.25rem 1rem;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 0.4rem;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1;
}

.stat-card .stat-sub {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 0.3rem;
}

.stat-card.accent-blue   { border-top: 3px solid #2563eb; }
.stat-card.accent-orange { border-top: 3px solid #f97316; }
.stat-card.accent-green  { border-top: 3px solid #16a34a; }
.stat-card.accent-purple { border-top: 3px solid #7c3aed; }
.stat-card.accent-slate  { border-top: 3px solid #64748b; }

/* ── Select input ──────────────────────────────────────────────────────────── */

select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #1e293b;
  background-color: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
  background-color: #fff;
}

/* ── Line items table ──────────────────────────────────────────────────────── */

.li-wrap {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.li-wrap td { padding: 0.5rem 0.75rem; }
.li-wrap input { margin: 0; background: #fff; }
.li-wrap input:focus { background: #fff; }

.col-desc   { width: 44%; }
.col-qty    { width: 13%; }
.col-price  { width: 16%; }
.col-total  { width: 16%; text-align: right; font-weight: 600; color: #1e293b; }
.col-remove { width: 6%;  text-align: center; }

.btn-remove {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}
.btn-remove:hover { color: #b91c1c; }

/* ── Grand total bar ───────────────────────────────────────────────────────── */

.grand-total {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 1.5rem;
}

.grand-total span { font-size: 1.2rem; color: #1d4ed8; }

/* ── Form actions row ──────────────────────────────────────────────────────── */

.form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ── Success card ──────────────────────────────────────────────────────────── */

.success-card {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 10px;
  padding: 2.5rem 2rem;
  text-align: center;
  display: none;
}
.success-card.show { display: block; }
.success-card h2   { color: #15803d; font-size: 1.25rem; margin-bottom: 0.5rem; }
.success-card .po-number {
  font-size: 1.75rem;
  font-weight: 800;
  color: #1e293b;
  margin: 1rem 0;
  letter-spacing: 1px;
}
.success-card p { color: #64748b; font-size: 0.9rem; margin-bottom: 1.5rem; }

/* ── Status badges ─────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-draft            { background: #f1f5f9; color: #64748b; }
.badge-submitted        { background: #eff6ff; color: #1d4ed8; }
.badge-pending_approval { background: #fff7ed; color: #c2410c; }
.badge-approved         { background: #f0fdf4; color: #15803d; }
.badge-rejected         { background: #fef2f2; color: #b91c1c; }

/* ── Filter bar ────────────────────────────────────────────────────────────── */

.filter-bar {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 130px;
}

.filter-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}

.filter-group input,
.filter-group select {
  padding: 0.45rem 0.75rem;
  font-size: 0.875rem;
  margin: 0;
}

/* ── PO detail document ────────────────────────────────────────────────────── */

.doc-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.doc-header {
  background: #1d4ed8;
  color: #fff;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.doc-header-left h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 0.2rem;
}

.doc-header-left p { font-size: 0.875rem; opacity: 0.8; }

.doc-body { padding: 1.75rem 2rem; }

.doc-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.doc-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.6rem;
}

.doc-field {
  font-size: 0.9rem;
  color: #475569;
  margin-bottom: 0.3rem;
}

.doc-field strong { color: #1e293b; }

.doc-notes-box {
  background: #f8fafc;
  border-radius: 7px;
  padding: 0.85rem 1rem;
  color: #475569;
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}

.doc-grand-total {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 2rem;
  padding: 1rem 1rem 0;
  border-top: 2px solid #e2e8f0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
}

.doc-grand-total span { font-size: 1.2rem; color: #1d4ed8; }

/* ── Approve / Reject action bar (po-detail) ───────────────────────────────── */

.btn-success {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  background: #16a34a;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-success:hover    { background: #15803d; }
.btn-success:disabled { background: #86efac; cursor: not-allowed; }

.btn-danger {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  background: #dc2626;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-danger:hover    { background: #b91c1c; }
.btn-danger:disabled { background: #fca5a5; cursor: not-allowed; }

.action-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-left: 4px solid #f97316;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.action-card .action-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 1rem;
}

.action-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ── Status history (po-detail) ────────────────────────────────────────────── */

.history-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-top: 0;
}

.history-item {
  padding: 0.85rem 0;
  border-bottom: 1px solid #f1f5f9;
}
.history-item:last-child { border-bottom: none; }

.history-meta {
  font-size: 0.82rem;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.history-change {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.history-note {
  color: #64748b;
  font-style: italic;
}

/* ── Superadmin impersonation banner ───────────────────────────────────────── */

.impersonation-banner {
  background: #b91c1c;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.impersonation-banner .btn-exit-impersonation {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.55);
  padding: 0.25rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.impersonation-banner .btn-exit-impersonation:hover { background: rgba(255,255,255,0.3); }

/* ── Nav dropdown (Settings menu) ─────────────────────────────────────────── */

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.82);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.3rem 0.5rem;
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}

.nav-dropdown-toggle:hover,
.nav-dropdown-toggle.active {
  color: #fff;
  background: rgba(255,255,255,0.15);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 210px;
  z-index: 200;
  padding: 0.4rem 0;
}

.nav-dropdown.open .nav-dropdown-menu,
.nav-dropdown:hover .nav-dropdown-menu {
  display: block;
}

#navDashboardDropdown .nav-dropdown-menu {
  right: auto;
  left: 0;
}

#navUserDropdown .nav-dropdown-menu {
  min-width: 240px;
}

.nav-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.55rem 1rem;
  font-size: 0.875rem;
  color: #1e293b;
  text-decoration: none;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
  font-family: inherit;
  line-height: 1.4;
}

a.nav-dropdown-item:hover,
button.nav-dropdown-item:hover {
  background: #f1f5f9;
}

.nav-dropdown-item-disabled {
  color: #94a3b8;
  cursor: default;
}

.nav-dropdown-note {
  display: block;
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.1rem;
}

.nav-dropdown-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 0.4rem 0;
}

.nav-dropdown-logout {
  color: #b91c1c;
  font-weight: 600;
}

.nav-dropdown-logout:hover {
  background: #fef2f2 !important;
}

/* ── Draggable column ordering ─────────────────────────────────────────────── */

.table-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 0.5rem;
}

.col-reset-link {
  background: none;
  border: none;
  font-size: 0.78rem;
  color: #94a3b8;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: color 0.12s;
}
.col-reset-link:hover { color: #64748b; }

/* ── File viewer modal ──────────────────────────────────────────────────────── */

.file-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 400;
  align-items: center;
  justify-content: center;
}
.file-modal-backdrop.open { display: flex; }

.file-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 90vw;
  max-width: 920px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.file-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1.5px solid #e2e8f0;
  gap: 1rem;
  flex-shrink: 0;
}

.file-modal-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.file-modal-header-btns {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.file-modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 0.25rem 0.45rem;
  border-radius: 5px;
  transition: background 0.12s, color 0.12s;
}
.file-modal-close:hover { background: #f1f5f9; color: #1e293b; }

.file-modal-body {
  flex: 1;
  overflow: auto;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}

.file-modal-body iframe {
  width: 100%;
  height: calc(92vh - 70px);
  border: none;
  display: block;
}

.file-modal-body img {
  max-width: 100%;
  max-height: calc(92vh - 70px);
  object-fit: contain;
  display: block;
}

.file-modal-no-preview {
  padding: 2.5rem 2rem;
  color: #64748b;
  font-size: 0.9rem;
  text-align: center;
}

/* ── Business Profile tab strip ───────────────────────────────────────────── */

.biz-tabs {
  display: flex;
  border-bottom: 1.5px solid rgba(255,255,255,.08);
  margin-bottom: 1.75rem;
  gap: 0;
}
.biz-tab {
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted, #64748b);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.biz-tab:hover { color: var(--text, #fff); }
.biz-tab.active {
  color: var(--lav, #8D7BAC);
  border-bottom-color: var(--lav, #8D7BAC);
  font-weight: 600;
}

.nav-dropdown-item--active {
  font-weight: 600;
  color: var(--lav, #8D7BAC) !important;
}

/* ── User avatars ──────────────────────────────────────────────────────────── */

.u-avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: inline-flex;
  vertical-align: middle;
}
.u-avatar-initials {
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--btn-from, #7264a0), var(--btn-to, #9B8BBE));
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* User & Settings toggle flex layout */
.nav-user-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 0.35rem;
}

/* User identity card at top of User & Settings dropdown */
.nav-user-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem 0.65rem;
  pointer-events: none;
  user-select: none;
}
.nav-user-avatar-img {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.nav-user-avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7264a0, #9B8BBE);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}
.nav-user-info { min-width: 0; }
.nav-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-user-role {
  font-size: 0.75rem;
  color: #64748b;
  text-transform: capitalize;
}
.navbar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.navbar-avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--btn-from, #7264a0), var(--btn-to, #9B8BBE));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Uploader component ─────────────────────────────────────────────────────── */

.upl { position: relative; }

.upl-zone {
  border: 2px dashed rgba(141, 123, 172, 0.35);
  border-radius: 10px;
  padding: 1.4rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s;
  background: rgba(255, 255, 255, .02);
  user-select: none;
}
.upl-zone:focus { outline: 2px solid var(--lav, #8D7BAC); outline-offset: 2px; }
.upl[data-state="drag-over"] .upl-zone {
  border-color: var(--lav, #8D7BAC);
  background: rgba(141, 123, 172, .1);
}
.upl-disabled .upl-zone { opacity: .45; cursor: not-allowed; pointer-events: none; }

.upl-icon {
  font-size: 1.6rem; line-height: 1; margin-bottom: .35rem; opacity: .45;
}
.upl-text { font-size: .875rem; color: var(--muted); line-height: 1.4; }
.upl-browse {
  background: none; border: none; padding: 0;
  color: var(--lav, #8D7BAC); font-size: inherit;
  cursor: pointer; text-decoration: underline;
}
.upl-cam-btn {
  display: inline-block; margin-top: .5rem;
  background: none; border: 1px solid rgba(141, 123, 172, .3);
  color: var(--muted); font-size: .8rem; padding: .25rem .7rem;
  border-radius: 6px; cursor: pointer;
}
.upl-cam-btn:hover { background: rgba(141, 123, 172, .12); }
.upl-sub { font-size: .75rem; color: var(--muted); opacity: .5; margin-top: .35rem; }

.upl-preview-wrap {
  position: relative;
  border-radius: 10px;
  border: 1px solid rgba(141, 123, 172, .22);
  background: rgba(255, 255, 255, .03);
  display: flex; align-items: center; justify-content: center;
  min-height: 80px; padding: .75rem;
}
.upl-preview-img {
  max-width: 100%; max-height: 200px;
  border-radius: 6px; object-fit: contain; display: block;
}
.upl-file-chip {
  display: flex; align-items: center; gap: .5rem; font-size: .875rem;
}
.upl-file-icon { font-size: 1.5rem; }
.upl-file-name { font-weight: 500; word-break: break-all; }
.upl-file-size { opacity: .45; font-size: .8rem; white-space: nowrap; }

.upl-clear-btn {
  position: absolute; top: .4rem; right: .4rem;
  width: 22px; height: 22px;
  background: rgba(0, 0, 0, .5); color: #fff;
  border: none; border-radius: 50%; font-size: 1.1rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.upl-clear-btn:hover { background: rgba(239, 68, 68, .75); }

.upl-overlay {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
}
.upl-spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(255, 255, 255, .25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: upl-spin .7s linear infinite;
}
@keyframes upl-spin { to { transform: rotate(360deg); } }

.upl-status-icon { font-size: 2rem; font-weight: 700; }
.upl-status-icon.success { color: #4ade80; }
.upl-status-icon.error   { color: #f87171; }

.upl-msg { font-size: .8rem; margin-top: .35rem; min-height: 1rem; }
.upl-msg.error   { color: #f87171; }
.upl-msg.success { color: #4ade80; }

/* ── Print styles ──────────────────────────────────────────────────────────── */

@media print {
  .no-print { display: none !important; }
  .navbar   { display: none !important; }
  body.app  { background: #fff; }
  .page-content { margin: 0; padding: 0.5rem; max-width: none; }
  .doc-card { box-shadow: none; border: 1px solid #ccc; }
}
