:root {
  --primary:       #0a1628;
  --primary-light: #0090DF;
  --primary-dark:  #050e1a;
  --blr-blue:      #00A6FF;
  --blr-blue-dark: #0090DF;
  --blr-black:     #0a1628;
  --accent:        #00A6FF;
  --accent-light:  #33bbff;
  --success:       #16a34a;
  --warning:       #d97706;
  --danger:        #dc2626;
  --info:          #0090DF;
  --bg:            #f0f4f8;
  --bg-card:       #ffffff;
  --text:          #0a1628;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --sidebar-w:     260px;
  --header-h:      64px;
  --radius:        10px;
  --radius-sm:     6px;
  --shadow:        0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.13);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, #050e1a 0%, #0a1628 45%, #0d2040 100%);
  position: relative;
  overflow: hidden;
}
.auth-page::before {
  content: '';
  position: absolute;
  top: -180px; left: -180px;
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(0,166,255,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.auth-page::after {
  content: '';
  position: absolute;
  bottom: -120px; right: -120px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(0,144,223,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.auth-card {
  background: rgba(255,255,255,0.97);
  border-radius: 18px;
  padding: 48px 44px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.08);
  position: relative; z-index: 1;
}

.auth-logo { text-align: center; margin-bottom: 36px; }
.auth-logo .blr-wordmark {
  display: flex; align-items: baseline; justify-content: center;
  gap: 0; margin-bottom: 6px;
}
.auth-logo .blr-b {
  font-size: 42px; font-weight: 900;
  background: linear-gradient(135deg, #00A6FF 0%, #000 60%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; letter-spacing: -1px; line-height: 1;
  font-family: 'Inter', sans-serif;
}
.auth-logo .blr-lr {
  font-size: 42px; font-weight: 900; color: #0a1628;
  letter-spacing: -1px; line-height: 1; font-family: 'Inter', sans-serif;
}
.auth-logo .blr-divider {
  width: 100%; height: 1.5px;
  background: linear-gradient(90deg, transparent, #00A6FF 30%, #0a1628 70%, transparent);
  margin: 8px 0 10px;
}
.auth-logo .blr-agency {
  font-size: 10px; font-weight: 400; color: #64748b;
  text-transform: uppercase; letter-spacing: 2.5px; margin-bottom: 4px;
}
.auth-logo .blr-name {
  font-size: 22px; font-weight: 900; color: #0090DF;
  letter-spacing: -0.5px; font-family: 'Inter', sans-serif;
}
.auth-logo .blr-cie { font-size: 14px; font-weight: 400; font-style: italic; color: #0090DF; }
.auth-logo h1 {
  font-size: 11px; font-weight: 500; color: var(--text-muted);
  letter-spacing: 0.5px; text-transform: uppercase; margin-top: 14px;
}

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

.form-control {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 14px; font-family: inherit; color: var(--text);
  background: #f8fafc; transition: border-color 0.2s, box-shadow 0.2s; outline: none;
}
.form-control:focus { border-color: var(--primary-light); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,168,0.12); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }

.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-left: 40px; }
.input-icon-wrap .input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 15px; }

.tags-input-wrap {
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: #f8fafc; padding: 6px 10px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  min-height: 44px; cursor: text; transition: border-color 0.2s, box-shadow 0.2s;
}
.tags-input-wrap:focus-within { border-color: var(--primary-light); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,168,0.12); }
.tags-input-wrap input {
  border: none; outline: none; background: transparent;
  font-size: 13px; font-family: inherit; color: var(--text); flex: 1; min-width: 100px;
}
.tag-item {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--primary); color: #fff;
  border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 500;
}
.tag-item.tag-numeric { background: var(--info); }
.tag-remove { cursor: pointer; font-size: 14px; line-height: 1; opacity: 0.7; }
.tag-remove:hover { opacity: 1; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; font-family: inherit;
  border: none; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--blr-blue-dark), var(--blr-blue)); color: #fff; }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #007ac0, var(--blr-blue)); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,166,255,0.35); }
.btn-accent { background: linear-gradient(135deg, var(--blr-black), #1a3060); color: #fff; }
.btn-accent:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(10,22,40,0.4); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; transform: translateY(-1px); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover:not(:disabled) { background: #b45309; transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: var(--bg); }
.btn-outline-white { background: transparent; border: 1.5px solid rgba(255,255,255,0.3); color: rgba(255,255,255,0.85); }
.btn-outline-white:hover:not(:disabled) { background: rgba(255,255,255,0.1); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

.toggle-wrap { display: flex; align-items: center; gap: 8px; }
.toggle { position: relative; display: inline-block; width: 42px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #cbd5e1; border-radius: 24px; transition: 0.3s;
}
.toggle-slider:before {
  content: ""; position: absolute;
  width: 18px; height: 18px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%; transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--primary-light); }
.toggle input:checked + .toggle-slider:before { transform: translateX(18px); }

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

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #050e1a 0%, #0a1628 60%, #0d1f3a 100%);
  color: #fff;
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 100; transition: transform 0.3s;
  border-right: 1px solid rgba(0,166,255,0.15);
}

.sidebar-brand { padding: 0 0 12px; border-bottom: 1px solid rgba(0,166,255,0.15); text-align: center; }
.sidebar-brand .brand-logo { display: block; padding: 18px 20px 10px; background: rgba(0,0,0,0.2); }
.sidebar-brand .brand-logo img { display: none; }
.sidebar-wordmark {
  display: flex; align-items: baseline; justify-content: center;
  gap: 5px; flex-wrap: wrap;
}
.sw-b {
  font-size: 26px; font-weight: 900;
  background: linear-gradient(135deg, #00A6FF 0%, #ffffff 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; line-height: 1;
}
.sw-lr { font-size: 26px; font-weight: 900; color: #ffffff; line-height: 1; }
.sw-name {
  font-size: 12px; font-weight: 700; color: #0090DF; letter-spacing: 0.5px;
  width: 100%; text-align: center; margin-top: 3px; display: block;
}
.sidebar-brand h2 { display: none; }
.sidebar-brand .brand-sub {
  font-size: 10px; opacity: 0.45; margin-top: 6px;
  text-transform: uppercase; letter-spacing: 1px; padding: 0 20px; color: #fff;
}

.sidebar-user {
  padding: 12px 16px; border-bottom: 1px solid rgba(0,166,255,0.12);
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,166,255,0.05);
}
.sidebar-user .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blr-blue), var(--blr-blue-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,166,255,0.35);
}
.sidebar-user .user-info small { display: block; font-size: 10px; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.5px; }
.sidebar-user .user-info strong { font-size: 13px; display: block; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section-title { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; opacity: 0.4; padding: 12px 20px 6px; color: var(--blr-blue); }

.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.65);
  border-left: 3px solid transparent; transition: all 0.2s;
}
.sidebar-nav a:hover { background: rgba(0,166,255,0.1); color: #fff; border-left-color: rgba(0,166,255,0.4); }
.sidebar-nav a.active { background: rgba(0,166,255,0.15); color: #fff; border-left-color: var(--blr-blue); }
.sidebar-nav a.active i { color: var(--blr-blue); }
.sidebar-nav a i { width: 18px; text-align: center; font-size: 14px; color: rgba(255,255,255,0.45); transition: color 0.2s; }

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

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

.top-header {
  background: var(--bg-card); height: var(--header-h);
  border-bottom: 2px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06); gap: 12px;
}
.top-header h3 { font-size: 16px; font-weight: 700; color: var(--text); flex-shrink: 0; letter-spacing: -0.3px; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.burger-btn {
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: var(--text); padding: 6px;
  border-radius: 8px; display: none;
}
@media (max-width: 900px) { .burger-btn { display: flex; align-items: center; } }

.notif-btn {
  position: relative; background: none; border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 7px 12px;
  cursor: pointer; font-size: 16px; color: var(--text-muted);
  transition: all 0.2s; display: flex; align-items: center; gap: 6px;
  overflow: visible;
}
.notif-btn:hover { background: var(--bg); color: var(--primary); border-color: var(--primary-light); }
.notif-count {
  position: absolute; top: -8px; right: -8px;
  background: #dc2626; color: #fff;
  border-radius: 50%; font-size: 10px; font-weight: 800;
  min-width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 2.5px solid var(--bg-card);
  line-height: 1;
  animation: pulse-notif 1.5s infinite;
  box-shadow: 0 2px 6px rgba(220,38,38,0.5);
}
.notif-count.hidden { display: none !important; }

@keyframes pulse-notif {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.notif-dropdown {
  position: absolute; top: calc(var(--header-h) + 4px); right: 24px;
  width: 360px; max-width: 95vw; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); z-index: 500;
  display: none; animation: modalIn 0.2s ease;
}
.notif-dropdown.open { display: block; }
.notif-dropdown-header {
  padding: 14px 18px 10px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.notif-dropdown-header h4 { font-size: 14px; font-weight: 600; }
.notif-list { max-height: 340px; overflow-y: auto; }
.notif-item {
  padding: 12px 18px; border-bottom: 1px solid #f1f5f9;
  cursor: pointer; transition: background 0.15s;
  display: flex; gap: 10px; align-items: flex-start;
}
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #eff6ff; }
.notif-item:last-child { border-bottom: none; }
.notif-icon {
  width: 34px; height: 34px; border-radius: 50%;
  background: #dbeafe; color: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.notif-icon.green { background: #dcfce7; color: var(--success); }
.notif-icon.orange { background: #ffedd5; color: var(--warning); }
.notif-icon.red { background: #fee2e2; color: var(--danger); }
.notif-content p { font-size: 13px; line-height: 1.4; color: var(--text); }
.notif-content small { font-size: 11px; color: var(--text-muted); }
.notif-empty { padding: 28px; text-align: center; color: var(--text-muted); font-size: 13px; }

.mode-switch-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--text-muted); transition: all 0.2s;
}
.mode-switch-btn:hover { background: var(--bg); color: var(--primary); border-color: var(--primary-light); }
.mode-switch-btn.mobile-active { background: var(--primary); color: #fff; border-color: var(--primary); }

.page-content { padding: 28px; flex: 1; }
.page-section { display: none; }
.page-section.active { display: block; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 99;
  opacity: 0; pointer-events: none;
}
.sidebar-overlay.open { display: block; opacity: 1; pointer-events: all; }

.card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h4 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; flex-shrink: 0;
}
.stat-icon.blue   { background: #dbeafe; color: var(--primary-light); }
.stat-icon.green  { background: #dcfce7; color: var(--success); }
.stat-icon.orange { background: #ffedd5; color: var(--warning); }
.stat-icon.red    { background: #fee2e2; color: var(--danger); }
.stat-icon.cyan   { background: #cffafe; color: var(--info); }
.stat-icon.yellow { background: #fef9c3; color: #ca8a04; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-info .stat-value { font-size: 24px; font-weight: 700; line-height: 1; color: var(--text); }
.stat-info .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: #f8fafc; padding: 11px 14px;
  text-align: left; font-weight: 600; font-size: 12px;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.5px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; color: var(--text); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-soumis    { background: #e0f2fe; color: #0369a1; }
.badge-en-attente{ background: #e0f2fe; color: #0369a1; }
.badge-pris      { background: #fef9c3; color: #92400e; }
.badge-ok        { background: #dcfce7; color: #166534; }
.badge-consigne  { background: #fee2e2; color: #991b1b; }
.badge-cloture   { background: #f1f5f9; color: #475569; }
.badge-annule    { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.badge-admin     { background: #ede9fe; color: #7c3aed; }
.badge-commis    { background: #dbeafe; color: #1d4ed8; }
.badge-declarant { background: #dcfce7; color: #166534; }
.badge-actif     { background: #dcfce7; color: #166534; }
.badge-inactif   { background: #fee2e2; color: #991b1b; }
.badge-sivep     { background: #fef3c7; color: #92400e; }
.badge-douane    { background: #dbeafe; color: #1e40af; }
.badge-oui       { background: #dcfce7; color: #166534; }
.badge-non       { background: #f1f5f9; color: #475569; }
.badge-client    { background: #fdf4ff; color: #9333ea; }
.badge-retour-uk   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; font-weight: 700; }
.badge-destruction { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.badge-doc         { background: #fef9c3; color: #92400e; border: 1px solid #f59e0b; }
.badge-pause       { background: #fef9c3; color: #92400e; border: 1px solid #f59e0b; }
.badge-quai        { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; border: 1px solid #f59e0b; font-weight: 700; }
.badge-assignee-me { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #1d4ed8; border: 1px solid #93c5fd; font-weight: 700; }
.badge-assignee    { background: #eff6ff; color: #3b82f6; border: 1px solid #bfdbfe; }
.badge-subscriber  { background: #fefce8; color: #a16207; border: 1px solid #fde68a; }

.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 1000;
  align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card); border-radius: 14px;
  width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: modalIn 0.2s ease;
}
.modal-lg { max-width: 820px; }
.modal-xl { max-width: 960px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-muted); cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: background 0.2s; }
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-header-success { background: linear-gradient(135deg, #ecfdf5, #d1fae5); }
.modal-header-warning { background: linear-gradient(135deg, #fffbeb, #fef3c7); }
.modal-header-danger  { background: linear-gradient(135deg, #fef2f2, #fee2e2); }

.chat-area { display: flex; flex-direction: column; gap: 14px; max-height: 350px; overflow-y: auto; padding: 4px 0; }
.chat-message { display: flex; gap: 10px; }
.chat-message.mine { flex-direction: row-reverse; }
.chat-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0; color: #fff;
}
.chat-avatar.declarant { background: var(--success); }
.chat-avatar.commis    { background: var(--primary-light); }
.chat-avatar.admin     { background: #7c3aed; }
.chat-bubble {
  background: #f1f5f9; border-radius: 12px 12px 12px 3px;
  padding: 10px 14px; max-width: 75%; font-size: 13px; line-height: 1.5;
}
.chat-message.mine .chat-bubble {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; border-radius: 12px 12px 3px 12px;
}
.chat-meta { font-size: 11px; margin-top: 4px; color: var(--text-muted); }
.chat-message.mine .chat-meta { color: rgba(255,255,255,0.7); }
.chat-sender { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 3px; }
.chat-message.mine .chat-sender { text-align: right; color: rgba(255,255,255,0.8); }
.chat-input-wrap { display: flex; gap: 10px; margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px; }
.chat-input-wrap textarea { flex: 1; min-height: 54px; max-height: 100px; }

.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-info    { background: #e0f2fe; color: #0369a1; border: 1px solid #7dd3fc; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--text); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 13px;
  display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow-lg); animation: toastIn 0.3s ease; max-width: 320px;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state i { font-size: 36px; opacity: 0.3; display: block; margin-bottom: 10px; }
.empty-state p { font-size: 14px; }

.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.col { flex: 1; min-width: 220px; }
.col-2 { flex: 2; min-width: 300px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

.dossier-num { font-family: 'Courier New', monospace; font-weight: 700; color: var(--primary-light); font-size: 13px; }
.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters-bar .form-control { width: auto; }

.spinner { width: 38px; height: 38px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status-timeline { display: flex; align-items: center; gap: 0; flex-wrap: wrap; margin: 12px 0; }
.timeline-step { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
.timeline-step .step-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.timeline-step.done .step-dot   { background: var(--success); color: #fff; }
.timeline-step.active .step-dot { background: var(--primary); color: #fff; }
.timeline-step.danger .step-dot { background: var(--danger); color: #fff; }
.timeline-line { flex: 1; height: 2px; background: var(--border); min-width: 14px; }
.timeline-line.done { background: var(--success); }

.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0; }
.info-row { display: flex; gap: 8px; padding: 7px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; align-items: flex-start; }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); min-width: 145px; flex-shrink: 0; font-size: 12px; padding-top: 1px; }
.info-value { color: var(--text); font-weight: 500; word-break: break-word; flex: 1; }
.info-row-empty { opacity: 0.5; }

.commis-section { background: #f8fafc; border-radius: var(--radius); padding: 16px; margin-top: 16px; border: 1px solid var(--border); }
.commis-section h5 { font-size: 13px; font-weight: 600; margin-bottom: 12px; color: var(--primary); display: flex; align-items: center; gap: 6px; }

.dossier-important-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 4px; }
.imp-field { border-radius: 10px; padding: 12px 14px; border: 2px solid transparent; }
.imp-filled { background: linear-gradient(135deg, #eef4ff, #f0fdf4); border-color: #bfdbfe; }
.imp-empty  { background: #f8fafc; border-color: #e2e8f0; opacity: 0.6; }
.imp-required.imp-empty { border-color: #fca5a5; background: #fff7f7; opacity: 0.8; }
.imp-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 5px; display: flex; align-items: center; gap: 5px; }
.imp-filled .imp-label { color: var(--primary); }
.imp-value { font-size: 15px; font-weight: 700; color: var(--text); word-break: break-word; line-height: 1.3; }
.imp-value-empty { font-size: 13px; color: var(--text-muted); font-style: italic; }

.detail-collapsible { max-height: 0; overflow: hidden; transition: max-height 0.35s ease; }
.detail-collapsible.open { max-height: 2000px; }

.manut-toggle { display: inline-flex; border-radius: var(--radius); overflow: hidden; border: 2px solid var(--border); }
.manut-btn { padding: 8px 20px; font-size: 13px; font-weight: 600; font-family: inherit; border: none; cursor: pointer; transition: all 0.2s; background: #f8fafc; color: var(--text-muted); }
.manut-btn.active-oui { background: var(--success); color: #fff; }
.manut-btn.active-non { background: var(--danger); color: #fff; }
.manut-btn:not(.active-oui):not(.active-non):hover { background: var(--bg); }

.port-selector { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.port-btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 58px; height: 52px; border-radius: 10px; border: 2px solid var(--border);
  background: #f8fafc; color: var(--text-muted); cursor: pointer;
  font-family: inherit; transition: all 0.18s; padding: 0;
}
.port-btn .port-code { font-size: 15px; font-weight: 800; letter-spacing: 0.5px; line-height: 1; }
.port-btn .port-sub  { font-size: 9px; font-weight: 500; opacity: 0.7; margin-top: 2px; white-space: nowrap; }
.port-btn:hover:not(.active) { border-color: var(--primary-light); background: #eff6ff; color: var(--primary-light); }
.port-btn.active { border-color: var(--primary-light); background: var(--primary-light); color: #fff; box-shadow: 0 3px 10px rgba(37,99,168,0.35); }
.port-btn.active .port-sub { opacity: 0.85; }

.badge-port { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.3px; }
.badge-port-CLS { background: #dbeafe; color: #1e40af; }
.badge-port-DKK { background: #dcfce7; color: #166534; }
.badge-port-TUN { background: #fef9c3; color: #854d0e; }
.badge-port-BLG { background: #fce7f3; color: #9d174d; }

.type-selector { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.type-btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 80px; height: 52px; border-radius: 10px; border: 2px solid var(--border);
  background: #f8fafc; color: var(--text-muted); cursor: pointer;
  font-family: inherit; transition: all 0.18s; padding: 0 10px; gap: 3px;
}
.type-btn .type-label { font-size: 13px; font-weight: 800; letter-spacing: 0.4px; line-height: 1; }
.type-btn .type-sub   { font-size: 10px; font-weight: 500; opacity: 0.7; white-space: nowrap; }
.type-btn:hover:not(.active) { border-color: var(--primary-light); background: #eff6ff; color: var(--primary-light); }
.type-btn.active-sivep  { border-color: #16a34a; background: #16a34a; color: #fff; box-shadow: 0 3px 10px rgba(22,163,74,0.35); }
.type-btn.active-sivep .type-sub { opacity: 0.85; }
.type-btn.active-douane { border-color: #7c3aed; background: #7c3aed; color: #fff; box-shadow: 0 3px 10px rgba(124,58,237,0.35); }
.type-btn.active-douane .type-sub { opacity: 0.85; }

.fin-ctrl-section { background: #f0fdf4; border: 1.5px solid #bbf7d0; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.fin-ctrl-section.warning { background: #fff7ed; border-color: #fed7aa; }
.fin-ctrl-warning-msg { display: none; background: #fef2f2; border: 1.5px solid #fca5a5; border-radius: var(--radius); padding: 12px 14px; color: #991b1b; font-size: 13px; font-weight: 600; margin-top: 10px; }

.btn-quai {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px;
  background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff;
  font-weight: 700; font-size: 14px; border: none; border-radius: var(--radius);
  cursor: pointer; box-shadow: 0 4px 14px rgba(245,158,11,0.4); transition: all 0.2s;
}
.btn-quai:hover { background: linear-gradient(135deg, #d97706, #b45309); box-shadow: 0 6px 20px rgba(245,158,11,0.5); transform: translateY(-1px); }
.btn-quai:disabled { background: #e2e8f0; color: #94a3b8; box-shadow: none; transform: none; cursor: not-allowed; }

.btn-quai-sm {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px;
  background: #f59e0b; color: #fff; font-weight: 600; font-size: 11px;
  border: none; border-radius: 6px; cursor: pointer; white-space: nowrap; transition: background 0.15s;
}
.btn-quai-sm:hover { background: #d97706; }
.btn-quai-sm:disabled { background: #d1d5db; color: #9ca3af; cursor: not-allowed; }

.quai-banner {
  background: linear-gradient(135deg, #fffbeb, #fef3c7); border: 2px solid #f59e0b;
  border-radius: var(--radius); padding: 14px 20px;
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px;
}
tr.row-quai { background: linear-gradient(90deg,#fffbeb,transparent) !important; }
.row-quai td { background: #fffbeb; }

.btn-arrive-camion {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
  background: linear-gradient(135deg, #059669, #047857); color: #fff;
  border: none; border-radius: 8px; font-weight: 600; font-size: 12px;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(5,150,105,0.25);
}
.btn-arrive-camion:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(5,150,105,0.4); }

.issue-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-top: 10px; }
.issue-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px; border-radius: 12px; border: 2.5px solid var(--border);
  background: #f8fafc; cursor: pointer; font-family: inherit;
  transition: all 0.18s; font-size: 12px; font-weight: 700; color: var(--text-muted);
}
.issue-btn i { font-size: 22px; }
.issue-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.issue-btn.sel-fin    { border-color: #16a34a; background: #f0fdf4; color: #15803d; box-shadow: 0 3px 10px rgba(22,163,74,0.2); }
.issue-btn.sel-retour { border-color: #f59e0b; background: #fffbeb; color: #92400e; box-shadow: 0 3px 10px rgba(245,158,11,0.2); }
.issue-btn.sel-destr  { border-color: #dc2626; background: #fef2f2; color: #991b1b; box-shadow: 0 3px 10px rgba(220,38,38,0.2); }

.btn-subscribe {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
  border-radius: var(--radius); font-size: 12px; font-weight: 600;
  border: 2px solid #fde68a; background: #fefce8; color: #a16207;
  cursor: pointer; transition: all 0.2s;
}
.btn-subscribe:hover { background: #fde68a; }
.btn-subscribe.subscribed { background: #fde68a; color: #78350f; border-color: #f59e0b; }

.assign-panel { background: #f0f7ff; border: 1.5px solid #bfdbfe; border-radius: var(--radius); padding: 14px 16px; margin-top: 14px; }
.assign-panel h5 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--primary); margin-bottom: 10px; }

.client-dossier-card {
  background: var(--bg-card); border-radius: 14px; border: 1.5px solid var(--border);
  padding: 18px; transition: all 0.2s; cursor: pointer; position: relative; overflow: hidden;
}
.client-dossier-card:hover { border-color: var(--primary-light); box-shadow: 0 6px 24px rgba(37,99,168,0.13); transform: translateY(-2px); }
.client-dossier-card .card-status-bar { position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: 14px 14px 0 0; }

.card-consigne-alert { background: #fef2f2; border: 1px solid #fca5a5; border-radius: 8px; padding: 8px 10px; font-size: 12px; color: #991b1b; margin-bottom: 8px; }
.card-quai-alert    { background: #fefce8; border: 1px solid #fde047; border-radius: 8px; padding: 8px 10px; font-size: 12px; color: #92400e; margin-bottom: 8px; }

.tag-douanier { background: #ede9fe; color: #6d28d9; border-radius: 4px; padding: 2px 7px; font-size: 11px; font-weight: 600; border: 1px solid #ddd6fe; }

@keyframes shimmer {
  0%   { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200px 100%; animation: shimmer 1.5s infinite;
  border-radius: 6px; display: inline-block;
}

@media (max-width: 1200px) {
  :root { --sidebar-w: 220px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 260px; }
  .sidebar { transform: translateX(-100%); z-index: 200; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 32px rgba(0,0,0,0.35); }
  /* overlay : visible (opaque) seulement quand .open, sinon transparent et non-interactif */
  .sidebar-overlay { display: block; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
  .sidebar-overlay.open { opacity: 1; pointer-events: all; }
  .main-content { margin-left: 0 !important; }
  .top-header { padding: 0 16px; }
  .page-content { padding: 14px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .filters-bar .form-control { max-width: 100% !important; width: 100% !important; }
  .issue-grid { grid-template-columns: 1fr; }
  .issue-btn { flex-direction: row; justify-content: flex-start; padding: 12px 14px; gap: 12px; }
  .issue-btn i { font-size: 18px; min-width: 24px; }
  .form-row { flex-direction: column; }
  .modal { max-width: calc(100vw - 24px) !important; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .card-header { flex-wrap: wrap; gap: 8px; }
  table { font-size: 12px; }
  table thead th, table tbody td { padding: 8px 8px; }
  .btn { padding: 7px 12px; font-size: 12px; }
  .top-header h3 { font-size: 14px; }
  .modal { max-width: 100% !important; margin: 0 !important; border-radius: 14px 14px 0 0; max-height: 92vh; }
  .modal-overlay { align-items: flex-end !important; padding: 0 !important; }
  .auth-card { padding: 32px 20px; border-radius: 14px; }
  .page-content { padding: 10px; }
}

/* ─── Dashboard commis : Dossiers en cours à gauche, En attente à droite ─────── */
.row-dashboard { display: flex; gap: 24px; align-items: flex-start; }
.row-dashboard .col-encours { flex: 1 1 50%; min-width: 0; order: 1; }
.row-dashboard .col-attente  { flex: 1 1 50%; min-width: 0; order: 2; }

@media (max-width: 900px) {
  .row-dashboard { flex-direction: column; gap: 16px; }
  .row-dashboard .col-encours { flex: 1 1 100%; order: 1; }
  .row-dashboard .col-attente  { flex: 1 1 100%; order: 2; }
}

/* ─── Référence cliquable ────────────────────────────────────────────────────── */
.dos-ref-link {
  cursor: pointer;
  color: var(--primary-light);
  text-decoration: underline dotted;
  transition: color 0.15s;
}
.dos-ref-link:hover { color: var(--blr-blue-dark); text-decoration: underline; }

/* ─── btn-quai-sm avec classe action-primary en mobile ─────────────────────── */
@media (max-width: 640px) {
  .dos-card-actions .btn-quai-sm.btn-action-primary {
    flex: 1 1 100%;
    min-height: 44px;
    font-size: 13px;
    font-weight: 600;
    padding: 11px 14px;
    justify-content: center;
    text-align: center;
  }
}

.mobile-cards-container { display: none; }

@media (max-width: 640px) {
  /* Masquer les tableaux, afficher les cards */
  .table-wrap-responsive table { display: none !important; }
  .mobile-cards-container { display: block; }

  /* Card dossier */
  .dos-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    position: relative;
  }
  .dos-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .dos-card-ref {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    flex: 1;
  }
  .dos-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
    font-size: 12px;
    margin-bottom: 10px;
  }
  .dos-card-field { display: flex; flex-direction: column; }
  .dos-card-label { color: var(--text-muted); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; }
  .dos-card-value { color: var(--text); font-size: 12px; font-weight: 500; }
  .dos-card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: 4px;
  }
  /* Bouton d'action principal (Passage à quai, Fin de contrôle, Issue, Prendre) : pleine largeur */
  .dos-card-actions .btn-action-primary {
    flex: 1 1 100%;
    padding: 11px 14px;
    font-size: 13px;
    font-weight: 600;
    min-height: 44px;
    justify-content: center;
    text-align: center;
    border-radius: var(--radius);
  }
  /* Bouton btn-accent (Prendre en charge) : pleine largeur */
  .dos-card-actions .btn-accent {
    flex: 1 1 100%;
    min-height: 44px;
    font-size: 13px;
    font-weight: 600;
    padding: 11px 14px;
    justify-content: center;
    text-align: center;
    border-radius: var(--radius);
  }
  /* Boutons intermédiaires CTRL Docs / Pause / Att. quai : 2 par ligne */
  .dos-card-actions .btn-sm:not(.btn-action-primary):not(.btn-accent):not(.btn-outline):not(.btn-primary):not(.btn-danger) {
    flex: 1 1 calc(50% - 4px);
    min-height: 40px;
    padding: 8px 6px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
  }
  /* Boutons icônes (modifier, voir, supprimer) : carrés */
  .dos-card-actions .btn-sq,
  .dos-card-actions .btn-outline.btn-sm,
  .dos-card-actions .btn-primary.btn-sm,
  .dos-card-actions .btn-danger.btn-sm {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    border-radius: var(--radius);
  }
  .dos-card-empty { text-align: center; padding: 28px; color: var(--text-muted); font-size: 13px; }

  /* Stats compactes */
  .stat-card { padding: 10px 12px; }
  .stat-icon { width: 38px; height: 38px; font-size: 16px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 10px; }
}

/* ─── Chips destinataires éditables ─────────────────────────────────────── */
.recip-chips {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px;
}
.recip-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #e0f2fe; border: 1px solid #7dd3fc;
  border-radius: 20px; padding: 3px 10px 3px 10px;
  font-size: 12px; color: #0369a1; font-weight: 500;
  transition: background 0.15s;
}
.recip-chip-remove {
  background: none; border: none; padding: 0; margin: 0;
  cursor: pointer; color: #dc2626; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  transition: background 0.15s;
}
.recip-chip-remove:hover { background: #fee2e2; }

/* Toggle email notif client */
.email-notif-toggle-wrap {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px; margin-top: 10px;
  font-size: 13px;
}
.toggle-switch {
  position: relative; width: 42px; height: 24px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #d1d5db; border-radius: 24px; transition: 0.2s;
}
.toggle-slider:before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background: #16a34a; }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }
