/* Juriveille 2 — feuille de style */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f8fafc; --text: #1f2937; --muted: #6b7280; --border: #e5e7eb;
  --primary: #1f5f8b; --primary-hover: #174a6d; --primary-soft: #e6f0f7; --accent: #b45309;
  --success: #15803d; --success-soft: #dcfce7; --error: #b91c1c; --error-soft: #fee2e2; --warn: #92400e; --warn-soft: #fef3c7;
  --radius: 8px; --shadow: 0 1px 2px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #111418; --surface: #1a1f26; --surface-2: #232a33; --text: #e5e7eb; --muted: #9ca3af; --border: #2f3843; --primary: #6fb3e0; --primary-hover: #8fc5ea; --primary-soft: #1d2e3c; --success-soft: #14321f; --error-soft: #3b1d1d; --warn-soft: #3a2a10; --success: #4ade80; --error: #f87171; --warn: #fbbf24; }
}
:root[data-theme="dark"] { --bg: #111418; --surface: #1a1f26; --surface-2: #232a33; --text: #e5e7eb; --muted: #9ca3af; --border: #2f3843; --primary: #6fb3e0; --primary-hover: #8fc5ea; --primary-soft: #1d2e3c; --success-soft: #14321f; --error-soft: #3b1d1d; --warn-soft: #3a2a10; --success: #4ade80; --error: #f87171; --warn: #fbbf24; }

* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
p { margin: 0 0 .75rem; }
code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
pre { background: var(--surface-2); padding: .75rem; border-radius: var(--radius); overflow: auto; font-size: .85rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
[hidden] { display: none !important; }

/* Layout */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: .5rem 1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); display: flex; align-items: center; gap: .5rem; }
.brand .logo { width: 26px; height: 26px; border-radius: 6px; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; }
.nav { display: flex; gap: .15rem; flex-wrap: wrap; }
.nav a { padding: .4rem .65rem; border-radius: 6px; color: var(--text); font-weight: 500; }
.nav a:hover, .nav a.active { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.org-switch select { max-width: 200px; }
.container { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.container.narrow { max-width: 760px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.25rem; }
@media (max-width: 900px) { .layout-side { grid-template-columns: 1fr; } }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.15rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.stat { display: flex; flex-direction: column; gap: .1rem; }
.stat .n { font-size: 1.6rem; font-weight: 700; }
.stat .l { color: var(--muted); font-size: .85rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.flex { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt { margin-top: 1rem; } .mb0 { margin-bottom: 0; }

/* Forms */
label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
textarea { min-height: 90px; resize: vertical; }
input[type=color] { width: 48px; height: 34px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.field { margin-bottom: .85rem; }
.field .help { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.row { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.checkline { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.checkline input { width: auto; }
.inline-form { display: inline; }
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .85rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; line-height: 1.2; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--error); border-color: var(--error); }
.btn-danger:hover { background: var(--error-soft); }
.btn-sm { padding: .25rem .55rem; font-size: .82rem; }
.btn-link { border: 0; background: none; color: var(--primary); padding: 0; }
.btn[disabled] { opacity: .5; cursor: default; }

/* Alerts */
.flash { padding: .65rem .9rem; border-radius: var(--radius); margin-bottom: .75rem; border: 1px solid transparent; }
.flash-success { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.flash-error { background: var(--error-soft); color: var(--error); border-color: var(--error); }
.flash-info, .notice { background: var(--primary-soft); color: var(--text); border: 1px solid var(--primary); padding: .65rem .9rem; border-radius: var(--radius); margin-bottom: .75rem; }
.notice-warn { background: var(--warn-soft); border-color: var(--warn); }

/* Badges & tags */
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge-cat-textes { color: #1d4ed8; } .badge-cat-juradmin { color: #7c3aed; } .badge-cat-jurjud { color: #b45309; } .badge-cat-constit { color: #be123c; } .badge-cat-europe { color: #0e7490; }
.badge-status-nouveau { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge-status-a_traiter { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-status-traite { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-status-ecarte { opacity: .7; text-decoration: line-through; }
.tag { display: inline-block; padding: .05rem .5rem; border-radius: 4px; font-size: .74rem; font-weight: 600; color: #fff; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .3rem; vertical-align: middle; }
.score { display: inline-block; min-width: 2.2em; text-align: center; padding: .05rem .35rem; border-radius: 4px; font-size: .74rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); }

/* Tabs */
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tabs a { padding: .5rem .8rem; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; margin-bottom: -1px; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs .count { background: var(--surface-2); border-radius: 999px; padding: 0 .45rem; font-size: .75rem; margin-left: .25rem; }

/* Item list */
.item-list { list-style: none; margin: 0; padding: 0; }
.item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .75rem; padding: .8rem 0; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
.item .check { padding-top: .2rem; }
.item .meta { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; font-size: .8rem; color: var(--muted); margin-bottom: .2rem; }
.item .title { font-weight: 600; font-size: 1rem; }
.item .title a { color: var(--text); }
.item .summary { color: var(--muted); font-size: .88rem; margin-top: .2rem; }
.item .tags { margin-top: .35rem; display: flex; gap: .3rem; flex-wrap: wrap; }
.item .actions { display: flex; flex-direction: column; gap: .3rem; align-items: flex-end; }
.flag { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: .2rem .5rem; font-size: .8rem; cursor: pointer; color: var(--muted); }
.flag.on { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.pager { display: flex; gap: .5rem; align-items: center; justify-content: center; margin-top: 1rem; }
.bulkbar { display: none; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .5rem .75rem; background: var(--primary-soft); border-radius: var(--radius); margin-bottom: .75rem; }
.bulkbar.show { display: flex; }
.filters { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
.filters .wide { grid-column: 1 / -1; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; }
.table-wrap { overflow-x: auto; }
tr:hover td { background: var(--surface-2); }

/* Fiche */
.doc-head .meta { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .88rem; }
.doc-content { white-space: pre-wrap; font-size: .92rem; max-height: 480px; overflow: auto; background: var(--surface-2); padding: .85rem; border-radius: var(--radius); }
.note { border-left: 3px solid var(--border); padding: .4rem .8rem; margin-bottom: .75rem; }
.note.private { border-left-color: var(--accent); }
.note .who { font-size: .8rem; color: var(--muted); }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
.timeline li { padding: .25rem 0; border-bottom: 1px dashed var(--border); }
details summary { cursor: pointer; font-weight: 500; }

/* Auth pages */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.auth .card { width: 100%; max-width: 440px; padding: 1.5rem; }
.auth .brand { justify-content: center; margin-bottom: 1rem; font-size: 1.3rem; }
.auth.wide .card { max-width: 720px; }
.qr { display: block; margin: .5rem auto; width: 200px; height: 200px; background: #fff; padding: 6px; border-radius: 6px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; font-family: ui-monospace, monospace; font-size: 1.05rem; }
.check-ok { color: var(--success); font-weight: 600; } .check-ko { color: var(--error); font-weight: 600; }

.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-indicator { display: none; }
@media (max-width: 640px) { .item { grid-template-columns: auto minmax(0, 1fr); } .item .actions { grid-column: 2; flex-direction: row; } .topbar-right { margin-left: 0; width: 100%; } }
