/* =============================================================================
   Heures · Pisciculture Meyer
   Style mobile-first, responsive desktop.
   ============================================================================= */

:root {
    --bg:          #f7f8fa;
    --surface:     #ffffff;
    --border:      #e2e6ec;
    --text:        #1f2937;
    --muted:       #6b7280;
    --primary:     #0d6efd;
    --primary-dk:  #0a58ca;
    --secondary:   #6c757d;
    --success:     #198754;
    --danger:      #dc3545;
    --warning:     #ffc107;
    --info:        #0dcaf0;
    --weekend-bg:  #f3f4f6;
    --holiday-bg:  #fff7ec;
    --absence-bg:  #f5f3ff;
    --radius:      8px;
    --shadow:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg:   0 10px 25px rgba(0,0,0,.08), 0 4px 10px rgba(0,0,0,.04);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 16px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; }
h1 { font-size: 1.7rem; margin: 0 0 1rem; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mt { margin-top: 1rem; }
.full { grid-column: 1 / -1; }

.container { max-width: 1100px; margin: 0 auto; padding: 1rem; }

/* ---------- topbar ---------- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
    display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
    padding-top: .75rem; padding-bottom: .75rem;
}
.brand { font-size: 1.2rem; font-weight: 600; color: var(--text); }
.mainnav {
    display: flex; flex-wrap: wrap; gap: .25rem;
    flex: 1; justify-content: center;
}
.mainnav a {
    padding: .4rem .75rem; border-radius: var(--radius);
    color: var(--muted);
}
.mainnav a:hover { background: var(--bg); text-decoration: none; }
.mainnav a.active { background: var(--primary); color: #fff; }
.userbox {
    display: flex; align-items: center; gap: .75rem;
    font-size: .9rem;
}
.user-name { font-weight: 500; }
.btn-link { color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .55rem 1rem; font-size: .95rem;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    cursor: pointer; text-decoration: none;
    transition: all .15s ease;
}
.btn:hover { background: var(--bg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dk); border-color: var(--primary-dk); }
.btn-secondary { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.btn-danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm  { padding: .3rem .6rem; font-size: .85rem; }
.btn-lg  { padding: .85rem 1.25rem; font-size: 1.1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- alerts ---------- */
.alert {
    padding: .75rem 1rem; border-radius: var(--radius);
    border: 1px solid var(--border);
    background: #fff;
}
.alert-success { background: #d1e7dd; border-color: #badbcc; color: #0a3622; }
.alert-error   { background: #f8d7da; border-color: #f1aeb5; color: #58151c; }
.alert-info    { background: #cff4fc; border-color: #9eeaf9; color: #055160; }

/* ---------- forms ---------- */
.form-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;
    background: var(--surface); padding: 1.25rem;
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.form-grid label { display: flex; flex-direction: column; gap: .25rem; font-weight: 500; }
.form-grid input, .form-grid select, .form-grid textarea {
    padding: .55rem .75rem; font-size: 1rem;
    border: 1px solid var(--border); border-radius: 6px;
    background: #fff; color: var(--text);
    width: 100%; font-family: inherit;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
    outline: 2px solid var(--primary); outline-offset: -1px;
    border-color: var(--primary);
}
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.lbl { display: block; margin: .75rem 0 .25rem; font-weight: 500; }

@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
}

/* ---------- toolbar ---------- */
.toolbar {
    display: flex; flex-wrap: wrap; gap: 1rem; align-items: end;
    background: var(--surface); padding: .75rem 1rem;
    border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem;
}
.toolbar label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: .25rem; }
.toolbar select, .toolbar input {
    padding: .4rem .6rem; border: 1px solid var(--border); border-radius: 6px;
    font-size: .95rem; min-width: 180px;
}

/* ---------- page-head ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.period-picker input { padding: .4rem .6rem; border: 1px solid var(--border); border-radius: 6px; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.card  { background: var(--surface); padding: 1rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.kpi   { display: flex; flex-direction: column; }
.kpi-label { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }
.kpi-value { font-size: 1.8rem; font-weight: 600; margin-top: .25rem; }

/* ---------- data tables ---------- */
.data-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    background: var(--surface); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow);
}
.data-table th, .data-table td {
    padding: .65rem .85rem; text-align: left; border-bottom: 1px solid var(--border);
    font-size: .95rem;
}
.data-table th { background: #f5f7fa; font-weight: 600; font-size: .85rem; text-transform: uppercase; color: var(--muted); }
.data-table tr:last-child td { border-bottom: none; }
.data-table .num, .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tr:hover td { background: #fafbfd; }

/* ---------- hours table ---------- */
.hours-table tr.weekend td { background: var(--weekend-bg); color: var(--muted); }
.hours-table tr.holiday td { background: var(--holiday-bg); }
.hours-table tr.absence td { background: var(--absence-bg); color: var(--muted); }
.hours-table .time-input  { padding: .35rem; width: 6.5rem; font-variant-numeric: tabular-nums; border: 1px solid var(--border); border-radius: 5px; font-size: .95rem; }
.hours-table .notes-input { width: 100%; padding: .35rem; border: 1px solid var(--border); border-radius: 5px; font-size: .9rem; }
.hours-table .sep { color: var(--muted); margin: 0 .25rem; }
.hours-table tr.saved-flash td { background: #d1e7dd !important; transition: background .6s; }
.hours-table tr.save-error td  { background: #f8d7da !important; }
.inline-check { display: inline-flex; align-items: center; gap: .25rem; cursor: pointer; }

@media (max-width: 800px) {
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr { border-bottom: 1px solid var(--border); padding: .5rem 0; }
    .data-table td { padding: .35rem .85rem; border-bottom: none; }
    .data-table td.num { text-align: left; }
    .hours-table .time-input { width: 5.5rem; }
}

/* ---------- totals bar ---------- */
.totals-bar {
    display: flex; gap: 1.5rem; flex-wrap: wrap;
    background: var(--surface); padding: .75rem 1rem;
    border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem;
}
.totals-bar div { font-size: .95rem; }

/* ---------- tags ---------- */
.tag { display: inline-block; padding: .15rem .55rem; font-size: .75rem; border-radius: 99px; background: #eef2f6; color: var(--muted); }
.tag-muted     { background: #e5e7eb; }
.tag-cp        { background: #cfe2ff; color: #0a3a7d; }
.tag-rtt       { background: #d1e7dd; color: #0a3622; }
.tag-sick      { background: #f8d7da; color: #58151c; }
.tag-holiday_off { background: #fff3cd; color: #664d03; }
.tag-unpaid    { background: #e2d9f3; color: #2e1a55; }
.tag-other     { background: #ced4da; color: #1f2937; }

/* ---------- empty state ---------- */
.empty {
    background: var(--surface); padding: 2rem;
    border-radius: var(--radius); box-shadow: var(--shadow);
    text-align: center;
}

/* ---------- profile ---------- */
.profile-info {
    display: grid; grid-template-columns: 120px 1fr; gap: .5rem 1rem;
    background: var(--surface); padding: 1rem;
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.profile-info dt { color: var(--muted); }
.profile-info dd { margin: 0; font-weight: 500; }

.hint { color: var(--muted); margin-top: 1rem; text-align: center; }

/* ---------- footer ---------- */
.footer { padding: 2rem 1rem; text-align: center; color: var(--muted); }

/* ---------- auth page ---------- */
body.auth-page {
    background: linear-gradient(135deg, #eaf2ff 0%, #f7f8fa 100%);
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
body.auth-page .container { padding: 0; }
body.auth-page main.container { display: flex; align-items: center; justify-content: center; min-height: 80vh; }
body.auth-page .footer { position: absolute; bottom: 0; left: 0; right: 0; }
.auth-card {
    background: var(--surface); padding: 2.5rem 2rem;
    border-radius: 14px; box-shadow: var(--shadow-lg);
    width: 100%; max-width: 420px;
    margin: 1rem;
}
.auth-card h1 { text-align: center; margin: 0 0 .5rem; }
.auth-card p  { margin: 0 0 1.25rem; color: var(--muted); text-align: center; }
.auth-card ol { padding-left: 1.25rem; color: var(--muted); }

@media (max-width: 600px) {
    .topbar-inner { flex-direction: column; align-items: stretch; }
    .mainnav { justify-content: flex-start; overflow-x: auto; }
    .userbox { justify-content: space-between; }
    .auth-card { padding: 2rem 1.25rem; }
}
