:root {
    --ink:        #1c2530;
    --ink-soft:   #5b6774;
    --line:       #dde2e7;
    --bg:         #f7f8f9;
    --surface:    #ffffff;
    --accent:     #2f6f5e;   /* muted teal — used sparingly for primary actions */
    --accent-soft:#e7f0ed;
    --amber:      #a9660b;   /* submitted / pending */
    --amber-soft: #fbf1e2;
    --red:        #b3392c;
    --red-soft:   #fbeae7;
    --radius:     6px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--accent); }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.topbar .brand {
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
}

.topbar .who {
    color: var(--ink-soft);
    font-size: 13px;
}

.topbar .who a { margin-left: 12px; }

main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 28px 64px;
}

h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 4px;
}

.subtitle {
    color: var(--ink-soft);
    margin: 0 0 28px;
    font-size: 14px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 24px;
}

.panel h2 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 16px;
}

form.entry-form {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

form.entry-form .field { display: flex; flex-direction: column; gap: 4px; }
form.entry-form .field.span-2 { grid-column: span 2; }
form.entry-form .field.span-4 { grid-column: span 4; }

label {
    font-size: 12.5px;
    color: var(--ink-soft);
}

select, input[type=text], input[type=email], input[type=password] {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--surface);
    color: var(--ink);
}

select:focus, input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

button, .btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #275c4e; }

.btn-quiet { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { background: var(--bg); }

.btn-danger { background: var(--red-soft); color: var(--red); border-color: transparent; }
.btn-danger:hover { background: #f6dbd6; }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}

th {
    color: var(--ink-soft);
    font-weight: 600;
    font-size: 12px;
    text-transform: none;
}

tr:last-child td { border-bottom: none; }

.status {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}

.status-draft      { background: var(--line); color: var(--ink-soft); }
.status-submitted   { background: var(--amber-soft); color: var(--amber); }
.status-validated  { background: var(--accent-soft); color: var(--accent); }
.status-published  { background: #1c2530; color: #fff; }

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

.empty {
    padding: 32px;
    text-align: center;
    color: var(--ink-soft);
    font-size: 14px;
}

.flash {
    padding: 10px 14px;
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 13.5px;
    margin-bottom: 20px;
}

.flash-error {
    background: var(--red-soft);
    color: var(--red);
}

.login-wrap {
    max-width: 340px;
    margin: 10vh auto 0;
    padding: 0 20px;
}

.login-wrap .panel { padding: 28px; }

.login-wrap h1 { margin-bottom: 22px; }

.login-wrap form { display: flex; flex-direction: column; gap: 14px; }

.hint {
    font-size: 12.5px;
    color: var(--ink-soft);
    margin-top: 18px;
    line-height: 1.6;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

@media (max-width: 720px) {
    form.entry-form { grid-template-columns: 1fr 1fr; }
    form.entry-form .field.span-2, form.entry-form .field.span-4 { grid-column: span 2; }
}

.print-header { display: none; }

@media print {
    body { background: #fff; }
    .no-print { display: none !important; }
    .print-header { display: block; margin-bottom: 20px; }
    .print-header h1 { font-size: 17px; margin: 0 0 4px; }
    .print-header .meta { font-size: 12px; color: #555; margin: 0; }
    main { max-width: none; padding: 0 12px; }
    .panel { border: none; padding: 0; margin: 0; }
    table { font-size: 12.5px; }
    th, td { padding: 6px 8px; }
}

.admin-nav {
    display: flex;
    gap: 4px;
    padding: 0 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
}

.admin-nav-link {
    padding: 12px 14px;
    margin-right: 2px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-soft) !important;
    text-decoration: none !important;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.admin-nav-link:hover { color: var(--ink); }

.admin-nav-link.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.crud-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.crud-form .field { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13.5px;
    color: var(--ink);
    cursor: pointer;
    line-height: 1.4;
}

.checkbox-label input { margin-top: 3px; }

.field-hint {
    font-size: 12px;
    color: var(--ink-soft);
    margin: 4px 0 0 24px;
}

.badge-shared {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    background: var(--amber-soft);
    color: var(--amber);
}

/* Weekday color coding on the public portal */
.day-pill {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 100px;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.day-pill-lundi     { background: #dbeafe; color: #1d4ed8; }
.day-pill-mardi     { background: #dcfce7; color: #15803d; }
.day-pill-mercredi  { background: #ede9fe; color: #6d28d9; }
.day-pill-jeudi     { background: #fef3c7; color: #b45309; }
.day-pill-vendredi  { background: #fce7f3; color: #be185d; }
.day-pill-samedi    { background: #cffafe; color: #0e7490; }
.day-pill-autre     { background: var(--line); color: var(--ink-soft); }

.day-row-lundi     { background: #f8fbff; }
.day-row-mardi     { background: #f7fdf9; }
.day-row-mercredi  { background: #faf9ff; }
.day-row-jeudi     { background: #fffdf5; }
.day-row-vendredi  { background: #fffafc; }
.day-row-samedi    { background: #f5fdfe; }

@media print {
    .day-row-lundi, .day-row-mardi, .day-row-mercredi,
    .day-row-jeudi, .day-row-vendredi, .day-row-samedi {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Calendar grid view (day x time-slot), shared across portal/head/admin */
.view-toggle {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.view-toggle a {
    padding: 6px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    text-decoration: none;
    background: var(--surface);
}

.view-toggle a.active {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

.calendar-wrap {
    overflow-x: auto;
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.calendar-table th, .calendar-table td {
    border: 1px solid var(--line);
    padding: 6px;
    vertical-align: top;
}

.calendar-table th {
    background: var(--bg);
    text-align: center;
    padding: 10px 6px;
}

.slot-col {
    width: 110px;
    min-width: 110px;
}

.slot-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    text-align: center;
    white-space: nowrap;
}

.calendar-cell {
    min-width: 150px;
    height: 1px; /* combined with h-100% children forces equal cell height per row */
}

.calendar-entry {
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 6px;
    border-left: 3px solid transparent;
}

.calendar-entry:last-child { margin-bottom: 0; }

.calendar-entry-lundi     { background: #f8fbff; border-left-color: #1d4ed8; }
.calendar-entry-mardi     { background: #f7fdf9; border-left-color: #15803d; }
.calendar-entry-mercredi  { background: #faf9ff; border-left-color: #6d28d9; }
.calendar-entry-jeudi     { background: #fffdf5; border-left-color: #b45309; }
.calendar-entry-vendredi  { background: #fffafc; border-left-color: #be185d; }
.calendar-entry-samedi    { background: #f5fdfe; border-left-color: #0e7490; }

.entry-module {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 2px;
}

.entry-meta {
    font-size: 11px;
    color: var(--ink-soft);
    line-height: 1.4;
}

.entry-extra {
    font-size: 10.5px;
    color: var(--ink-soft);
    font-style: italic;
    margin-top: 2px;
}

.status-tiny {
    display: inline-block;
    margin-top: 4px;
    padding: 1px 7px;
    font-size: 10px;
}

@media print {
    .calendar-entry-lundi, .calendar-entry-mardi, .calendar-entry-mercredi,
    .calendar-entry-jeudi, .calendar-entry-vendredi, .calendar-entry-samedi {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Dashboard stat cards (index.php) */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    text-decoration: none;
    transition: border-color 0.15s;
}

.stat-card:hover { border-color: var(--accent); }

.stat-card .stat-number {
    font-size: 26px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 12.5px;
    color: var(--ink-soft);
    margin-top: 4px;
}

.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero {
    text-align: center;
    padding: 48px 20px;
}

.hero h1 { font-size: 26px; margin-bottom: 8px; }
.hero p { color: var(--ink-soft); margin-bottom: 24px; }

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.entry-groupe {
    display: inline-block;
    margin-left: 4px;
    padding: 0 6px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 600;
    background: var(--line);
    color: var(--ink-soft);
}



/* Room availability heat map (rooms_availability.php) */
.heatmap-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--ink-soft);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

.legend-free     { background: #dcfce7; }
.legend-shared   { background: #fef3c7; }
.legend-occupied { background: #fee2e2; }

.heatmap-table .heatmap-cell {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    vertical-align: middle;
    height: 44px;
}

.heatmap-free {
    background: #f0fdf4;
    color: #15803d;
}

.heatmap-shared {
    background: #fffbeb;
    color: #b45309;
}

.heatmap-occupied {
    background: #fef2f2;
    color: #b91c1c;
}
