/* ═══════════════════════════════════════════════════════════════
   HIDS-GED — DARK THEME PREMIUM HOLOGRAM.CD
   Développé par Hologram
   Chargé EN DERNIER pour surcharger Bootstrap
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg-primary:       #0D1117; /* alias test / intégration : fond principal */
  --bg-base:          #0D1117;
  --bg-card:          #161B22;
  --bg-sidebar:       #0D1117;
  --bg-hover:         #1C2128;
  --bg-input:         #1C2128;
  --bg-header:        #161B22;
  --accent-primary:   #1E6FBF;
  --accent-dark:      #003366;
  --accent-hover:     #2563EB;
  --accent-light:     #3B82F6;
  --text-primary:     #E6EDF3;
  --text-secondary:   #8B949E;
  --text-muted:       #484F58;
  --text-link:        #58A6FF;
  --border:           #30363D;
  --border-subtle:    #21262D;
  --success:          #3FB950;
  --warning:          #D29922;
  --danger:           #F85149;
  --info:             #58A6FF;
  --sidebar-width:    260px;
  --header-height:    60px;
  --radius:           6px;
  --radius-lg:        10px;
  --shadow:           0 4px 16px rgba(0,0,0,0.4);
  --transition:       all 0.15s ease;
}

*, *::before, *::after { box-sizing: border-box; }
[x-cloak] { display: none !important; }

html, body {
  background-color: var(--bg-base) !important;
  color: var(--text-primary) !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif !important;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

.hids-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  box-shadow: 0 1px 8px rgba(0,0,0,0.3);
}

.hids-header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  gap: 16px;
}

.hids-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
  flex-shrink: 0;
  min-width: calc(var(--sidebar-width) - 32px);
}

.hids-logo {
  height: 38px;
  width: auto;
  max-width: 148px;
  object-fit: contain;
  object-position: left center;
  display: block;
  flex-shrink: 0;
}

.hids-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.hids-brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary) !important;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hids-brand-emoji {
  font-size: 1.05em;
  line-height: 1;
  opacity: 0.95;
}

.hids-brand-sub {
  font-size: 0.65rem;
  color: var(--text-muted) !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hids-search { flex: 1; max-width: 480px; }

.hids-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.hids-search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

.hids-search-input {
  width: 100%;
  background: var(--bg-hover) !important;
  border: 1px solid var(--border) !important;
  border-radius: 20px !important;
  color: var(--text-primary) !important;
  padding: 7px 16px 7px 36px !important;
  font-size: 13px !important;
  outline: none;
  transition: var(--transition);
}

.hids-search-input:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 2px rgba(30,111,191,0.2) !important;
}

.hids-search-input::placeholder { color: var(--text-muted) !important; }

.hids-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.hids-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-primary);
}

.hids-user-btn:hover,
.hids-user-btn.active {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
}

.hids-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hids-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.hids-user-role {
  font-size: 11px;
  color: var(--text-muted);
}

.hids-user-info { display: flex; flex-direction: column; line-height: 1.2; }

.hids-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  min-width: 200px;
  z-index: 1100;
  overflow: hidden;
}

.hids-user-menu { position: relative; }

.hids-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: var(--text-primary) !important;
  text-decoration: none !important;
  font-size: 13px;
  transition: var(--transition);
  border: none;
  background: transparent;
  width: 100%;
  cursor: pointer;
}

.hids-dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary) !important;
}

.hids-dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

.hids-dropdown-logout { color: var(--danger) !important; }
.hids-dropdown-logout:hover { background: rgba(248,81,73,0.1); }

.hids-layout {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

.hids-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease;
  z-index: 900;
}

.hids-sidebar-inner { flex: 1; padding: 12px 8px; }

.hids-nav-section { margin-bottom: 20px; }

.hids-nav-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 4px 8px 6px;
}

.hids-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--text-secondary) !important;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 1px;
  position: relative;
}

.hids-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary) !important;
}

.hids-nav-item.active {
  background: rgba(30,111,191,0.15);
  color: var(--accent-light) !important;
  font-weight: 600;
}

.hids-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--accent-primary);
  border-radius: 0 3px 3px 0;
}

.hids-nav-item i { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

.hids-sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
}

.hids-sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hids-sidebar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-dark);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hids-sidebar-user-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.hids-sidebar-user-role {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.hids-sidebar-toggle {
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 6px 10px;
  cursor: pointer;
  display: none;
}

.hids-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 890;
}

.hids-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px;
  min-height: calc(100vh - var(--header-height));
  background: var(--bg-base);
}

#ajax-content { background: var(--bg-base) !important; color: var(--text-primary) !important; }

.hids-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.hids-page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary) !important;
  margin: 0;
}

.hids-page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 3px 0 0;
}

.hids-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.hids-breadcrumb a { color: var(--text-link) !important; text-decoration: none !important; }
.hids-breadcrumb a:hover { color: var(--accent-light) !important; }
.hids-breadcrumb-sep { color: var(--text-muted); }

.hids-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}

.hids-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

.hids-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
}

.hids-card-body { padding: 20px; }

.hids-table-wrap { overflow-x: auto; }

.hids-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text-primary) !important;
}

.hids-table thead th {
  background: var(--bg-card);
  color: var(--text-secondary) !important;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.hids-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text-primary) !important;
  font-size: 13px;
}

.hids-table tbody tr:hover td { background: var(--bg-hover); }
.hids-table tbody tr:last-child td { border-bottom: none; }

.hids-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none !important;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}

.hids-btn-primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff !important;
}
.hids-btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff !important; }

.hids-btn-secondary {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text-primary) !important;
}
.hids-btn-secondary:hover { background: var(--bg-hover); border-color: var(--accent-light); }

.hids-btn-success { background: var(--success); border-color: var(--success); color: #fff !important; }
.hids-btn-success:hover { background: #2ea043; }

.hids-btn-danger { background: var(--danger); border-color: var(--danger); color: #fff !important; }
.hids-btn-danger:hover { background: #da3633; }

.hids-btn-warning { background: var(--warning); border-color: var(--warning); color: #fff !important; }

.hids-btn-sm { padding: 4px 10px; font-size: 12px; }
.hids-btn-lg { padding: 10px 24px; font-size: 15px; }
.hids-btn-full { width: 100%; justify-content: center; }

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

.hids-form-group { margin-bottom: 18px; }

.hids-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.hids-input,
.hids-select,
.hids-textarea {
  display: block;
  width: 100%;
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  color: var(--text-primary) !important;
  padding: 9px 12px !important;
  font-size: 13px !important;
  transition: var(--transition);
  outline: none;
}

.hids-input:focus,
.hids-select:focus,
.hids-textarea:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px rgba(30,111,191,0.2) !important;
}

.hids-input::placeholder,
.hids-textarea::placeholder { color: var(--text-muted) !important; }

input[type="date"],
input[type="datetime-local"] {
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  color: var(--text-primary) !important;
  padding: 9px 12px !important;
  font-size: 13px !important;
  color-scheme: dark !important;
  width: 100%;
  outline: none;
}

input[type="date"]:focus,
input[type="datetime-local"]:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px rgba(30,111,191,0.2) !important;
}

.hids-input-group { position: relative; display: flex; }
.hids-input-group .hids-input { border-radius: var(--radius) 0 0 var(--radius) !important; }
.hids-input-toggle {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
  padding: 0 12px;
  cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent-primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.hids-messages { margin-bottom: 20px; }

.hids-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  border-left: 3px solid;
}

.hids-alert-content { display: flex; align-items: center; gap: 8px; }
.hids-alert-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 16px; opacity: 0.6; padding: 0; }
.hids-alert-close:hover { opacity: 1; }

.hids-alert-success { background: rgba(63,185,80,0.1); color: var(--success); border-color: var(--success); }
.hids-alert-error,
.hids-alert-danger  { background: rgba(248,81,73,0.1); color: var(--danger); border-color: var(--danger); }
.hids-alert-warning { background: rgba(210,153,34,0.1); color: var(--warning); border-color: var(--warning); }
.hids-alert-info    { background: rgba(88,166,255,0.1); color: var(--info); border-color: var(--info); }

.hids-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.hids-badge-primary { background: rgba(30,111,191,0.2); color: var(--accent-light); }
.hids-badge-success { background: rgba(63,185,80,0.2); color: var(--success); }
.hids-badge-danger  { background: rgba(248,81,73,0.2); color: var(--danger); }
.hids-badge-warning { background: rgba(210,153,34,0.2); color: var(--warning); }
.hids-badge-muted   { background: var(--bg-hover); color: var(--text-muted); }

.hids-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  gap: 4px;
}

.hids-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.hids-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.hids-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.hids-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.hids-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.hids-modal-body { padding: 20px; }

.hids-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.hids-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 20px;
  justify-content: center;
}

.hids-page-btn {
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-link) !important;
  text-decoration: none !important;
  font-size: 13px;
  transition: var(--transition);
}

.hids-page-btn:hover { background: var(--bg-hover); border-color: var(--accent-light); }
.hids-page-btn.active { background: var(--accent-primary); border-color: var(--accent-primary); color: #fff !important; }
.hids-page-btn.disabled { opacity: 0.4; pointer-events: none; }

.hids-signature-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-card);
  border-top: 2px solid var(--accent-primary);
  padding: 20px;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
  z-index: 1050;
  max-height: 65vh;
  overflow-y: auto;
}

.hids-login-body {
  background: var(--bg-base) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.hids-login-container {
  width: 100%;
  max-width: 420px;
}

.hids-login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.hids-login-header {
  text-align: center;
  padding: 32px 24px 24px;
  background: linear-gradient(135deg, var(--accent-dark) 0%, #0D2748 100%);
  border-bottom: 1px solid var(--border);
}

.hids-login-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 14px;
  width: 88px;
  height: 88px;
  border-radius: 18px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
}

.hids-login-logo {
  height: 72px;
  width: 72px;
  max-width: none;
  object-fit: contain;
  display: block;
  margin: 0;
}

.hids-login-title { font-size: 1.5rem; font-weight: 800; color: #fff; margin: 0 0 4px; }
.hids-login-subtitle { font-size: 12px; color: rgba(255,255,255,0.65); margin: 0 0 4px; }
.hids-login-company { font-size: 11px; color: rgba(255,255,255,0.45); margin: 0; text-transform: uppercase; letter-spacing: 0.1em; }

.hids-login-form { padding: 24px; }
.hids-login-footer { padding: 16px 24px; border-top: 1px solid var(--border-subtle); text-align: center; color: var(--text-muted); }

.hids-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.hids-empty-icon { font-size: 3rem; margin-bottom: 12px; display: block; }
.hids-empty-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.hids-empty-desc { font-size: 13px; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

@media (max-width: 1200px) {
  :root { --sidebar-width: 220px; }
}

@media (max-width: 768px) {
  /* Aligné contrat tests intégraux (complète la règle 767px ci-dessous) */
  .hids-main { padding: 16px; }
}

@media (max-width: 991px) {
  .hids-brand-sub { display: none; }
  .hids-user-info { display: none; }
}

.dashboard-archive-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 767px) {
  .hids-sidebar-toggle { display: flex; }

  .hids-sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }
  .hids-sidebar.open { transform: translateX(0); }
  .hids-sidebar-overlay.open { display: block; }

  .hids-main { margin-left: 0; padding: 16px; }

  .hids-search { display: none; }

  .hids-table thead th:nth-child(n+4) { display: none; }
  .hids-table tbody td:nth-child(n+4) { display: none; }

  .hids-btn-actions { flex-direction: column; }
  .hids-btn-full-mobile { width: 100%; justify-content: center; }

  .hids-modal { margin: 10px; }
  .hids-signature-panel { max-height: 80vh; }

  .hids-page-header { flex-direction: column; }

  .dashboard-archive-grid { grid-template-columns: 1fr; }
}

@media (max-width: 375px) {
  body { font-size: 13px; }
  .hids-main { padding: 12px; }
  .hids-card-body { padding: 14px; }
}

.hids-divider { height: 1px; background: var(--border); margin: 16px 0; }
a:not(.hids-btn):not(.hids-nav-item):not(.hids-dropdown-item):not(.hids-page-btn) { color: var(--text-link); }
.hids-nav-item,
.hids-dropdown-item { color: var(--text-secondary); }
h1,h2,h3,h4,h5,h6 { color: var(--text-primary) !important; }
.text-muted { color: var(--text-secondary) !important; }
hr { border-color: var(--border) !important; }

/* Anciennes classes page login (compat.) */
body.hids-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-base);
  color: var(--text-primary);
}
.hids-plain-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.hids-notif-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  text-decoration: none !important;
  transition: var(--transition);
}
.hids-notif-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.rotate-180 { transform: rotate(180deg); }
.transition { transition: var(--transition); }

/* Onglets fiche document */
.hids-tab, .hids-tab-active {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}
.hids-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.hids-tab-active {
  color: var(--accent-light);
  border-bottom-color: var(--accent-primary);
  background: var(--bg-hover);
}
