/* Tahuarii — admin de prospection. Même identité que la maquette : sobre, lisible, accents teal / ambre. */
:root {
  --bg: #F4F5F2; --surface: #FFFFFF; --ink: #18201C; --ink-2: #2D3732; --muted: #56605A; --line: #DDE1DC; --line-2: #ECEFEB;
  --accent: #0E6B5C; --accent-ink: #0A4F44; --accent-soft: #DCEFE9; --amber: #E8A33D;
  --nav: #18201C; --nav-2: #2E3B35; --nav-ink: #D3DAD6;
  --ok-bg: #DCEFE9; --ok: #0A5146; --warn-bg: #FBEBDD; --warn: #8A4105; --bad-bg: #FBE4E1; --bad: #8E2117;
  --info-bg: #E4ECF8; --info: #1D4A90; --violet-bg: #E6E3EE; --violet: #4A3D6B; --neutral-bg: #EEF1EE;
  --radius: 12px; --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; line-height: 1.45; }
a { color: var(--accent); } a:hover { color: var(--accent-ink); }
h1 { font-size: 1.9rem; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: .85rem; margin: 1rem 0 .5rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
p { margin: 0 0 .75rem; }
.mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.pre { white-space: pre-wrap; }
.hidden { display: none !important; }

/* Structure */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 230px; max-width: 100%; background: var(--nav); color: var(--nav-ink); padding: 22px 14px; display: flex; flex-direction: column; gap: 22px; }
.brand { padding: 0 10px; display: flex; flex-direction: column; }
.brand b { color: #fff; font-size: 1.45rem; letter-spacing: -0.01em; }
.brand span { font-family: var(--mono); font-size: .75rem; color: #A9B4AE; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #8E9A93; padding: 12px 12px 4px; }
.nav a { display: flex; justify-content: space-between; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 8px; color: var(--nav-ink); text-decoration: none; }
.nav a:hover { background: #24302A; color: #fff; }
.nav a.active { background: var(--nav-2); color: #fff; font-weight: 600; }
.badge { background: var(--amber); color: var(--ink); font-size: .75rem; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.side .agent { margin-top: auto; background: #232E29; border-radius: 10px; padding: 12px 14px; font-size: .85rem; display: flex; flex-direction: column; gap: 4px; }
.side .agent b { color: #fff; }
.side .user { font-size: .85rem; padding: 0 10px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.side .user form { margin: 0; }
.side .user button { background: none; border: 0; color: #A9B4AE; cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }
main.content { flex: 999 1 560px; min-width: 0; padding: 26px 36px 48px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 720px) { main.content { padding: 18px 16px 40px; } .side { gap: 12px; } .nav { flex-direction: row; flex-wrap: wrap; } .nav .group { display: none; } }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Cartes et grilles */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; }
.card.dark { background: var(--nav); color: var(--nav-ink); border-color: var(--nav); }
.card.dark h2 { color: #fff; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.row > .col-3 { flex: 3 1 540px; min-width: 0; }
.row > .col-2 { flex: 2 1 340px; min-width: 0; }
.row > .col-1 { flex: 1 1 260px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; }
.kpi .l { font-size: .85rem; color: var(--muted); font-weight: 500; }
.kpi .v { font-family: var(--mono); font-size: 1.9rem; font-weight: 600; letter-spacing: -0.02em; }
.kpi .s { font-size: .8rem; color: var(--muted); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.grid-form .wide { grid-column: 1 / -1; }
.dl { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 16px; margin: 0; font-size: .95rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }

/* Formulaires */
label.f { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 600; color: #3B4540; }
label.check { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: .95rem; font-weight: 400; color: var(--ink); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], input[type=date], input[type=datetime-local], input[type=time], select, textarea {
  font: inherit; font-weight: 400; font-size: .95rem; color: var(--ink); background: #fff; border: 1px solid #C9CFCA; border-radius: 8px; min-height: 40px; padding: 0 11px; width: 100%;
}
textarea { padding: 10px 11px; line-height: 1.5; resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #9CCFC2; outline-offset: 1px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); }
select[multiple] { min-height: 110px; padding: 6px; }
.field-hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid #C9CFCA; background: #fff; color: var(--ink); font: inherit; font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); color: #fff; }
.btn.amber { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.btn.danger { color: var(--bad); border-color: #E7B7B1; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.inline { display: inline; margin: 0; }
form.stack-form { display: flex; flex-direction: column; gap: 14px; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { text-align: left; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr:hover td { background: #FAFBF9; }
table.t td:first-child, table.t th:first-child { padding-left: 0; }
table.t .strong { font-weight: 600; color: var(--ink); text-decoration: none; }
.score { display: inline-flex; justify-content: center; min-width: 40px; font-family: var(--mono); font-weight: 600; background: var(--neutral-bg); border-radius: 6px; padding: 3px 6px; }

/* Étiquettes */
.tag { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: .78rem; background: var(--neutral-bg); border: 1px solid var(--line); color: var(--ink-2); border-radius: 999px; padding: 1px 9px; text-decoration: none; white-space: nowrap; }
.tag.green { background: var(--ok-bg); color: var(--ok); border-color: #BFE0D5; }
.tag.red { background: var(--bad-bg); color: var(--bad); border-color: #F0C6C0; }
.tag.orange { background: var(--warn-bg); color: var(--warn); border-color: #F0D2B6; }
.tag.blue { background: var(--info-bg); color: var(--info); border-color: #C6D5EE; }
.tag.purple { background: var(--violet-bg); color: var(--violet); border-color: #D2CCE2; }
.tag.teal { background: #D9EEF0; color: #0C5560; border-color: #B7DDE1; }
.tag.gray { background: #EDEDED; color: #3D3D3D; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-block; font-size: .78rem; font-weight: 600; border-radius: 999px; padding: 2px 10px; background: var(--neutral-bg); color: var(--ink-2); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: var(--info-bg); color: var(--info); }
.chip.violet { background: var(--violet-bg); color: var(--violet); }
.chip.dark { background: var(--ink); color: #fff; }

/* Messages */
.flash { border-radius: 10px; padding: 12px 16px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--bad-bg); color: var(--bad); }
.flash.info { background: var(--info-bg); color: var(--info); }
.notice { background: #F1F8F5; border: 1px solid #CBE3DA; border-radius: 10px; padding: 12px 16px; }
.notice .t { font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ok); display: block; margin-bottom: 3px; }
.empty { color: var(--muted); padding: 18px 0; }
.secret { font-family: var(--mono); background: #fff7e6; border: 1px dashed var(--amber); border-radius: 8px; padding: 12px; overflow-wrap: anywhere; }

/* Barre de sélection / filtres */
.bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; background: var(--nav); color: #fff; border-radius: var(--radius); padding: 14px 20px; }
.bar .muted { color: #C9D2CD; }
.filters summary { cursor: pointer; font-weight: 600; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; font-size: .9rem; }
.progress { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; min-width: 90px; }
.progress > span { display: block; height: 6px; background: var(--accent); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.bars .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-width: 8px; }
.bars .b span { display: block; background: var(--accent); border-radius: 3px 3px 0 0; }
.bars .b span.r { background: var(--amber); }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* Fil d'emails */
.thread { display: flex; flex-direction: column; gap: 12px; }
.mail { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: #fff; }
.mail.ours { background: #F7F8F6; }
.mail .meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.mail .subject { font-weight: 600; margin-bottom: 6px; }
.mail .body { white-space: pre-wrap; font-size: .93rem; overflow-wrap: anywhere; }
.bilingual { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.bilingual .lang { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: .9rem; }
.timeline .when { color: var(--muted); font-family: var(--mono); font-size: .78rem; }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: #ECEFEB; border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 200px; }
.kcol h3 { margin: 4px 4px 6px; display: flex; justify-content: space-between; }
.kcol.drop { outline: 2px dashed var(--accent); }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: grab; font-size: .9rem; }
.kcard a { color: var(--ink); font-weight: 600; text-decoration: none; }
.kcard .muted { font-size: .8rem; }

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 420px; padding: 30px; }
.login h1 { margin-bottom: 4px; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600; }
.tabs a.active { color: var(--ink); border-color: var(--accent); }
details.box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: #fff; }
details.box summary { cursor: pointer; font-weight: 600; }
code.k { font-family: var(--mono); background: var(--neutral-bg); padding: 1px 6px; border-radius: 5px; }
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
