/* ==========================================================================
   arbre.lu — Administration — style.css
   Continuité éditoriale avec arbre.lu : sobre, naturel, éditorial.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root{
  /* --- Couleurs --- */
  --paper:        #f6f3ec;
  --paper-dim:     #efe9db;
  --white:        #fffefb;
  --ink:          #23281f;
  --ink-soft:     #565f4f;
  --ink-faint:    #8a9080;
  --line:         #ddd6c2;
  --line-strong:  #c9c0a6;

  --forest:       #33503f;
  --forest-dark:  #22362a;
  --forest-tint:  #e7ece4;
  --moss:         #7c9270;

  --ok:           #3e7148;
  --ok-tint:      #e5f0e3;
  --warn:         #9c6b16;
  --warn-tint:    #f7ecd6;
  --bad:          #a13f34;
  --bad-tint:     #f6e4e1;
  --info:         #3c6e8f;
  --info-tint:    #e3edf3;
  --muted:        #6b6b63;
  --muted-tint:   #ececE4;

  /* --- Typo --- */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'IBM Plex Mono', 'SFMono-Regular', monospace;

  /* --- Rayon / ombre / rythme --- */
  --radius-s: 4px;
  --radius-m: 8px;
  --radius-l: 14px;
  --shadow-s: 0 1px 2px rgba(35,40,31,.06);
  --shadow-m: 0 6px 20px rgba(35,40,31,.10);
  --sidebar-w: 248px;
  --topbar-h: 64px;
}

*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0;
  font-family:var(--font-body);
  color:var(--ink);
  background:var(--paper);
  font-size:15px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4{ font-family:var(--font-display); font-weight:600; margin:0; color:var(--ink); letter-spacing:-.01em; }
p{ margin:0 0 .75em; }
a{ color:var(--forest); text-decoration:none; }
a:hover{ text-decoration:underline; }
ul{ margin:0; padding:0; list-style:none; }
button{ font-family:inherit; }
img{ max-width:100%; display:block; }
svg{ display:block; flex-shrink:0; width:16px; height:16px; }

::selection{ background:var(--forest); color:var(--white); }

:focus-visible{
  outline: 2.5px solid var(--forest);
  outline-offset: 2px;
  border-radius: 3px;
}

.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

.skip-link{
  position:absolute; left:8px; top:-48px;
  background:var(--forest); color:var(--white);
  padding:10px 16px; border-radius:var(--radius-s);
  z-index:1000; transition:top .15s ease;
  font-weight:600; font-size:14px;
}
.skip-link:focus{ top:8px; }

/* ==========================================================================
   Layout de l'application
   ========================================================================== */

.app{
  display:grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "sidebar topbar" "sidebar main";
  min-height:100vh;
}

/* --- Sidebar --- */
.sidebar{
  grid-area:sidebar;
  background:var(--forest-dark);
  color:#eef1e9;
  display:flex;
  flex-direction:column;
  position:sticky; top:0; height:100vh;
  z-index:40;
}
.sidebar-brand{
  display:flex; align-items:center; gap:10px;
  padding:20px 20px 16px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.sidebar-brand .mark{
  width:34px; height:34px; border-radius:8px;
  background:linear-gradient(155deg, var(--moss), var(--forest));
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-family:var(--font-display); font-weight:700; font-size:18px;
  flex-shrink:0;
}
.sidebar-brand .name{ font-family:var(--font-display); font-size:17px; font-weight:600; color:#fff; line-height:1.2; }
.sidebar-brand .tag{ font-size:11px; color:#b7c2ac; letter-spacing:.04em; text-transform:uppercase; }

.sidebar-nav{ flex:1; padding:14px 12px; overflow-y:auto; }
.sidebar-nav .group-label{
  font-size:11px; text-transform:uppercase; letter-spacing:.08em;
  color:#8ba087; padding:14px 10px 6px;
}
.nav-link{
  display:flex; align-items:center; gap:12px;
  padding:9px 12px; border-radius:var(--radius-s);
  color:#dbe3d3; font-size:14px; font-weight:500;
  margin-bottom:2px; position:relative;
}
.nav-link svg{ width:18px; height:18px; opacity:.85; }
.nav-link:hover{ background:rgba(255,255,255,.07); text-decoration:none; color:#fff; }
.nav-link.active{ background:rgba(255,255,255,.13); color:#fff; }
.nav-link.active::before{
  content:""; position:absolute; left:-12px; top:8px; bottom:8px; width:3px;
  background:var(--moss); border-radius:2px;
}
.nav-link .count{
  margin-left:auto; font-family:var(--font-mono); font-size:11px;
  background:rgba(255,255,255,.1); padding:1px 6px; border-radius:20px; color:#cfd9c6;
}
.nav-link .count.alert{ background:var(--bad); color:#fff; }

.sidebar-foot{
  padding:14px 20px 18px; border-top:1px solid rgba(255,255,255,.08);
  font-size:12px; color:#93a58c;
}

/* --- Topbar --- */
.topbar{
  grid-area:topbar;
  background:var(--white);
  border-bottom:1px solid var(--line);
  display:flex; align-items:center; gap:16px;
  padding:0 22px;
  position:sticky; top:0; z-index:30;
}
.menu-toggle{ display:none; }
.topbar-search{
  flex:1; max-width:480px; position:relative;
}
.topbar-search input{
  width:100%; padding:9px 14px 9px 36px; border:1px solid var(--line);
  border-radius:20px; background:var(--paper-dim); font-size:13.5px; color:var(--ink);
}
.topbar-search input:focus{ background:var(--white); }
.topbar-search svg{ position:absolute; left:12px; top:50%; transform:translateY(-50%); color:var(--ink-faint); width:16px; height:16px; }
.topbar-actions{ display:flex; align-items:center; gap:10px; margin-left:auto; }
.icon-btn{
  width:36px; height:36px; border-radius:50%; border:1px solid transparent;
  background:transparent; display:flex; align-items:center; justify-content:center;
  color:var(--ink-soft); cursor:pointer; position:relative;
}
.icon-btn:hover{ background:var(--paper-dim); color:var(--ink); }
.icon-btn .dot{
  position:absolute; top:6px; right:6px; width:8px; height:8px; border-radius:50%;
  background:var(--bad); border:2px solid var(--white);
}
.user-chip{
  display:flex; align-items:center; gap:9px; padding:5px 12px 5px 5px;
  border-radius:20px; border:1px solid var(--line); background:var(--white); cursor:pointer;
}
.user-chip .avatar{
  width:28px; height:28px; border-radius:50%; background:var(--forest-tint); color:var(--forest);
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:12px; font-family:var(--font-display);
}
.user-chip .who{ font-size:13px; font-weight:600; color:var(--ink); }

/* --- Main --- */
.main{
  grid-area:main;
  padding:26px 30px 60px;
  min-width:0;
}
.page-head{
  display:flex; align-items:flex-end; justify-content:space-between; gap:16px;
  margin-bottom:22px; flex-wrap:wrap;
}
.page-head h1{ font-size:26px; }
.page-head .lede{ color:var(--ink-soft); font-size:14px; margin-top:4px; }
.breadcrumb{
  font-size:12.5px; color:var(--ink-faint); margin-bottom:8px;
  display:flex; align-items:center; gap:6px;
}
.breadcrumb a{ color:var(--ink-faint); }
.breadcrumb a:hover{ color:var(--forest); }
.head-actions{ display:flex; gap:10px; flex-wrap:wrap; }

/* ==========================================================================
   Composants
   ========================================================================== */

.btn{
  display:inline-flex; align-items:center; gap:8px; justify-content:center;
  font-family:var(--font-body); font-weight:600; font-size:13.5px; cursor:pointer;
  padding:10px 16px; border-radius:8px; border:1px solid transparent;
  transition:background .12s ease, border-color .12s ease, transform .05s ease;
  white-space:nowrap;
}
.btn:active{ transform:translateY(1px); }
.btn svg{ width:16px; height:16px; }
.btn-primary{ background:var(--forest); color:#fff; }
.btn-primary:hover{ background:var(--forest-dark); text-decoration:none; }
.btn-secondary{ background:var(--white); color:var(--ink); border-color:var(--line-strong); }
.btn-secondary:hover{ background:var(--paper-dim); text-decoration:none; }
.btn-ghost{ background:transparent; color:var(--ink-soft); }
.btn-ghost:hover{ background:var(--paper-dim); color:var(--ink); text-decoration:none; }
.btn-danger{ background:var(--white); color:var(--bad); border-color:#e3c3bd; }
.btn-danger:hover{ background:var(--bad-tint); text-decoration:none; }
.btn-danger.solid{ background:var(--bad); color:#fff; border-color:var(--bad); }
.btn-danger.solid:hover{ background:#8a352b; }
.btn-sm{ padding:6px 11px; font-size:12.5px; border-radius:6px; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }
.btn:disabled:hover{ background:inherit; }

.btn-icon{
  width:34px; height:34px; padding:0; border-radius:7px;
  display:inline-flex; align-items:center; justify-content:center;
  background:var(--white); border:1px solid var(--line-strong); color:var(--ink-soft); cursor:pointer;
}
.btn-icon:hover{ background:var(--paper-dim); color:var(--ink); }

/* --- Cartes --- */
.card{
  background:var(--white); border:1px solid var(--line); border-radius:var(--radius-l);
  box-shadow:var(--shadow-s);
}
.card-pad{ padding:20px 22px; }
.card-head{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:16px 20px; border-bottom:1px solid var(--line);
}
.card-head h2{ font-size:16px; }
.card-head h3{ font-size:15px; }

/* --- Badges de statut --- */
.badge{
  display:inline-flex; align-items:center; gap:6px;
  font-size:12px; font-weight:600; padding:4px 10px 4px 8px; border-radius:20px;
  white-space:nowrap;
}
.badge::before{ content:""; width:6px; height:6px; border-radius:50%; background:currentColor; }
.badge.tone-ok{ background:var(--ok-tint); color:var(--ok); }
.badge.tone-warn{ background:var(--warn-tint); color:var(--warn); }
.badge.tone-bad{ background:var(--bad-tint); color:var(--bad); }
.badge.tone-info{ background:var(--info-tint); color:var(--info); }
.badge.tone-muted{ background:var(--muted-tint); color:var(--muted); }

.pill{
  display:inline-flex; align-items:center; font-size:11.5px; font-weight:600;
  padding:3px 9px; border-radius:20px; background:var(--paper-dim); color:var(--ink-soft);
}

/* --- Numéro de référence (signature visuelle : catalogue arbre.lu) --- */
.refno{
  font-family:var(--font-mono); font-size:12px; font-weight:600;
  color:var(--forest); background:var(--forest-tint);
  border:1px solid #d3ddca; padding:2px 7px; border-radius:5px;
  letter-spacing:.02em; white-space:nowrap;
}

/* --- Formulaires --- */
.field{ margin-bottom:16px; }
.field label{ display:block; font-size:12.5px; font-weight:600; color:var(--ink-soft); margin-bottom:6px; }
.field .hint{ font-size:12px; color:var(--ink-faint); margin-top:5px; }
.field .error{ font-size:12px; color:var(--bad); margin-top:5px; display:none; font-weight:600;}
.field.has-error .error{ display:block; }
.field.has-error input, .field.has-error select, .field.has-error textarea{ border-color:var(--bad); background:var(--bad-tint); }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=date], input[type=search], input[type=number], select, textarea{
  width:100%; padding:10px 12px; border:1px solid var(--line-strong); border-radius:7px;
  background:var(--white); font-size:13.5px; color:var(--ink); font-family:var(--font-body);
}
textarea{ resize:vertical; min-height:80px; }
input:focus, select:focus, textarea:focus{ border-color:var(--forest); }
.row-2{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.row-3{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:16px; }
.checkbox-row{ display:flex; align-items:center; gap:9px; }
.checkbox-row input{ width:16px; height:16px; accent-color:var(--forest); }
fieldset{ border:1px solid var(--line); border-radius:var(--radius-m); padding:14px 16px; margin:0 0 16px; }
legend{ font-size:12.5px; font-weight:700; color:var(--ink-soft); padding:0 6px; text-transform:uppercase; letter-spacing:.04em; }

/* --- Tableau des références --- */
.table-toolbar{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  padding:14px 18px; border-bottom:1px solid var(--line);
}
.table-toolbar .search-mini{ position:relative; flex:1; min-width:180px; max-width:320px; }
.table-toolbar .search-mini svg{ position:absolute; left:10px; top:50%; transform:translateY(-50%); width:15px; height:15px; color:var(--ink-faint); }
.table-toolbar .search-mini input{ padding-left:32px; }
.filter-chip{
  display:inline-flex; align-items:center; gap:6px; padding:7px 12px; border-radius:8px;
  border:1px solid var(--line-strong); background:var(--white); font-size:12.5px; font-weight:600; color:var(--ink-soft); cursor:pointer;
}
.filter-chip:hover{ background:var(--paper-dim); }
.filter-chip.active{ background:var(--forest); color:#fff; border-color:var(--forest); }
.filter-chip svg{ width:13px; height:13px; }

.bulkbar{
  display:none; align-items:center; gap:12px; padding:10px 18px;
  background:var(--forest-tint); border-bottom:1px solid #d3ddca; font-size:13px; color:var(--forest-dark); font-weight:600;
}
.bulkbar.show{ display:flex; }
.bulkbar .spacer{ flex:1; }
.bulkbar .actions{ display:flex; gap:8px; }

.table-wrap{ overflow-x:auto; }
table.refs{ width:100%; border-collapse:collapse; min-width:920px; }
table.refs th{
  text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.05em;
  color:var(--ink-faint); font-weight:700; padding:11px 14px; border-bottom:1px solid var(--line);
  background:var(--paper-dim); position:sticky; top:0; cursor:pointer; user-select:none; white-space:nowrap;
}
table.refs th.sortable:hover{ color:var(--ink); }
table.refs th .arrow{ margin-left:4px; opacity:.4; }
table.refs th.sorted .arrow{ opacity:1; }
table.refs td{ padding:12px 14px; border-bottom:1px solid var(--line); font-size:13.5px; vertical-align:middle; }
table.refs tbody tr{ transition:background .1s ease; }
table.refs tbody tr:hover{ background:var(--paper-dim); }
table.refs tbody tr.is-selected{ background:var(--forest-tint); }
table.refs td.col-title{ max-width:320px; }
table.refs td.col-title .t{ font-weight:600; color:var(--ink); display:block; }
table.refs td.col-title .u{ font-size:12px; color:var(--ink-faint); display:block; margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:320px; }
table.refs td.col-actions{ text-align:right; white-space:nowrap; }
table.refs .row-actions{ display:inline-flex; gap:4px; opacity:0; transition:opacity .1s ease; }
table.refs tr:hover .row-actions, table.refs tr:focus-within .row-actions{ opacity:1; }
table.refs input[type=checkbox]{ width:16px; height:16px; accent-color:var(--forest); }
.cat-tag{ font-size:12px; color:var(--ink-soft); }

.table-foot{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:12px 18px; border-top:1px solid var(--line); font-size:12.5px; color:var(--ink-faint); flex-wrap:wrap;
}
.pager{ display:flex; gap:6px; }
.pager button{
  width:30px; height:30px; border-radius:6px; border:1px solid var(--line-strong); background:var(--white);
  font-size:12.5px; font-weight:600; color:var(--ink-soft); cursor:pointer;
}
.pager button.active{ background:var(--forest); color:#fff; border-color:var(--forest); }
.pager button:hover:not(.active){ background:var(--paper-dim); }

.empty-state{
  padding:60px 20px; text-align:center; color:var(--ink-faint);
}
.empty-state .icon{ width:46px; height:46px; margin:0 auto 14px; color:var(--line-strong); }
.empty-state h3{ color:var(--ink-soft); font-size:15px; margin-bottom:6px; }

/* --- Stat cards (dashboard) --- */
.stat-grid{ display:grid; grid-template-columns:repeat(5, 1fr); gap:14px; margin-bottom:22px; }
.stat-card{
  background:var(--white); border:1px solid var(--line); border-radius:var(--radius-l);
  padding:16px 18px; box-shadow:var(--shadow-s);
}
.stat-card .k{ font-size:11.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-faint); font-weight:700; }
.stat-card .v{ font-family:var(--font-display); font-size:30px; font-weight:600; margin-top:6px; }
.stat-card .d{ font-size:12px; margin-top:6px; display:flex; align-items:center; gap:5px; }
.stat-card.tone-ok .v{ color:var(--ok); }
.stat-card.tone-warn .v{ color:var(--warn); }
.stat-card.tone-bad .v{ color:var(--bad); }
.stat-card.tone-muted .v{ color:var(--muted); }

.dash-grid{ display:grid; grid-template-columns:1.5fr 1fr; gap:16px; align-items:start; }

.bars{ display:flex; flex-direction:column; gap:12px; }
.bar-row{ display:grid; grid-template-columns:120px 1fr 40px; align-items:center; gap:10px; }
.bar-row .lbl{ font-size:12.5px; color:var(--ink-soft); font-weight:600; }
.bar-track{ height:9px; border-radius:5px; background:var(--paper-dim); overflow:hidden; }
.bar-fill{ height:100%; border-radius:5px; background:var(--forest); }
.bar-row .n{ font-family:var(--font-mono); font-size:12px; color:var(--ink-faint); text-align:right; }

.activity-list{ display:flex; flex-direction:column; }
.activity-item{ display:flex; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); }
.activity-item:last-child{ border-bottom:none; }
.activity-dot{
  width:30px; height:30px; border-radius:50%; flex-shrink:0;
  display:flex; align-items:center; justify-content:center; background:var(--forest-tint); color:var(--forest);
}
.activity-dot svg{ width:15px; height:15px; }
.activity-item .txt{ font-size:13px; }
.activity-item .txt b{ font-weight:600; }
.activity-item .when{ font-size:11.5px; color:var(--ink-faint); margin-top:2px; }

.alert-box{
  display:flex; gap:12px; padding:14px 16px; border-radius:var(--radius-m);
  border:1px solid #e6cfb0; background:#fbf3e6; margin-bottom:14px; align-items:flex-start;
}
.alert-box svg{ width:19px; height:19px; color:var(--warn); flex-shrink:0; margin-top:1px; }
.alert-box .t{ font-size:13px; font-weight:700; color:#7a5410; }
.alert-box .d{ font-size:12.5px; color:#8a6a2c; margin-top:2px; }
.alert-box.info{ border-color:#bcd6e3; background:#eaf3f7; }
.alert-box.info svg{ color:var(--info); }
.alert-box.info .t{ color:#274a5c; }
.alert-box.info .d{ color:#3f6a80; }

.quicklinks{ display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }
.quicklink{
  display:flex; flex-direction:column; gap:8px; padding:16px; border-radius:var(--radius-m);
  border:1px solid var(--line); background:var(--white); color:var(--ink);
}
.quicklink:hover{ border-color:var(--forest); background:var(--forest-tint); text-decoration:none; }
.quicklink svg{ width:20px; height:20px; color:var(--forest); }
.quicklink .t{ font-weight:600; font-size:13.5px; }
.quicklink .d{ font-size:12px; color:var(--ink-faint); }

/* --- Modal --- */
.modal-overlay{
  position:fixed; inset:0; background:rgba(34,38,29,.45); backdrop-filter:blur(1px);
  display:none; align-items:center; justify-content:center; z-index:200; padding:20px;
}
.modal-overlay.open{ display:flex; }
.modal{
  background:var(--white); border-radius:var(--radius-l); width:100%; max-width:480px;
  box-shadow:var(--shadow-m); max-height:88vh; display:flex; flex-direction:column; overflow:hidden;
}
.modal.modal-lg{ max-width:640px; }
.modal-head{ padding:18px 22px; border-bottom:1px solid var(--line); display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.modal-head h3{ font-size:17px; }
.modal-head p{ font-size:12.5px; color:var(--ink-faint); margin-top:4px; }
.modal-body{ padding:20px 22px; overflow-y:auto; font-size:13.5px; color:var(--ink-soft); }
.modal-body strong{ color:var(--ink); }
.modal-foot{ padding:16px 22px; border-top:1px solid var(--line); display:flex; justify-content:flex-end; gap:10px; }
.modal-close{ background:transparent; border:none; cursor:pointer; color:var(--ink-faint); padding:4px; }
.modal-close:hover{ color:var(--ink); }
.modal.danger .modal-head{ background:var(--bad-tint); }
.modal.danger h3{ color:var(--bad); }

/* --- Toasts --- */
.toast-stack{
  position:fixed; bottom:22px; right:22px; z-index:400;
  display:flex; flex-direction:column; gap:10px; max-width:340px;
}
.toast{
  display:flex; align-items:flex-start; gap:10px; background:var(--ink); color:#fff;
  padding:13px 15px; border-radius:var(--radius-m); box-shadow:var(--shadow-m);
  font-size:13px; animation:toast-in .18s ease;
}
.toast svg{ width:18px; height:18px; flex-shrink:0; margin-top:1px; }
.toast.ok{ background:var(--forest-dark); }
.toast.bad{ background:#7a2e25; }
.toast .close{ margin-left:auto; background:none; border:none; color:#d7ddd0; cursor:pointer; padding:2px; }
@keyframes toast-in{ from{ opacity:0; transform:translateY(8px);} to{ opacity:1; transform:translateY(0);} }

/* --- Tabs --- */
.tabs{ display:flex; gap:2px; border-bottom:1px solid var(--line); margin-bottom:20px; overflow-x:auto; }
.tab{
  padding:11px 16px; font-size:13.5px; font-weight:600; color:var(--ink-faint);
  border-bottom:2px solid transparent; cursor:pointer; white-space:nowrap;
}
.tab:hover{ color:var(--ink); }
.tab.active{ color:var(--forest); border-color:var(--forest); }
.tab-panel{ display:none; }
.tab-panel.active{ display:block; }

/* --- Explorateur de catégories --- */
.tree{ display:flex; flex-direction:column; gap:2px; }
.tree-node{ border-radius:7px; }
.tree-row{
  display:flex; align-items:center; gap:8px; padding:9px 10px; border-radius:7px;
  cursor:grab; border:1px solid transparent;
}
.tree-row:hover{ background:var(--paper-dim); }
.tree-row.drag-over{ border-color:var(--forest); background:var(--forest-tint); }
.tree-row .grip{ color:var(--line-strong); width:14px; height:14px; flex-shrink:0; }
.tree-row .chev{ width:16px; height:16px; color:var(--ink-faint); transition:transform .12s ease; flex-shrink:0; cursor:pointer;}
.tree-row.collapsed .chev{ transform:rotate(-90deg); }
.tree-row .name{ font-weight:600; font-size:13.5px; flex:1; }
.tree-row .count{ font-family:var(--font-mono); font-size:11.5px; color:var(--ink-faint); }
.tree-row .row-actions{ display:inline-flex; gap:4px; opacity:0; }
.tree-row:hover .row-actions{ opacity:1; }
.tree-children{ margin-left:26px; border-left:1px dashed var(--line-strong); padding-left:10px; display:flex; flex-direction:column; gap:2px;}
.tree-children.collapsed{ display:none; }

/* --- Import / Export --- */
.io-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.io-card{ padding:20px; }
.io-card .icon{
  width:42px; height:42px; border-radius:10px; background:var(--forest-tint); color:var(--forest);
  display:flex; align-items:center; justify-content:center; margin-bottom:12px;
}
.io-card .icon svg{ width:22px; height:22px; }
.dropzone{
  border:2px dashed var(--line-strong); border-radius:var(--radius-m); padding:26px 16px;
  text-align:center; color:var(--ink-faint); font-size:13px; margin-top:10px; transition:all .12s ease;
}
.dropzone.drag{ border-color:var(--forest); background:var(--forest-tint); color:var(--forest); }
.progress{ height:8px; border-radius:5px; background:var(--paper-dim); overflow:hidden; margin-top:12px; display:none; }
.progress.show{ display:block; }
.progress .fill{ height:100%; background:var(--forest); width:0%; transition:width .25s ease; }

/* --- Login --- */
.auth-shell{
  min-height:100vh; display:grid; grid-template-columns:1fr 1fr;
  background:var(--paper);
}
.auth-visual{
  background: radial-gradient(circle at 30% 20%, #3f6350 0%, var(--forest-dark) 55%, #182619 100%);
  display:flex; flex-direction:column; justify-content:space-between; padding:48px;
  color:#eef1e9; position:relative; overflow:hidden;
}
.auth-visual .rings{ position:absolute; inset:0; opacity:.16; }
.auth-visual blockquote{ font-family:var(--font-display); font-size:26px; line-height:1.35; max-width:420px; position:relative; z-index:1; }
.auth-visual cite{ font-style:normal; font-size:13px; color:#b7c2ac; display:block; margin-top:14px; }
.auth-form-wrap{ display:flex; align-items:center; justify-content:center; padding:40px; }
.auth-card{ width:100%; max-width:380px; }
.auth-card .mark{
  width:44px; height:44px; border-radius:10px; background:linear-gradient(155deg, var(--moss), var(--forest));
  display:flex; align-items:center; justify-content:center; color:#fff; font-family:var(--font-display); font-weight:700; font-size:20px; margin-bottom:20px;
}
.auth-card h1{ font-size:24px; margin-bottom:6px; }
.auth-card .sub{ color:var(--ink-soft); font-size:13.5px; margin-bottom:26px; }
.auth-foot{ margin-top:18px; font-size:12.5px; color:var(--ink-faint); text-align:center; }
.demo-note{
  margin-top:22px; padding:12px 14px; border-radius:var(--radius-m); background:var(--forest-tint);
  border:1px solid #d3ddca; font-size:12px; color:var(--forest-dark); line-height:1.5;
}

/* --- Utilitaires --- */
.mb-0{ margin-bottom:0 !important; }
.text-muted{ color:var(--ink-faint); }
.mono{ font-family:var(--font-mono); }
.flex{ display:flex; align-items:center; }
.gap-8{ gap:8px; } .gap-10{ gap:10px; } .gap-14{ gap:14px; }
.divider{ height:1px; background:var(--line); margin:18px 0; border:none; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1180px){
  .stat-grid{ grid-template-columns:repeat(3,1fr); }
  .dash-grid{ grid-template-columns:1fr; }
  .quicklinks{ grid-template-columns:repeat(2,1fr); }
  .io-grid{ grid-template-columns:1fr; }
}

@media (max-width: 900px){
  .app{
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "main";
  }
  .sidebar{
    position:fixed; left:0; top:0; bottom:0; width:264px;
    transform:translateX(-100%); transition:transform .18s ease; box-shadow:var(--shadow-m);
  }
  .sidebar.open{ transform:translateX(0); }
  .menu-toggle{
    display:flex; align-items:center; justify-content:center;
    width:38px; height:38px; border-radius:8px; border:1px solid var(--line-strong);
    background:var(--white); color:var(--ink); cursor:pointer;
  }
  .scrim{ display:none; position:fixed; inset:0; background:rgba(0,0,0,.35); z-index:39; }
  .scrim.show{ display:block; }
  .topbar-search{ max-width:none; }
  .stat-grid{ grid-template-columns:repeat(2,1fr); }
  .row-2, .row-3{ grid-template-columns:1fr; }
  .quicklinks{ grid-template-columns:1fr 1fr; }
  .auth-visual{ display:none; }
  .auth-shell{ grid-template-columns:1fr; }
}

@media (max-width: 620px){
  .main{ padding:18px 14px 40px; }
  .stat-grid{ grid-template-columns:1fr 1fr; gap:10px; }
  .stat-card .v{ font-size:24px; }
  .page-head h1{ font-size:21px; }
  .quicklinks{ grid-template-columns:1fr; }
  table.refs{ min-width:760px; }
  .topbar{ padding:0 12px; gap:10px; }
  .user-chip .who{ display:none; }
  .modal{ max-width:100%; }
}
