/* ==========================================================================
   repareli.com — Portail
   Thème pro/sobre, style éditorial proche d'ewyb.fr
   ========================================================================== */

:root {
    /* Surfaces */
    --bg:            #fafaf8;
    --surface:       #ffffff;
    --surface-alt:   #f5f5f3;
    --surface-hover: #efeeec;

    /* Bordures */
    --border:        #e7e5e4;
    --border-strong: #d6d3d1;

    /* Texte */
    --text:          #1c1917;
    --text-muted:    #57534e;
    --text-faint:    #a8a29e;

    /* Accent (bleu marine sobre) */
    --accent:        #1e3a5f;
    --accent-hover:  #2a4d75;
    --accent-soft:   #eef2f7;

    /* Sémantique */
    --ok:            #166534;
    --ok-soft:       #f0fdf4;
    --danger:        #991b1b;
    --danger-soft:   #fef2f2;
    --warn:          #854d0e;
    --warn-soft:     #fefce8;

    /* Géométrie */
    --radius:        4px;
    --radius-lg:     6px;

    /* Typographie */
    --font-serif: 'Iowan Old Style', 'Charter', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
    --font-sans:  -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, system-ui, sans-serif;
    --font-mono:  ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
}

/* -------- Reset / Base -------- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }

code, pre { font-family: var(--font-mono); font-size: 13px; }

/* -------- Topbar -------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 32px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.brand {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
}
.brand::after { content: '.'; color: var(--accent); }
.brand-sub {
    margin-left: 10px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.userbox {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 13px;
    color: var(--text-muted);
}
.userbox a { color: var(--text-muted); text-decoration: none; }
.userbox a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* -------- Layout -------- */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 48px 32px;
}
.container-wide {
    max-width: 1320px;
    margin: 0 auto;
    padding: 48px 32px;
}

/* -------- Headings -------- */
h1, h2, h3, h4 { color: var(--text); margin: 0; }
h1 {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
h1 em { font-style: italic; font-weight: 500; color: var(--accent); }

.section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 18px;
}
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

/* -------- Login card -------- */
.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--bg);
}
.card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
}
.card-title {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 6px;
}
.card-title::after { content: '.'; color: var(--accent); }
.card-sub {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 24px;
}

/* -------- Forms -------- */
label, .label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin: 16px 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
input[type=text],
input[type=email],
input[type=password],
input[type=url],
input[type=number],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.4;
    outline: none;
    transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.08);
}
input::placeholder { color: var(--text-faint); }
input:disabled { background: var(--surface-alt); color: var(--text-faint); }

.checkrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
    font-size: 14px;
    color: var(--text);
}
.checkrow input { width: auto; }
.checkrow label { margin: 0; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); font-weight: 400; }

/* -------- Buttons -------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; text-decoration: none; }

.btn-full { width: 100%; }
.btn-lg { padding: 11px 18px; font-size: 14px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-ghost {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}
.btn-ghost:hover { background: var(--surface-alt); border-color: var(--text-muted); color: var(--text); }

.btn-ms {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}
.btn-ms:hover { background: var(--surface-alt); color: var(--text); }

.btn-danger {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--danger);
}
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

.btn-spacer { margin-top: 24px; }

/* -------- Separator with text -------- */
.sep {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 8px;
    color: var(--text-faint);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* -------- Flash messages -------- */
.flash {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 10px;
    font-size: 13px;
    border: 1px solid;
}
.flash.ok { background: var(--ok-soft); border-color: rgba(22,101,52,.2); color: var(--ok); }
.flash.err { background: var(--danger-soft); border-color: rgba(153,27,27,.2); color: var(--danger); }
.flash.warn { background: var(--warn-soft); border-color: rgba(133,77,14,.2); color: var(--warn); }

/* -------- Project grid (dashboard) -------- */
.grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.tile {
    display: block;
    padding: 22px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    text-decoration: none;
    transition: border-color .12s, background .12s;
}
.tile:hover {
    border-color: var(--border-strong);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
}
.tile .name {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
    color: var(--text);
}
.tile .desc {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

/* -------- Badges -------- */
.badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid;
    line-height: 1.4;
}
.b-admin  { background: var(--accent-soft); border-color: rgba(30,58,95,.15); color: var(--accent); }
.b-active { background: var(--ok-soft);     border-color: rgba(22,101,52,.2); color: var(--ok); }
.b-off    { background: var(--danger-soft); border-color: rgba(153,27,27,.2); color: var(--danger); }
.b-sso    { background: var(--warn-soft);   border-color: rgba(133,77,14,.2); color: var(--warn); }
.b-me     { background: var(--surface-alt); border-color: var(--border);      color: var(--text-muted); }

/* -------- Table (admin) -------- */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
thead th {
    text-align: left;
    padding: 10px 16px;
    background: var(--surface-alt);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
}
tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-alt); }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions form { display: inline; margin: 0; }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mono  { font-family: var(--font-mono); font-size: 12px; }

/* -------- Modal -------- */
.modal-bg {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(28, 25, 23, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal-bg.open { display: flex; }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 12px 32px rgba(0,0,0,.08);
}
.modal h3 {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}
.modal h3::after { content: '.'; color: var(--accent); }
.modal-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

/* -------- Footer -------- */
.footer {
    color: var(--text-faint);
    font-size: 12px;
    margin-top: 64px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: left;
    letter-spacing: 0.02em;
}

/* -------- Error pages -------- */
.errbox {
    max-width: 720px;
    margin: 80px auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--danger);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
}
.errbox h2 {
    font-family: var(--font-serif);
    font-size: 22px;
    margin: 0 0 12px;
}
.errbox pre {
    background: var(--surface-alt);
    padding: 12px 14px;
    border-radius: var(--radius);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
}
