@import url("sidebar.css");

/* Basic CentraTruck styles */
:root {
  --primary: #0b5fff;
  --bg: #f7f7f7;
  --muted: #6b7280;
  /* Combined height of .header-top h1 block + .dashboard-nav */
  --header-h: 108px;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  margin: 0;
  padding: 0;
  color: #222;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

header {
  background: var(--primary);
  color: #fff;
  padding: 0.5rem 1rem;
  position: static;
  width: 100%;
  flex-shrink: 0;
}

.dashboard-nav {
  position: sticky;
  top: 0;
  z-index: 240;
}

header .header-top {
  display: flex;
  align-items: center;
  padding: 0 0 0.5rem 0;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

main {
  margin: 0;
}

/* Centered auth layout */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding: 2rem;
  box-sizing: border-box;
  background: #e7f1ff;
}

.setup-page {
  background: linear-gradient(145deg, #1152a5 0%, #1f6be4 60%, #9cc3ff 100%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 10px;
  padding: 2rem;
  box-shadow: 0 8px 30px rgba(11, 95, 255, 0.08);
  border: 1px solid rgba(15, 23, 42, 0.04);
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.auth-logo img {
  max-height: 100px;
  max-width: 220px;
  object-fit: contain;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.setup-brand {
  text-align: center;
  margin-bottom: 1.25rem;
}

.setup-brand .setup-icon {
  font-size: 1.6rem;
  display: block;
  margin: auto auto 0.5rem;
}

.auth-card h2 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  color: #0f172a;
}

.step-indicator {
  font-size: 0.85rem;
  color: #475569;
  margin-bottom: 0.85rem;
  font-weight: 600;
}

.form-step {
  margin-bottom: 1rem;
}

.password-help {
  margin-top: 0.4rem;
  margin-bottom: 0.6rem;
  color: #475569;
  font-size: 0.9rem;
}

.strength-meter {
  height: 10px;
  width: 0;
  background: #eee;
  border-radius: 4px;
  transition: width .2s ease;
  margin-bottom: 0.35rem;
}

.strength-text {
  font-size: 0.9rem;
  color: #334155;
  margin-bottom: 0.8rem;
}

/* Flash/toast messages */
.flashes,
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
  pointer-events: none;
}

.flashes .flash,
.toast .toast,
.toast,
.flashes .toast {
  min-width: 230px;
  max-width: 330px;
  padding: 0.8rem 1rem;
  border-radius: 0.65rem;
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
  opacity: 0;
  transform: translateX(25px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: auto;
  font-size: 0.91rem;
}

.toast.show,
.flashes .flash.show,
.toast.show,
.flashes .toast.show {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.flashes .flash.success,
.toast.success,
.flashes .toast.success {
  background: #22c55e;
  color: #f8fafc;
}

.flashes .flash.error,
.toast.error,
.flashes .toast.error {
  background: #ef4444;
  color: #fff;
}

.flashes .flash.info,
.toast.info,
.flashes .toast.info {
  background: #0b5fff;
  color: #fff;
}


.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  min-width: 230px;
  max-width: 330px;
  padding: 0.8rem 1rem;
  border-radius: 0.65rem;
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
  opacity: 0;
  transform: translateX(25px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: auto;
  font-size: 0.91rem;
}

.toast.show {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.toast.success {
  background: #22c55e;
  color: #f8fafc;
}

.toast.error {
  background: #ef4444;
  color: #fff;
}

/* Customized actions select styling */
.select-wrapper {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}

/* Serials compact table and controls */
.serials-card .serials-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.serials-controls .serial-search {
  padding: 0.45rem 0.6rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  width: 260px;
  font-size: 0.95rem;
}

.serials-controls .copy-all-btn {
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  border: none;
  background: #eff6ff;
  color: #0b5fff;
  cursor: pointer;
  font-weight: 700;
}

.serials-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  table-layout: fixed;
}

.serials-table th,
.serials-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  vertical-align: middle;
}

.serials-table th {
  font-size: 0.78rem;
  color: #6b7280;
  font-weight: 700;
  text-transform: uppercase;
}

.serials-table td.serial-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto Mono', 'Courier New', monospace;
}

.serial-actions {
  text-align: right;
}

.serial-copy-btn {
  background: none;
  border: 1px solid #e6f0ff;
  padding: 0.28rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  color: #0b5fff;
  font-weight: 700;
}

.serial-copy-btn:hover {
  background: #eef6ff;
}

.serial-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.78rem;
}

.serial-badge.available {
  background: #dcfce7;
  color: #15803d;
}

.serial-badge.sold {
  background: #fee2e2;
  color: #b91c1c;
}

.serial-badge.reserved {
  background: #fff7ed;
  color: #b45309;
}

.serials-modal .profile-modal {
  max-width: 760px;
}

@media (max-width: 760px) {
  .serials-modal .profile-modal {
    width: 95vw;
    padding: 1rem;
  }

  .serials-controls .serial-search {
    width: 140px;
  }
}

.select-wrapper .product-action-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding: 0.48rem 1.6rem 0.48rem 0.6rem;
  /* room for pseudo icon */
  border-radius: 8px;
  border: 1px solid #e6e9ef;
  background: #fff;
  font-size: 0.9rem;
  color: #0f172a;
  min-width: 10ch;
}

.select-wrapper::after {
  content: '\22EF';
  /* midline ellipsis as subtle icon */
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: #374151;
  pointer-events: none;
}

.product-action-select:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(11, 95, 255, 0.06);
  border-color: rgba(11, 95, 255, 0.8);
}

.product-action-cell {
  white-space: nowrap;
}



/* Forms */
form {
  width: 100%;
}

.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  color: #0f172a;
  font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"] {
  width: 100%;
  padding: 0.75rem 0.9rem;
  box-sizing: border-box;
  border-radius: 8px;
  border: 1px solid #e6e9ef;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  font-size: 0.95rem;
}

.password-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 1rem;
  cursor: pointer;
  user-select: none;
  padding: 0;
  line-height: 1;
}

.password-toggle:hover {
  color: #0b5fff;
}

input:focus {
  outline: none;
  border-color: rgba(11, 91, 255, 0.8);
  box-shadow: 0 0 0 4px rgba(11, 95, 255, 0.06);
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

button {
  padding: 0.65rem 1rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

button.secondary {
  background: transparent;
  color: #111827;
  border: 1px solid #e6e9ef;
}

.small-links {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.small-links a {
  color: var(--primary);
  text-decoration: none;
}

.version-tag {
  text-align: center;
  margin-top: 0.5rem;
  color: #6b7280;
  font-size: 0.85rem;
}

@media (max-width:480px) {
  .auth-card {
    padding: 1.25rem;
    margin: 0 0.5rem;
  }
}

/* Dashboard layout */
.dashboard-nav {
  position: sticky;
  top: 0;
  z-index: 240;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0b5fff;
  border-top: none;
  padding: 0.75rem 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0;
  box-shadow: 0 2px 8px rgba(11, 95, 255, 0.15);
}

.dashboard-nav-left,
.dashboard-nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.dashboard-nav-right {
  justify-content: flex-end;
}

.dashboard-nav-center {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
}

.dashboard-nav-center a {
  text-decoration: none !important;
  color: #fff !important;
  font-weight: 700 !important;
  padding: 0.35rem 0.8rem;
  border-radius: 6px;
  transition: background 0.15s;
}

.dashboard-nav-center a:hover {
  background: rgba(255, 255, 255, 0.18);
}

.dashboard-nav-right a,
.dashboard-nav-left a {
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
}

.dashboard-nav-right a:hover,
.dashboard-nav-left a:hover {
  background: rgba(255, 255, 255, 0.15);
}

.dashboard-nav-right .user-label {
  font-weight: 700;
  color: #fff;
}

.nav-timestamp {
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.nav-logout-btn {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  color: #fff !important;
  font-weight: 700;
  padding: 0.3rem 0.85rem;
  border-radius: 6px;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  transition: background 0.15s;
}

.nav-logout-btn:hover {
  background: rgba(255, 255, 255, 0.28) !important;
}

.dashboard-layout,
.layout-wrap {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  margin: 0;
  gap: 0;
  padding: 0;
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}

.dashboard-main {
  flex: 1;
  min-height: 0;
  background: #fff;
  border: none;
  border-radius: 0;
  padding: 1.25rem;
  box-shadow: none;
  overflow-y: auto;
}

.dashboard-main::after {
  content: '';
  display: block;
  height: 5rem;
}

.product-form-container {
  max-height: 600px;
  /* compact scrollable form */
  overflow-y: auto;
  padding-right: 0.5rem;
  /* space for scrollbar */
}

.product-form {
  max-width: 700px;
  margin: 0 auto;
}

.dashboard-cards {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 1.5rem;
}

.dashboard-stat {
  background: #fff;
  border: 1px solid #e6e9ef;
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

.dashboard-stat h3 {
  margin: 0 0 .65rem;
  font-size: .9rem;
  color: #334155;
  font-weight: 700;
}

.dashboard-stat p {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
  color: #0f172a;
}

.dashboard-section {
  background: #fff;
  border: 1px solid #e6e9ef;
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

.sales-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: .5rem;
  margin-top: 1rem;
  align-items: end;
}

.sales-bar {
  background: #e2e8f0;
  border-radius: 8px;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100px;
  position: relative;
}

.sales-bar::before {
  content: '';
  display: block;
  width: 100%;
  background: linear-gradient(180deg, #2563eb 0%, #4f46e5 100%);
  border-radius: 5px;
  height: var(--height, 10%);
  position: absolute;
  bottom: 1.15rem;
  left: 0.15rem;
}

.sales-value,
.sales-date {
  z-index: 1;
  text-align: center;
  font-size: 0.72rem;
}

.sales-grid {
  display: grid;
  grid-template-columns: repeat(25, minmax(40px, 1fr));
  gap: .5rem;
  margin-top: 1rem;
  align-items: end;
}

.sales-bar {
  background: #e2e8f0;
  border-radius: 8px;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100px;
  position: relative;
}

.card {
  background: #f9fbff;
  border-radius: 10px;
  border: 1px solid #e6ecf9;
  padding: 1rem;
}

.card h3 {
  margin-top: 0;
  margin-bottom: 1rem;
}

.product-detail-card {
  background: #fff;
  border: 1px solid #dbe1ec;
  box-shadow: 0 10px 24px rgba(0, 35, 80, 0.06);
  padding: 1rem;
  max-width: 900px;
  margin: 0;
  /* removed auto centering to align left while keeping card style */
}

.product-detail-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.product-image-panel {
  display: flex;
  justify-content: center;
}

.product-image-panel img.product-image {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #dbe1ec;
  object-fit: cover;
  max-height: 180px;
}

.product-image-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px dashed #dbe1ec;
  border-radius: 12px;
  background: #f3f7ff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  font-size: 0.85rem;
  text-align: center;
  padding: 0.6rem;
}

.product-detail-content {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.meta-value-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
}

.product-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stock-level {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stock-level span:first-child {
  text-transform: uppercase;
  color: #6b7280;
  font-size: 0.72rem;
  letter-spacing: 0.3px;
}

.stock-badge {
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
}

.stock-high {
  background: #10b981;
}

.stock-low {
  background: #f59e0b;
}

.stock-out {
  background: #dc2626;
}

.stock-unknown {
  background: #6b7280;
}

.product-meta-timestamps {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.product-meta-timestamps div {
  background: #f8fafc;
  border: 1px solid #ebeff6;
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
}

.product-meta-timestamps strong {
  display: block;
  font-size: 0.72rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.product-meta-timestamps small {
  display: block;
  font-size: 0.78rem;
  color: #334155;
}

.product-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.product-card-header h2 {
  margin: 0;
  font-size: 1.45rem;
  color: #0f172a;
}

.status-badge {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: #fff;
  background: #7f9cf5;
}

.status-active {
  background: #10b981;
}

.status-inactive {
  background: #f59e0b;
}

.status-pending {
  background: #3b82f6;
}

.product-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.product-meta-item {
  background: #f8fafc;
  border: 1px solid #ebeff6;
  border-radius: 8px;
  padding: 0.75rem;
}

.product-meta-item span {
  display: block;
  color: #6b7280;
  font-size: 0.78rem;
  margin-bottom: 0.15rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.product-meta-item strong {
  display: block;
  color: #111827;
  font-size: 1rem;
}

.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.product-description {
  margin-top: 1rem;
  background: #f8fafc;
  border: 1px solid #ebeff6;
  border-radius: 8px;
  padding: 0.95rem;
}

.product-description h4 {
  margin-top: 0;
  margin-bottom: 0.65rem;
  font-size: 1.03rem;
  color: #0f172a;
}

.product-description p {
  margin: 0;
  line-height: 1.55;
  color: #334155;
}


@media (max-width: 1024px) {
  .dashboard-layout {
    gap: 0;
    margin: 0;
  }

  .sidebar {
    width: 220px;
    min-width: 220px;
    padding: 1rem;
  }

  .dashboard-main {
    padding: 1.5rem;
  }
}

@media (max-width: 768px) {
  .dashboard-layout {
    flex-direction: column;
    min-height: auto;
    gap: 0;
    margin: 0;
  }

  .sidebar {
    width: 100%;
    min-width: unset;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid #e6e9ef;
  }

  .dashboard-main {
    width: 100%;
    height: auto;
    margin-left: 0;
  }

  #productModal {
    padding: 1rem;
  }

  #productModal .profile-modal {
    width: min(540px, 100%);
    max-height: calc(100vh - 2rem);
  }
}

/* Profile page */
.profile-section {
  background: #f9fbff;
  border-radius: 10px;
  border: 1px solid #e6ecf9;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.profile-section h3 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: #0f172a;
  font-size: 1.1rem;
}

.profile-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  margin-top: 1rem;
}

.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrapper th,
.table-wrapper td {
  padding: 0.9rem 0.7rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 0.92rem;
}

.table-wrapper th {
  background: #f8fafc;
  font-weight: 700;
}

.table-wrapper tr:nth-child(even) {
  background: #f8fafc;
}

.pagination {
  margin-top: 1rem;
}

.pagination a {
  display: inline-block;
  margin-right: .35rem;
  padding: .35rem .65rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  text-decoration: none;
  color: #0f172a;
  transition: background .2s;
}

.pagination a:hover {
  background: #f1f5f9;
}

.pagination a.active {
  background: #0b5fff;
  color: #fff;
  border-color: #0b5fff;
}

.info-item {
  padding: 1rem;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e6e9ef;
}

.info-item label {
  display: block;
  font-weight: 600;
  color: #0b5fff;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.info-item p {
  margin: 0;
  color: #222;
  word-break: break-word;
}

.profile-actions {
  background: #f9fbff;
  border-radius: 10px;
  border: 1px solid #e6ecf9;
  padding: 1.5rem;
}

.profile-actions h3 {
  margin-top: 0;
  margin-bottom: 1rem;
}

.profile-actions ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.profile-actions li {
  margin: 0;
}

.btn {
  display: inline-flex;
  min-width: 160px;
  justify-content: center;
  padding: 0.85rem 1.25rem;
  background: linear-gradient(135deg, #0b5fff 0%, #4f5cff 45%, #7a6cff 100%);
  color: #fff;
  text-decoration: none;
  border-radius: 11px;
  font-weight: 700;
  transition: all 0.25s ease;
  cursor: pointer;
  border: none;
  box-shadow: 0 6px 18px rgba(11, 95, 255, 0.24);
}

.btn:hover {
  background: linear-gradient(135deg, #0a4fff 0%, #3e5cff 48%, #5d6dff 100%);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(11, 95, 255, 0.28);
}

.btn-secondary {
  background: #e6e9ef;
  color: #0f172a;
}

.btn-secondary:hover {
  background: #d1d5e0;
}

/* Modal for edit profile */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop.active {
  display: flex;
}

.profile-modal {
  width: min(540px, 95vw);
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
  padding: 1.25rem;
  position: relative;
}

.profile-modal h3 {
  margin-top: 0;
}

.profile-modal .form-row {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}

.profile-modal .form-row label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1f2a44;
}

.profile-modal .form-row input,
.profile-modal .form-row textarea,
.profile-modal .form-row select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
}

.profile-modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.profile-modal .btn-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: #efeff5;
  color: #2f3e5b;
  font-size: 1rem;
  line-height: 1;
}

.profile-modal .btn-close:hover {
  background: #d7d9e5;
}

.modal-notice {
  display: none;
  margin-bottom: 0.7rem;
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  background: #f8fafc;
  border: 1px solid #d1d5db;
  color: #334155;
  font-size: 0.95rem;
}

.modal-notice.show {
  display: block;
}

#productModal {
  padding: 1.5rem;
  box-sizing: border-box;
}

#productModal .profile-modal {
  width: min(540px, calc(100vw - 3rem));
  max-height: min(640px, calc(100vh - 3rem));
  display: flex;
  flex-direction: column;
}

#productModalForm {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.35rem;
}

#productModalForm .form-row {
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

#productModalForm .form-row small,
#productModalForm .form-help {
  font-size: 0.82rem;
  color: #64748b;
}

#productModalForm .modal-actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding-top: 0.75rem;
}

/* Products table + form */
.product-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid #e6e9ef;
  background: #fff;
}

.product-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.product-table th,
.product-table td {
  border-bottom: 1px solid #eef2f7;
  padding: 0.75rem 0.8rem;
  text-align: left;
  font-size: 0.92rem;
}

.product-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
}

.product-table tbody tr:hover {
  background: #f8fafc;
}

.product-table tbody tr td:last-child {
  white-space: nowrap;
}

.product-name-cell {
  display: grid;
  gap: 0.2rem;
  min-width: 180px;
}

.product-name-main {
  font-weight: 700;
  color: #0f172a;
}

.product-name-sub {
  font-size: 0.8rem;
  color: #64748b;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-action-cell {
  min-width: 170px;
}

.product-action-select {
  width: 100%;
  min-width: 150px;
  padding: 0.62rem 2.3rem 0.62rem 0.8rem;
  border: 1px solid #d7e0ef;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: #0f172a;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%), linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px), 0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.product-action-select:hover {
  border-color: #bfd0f5;
}

.product-action-select:focus-visible {
  outline: none;
  border-color: rgba(11, 91, 255, 0.8);
  box-shadow: 0 0 0 4px rgba(11, 95, 255, 0.08);
}

.product-action-trigger,
.product-action-delete {
  display: none;
}

.product-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.6rem 1rem;
  background: #fff;
  border: 1px solid #e6e9ef;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.product-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.product-toolbar-left::-webkit-scrollbar {
  display: none;
}

.product-toolbar-divider {
  width: 1px;
  height: 28px;
  background: #e2e8f0;
  flex-shrink: 0;
}

.product-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.55rem 0.95rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1d4ed8;
  background: #eff6ff;
  text-decoration: none;
  border-radius: 8px;
  border: 1px solid #c7d2fe;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.btn-tool:hover {
  background: #e0e7ff;
  border-color: #a5b4fc;
  color: #1e40af;
  transform: translateY(-1px);
}

.btn-add-product {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  font-weight: 700;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-add-product:hover {
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.product-toolbar-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  min-width: 0;
}

.product-filter {
  flex: 1 1 160px;
  min-width: 150px;
  max-width: 280px;
  padding: 0.6rem 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #f8fafc;
  color: #334155;
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.product-filter-sm {
  max-width: 160px;
  min-width: 130px;
}

.product-filter::placeholder {
  color: #94a3b8;
}

.product-filter:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  outline: none;
  background: #fff;
}

.btn-filter-submit {
  padding: 0.6rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  background: #0b5fff;
  color: #fff;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-filter-submit:hover {
  background: #2563eb;
}

.product-actions-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e6e9ef;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.product-toolbar-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-add-product {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  font-weight: 700;
  padding: 0.7rem 1.4rem;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
  transition: all 0.2s ease;
}

.btn-add-product:hover {
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}

.product-secondary-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.product-search-row {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
}

.product-actions {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.85rem;
  background: #f9fbff;
  border-radius: 10px;
  border: 1px solid #e6e9ef;
}

.product-search-form {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.product-filter {
  flex: 1 1 160px;
  min-width: 160px;
  max-width: 280px;
  padding: 0.7rem 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-sizing: border-box;
  background: #fff;
  color: #334155;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.product-filter::placeholder {
  color: #a0aec0;
}

.product-filter:focus {
  border-color: rgba(11, 91, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(11, 95, 255, 0.08);
  outline: none;
}

.btn-filter {
  min-width: 100px;
  white-space: nowrap;
}

.product-toolbar-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.product-empty {
  text-align: center;
  color: #6b7280;
  font-style: italic;
  padding: 0.85rem;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: #334155;
}

.breadcrumb a {
  color: #0b5fff;
  text-decoration: none;
  font-weight: 600;
}

.breadcrumb .sep {
  color: #6b7280;
}

/* Field-level error text */
.field-error {
  color: #b91c1c;
  font-size: 0.85rem;
  margin-top: 0.35rem;
  min-height: 1rem;
}

/* Danger button */
.btn-danger {
  background: #f87171;
  color: #fff;
  border: none;
}

.btn-danger:hover {
  background: #ef4444;
}

/* ── Setup page ── */
.setup-card {
  max-width: 500px;
}

.setup-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.setup-brand .setup-icon {
  font-size: 2rem;
  display: block;
  line-height: 1;
  margin-bottom: 0.4rem;
}

.setup-card h2 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  color: #0f172a;
  font-weight: 700;
}

.setup-brand p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Inline checkbox rows */
.form-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.form-inline input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.form-inline label {
  margin-bottom: 0;
  font-weight: 400;
  color: #374151;
  cursor: pointer;
  font-size: 0.9rem;
}

/* Password strength bar */
.strength-bar-wrap {
  background: #e2e8f0;
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
  height: 4px;
}

#strengthMeter,
#su_strengthMeter {
  height: 4px;
  width: 0;
  transition: width .3s, background .3s;
  border-radius: 2px;
  background: #f44336;
}

/* ── Field validation icons ─────────────────────────────────── */
.input-status-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-status-wrap input {
  flex: 1;
  padding-right: 2.25rem;
}

.field-icon {
  position: absolute;
  right: .75rem;
  font-size: 1rem;
  line-height: 1;
  pointer-events: none;
  transition: opacity .15s;
  opacity: 0;
}

.field-icon.visible {
  opacity: 1;
}

.field-icon.valid {
  color: #22c55e;
}

.field-icon.invalid {
  color: #ef4444;
}

.field-hint {
  display: block;
  font-size: .78rem;
  margin-top: .3rem;
  min-height: 1rem;
  color: #ef4444;
}

input.input-valid {
  border-color: #22c55e !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .1);
}

input.input-invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .1);
}

/* Setup form actions — single button: full width column; multi-button: side-by-side row */
.setup-card .form-actions {
  flex-direction: column;
  margin-top: 1.25rem;
}

.setup-card .form-actions .btn {
  width: 100%;
  min-width: unset;
  box-sizing: border-box;
}

.setup-card .form-actions.form-actions-row {
  flex-direction: row;
}

.setup-card .form-actions.form-actions-row .btn {
  flex: 1;
  min-width: 0;
  width: auto;
}

/* Secondary button — remove primary blue shadow */
.btn-secondary {
  box-shadow: none;
}

.btn-secondary:hover {
  transform: none;
  box-shadow: none;
}