/* ── REQMA v2 — style.css ──────────────────────────────────────────────── */

:root {
  --navy:     #1a2035;
  --navy-l:   #243050;
  --navy-d:   #121626;
  --orange:   #ff6b35;
  --orange-l: #ff8555;
  --orange-d: #e85d2a;
  --bg:       #f4f6fb;
  --white:    #ffffff;
  --text:     #1e293b;
  --text-muted: #64748b;
  --border:   #e2e8f0;
  --shadow:   0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-md:0 4px 20px rgba(0,0,0,.12);
  --radius:   12px;
  --sidebar-w:260px;
  --topbar-h: 64px;
  --green:    #22c55e;
  --red:      #ef4444;
  --blue:     #3b82f6;
  --amber:    #f59e0b;
  --grey:     #9ca3af;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--orange); text-decoration: none; }
a:hover { color: var(--orange-d); }
button, input, select, textarea { font-family: inherit; }
ul { list-style: none; }
code { font-family: 'JetBrains Mono', 'Fira Code', monospace; }

/* ── Layout ────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .25s ease;
}
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .25s ease;
}
.main-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
}

/* ── Sidebar brand ─────────────────────────────────────────────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon {
  width: 40px; height: 40px;
  background: var(--orange);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.brand-name {
  display: block;
  font-size: 18px; font-weight: 700; color: #fff;
  letter-spacing: .5px;
}
.brand-sub {
  display: block;
  font-size: 11px; color: rgba(255,255,255,.45);
}

/* ── Sidebar nav ───────────────────────────────────────────────────────── */
.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-nav ul { padding: 0; }
.nav-section-label {
  padding: 16px 20px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.3);
  font-weight: 600;
}
.nav-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.7);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 0;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.nav-item a:hover:not(.disabled) {
  background: rgba(255,255,255,.07);
  color: #fff;
  border-left-color: rgba(255,255,255,.2);
}
.nav-item.active a {
  background: var(--orange);
  color: #fff;
  border-left-color: var(--orange-d);
}
.nav-item.nav-disabled a.disabled {
  cursor: default;
  opacity: .55;
}
.nav-item.nav-disabled a.disabled:hover {
  background: none;
  border-left-color: transparent;
}
.nav-icon {
  font-size: 13px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.nav-badge-soon {
  margin-left: auto;
  font-size: 10px;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.5);
  padding: 1px 7px;
  border-radius: 20px;
}
.nav-badge-alert {
  margin-left: auto;
  font-size: 10px;
  background: var(--orange);
  color: #fff;
  padding: 1px 7px;
  border-radius: 20px;
  font-weight: 700;
}

/* ── Sidebar footer ────────────────────────────────────────────────────── */
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.15);
}
.user-avatar {
  width: 34px; height: 34px;
  background: var(--orange);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-info { overflow: hidden; }
.user-name {
  display: block;
  font-size: 12.5px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.role-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 8px;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
}
.role-admin  { background: var(--orange); color: #fff; }
.role-manager{ background: var(--blue); color: #fff; }
.role-viewer { background: rgba(255,255,255,.15); color: rgba(255,255,255,.7); }

/* ── Topbar ────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-avatar {
  width: 32px; height: 32px;
  background: var(--navy);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
.topbar-name { font-size: 13px; font-weight: 500; color: var(--text); }
.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
}
.logout-btn:hover { background: #ef4444; color: #fff; border-color: #ef4444; }
.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  background: transparent;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  flex-shrink: 0;
}
.sidebar-logout-btn:hover { background: #ef4444; color: #fff; border-color: #ef4444; }


.sidebar-toggle {
  display: none;
  flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer;
  padding: 4px;
}
.sidebar-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--text); border-radius: 2px;
}

/* ── Bell button ───────────────────────────────────────────────────────── */
.bell-btn {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  transition: background .15s;
}
.bell-btn:hover { background: var(--orange); color: #fff; border-color: var(--orange); }
.bell-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--orange);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  border: 2px solid #fff;
}

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 15px; font-weight: 600; color: var(--navy);
}
.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }
.chart-body { padding: 16px; min-height: 250px; }
.p-0 { padding: 0 !important; }
.mt-4 { margin-top: 20px; }

/* ── KPI Grid ──────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border-left: 4px solid transparent;
  transition: transform .15s, box-shadow .15s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-blue   { border-left-color: var(--blue); }
.kpi-green  { border-left-color: var(--green); }
.kpi-orange { border-left-color: var(--orange); }
.kpi-red    { border-left-color: #f97316; }
.kpi-danger { border-left-color: var(--red); }
.kpi-icon {
  font-size: 22px;
  margin-bottom: 8px;
  opacity: .7;
}
.kpi-blue   .kpi-icon { color: var(--blue); }
.kpi-green  .kpi-icon { color: var(--green); }
.kpi-orange .kpi-icon { color: var(--orange); }
.kpi-red    .kpi-icon { color: #f97316; }
.kpi-danger .kpi-icon { color: var(--red); }
.kpi-value {
  font-size: 32px; font-weight: 700; color: var(--navy);
  line-height: 1;
}
.kpi-label {
  font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500;
}
.kpi-link {
  font-size: 11px; color: var(--orange); margin-top: 10px;
  font-weight: 500; letter-spacing: .2px;
}
.kpi-link:hover { text-decoration: underline; }

/* ── Dashboard grid ────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; border-radius: var(--radius); }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table thead tr {
  background: #f8fafc;
  border-bottom: 2px solid var(--border);
}
.table thead th {
  padding: 16px 24px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background .15s;
}
.table.table-hover tbody tr:hover { background: #f8fafc; }
.table tbody td {
  padding: 18px 24px;
  color: var(--text);
  vertical-align: middle;
  font-size: 14px;
}
.table tbody tr:last-child { border-bottom: none; }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-active           { background: #dcfce7; color: #166534; }
.badge-expiring         { background: #fff7ed; color: #c2410c; }
.badge-expired          { background: #fee2e2; color: #991b1b; }
.badge-in_registration  { background: #dbeafe; color: #1d4ed8; }
.badge-not_submitted    { background: #f1f5f9; color: #475569; }
.badge-lg { font-size: 13px; padding: 5px 14px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 8px;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--orange); color: #fff; border-color: var(--orange);
}
.btn-primary:hover { background: var(--orange-d); border-color: var(--orange-d); color: #fff; }
.btn-outline {
  background: transparent; color: var(--navy); border-color: var(--border);
}
.btn-outline:hover { background: var(--bg); color: var(--navy); }
.btn-outline-orange {
  background: transparent; color: var(--orange); border-color: var(--orange);
}
.btn-outline-orange:hover { background: var(--orange); color: #fff; }
.btn-danger {
  background: var(--red); color: #fff; border-color: var(--red);
}
.btn-danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-label.required::after { content: ' *'; color: var(--red); }
.form-control {
  width: 100%;
  padding: 9px 13px;
  font-size: 13.5px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255,107,53,.12);
}
.form-control:disabled, .form-control[readonly] {
  background: var(--bg); color: var(--text-muted); cursor: not-allowed;
}
.form-control.is-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}
.invalid-feedback {
  display: none;
  font-size: 12px; color: var(--red); margin-top: 4px;
}
.form-control.is-invalid ~ .invalid-feedback { display: block; }
select.form-control { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 36px;
}
textarea.form-control { resize: vertical; min-height: 100px; }
.input-group { display: flex; position: relative; }
.input-group .form-control { border-radius: 8px 0 0 8px; }
.input-toggle-pw {
  padding: 0 12px;
  background: var(--bg); border: 1.5px solid var(--border); border-left: none;
  border-radius: 0 8px 8px 0; cursor: pointer; color: var(--text-muted);
  font-size: 16px;
}
.input-toggle-pw:hover { background: var(--orange); color: #fff; border-color: var(--orange); }

/* Form layout helpers */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.form-section-title {
  font-size: 13px; font-weight: 700; color: var(--navy);
  text-transform: uppercase; letter-spacing: .5px;
  padding: 8px 0 12px;
  border-bottom: 2px solid var(--orange);
  margin: 20px 0 16px;
}
.form-actions {
  display: flex; gap: 12px; justify-content: flex-end;
  margin-top: 24px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.form-card { max-width: 1100px; }
.form-page { max-width: 1100px; }

/* ── Toolbar (list page) ───────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-form {
  display: flex; align-items: center; gap: 10px; flex: 1; flex-wrap: wrap;
}
.filter-group { display: flex; flex-direction: column; }
.search-input { min-width: 260px; }
.select-filter { min-width: 160px; }
.toolbar-actions { display: flex; gap: 10px; margin-left: auto; }
.results-info { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.action-btns { display: flex; gap: 6px; }
.inline-form { display: inline; }
.form-pill {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Ref code ──────────────────────────────────────────────────────────── */
.ref-code {
  background: var(--navy);
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
}
.ref-code-lg {
  font-size: 16px;
  padding: 4px 14px;
}

/* ── Sort icons ────────────────────────────────────────────────────────── */
.sortable { user-select: none; }
.sort-icon { opacity: .5; font-size: 12px; }

/* ── Detail page ───────────────────────────────────────────────────────── */
.detail-header-card { margin-bottom: 20px; }
.detail-header-inner {
  display: flex; align-items: center; gap: 20px;
  padding: 20px;
  flex-wrap: wrap;
}
.detail-ref-block { display: flex; align-items: center; gap: 10px; }
.detail-title-block { flex: 1; min-width: 200px; }
.product-title { font-size: 22px; font-weight: 700; color: var(--navy); }
.product-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 2px; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}
.detail-dl {}
.dl-row {
  display: flex; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.dl-row:last-child { border-bottom: none; }
dl dt {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .3px;
  width: 160px; flex-shrink: 0;
}
dl dd { font-size: 13.5px; color: var(--text); }
.notes-text { font-size: 13.5px; color: var(--text); line-height: 1.7; white-space: pre-wrap; }
.expiry-delta { font-size: 12px; color: var(--orange); font-weight: 600; margin-left: 6px; }

/* ── Text colors ───────────────────────────────────────────────────────── */
.text-red    { color: var(--red) !important; font-weight: 600; }
.text-orange { color: var(--orange) !important; font-weight: 600; }
.text-green  { color: var(--green) !important; font-weight: 600; }
.text-muted  { color: var(--text-muted) !important; }

/* ── Empty state ───────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 15px; margin-bottom: 16px; }

/* ── Flash messages ────────────────────────────────────────────────────── */
.flash-container {
  padding: 12px 24px 0;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideIn .25s ease;
}
.toast-success  { background: #dcfce7; color: #166534; border-left: 4px solid var(--green); }
.toast-error    { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--red); }
.toast-warning  { background: #fff7ed; color: #c2410c; border-left: 4px solid var(--orange); }
.toast-info     { background: #dbeafe; color: #1d4ed8; border-left: 4px solid var(--blue); }
.toast-close {
  background: none; border: none; cursor: pointer;
  font-size: 16px; color: inherit; opacity: .6; padding: 0 4px;
}
.toast-close:hover { opacity: 1; }

/* JS toast container */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999; max-width: 380px;
}

/* ── Login page ────────────────────────────────────────────────────────── */
.login-page {
  background: var(--navy);
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  position: relative;
}
.login-wrapper {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 20px;
  position: relative; z-index: 2;
}
.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-logo {
  width: 60px; height: 60px;
  background: var(--orange);
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; color: #fff;
  margin-bottom: 12px;
}
.login-title {
  font-size: 26px; font-weight: 800; color: var(--navy);
  letter-spacing: 1px; margin-bottom: 4px;
}
.login-subtitle { font-size: 13px; color: var(--text-muted); }
.login-form .form-group { margin-bottom: 18px; }
.login-hint {
  margin-top: 24px; text-align: center;
  font-size: 12px; color: var(--text-muted); line-height: 1.7;
}

/* Alerts */
.alert {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 16px;
}
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-icon { font-size: 16px; flex-shrink: 0; }

/* BG circles */
.login-bg-circles { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.bg-circle {
  position: absolute; border-radius: 50%;
  background: rgba(255,107,53,.12);
}
.bg-circle-1 { width: 500px; height: 500px; top: -150px; right: -100px; }
.bg-circle-2 { width: 350px; height: 350px; bottom: -100px; left: -80px; }
.bg-circle-3 { width: 200px; height: 200px; top: 50%; right: 10%; opacity: .5; }

/* ── Animations ────────────────────────────────────────────────────────── */
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Print styles ──────────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .toolbar, .flash-container,
  .toast-container, .no-print { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .main-content { padding: 0 !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  .table tbody tr { page-break-inside: avoid; }
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,.3);
  }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-actions { margin-left: 0; }
  .filter-form { flex-direction: column; }
  .search-input, .select-filter { min-width: unset; width: 100%; }
}

/* ════════════════════════════════════════════════════════════════════════
   CTD Builder — Additional Classes (appended, do not remove)
   ════════════════════════════════════════════════════════════════════════ */

/* Layout */
.ctd-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* Left panel */
.ctd-left-panel {
  width: 280px;
  min-width: 280px;
  background: #fff;
  color: #1a2035;
  overflow-y: auto;
  flex-shrink: 0;
  border-right: 1px solid #e2e8f0;
}

/* Right panel */
.ctd-right-panel {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  padding: 0;
  min-width: 0;
}

/* Module header (navy card) */
.ctd-module-header {
  background: var(--navy);
  color: #fff;
  padding: 1rem 1.4rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

/* Section cards */
.ctd-section-card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  margin-bottom: .65rem;
  overflow: hidden;
}

.ctd-section-card.complet       { border-left-color: var(--green); }
.ctd-section-card.manquant      { border-left-color: var(--red); }
.ctd-section-card.en_revision   { border-left-color: var(--blue); }
.ctd-section-card.a_verifier    { border-left-color: var(--amber); }
.ctd-section-card.partie_fermee { border-left-color: var(--grey); opacity: 0.7; }
.ctd-section-card.na            { border-left-color: #94a3b8; }

/* Upload drop zone */
.upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 1.2rem;
  text-align: center;
  cursor: pointer;
  background: #f8fafc;
  color: #64748b;
  transition: all .2s;
}
.upload-zone:hover {
  border-color: #6366f1;
  background: #eef2ff;
  color: #4f46e5;
}

/* Status dot (8px circle) */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-complet       { background: var(--green); }
.dot-manquant      { background: var(--red); }
.dot-en_revision   { background: var(--blue); }
.dot-a_verifier    { background: var(--amber); }
.dot-partie_fermee { background: var(--grey); }
.dot-na            { background: #94a3b8; }

/* ── data-table (alias .table) ─────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table thead tr {
  background: #f8fafc;
  border-bottom: 2px solid var(--border);
}
.data-table thead th {
  padding: 16px 24px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background .15s;
}
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody td {
  padding: 18px 24px;
  color: var(--text);
  vertical-align: middle;
  font-size: 14px;
}
.data-table tbody tr:last-child { border-bottom: none; }

/* Products table — no horizontal scroll, text truncated */
#productsTable td, #productsTable th {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 6px;
  font-size: 12.5px;
}
#productsTable td:hover {
  overflow: visible;
  white-space: normal;
  word-break: break-word;
}

/* ── Global Search ─────────────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  flex: 1;
  max-width: 360px;
}
#globalSearch {
  width: 100%;
  padding: 8px 14px 8px 36px;
  font-size: 13px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}
#globalSearch:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255,107,53,.1);
}
#globalSearch::placeholder { color: var(--text-muted); }

.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  z-index: 999;
  max-height: 380px;
  overflow-y: auto;
}
.search-dropdown.open { display: block; }

.search-cat-title {
  padding: 8px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.search-cat-title:first-child { border-top: none; }

.search-item {
  display: block;
  padding: 8px 14px;
  text-decoration: none;
  transition: background .12s;
}
.search-item:hover { background: var(--bg); }

.search-item-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.search-item-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}
.search-empty {
  padding: 20px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Settings Tabs ─────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--orange);
  border-bottom-color: var(--orange);
  font-weight: 600;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
