/* ═══════════════════════════════════════════════════════════════════
   SUKUMA PORTAIL — CSS v4 COMPLET
   Breakpoints: 1200 · 960 · 860 · 700 · 540 · 400px
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ── Reset & Variables ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --pk:      #00C2A7;
  --sec:     #69C0F6;
  --dark:    #0a2540;
  --tx:      #0f1f2e;
  --mu:      #64748b;
  --bg:      #f6f5f3;
  --bg2:     #f0efed;
  --bd:      #e2e8f0;
  --white:   #ffffff;
  --grad:    linear-gradient(135deg, #00C2A7 0%, #69C0F6 100%);
  --r:       10px;
  --r2:      14px;
  --r3:      20px;
  --sh:      0 1px 3px rgba(0,0,0,.07), 0 2px 8px rgba(0,0,0,.05);
  --sh-md:   0 4px 16px rgba(0,0,0,.1), 0 1px 4px rgba(0,0,0,.06);
  --sidebar: 220px;
  --topbar:  56px;
  /* Status colors */
  --danger-bg:  #fef2f2; --danger-tx:  #991b1b; --danger-bd:  #fecaca;
  --warning-bg: #fffbeb; --warning-tx: #92400e; --warning-bd: #fde68a;
  --success-bg: #f0fdf4; --success-tx: #166534; --success-bd: #bbf7d0;
  --info-bg:    #eff6ff; --info-tx:    #1e40af; --info-bd:    #bfdbfe;
  --new-bg:     rgba(0,194,167,.08); --new-tx: #00C2A7; --new-bd: rgba(0,194,167,.25);
}

body { font-family: 'Inter', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--tx); font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased; }

/* ── APP SHELL ──────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ── SIDEBAR ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar);
  background: var(--dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
  transition: transform .28s cubic-bezier(.4,0,.2,1), box-shadow .28s;
  flex-shrink: 0;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }

.sidebar-head { padding: 1rem 1rem .75rem; }
.sidebar-logo { font-size: 1.25rem; font-weight: 900; color: var(--pk); letter-spacing: -.5px; line-height: 1; }
.sidebar-logo-sub { font-size: .62rem; color: rgba(255,255,255,.4); letter-spacing: .6px; text-transform: uppercase; margin-top: 2px; }

.sidebar-profile {
  padding: .625rem 1rem .75rem;
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid rgba(255,255,255,.07);
  border-bottom: 1px solid rgba(255,255,255,.07);
  margin-bottom: .5rem;
}
.sidebar-avatar {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.sidebar-pname { font-size: .78rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-prole { font-size: .62rem; color: rgba(255,255,255,.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-nav { flex: 1; padding: .25rem 0; overflow-y: auto; overflow-x: hidden; }
.sidebar-nav-section { margin-bottom: .25rem; }
.sidebar-nav-label {
  font-size: .58rem; font-weight: 800; letter-spacing: 1.2px;
  text-transform: uppercase; color: rgba(255,255,255,.28);
  padding: .625rem 1rem .3rem;
}

.side-link {
  display: flex; align-items: center; gap: 9px;
  padding: .5rem 1rem;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: .75rem; font-weight: 500;
  border-radius: 0;
  transition: all .18s;
  position: relative;
  white-space: nowrap;
}
.side-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.side-link.active { color: var(--pk); background: rgba(0,194,167,.12); font-weight: 700; }
.side-link.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 60%; background: var(--pk); border-radius: 0 2px 2px 0; }
.side-link-icon { width: 15px; height: 15px; flex-shrink: 0; opacity: .75; }
.side-link.active .side-link-icon { opacity: 1; }
.side-link-label { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.side-link-badge { background: var(--pk); color: #fff; border-radius: 20px; font-size: .58rem; font-weight: 800; padding: 1px 6px; min-width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-footer { padding: .75rem 1rem; border-top: 1px solid rgba(255,255,255,.07); }
.sidebar-logout {
  display: flex; align-items: center; gap: 8px;
  font-size: .72rem; color: rgba(255,255,255,.45); text-decoration: none;
  padding: .5rem .625rem; border-radius: 8px;
  transition: all .18s;
}
.sidebar-logout:hover { color: rgba(255,255,255,.8); background: rgba(255,255,255,.06); }

/* ── MAIN CONTENT ───────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.mobile-topbar {
  display: none;
  height: var(--topbar);
  background: var(--dark);
  align-items: center;
  padding: 0 1rem;
  gap: .75rem;
  position: sticky; top: 0; z-index: 150;
  flex-shrink: 0;
}
.mobile-topbar-logo { font-size: 1rem; font-weight: 900; color: var(--pk); flex: 1; letter-spacing: -.3px; }
.mobile-avatar { width: 30px; height: 30px; border-radius: 8px; background: var(--grad); display: flex; align-items: center; justify-content: center; font-size: .65rem; font-weight: 800; color: #fff; }

.mobile-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 190;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.mobile-overlay.open { display: block; }

.icon-button {
  background: rgba(255,255,255,.1); border: none; border-radius: 8px;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; transition: background .2s;
  -webkit-tap-highlight-color: transparent;
}
.icon-button:hover { background: rgba(255,255,255,.18); }

.content-area { padding: 1.25rem 1.5rem 2.5rem; flex: 1; max-width: 1400px; width: 100%; }

/* ── PAGE HEADER ────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-header-left .eyebrow { font-size: .62rem; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--pk); display: block; margin-bottom: 4px; }
.page-header-left h1 { font-size: 1.4rem; font-weight: 800; color: var(--tx); letter-spacing: -.3px; line-height: 1.2; }
.page-header-left p { font-size: .8rem; color: var(--mu); margin-top: 4px; }
.page-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── ADMIN HERO ─────────────────────────────────────────── */
.admin-hero {
  background: linear-gradient(135deg, var(--dark) 0%, #0d3058 100%);
  border-radius: var(--r3); padding: 1.5rem 2rem; margin-bottom: 1.25rem;
  position: relative; overflow: hidden;
}
.admin-hero::before { content: ''; position: absolute; top: -30px; right: -40px; width: 200px; height: 200px; border-radius: 50%; background: rgba(0,194,167,.08); }
.admin-hero-title { font-size: 1.1rem; font-weight: 800; color: #fff; margin-bottom: .5rem; letter-spacing: -.2px; }
.hero-points { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-points span { font-size: .65rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: rgba(0,194,167,.9); background: rgba(0,194,167,.12); border-radius: 50px; padding: 3px 10px; }

/* ── PANELS ─────────────────────────────────────────────── */
.panel { background: var(--white); border-radius: var(--r3); box-shadow: var(--sh); overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: .875rem 1rem; border-bottom: 1px solid var(--bd);
  position: sticky; top: 0; background: var(--white); z-index: 2;
  flex-wrap: wrap;
}
.panel-head h3 { font-size: .85rem; font-weight: 700; color: var(--tx); }
.panel-head .panel-subtitle { font-size: .7rem; color: var(--mu); }
.panel-head .more { font-size: .72rem; font-weight: 600; color: var(--pk); text-decoration: none; }
.panel-body { padding: 1rem; }
.panel-scroll { overflow-y: auto; }
.panel-scroll::-webkit-scrollbar { width: 4px; }
.panel-scroll::-webkit-scrollbar-thumb { background: var(--bd); border-radius: 2px; }

/* ── GRILLES DASHBOARD ──────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 1.25rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 1.25rem; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dashboard-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dashboard-three { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 14px; }

/* ── STAT / KPI CARDS ───────────────────────────────────── */
.stat-card, .kpi-card {
  background: var(--white); border-radius: var(--r2); padding: .875rem 1rem;
  box-shadow: var(--sh); display: flex; flex-direction: column; gap: 4px;
}
.stat-card.highlight-card, .kpi-card.accent { border-top: 3px solid var(--pk); }
.stat-label, .kpi-label { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--mu); }
.stat-val, .kpi-value { font-size: 1.6rem; font-weight: 900; color: var(--tx); letter-spacing: -1px; line-height: 1; }
.stat-hint { font-size: .68rem; color: var(--mu); line-height: 1.4; }
.kpi-foot { font-size: .68rem; color: var(--mu); }

/* ── BADGES ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 50px;
  font-size: .67rem; font-weight: 700; white-space: nowrap;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.badge.success { background: var(--success-bg); color: var(--success-tx); } .badge.success::before { background: var(--success-tx); }
.badge.warning { background: var(--warning-bg); color: var(--warning-tx); } .badge.warning::before { background: var(--warning-tx); }
.badge.danger  { background: var(--danger-bg);  color: var(--danger-tx);  } .badge.danger::before  { background: var(--danger-tx); }
.badge.info    { background: var(--info-bg);    color: var(--info-tx);    } .badge.info::before    { background: var(--info-tx); }
.badge.neutral { background: var(--bg);         color: var(--mu);         } .badge.neutral::before { background: var(--mu); }
.badge.new     { background: var(--new-bg);     color: var(--new-tx);     } .badge.new::before     { background: var(--new-tx); }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: .5rem 1.125rem; border-radius: 50px;
  font-size: .78rem; font-weight: 700; font-family: inherit;
  border: none; cursor: pointer; text-decoration: none;
  transition: all .2s; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 2px 10px rgba(0,194,167,.25); }
.btn-primary:hover { opacity: .88; transform: translateY(-1px); }
.btn-ghost { background: var(--bg); color: var(--tx); border: 1.5px solid var(--bd); }
.btn-ghost:hover { background: var(--bg2); border-color: var(--pk); color: var(--pk); }
.btn-outline { background: transparent; color: var(--pk); border: 1.5px solid var(--pk); }
.btn-outline:hover { background: rgba(0,194,167,.08); }
.btn-danger { background: var(--danger-bg); color: var(--danger-tx); border: 1.5px solid var(--danger-bd); }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: .3rem .75rem; font-size: .72rem; }
.btn-full { width: 100%; }

/* ── TABLES ──────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.table thead th { font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--mu); padding: 10px 14px; border-bottom: 1.5px solid var(--bd); white-space: nowrap; background: var(--bg); text-align: left; }
.table tbody td { padding: 10px 14px; border-bottom: 1px solid var(--bd); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(0,194,167,.025); }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.empty-cell { text-align: center; color: var(--mu); padding: 2rem !important; font-size: .8rem; }

/* ── LIST ITEMS ─────────────────────────────────────────── */
.list-item {
  display: flex; align-items: center; gap: 10px;
  padding: .625rem 1rem; border-bottom: 1px solid var(--bd);
  font-size: .78rem;
}
.list-item:last-child { border-bottom: none; }
.list-item strong { display: block; font-size: .8rem; font-weight: 700; color: var(--tx); margin-bottom: 1px; }
.list-item span { font-size: .7rem; color: var(--mu); }

/* ── EMPTY STATE ────────────────────────────────────────── */
.empty-state { padding: 2rem; text-align: center; color: var(--mu); font-size: .8rem; line-height: 1.6; }

/* ── DOC ICON ───────────────────────────────────────────── */
.doc-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--grad); color: #fff; font-size: .6rem; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ── FORMS ───────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: .72rem; font-weight: 700; color: var(--tx); }
.field input, .field select, .field textarea {
  padding: 9px 12px; border: 1.5px solid var(--bd); border-radius: var(--r); 
  font-size: .82rem; font-family: inherit; outline: none; background: var(--white);
  transition: border .2s;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--pk); }
.field textarea { resize: vertical; min-height: 80px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stack-form { display: flex; flex-direction: column; gap: 12px; }
.access-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.access-grid .full-span { grid-column: 1 / -1; }

/* ── ALERTS ──────────────────────────────────────────────── */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: .75rem 1rem; border-radius: var(--r2); font-size: .8rem; font-weight: 600; margin-bottom: .75rem; }
.alert-success { background: var(--success-bg); color: var(--success-tx); border: 1px solid var(--success-bd); }
.alert-error, .alert-blocked { background: var(--danger-bg); color: var(--danger-tx); border: 1px solid var(--danger-bd); }

/* ── FILTER CARD ────────────────────────────────────────── */
.filter-card { background: var(--white); border-radius: var(--r2); padding: .875rem 1rem; box-shadow: var(--sh); margin-bottom: 1rem; }
.filter-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* ── CHARTS ──────────────────────────────────────────────── */
.chart-card { background: var(--white); border-radius: var(--r3); box-shadow: var(--sh); overflow: hidden; }
.canvas-wrap { padding: .75rem 1rem 1rem; }
.canvas-wrap canvas { max-height: 220px !important; }
.canvas-wrap.tall canvas { max-height: 260px !important; }

/* ── TIMELINE ────────────────────────────────────────────── */
.timeline { padding: .75rem 1rem; display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 12px; padding: .75rem 0; position: relative; }
.timeline-item:not(:last-child)::after { content: ''; position: absolute; left: 15px; top: 42px; bottom: -4px; width: 1px; background: var(--bd); }
.timeline-step { width: 32px; height: 32px; min-width: 32px; border-radius: 50%; background: var(--grad); display: flex; align-items: center; justify-content: center; font-size: .68rem; font-weight: 800; color: #fff; flex-shrink: 0; }
.timeline-date { font-size: .68rem; color: var(--mu); margin-bottom: 2px; font-weight: 600; }
.timeline-title { font-size: .8rem; font-weight: 700; color: var(--tx); margin-bottom: 3px; }
.timeline-text { font-size: .75rem; color: var(--mu); line-height: 1.55; }

/* ── CLIENT INITIALS ────────────────────────────────────── */
.client-initials { width: 38px; height: 38px; border-radius: 10px; background: var(--grad); color: #fff; font-size: .72rem; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.folder-metric { background: var(--bg); border-radius: 6px; padding: 2px 7px; font-size: .7rem; font-weight: 600; color: var(--mu); }

/* ── ACCESS CARDS ────────────────────────────────────────── */
.access-card { background: var(--white); border-radius: var(--r3); padding: 1.25rem; box-shadow: var(--sh); margin-bottom: 12px; border: 1.5px solid transparent; }
.access-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: 8px; }
.identity-inline { display: flex; align-items: center; gap: 10px; }
.mini-avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--grad); color: #fff; font-size: .72rem; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.identity-inline strong { display: block; font-size: .85rem; font-weight: 700; color: var(--tx); }
.identity-inline span { font-size: .72rem; color: var(--mu); }

/* ── LOGIN ───────────────────────────────────────────────── */
.login-body { background: var(--bg); display: flex; align-items: stretch; justify-content: center; min-height: 100vh; }
.login-shell { display: grid; grid-template-columns: 1fr 420px; width: 100%; max-width: 1100px; margin: auto; background: var(--white); box-shadow: 0 24px 80px rgba(0,0,0,.12); border-radius: 24px; overflow: hidden; min-height: 600px; }
.login-visual { background: var(--dark); padding: 2.5rem 2rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-grid-overlay { position: absolute; inset: 0; background-image: linear-gradient(rgba(0,194,167,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(0,194,167,.05) 1px, transparent 1px); background-size: 48px 48px; }
.login-back-btn { display: inline-flex; align-items: center; gap: 6px; color: rgba(255,255,255,.5); font-size: .72rem; font-weight: 600; text-decoration: none; margin-bottom: .5rem; transition: color .2s; position: relative; z-index: 1; }
.login-back-btn:hover { color: var(--pk); }
.login-brand { font-size: 1.5rem; font-weight: 900; color: var(--pk); letter-spacing: -1px; position: relative; z-index: 1; }
.login-body-content { position: relative; z-index: 1; }
.login-pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(0,194,167,.15); border: 1px solid rgba(0,194,167,.3); border-radius: 50px; padding: 4px 12px; font-size: .68rem; font-weight: 700; color: var(--pk); margin-bottom: 1rem; }
.login-body-content h1 { font-size: 1.5rem; font-weight: 900; color: #fff; line-height: 1.25; margin-bottom: .75rem; letter-spacing: -.3px; }
.login-body-content p { font-size: .78rem; color: rgba(255,255,255,.55); line-height: 1.7; }
.login-features { display: flex; flex-direction: column; gap: 8px; position: relative; z-index: 1; }
.feature-card { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 12px; padding: .75rem 1rem; }
.feature-card h3 { font-size: .8rem; font-weight: 700; color: #fff; margin-bottom: 3px; }
.feature-card p { font-size: .72rem; color: rgba(255,255,255,.5); line-height: 1.5; }
.login-panel { padding: 2.5rem 2rem; display: flex; flex-direction: column; justify-content: center; gap: 1rem; }
.login-panel-header { }
.login-panel-header .eyebrow { font-size: .62rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--pk); display: block; margin-bottom: 6px; }
.login-panel-header h2 { font-size: 1.4rem; font-weight: 800; color: var(--tx); margin-bottom: 6px; letter-spacing: -.2px; }
.login-panel-header p { font-size: .8rem; color: var(--mu); line-height: 1.6; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-links { display: flex; align-items: center; justify-content: space-between; font-size: .75rem; color: var(--mu); }
.login-links a { color: var(--pk); text-decoration: none; font-weight: 600; }

/* ── CHART AREA (overview) ──────────────────────────────── */
.dashboard-two.chart-row { align-items: stretch; }

/* ── FOLDER GRID ────────────────────────────────────────── */
.client-folder-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 1rem; }
.folder-card { background: var(--bg); border-radius: 14px; padding: .875rem; border: 1.5px solid var(--bd); }
.folder-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.folder-metrics { display: flex; gap: 5px; flex-wrap: wrap; }

/* ── QUICK GRID ─────────────────────────────────────────── */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

/* ── PORTAIL TOAST ──────────────────────────────────────── */
#portail-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: var(--white); border-radius: 14px; padding: 12px 18px;
  box-shadow: 0 8px 28px rgba(0,0,0,.16); font-size: .82rem; font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif; display: flex; align-items: center; gap: 10px;
  max-width: 340px; border-left: 4px solid var(--pk);
  transition: opacity .3s, transform .3s;
}

/* ── SPIN ANIMATION ─────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:.3} }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (≤ 1100px)
══════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — SIDEBAR COLLAPSE (≤ 860px)
══════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
  :root { --sidebar: 0px; }

  .sidebar {
    transform: translateX(-100%);
    width: 240px;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,.25);
  }

  .main-content { margin-left: 0; }
  .mobile-topbar { display: flex; }

  .content-area { padding: 1rem 1rem 2rem; }

  /* Grilles */
  .dashboard-two, .dashboard-three { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .client-folder-grid { grid-template-columns: 1fr; }

  /* Tables: scroll horizontal */
  .table-responsive { border-radius: 0; }
  
  /* Deux colonnes layouts */
  div[style*="grid-template-columns:300px 1fr"],
  div[style*="grid-template-columns: 300px 1fr"],
  div[style*="grid-template-columns:320px 1fr"],
  div[style*="grid-template-columns: 320px 1fr"],
  div[style*="grid-template-columns:340px 1fr"],
  div[style*="grid-template-columns: 340px 1fr"],
  div[style*="grid-template-columns:360px 1fr"],
  div[style*="grid-template-columns: 360px 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — SMALL TABLET (≤ 700px)
══════════════════════════════════════════════════════════ */
@media (max-width: 700px) {
  .content-area { padding: .875rem .875rem 2rem; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-row { grid-template-columns: 1fr; }
  .field-row, .access-grid { grid-template-columns: 1fr; }
  .access-grid .full-span { grid-column: 1; }
  .page-header { flex-direction: column; gap: 8px; }
  .page-header-actions { width: 100%; justify-content: flex-start; }
  .page-header-left h1 { font-size: 1.15rem; }

  /* Panel head stacks */
  .panel-head { flex-wrap: wrap; gap: 8px; }
  .panel-head .panel-subtitle { display: none; }

  /* Admin hero compact */
  .admin-hero { padding: 1.125rem; }
  .admin-hero-title { font-size: .9rem; }

  /* Charts smaller */
  .canvas-wrap canvas { max-height: 180px !important; }
  .canvas-wrap.tall canvas { max-height: 200px !important; }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 540px)
══════════════════════════════════════════════════════════ */
@media (max-width: 540px) {
  .content-area { padding: .75rem .75rem 2rem; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-value { font-size: 1.25rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-val { font-size: 1.3rem; }
  
  .table { font-size: .72rem; }
  .table thead th { padding: 8px 10px; font-size: .6rem; }
  .table tbody td { padding: 8px 10px; }
  
  .badge { font-size: .6rem; padding: 2px 7px; }
  .btn-sm { padding: .28rem .65rem; font-size: .68rem; }
  
  .list-item { padding: .5rem .875rem; gap: 8px; }
  
  .panel-head { padding: .75rem; }
  .panel-body { padding: .875rem; }
  
  #portail-toast { left: 12px; right: 12px; bottom: 16px; max-width: none; font-size: .78rem; }
  
  .timeline-item { gap: 8px; }
  .timeline-step { width: 28px; height: 28px; min-width: 28px; font-size: .62rem; }
  .timeline-title { font-size: .75rem; }
  .timeline-text { font-size: .7rem; }
  
  .access-card { padding: 1rem; }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — LOGIN (≤ 640px)
══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .login-body { padding: 0; align-items: stretch; background: var(--white); }
  .login-shell {
    grid-template-columns: 1fr;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }
  .login-visual { display: none; }
  .login-panel {
    padding: 2rem 1.5rem 2.5rem;
    min-height: 100vh;
    justify-content: flex-start;
    padding-top: 3rem;
  }
  .login-panel::before {
    content: 'SUKUMA';
    display: block;
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--pk);
    letter-spacing: -.5px;
    margin-bottom: 2rem;
  }
  .login-panel-header h2 { font-size: 1.3rem; }
  .login-form .field input { font-size: 16px; padding: 12px 14px; }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — TINY (≤ 400px)
══════════════════════════════════════════════════════════ */
@media (max-width: 400px) {
  .login-panel { padding: 1.5rem 1rem 2rem; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .sidebar { width: 85vw; max-width: 260px; }
}

/* ══════════════════════════════════════════════════════════
   TOUCH DEVICE OPTIMIZATIONS
══════════════════════════════════════════════════════════ */
@media (hover: none) {
  .btn:hover { transform: none; opacity: 1; }
  .btn:active { opacity: .8; }
  .side-link:hover { background: transparent; color: rgba(255,255,255,.6); }
}

/* Prevent iOS input zoom */
@media (max-width: 860px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  input[type="date"],
  input[type="number"],
  select, textarea { font-size: 16px !important; }
}

/* Touch targets minimum 44px */
@media (max-width: 860px) {
  .btn { min-height: 40px; }
  .side-link { min-height: 42px; }
  .icon-button { min-height: 40px; min-width: 40px; }
  input[type="checkbox"] { min-width: 20px; min-height: 20px; }
}

/* Safe area insets for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .content-area { padding-bottom: calc(2rem + env(safe-area-inset-bottom)); }
  .mobile-topbar { padding-top: env(safe-area-inset-top); height: calc(var(--topbar) + env(safe-area-inset-top)); }
}
