/* ==========================================================================
   Atelier — design system
   ========================================================================== */
:root {
  --bg: #f5f6fa;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(124, 92, 255, .08), transparent 60%),
             radial-gradient(900px 500px at -10% 110%, rgba(56, 189, 248, .07), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-hover: #f2f3f8;
  --border: #e5e7ef;
  --border-strong: #d5d8e3;
  --text: #0f1424;
  --text-2: #475069;
  --muted: #7b8399;
  --primary: #5b4cf0;
  --primary-2: #8b5cf6;
  --primary-soft: rgba(91, 76, 240, .10);
  --primary-text: #4b3ce0;
  --ring: 0 0 0 4px rgba(91, 76, 240, .18);
  --green: #0f9d6b;  --green-soft: rgba(15, 157, 107, .12);
  --amber: #b7791f;  --amber-soft: rgba(245, 158, 11, .15);
  --red: #dc3545;    --red-soft: rgba(220, 53, 69, .11);
  --blue: #2563eb;   --blue-soft: rgba(37, 99, 235, .11);
  --violet: #7c3aed; --violet-soft: rgba(124, 58, 237, .12);
  --gray: #64748b;   --gray-soft: rgba(100, 116, 139, .13);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px -12px rgba(16, 24, 40, .12);
  --shadow-lg: 0 24px 48px -16px rgba(16, 24, 40, .25);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 268px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0a0c13;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(124, 92, 255, .14), transparent 60%),
             radial-gradient(900px 500px at -10% 110%, rgba(56, 189, 248, .08), transparent 60%);
  --surface: #121521;
  --surface-2: #161a28;
  --surface-hover: #1b2031;
  --border: #232a3d;
  --border-strong: #2f3750;
  --text: #e8eaf3;
  --text-2: #b4bbd0;
  --muted: #8089a3;
  --primary: #7c6cff;
  --primary-2: #a78bfa;
  --primary-soft: rgba(124, 108, 255, .16);
  --primary-text: #a99fff;
  --ring: 0 0 0 4px rgba(124, 108, 255, .25);
  --green: #34d399;  --amber: #fbbf24; --red: #f87171; --blue: #60a5fa; --violet: #a78bfa; --gray: #94a3b8;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 24px 48px -16px rgba(0,0,0,.7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg); background-image: var(--bg-grad); background-attachment: fixed;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 600; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column; gap: 6px; padding: 18px 14px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(16px); border-right: 1px solid var(--border);
  transition: transform .25s ease; overflow-y: auto; overscroll-behavior: contain;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; font-weight: 750; font-size: 17px; letter-spacing: -.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 6px 18px -6px var(--primary);
}
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.nav-section { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; display: flex; align-items: center; justify-content: space-between; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
  color: var(--text-2); font-weight: 500; transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.nav-link .count { margin-left: auto; font-size: 11.5px; font-weight: 650; padding: 1px 7px; border-radius: 99px; background: var(--amber-soft); color: var(--amber); }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 12.5px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #0ea5e9, var(--primary));
}
.user-meta { min-width: 0; flex: 1; line-height: 1.25; }
.user-meta strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 14px 32px; min-height: 64px;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb .sep { opacity: .5; }
.breadcrumb .current { color: var(--text); font-weight: 600; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content { padding: 28px 32px 56px; max-width: 1480px; width: 100%; }
.content.wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 720px; }
.btn.menu-toggle { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font: 600 13.5px/1 var(--font); cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { border-color: transparent; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 6px 16px -8px var(--primary); }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary), var(--primary)); }
.btn-success { border-color: transparent; color: #fff; background: #0f9d6b; }
.btn-success:hover { background: #0c8a5d; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-soft); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* Tool card */
.tool-card { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 22px; color: inherit; overflow: hidden; transition: transform .2s, box-shadow .2s, border-color .2s; }
.tool-card::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--primary), var(--primary-2), #38bdf8); opacity: 0; transition: opacity .2s; }
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); text-decoration: none; }
.tool-card:hover::after { opacity: 1; }
.tool-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: var(--primary-text); background: var(--primary-soft); }
.tool-icon .icon { width: 22px; height: 22px; }
.tool-card p { margin: 0; color: var(--text-2); font-size: 13.5px; }
.tool-card .row { display: flex; align-items: center; justify-content: space-between; }
.tool-stats { display: flex; gap: 18px; padding-top: 14px; border-top: 1px dashed var(--border); }
.tool-stats div { display: flex; flex-direction: column; }
.tool-stats strong { font-size: 18px; letter-spacing: -.02em; }
.tool-stats span { font-size: 12px; color: var(--muted); }
.tool-card.placeholder { border-style: dashed; box-shadow: none; background: transparent; align-items: center; justify-content: center; text-align: center; color: var(--muted); min-height: 220px; }

/* Stat tiles */
.stat { padding: 18px 20px; }
.stat .label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin-top: 4px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 650; white-space: nowrap; line-height: 1.4; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge-green { color: var(--green); background: var(--green-soft); }
.badge-amber { color: var(--amber); background: var(--amber-soft); }
.badge-red { color: var(--red); background: var(--red-soft); }
.badge-blue { color: var(--blue); background: var(--blue-soft); }
.badge-violet { color: var(--violet); background: var(--violet-soft); }
.badge-gray { color: var(--gray); background: var(--gray-soft); }

/* ---------- Tabs / segmented ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.segmented { display: inline-flex; padding: 4px; gap: 2px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); flex-wrap: wrap; }
.segmented a { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 8px; color: var(--text-2); font-weight: 550; font-size: 13px; }
.segmented a:hover { color: var(--text); text-decoration: none; }
.segmented a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.segmented .n { font-size: 11px; color: var(--muted); font-weight: 650; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  height: 38px; width: 100%; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: 500 13.5px var(--font); transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input-sm { height: 32px; font-size: 13px; padding: 0 9px; border-radius: 8px; }
.input.mono { font-family: var(--mono); }
.search { position: relative; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 36px; width: 280px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; color: var(--text-2); user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--border-strong); transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: none; }
.table tr.clickable { cursor: pointer; }
.table .supplier { display: flex; align-items: center; gap: 12px; }
.table .supplier strong { display: block; font-weight: 600; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.table td.mono { white-space: nowrap; }
.table td.actions { white-space: nowrap; text-align: right; }
.table .supplier span { font-size: 12.5px; color: var(--muted); }
.supplier-avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; color: var(--primary-text); background: var(--primary-soft); }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); padding: 12px 16px; }

/* Empty state */
.empty { text-align: center; padding: 56px 24px; color: var(--muted); }
.empty .tool-icon { margin: 0 auto 14px; }
.empty h3 { color: var(--text); margin-bottom: 4px; }

/* ---------- Flash toasts ---------- */
.toasts { position: fixed; right: 24px; bottom: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(440px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 13px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: toast-in .3s ease; font-weight: 500; }
.toast .icon { margin-top: 1px; }
.toast-success .icon { color: var(--green); }
.toast-error { border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.toast-error .icon { color: var(--red); }
.toast-info .icon { color: var(--blue); }
.toast button { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 18px; line-height: 1; }
.toast.hide { opacity: 0; transform: translateY(8px); transition: all .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* Alerts */
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 11px; font-size: 13px; border: 1px solid; }
.alert-warn { color: var(--amber); background: var(--amber-soft); border-color: transparent; }
.alert-error { color: var(--red); background: var(--red-soft); border-color: transparent; }
.alert-info { color: var(--blue); background: var(--blue-soft); border-color: transparent; }
.alert-ok { color: var(--green); background: var(--green-soft); border-color: transparent; }
.alert ul { margin: 0; padding-left: 16px; }

/* ---------- Invoice detail (split view) ---------- */
.split { display: grid; grid-template-columns: minmax(0, .9fr) minmax(560px, 1.1fr); gap: 20px; align-items: start; }
.viewer { position: sticky; top: 84px; height: calc(100vh - 108px); display: flex; flex-direction: column; overflow: hidden; }
.viewer .card-head { padding: 10px 14px; }
.viewer iframe, .viewer .viewer-img { flex: 1; width: 100%; border: 0; background: #525659; }
.viewer .viewer-img { object-fit: contain; }
.viewer .empty { flex: 1; display: grid; place-content: center; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.fact .k { font-size: 12px; color: var(--muted); font-weight: 500; }
.fact .v { font-weight: 600; margin-top: 2px; word-break: break-word; }
.amounts { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-top: 18px; }
.amounts > div { padding: 12px 14px; background: var(--surface-2); }
.amounts > div + div { border-left: 1px solid var(--border); }
.amounts .k { font-size: 12px; color: var(--muted); }
.amounts .v { font-size: 17px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.amounts .ttc { background: var(--primary-soft); }
.amounts .ttc .v { color: var(--primary-text); }

.entry-table td { padding: 6px 6px; }
.entry-table th { padding: 9px 8px; }
.entry-table td:first-child, .entry-table th:first-child { padding-left: 16px; }
.entry-table td:last-child, .entry-table th:last-child { padding-right: 12px; }
.entry-table .input-sm { min-width: 0; }
.entry-table { table-layout: fixed; }
.entry-table .input-sm { width: 100%; }
.entry-table .c-acc { width: 116px; }
.entry-table .c-amt { width: 108px; }
.entry-table .c-ana { width: 64px; }
.entry-table .c-del { width: 44px; }
.entry-table input[readonly] { background: var(--surface-2); color: var(--text-2); }
.balance { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.balance.ok { color: var(--green); }
.balance.ko { color: var(--red); }

/* Code preview */
.code { font-family: var(--mono); font-size: 12px; line-height: 1.7; white-space: pre; overflow-x: auto; padding: 18px 20px; margin: 0; background: #0d1020; color: #d7dcf5; border-radius: 0 0 var(--radius) var(--radius); }
.ruler { color: #5f6a94; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero {
  position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; color: #fff;
  background: radial-gradient(800px 400px at 20% 10%, rgba(167, 139, 250, .55), transparent 60%),
              radial-gradient(700px 500px at 90% 90%, rgba(56, 189, 248, .45), transparent 60%),
              linear-gradient(140deg, #1e1b4b, #312e81 45%, #4c1d95);
}
.auth-hero h2 { font-size: 38px; line-height: 1.12; font-weight: 750; letter-spacing: -.03em; max-width: 520px; }
.auth-hero p { color: rgba(255,255,255,.75); font-size: 15px; max-width: 460px; }
.auth-hero .pill { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: 99px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); font-size: 12.5px; font-weight: 600; backdrop-filter: blur(8px); }
.auth-hero .grid-bg { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(circle at 60% 40%, #000, transparent 75%); }
.auth-hero > * { position: relative; }
.auth-form { display: grid; place-items: center; padding: 32px; }
.auth-form form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.auth-form .input { height: 44px; }
.auth-form .btn { height: 44px; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .split { grid-template-columns: 1fr; }
  .viewer { position: relative; top: 0; height: 70vh; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  .main { margin-left: 0; }
  .btn.menu-toggle { display: inline-flex; }
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .breadcrumb a, .breadcrumb .sep { display: none; }
  .topbar-actions .muted { display: none; }
  .toolbar .btn-group { width: 100%; }
  .search { flex: 1; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .search .input { width: 100%; }
  .facts { grid-template-columns: 1fr; }
}
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Administration des outils ---------- */
.tool-admin { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.tool-admin-id { display: flex; gap: 16px; align-items: flex-start; }
.tool-admin-controls { display: flex; flex-direction: column; gap: 12px; align-items: stretch; min-width: 380px; }
.stage-picker { display: flex; align-items: center; gap: 6px; }
.stage-picker label { flex: 1; cursor: pointer; }
.stage-picker input { position: absolute; opacity: 0; pointer-events: none; }
.stage-picker label span {
  display: flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--border-strong); font-weight: 600; font-size: 13px;
  color: var(--text-2); background: var(--surface); transition: all .15s;
}
.stage-picker label span i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.stage-picker label:hover span { background: var(--surface-hover); }
.stage-picker input:focus-visible + span { box-shadow: var(--ring); }
.stage-picker .stage-violet input:checked + span { color: var(--violet); background: var(--violet-soft); border-color: transparent; }
.stage-picker .stage-amber input:checked + span { color: var(--amber); background: var(--amber-soft); border-color: transparent; }
.stage-picker .stage-green input:checked + span { color: var(--green); background: var(--green-soft); border-color: transparent; }
.stage-picker input:checked + span i { background: currentColor; }
.stage-arrow { color: var(--muted); display: inline-flex; }
@media (max-width: 1000px) {
  .tool-admin { grid-template-columns: 1fr; }
  .tool-admin-controls { min-width: 0; }
}
