/* ── Sogecore Inventaire — Design System ──────────────────── */
/* Palette: rgb(190,19,34) / #111316 / #f6f6f4 / #e6e7ea     */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --red:      rgb(190, 19, 34);
    --red-h:    rgb(168, 15, 29);
    --ink:      #111316;
    --ink-soft: #3a3d42;
    --mute:     #6b6f76;
    --line:     #e6e7ea;
    --bg:       #f6f6f4;
    --bg-card:  #ffffff;
    --olive:    #4d5a32;
    --olive-bg: #eef2e7;
    --font:     "Helvetica Neue", Helvetica, Arial, sans-serif;
    --mono:     "SF Mono", Menlo, Consolas, "Courier New", monospace;
    --radius:   2px;
}

html { font-size: 16px; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--font); font-weight: 600; letter-spacing: 0.01em;
    border-radius: var(--radius); cursor: pointer; border: 1px solid transparent;
    transition: background 120ms ease, transform 80ms ease;
    white-space: nowrap; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-sm  { padding: 8px 12px;  font-size: 13px; height: 34px; }
.btn-md  { padding: 10px 16px; font-size: 14px; height: 40px; }
.btn-lg  { padding: 14px 20px; font-size: 15px; height: 52px; }
.btn { padding: 10px 16px; font-size: 14px; }

.btn-primary   { background: var(--red);   color: #fff; border-color: var(--red); }
.btn-primary:hover { background: var(--red-h); }
.btn-secondary { background: #fff;         color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--ink-soft); }
.btn-dark      { background: var(--ink);   color: #fff; border-color: var(--ink); }
.btn-ghost     { background: transparent;  color: var(--ink); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); }
.btn-full      { width: 100%; }

.btn-link {
    background: none; border: none; cursor: pointer;
    color: var(--ink-soft); font-size: 14px; padding: 4px; font-family: var(--font);
    text-decoration: underline; text-underline-offset: 3px;
    text-decoration-color: var(--line);
}

/* ── Form fields ───────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
    font-size: 12px; font-weight: 600; color: var(--ink-soft);
    text-transform: uppercase; letter-spacing: 0.08em;
}
.required { color: var(--red); margin-left: 4px; }
.field-hint { font-size: 12px; color: var(--mute); }
.field-error { font-size: 12px; color: var(--red); font-weight: 500; }

.input {
    height: 44px; padding: 0 12px;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: #fff; color: var(--ink); font-family: var(--font);
    font-size: 15px; outline: none;
    transition: border-color 120ms;
    width: 100%;
}
.input:focus { border-color: var(--ink); }
.input::placeholder { color: var(--mute); }

.select {
    height: 44px; padding: 0 36px 0 12px;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: #fff; color: var(--ink); font-family: var(--font);
    font-size: 15px; outline: none; appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1L6 6L11 1' stroke='%23111316' stroke-width='1.5' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    width: 100%;
    transition: border-color 120ms;
}
.select:focus { border-color: var(--ink); outline: none; }

.form-stack { display: flex; flex-direction: column; gap: 16px; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
    font-family: var(--font); font-size: 11px; font-weight: 700;
    letter-spacing: 0.06em; border-radius: var(--radius); border: 1px solid transparent;
    white-space: nowrap;
}
.badge-neutral { background: #eef0f3; color: var(--ink-soft); border-color: #e0e2e6; }
.badge-red     { background: #fdecee; color: var(--red);      border-color: #f4c8cd; }
.badge-ink     { background: var(--ink); color: #fff; }
.badge-olive   { background: var(--olive-bg); color: var(--olive); border-color: #dde4cf; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(17,19,22,0.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; padding: 20px;
    animation: fadeIn 140ms ease;
}
.modal-backdrop[hidden] { display: none !important; }

.modal {
    background: #fff; width: 520px; max-width: 100%; max-height: 90vh;
    display: flex; flex-direction: column;
    border-top: 3px solid var(--red);
    box-shadow: 0 24px 60px rgba(0,0,0,.25);
    animation: slideUp 200ms cubic-bezier(.2,.7,.2,1);
    border-radius: var(--radius);
}
.modal-sm { width: 440px; }

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 18px; font-weight: 700; color: var(--ink); }
.modal-close {
    background: none; border: none; cursor: pointer; padding: 4px; color: var(--mute);
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
}
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 24px; overflow: auto; flex: 1; }
.modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--line);
    display: flex; justify-content: flex-end; gap: 10px; background: var(--bg);
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--ink); color: #fff; padding: 12px 18px;
    font-size: 14px; font-weight: 500; z-index: 200;
    display: flex; align-items: center; gap: 10px;
    border-left: 3px solid var(--red);
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    animation: slideUp 200ms ease;
    opacity: 0; pointer-events: none; transition: opacity 200ms;
    border-radius: var(--radius);
}
.toast.visible { opacity: 1; }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.th {
    padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 700;
    color: var(--mute); text-transform: uppercase; letter-spacing: 0.08em;
    background: var(--bg); border-bottom: 1px solid var(--line);
}
.th-right { text-align: right; }
.td { padding: 14px 16px; color: var(--ink); vertical-align: middle; border-bottom: 1px solid var(--line); }
.td-right { text-align: right; }
.tr:last-child .td { border-bottom: none; }
.tr:hover { background: #fafaf8; }

.sort-btn {
    background: none; border: none; cursor: pointer; padding: 0;
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 700; color: var(--mute);
    text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--font);
    white-space: nowrap;
}
.sort-btn.sort-active { color: var(--ink); }
.sort-arrow { opacity: 0.3; display: inline-flex; }
.sort-active .sort-arrow { opacity: 1; }
.sort-arrow-up { transform: rotate(180deg); }

.icon-btn {
    width: 32px; height: 32px; background: #fff;
    border: 1px solid var(--line); cursor: pointer; border-radius: var(--radius);
    color: var(--ink-soft); display: inline-flex;
    align-items: center; justify-content: center;
    transition: all 120ms;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn-danger { color: var(--red); }
.icon-btn-danger:hover { border-color: var(--red); background: #fdecee; }

.row-actions { display: inline-flex; gap: 6px; }

/* ── Misc utilities ────────────────────────────────────────── */
.mono { font-family: var(--mono); font-size: 12px; color: var(--ink); }
.text-soft { color: var(--ink-soft); }
.text-mute { color: var(--mute); }
.text-ink  { color: var(--ink); }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.hidden { display: none !important; }
.eyebrow {
    font-size: 11px; font-weight: 700; color: var(--red);
    letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 8px;
}
.empty-state { padding: 32px; color: var(--mute); text-align: center; }

.alert-error {
    background: #fdecee; color: var(--red); padding: 10px 12px;
    border-left: 3px solid var(--red); font-size: 13px; font-weight: 500;
    border-radius: var(--radius);
}

.loading-spinner-wrap { display: flex; align-items: center; justify-content: center; padding: 40px; }
.loading-spinner {
    width: 24px; height: 24px; border-radius: 50%;
    border: 2px solid var(--line); border-top-color: var(--red);
    animation: spin 700ms linear infinite;
}

/* ── Logo fallback ─────────────────────────────────────────── */
.logo-fallback {
    display: flex; align-items: center; gap: 10px;
}
.logo-fallback-text {
    color: #fff; font-family: var(--font);
    font-weight: 800; letter-spacing: 0.14em; font-size: 14px;
}

/* ── Animations ────────────────────────────────────────────── */
@keyframes fadeIn   { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp  { from { opacity:0; transform:translateY(12px) } to { opacity:1; transform:translateY(0) } }
@keyframes spin     { to { transform: rotate(360deg) } }
@keyframes pulse    { 0%,100% { opacity:.4 } 50% { opacity:1 } }
