:root {
    --surface: #eef2fb;
    --surface-strong: #ffffff;
    --border: #e1e7f5;
    --text: #1f2937;
    --muted: #6b7280;
    --accent: #6366f1;
    --accent-soft: rgba(99, 102, 241, 0.12);
    --success: #16a34a;
    --danger: #ef4444;
    --radius-large: 24px;
    --radius-medium: 18px;
    --shadow: 0 18px 32px -20px rgba(79, 70, 229, 0.35);
    font-size: 16px;
}

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

html, body {
    min-height: 100%;
}

body {
    font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, #f6f7ff 0%, #eef2fb 55%, #e2e8f0 100%);
    color: var(--text);
    margin: 0;
}

.page {
    width: min(1100px, 100% - 48px);
    margin: clamp(24px, 5vw, 48px) auto;
    display: grid;
    gap: clamp(24px, 4vw, 40px);
}

.card {
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow);
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(24px, 4vw, 32px);
    position: sticky;
    top: clamp(16px, 3vw, 32px);
    z-index: 20;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(18px);
    border-radius: var(--radius-large);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0;
}

.brand__logo {
    background: none;
    width: auto;
    height: auto;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand__logo img {
    display: block;
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 12px;
    margin-right: 12px;
}

.brand__text h1 {
    font-size: clamp(1.4rem, 4vw, 1.9rem);
}

.brand__text span {
    color: var(--muted);
    font-size: 0.95rem;
}

.credentials {
    display: grid;
    gap: 8px;
    justify-items: end;
    color: var(--muted);
    font-size: 0.9rem;
}

.credentials code {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.credentials code span {
    color: var(--muted);
    font-weight: 500;
}

.login-wrapper {
    padding: clamp(28px, 5vw, 40px);
    display: grid;
    gap: clamp(28px, 5vw, 40px);
}

.login-wrapper > div {
    display: grid;
    gap: 12px;
}

h2 {
    font-size: clamp(1.35rem, 3vw, 1.6rem);
    font-weight: 600;
}

.notice {
    font-size: 0.95rem;
    color: var(--muted);
    line-height: 1.5;
    font-style: italic;
}

form {
    display: grid;
    gap: 20px;
}

.field-group {
    display: grid;
    gap: 8px;
}

label {
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--muted);
}

.input,
.select,
.textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius-medium);
    border: 1px solid var(--border);
    background: #f8fafc;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.button {
    padding: 14px 18px;
    border-radius: 14px;
    font-weight: 600;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

.button--primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 12px 20px -12px rgba(99, 102, 241, 0.8);
}

.button--primary:hover {
    transform: translateY(-2px);
}

.tabs {
    position: relative;
    display: grid;
    gap: 28px;
}

.tabs > input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.tab-controls {
    display: grid;
    grid-auto-flow: column;
    gap: 12px;
    justify-content: start;
}

.tab-controls label {
    padding: 12px 22px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#tab-results:checked ~ .tab-controls label[for="tab-results"],
#tab-stock:checked ~ .tab-controls label[for="tab-stock"],
#tab-history:checked ~ .tab-controls label[for="tab-history"],
#tab-calendar:checked ~ .tab-controls label[for="tab-calendar"]{
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent);
    border-color: rgba(99, 102, 241, 0.22);
}

.tab-panels > section {
    display: none;
    gap: 28px;
}

#tab-results:checked ~ .tab-panels #panel-results,
#tab-stock:checked ~ .tab-panels #panel-stock,
#tab-history:checked ~ .tab-panels #panel-history,
#tab-calendar:checked ~ .tab-panels #panel-calendar,
#tab-clients:checked ~ .tab-panels #panel-clients{
    display: grid;
}

.grid {
    display: grid;
    gap: 20px;
}

.grid--two {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card__body {
    padding: clamp(24px, 4vw, 32px);
    display: grid;
    gap: 24px;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.graph {
    padding: 0;
}

.graph .section-title {
    padding: clamp(24px, 4vw, 32px) clamp(24px, 4vw, 32px) 0;
}

.graph__legend {
    display: flex;
    align-items: center;
    gap: 12px;
}

.graph__legend span {
    font-size: 0.85rem;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.graph__legend .legend-revenue::before,
.graph__legend .legend-expense::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

.graph__legend .legend-revenue::before {
    background: var(--success);
}

.graph__legend .legend-expense::before {
    background: var(--danger);
}

.graph__grid {
    padding: 0 clamp(24px, 4vw, 32px) clamp(24px, 4vw, 32px);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 20px;
    align-items: end;
}

.graph__item {
    display: grid;
    gap: 12px;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.graph__label {
    font-weight: 600;
    color: var(--text);
}

.graph__bars {
    display: grid;
    gap: 8px;
}

.graph__bar {
    width: 100%;
    border-radius: 10px;
}

.graph__bar--revenue {
    height: calc(var(--revenue) * 1px);
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.85), var(--success));
}

.graph__bar--expense {
    height: calc(var(--expense) * 1px);
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.85), var(--danger));
}

.stock-columns {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.stock-card .section-title {
    justify-content: flex-start;
}

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

.table thead {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent);
}

.table th,
.table td {
    padding: 14px 18px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

/* admin menu */
details.admin-menu {
    position: relative;
}

.admin-menu > summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease;
}

.admin-menu > summary::marker {
    content: "";
}

.admin-menu[open] > summary {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent);
}

.admin-menu__panel {
    position: absolute;
    right: 0;
    margin-top: 16px;
    width: clamp(260px, 40vw, 320px);
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-large);
    padding: 24px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 20px;
    z-index: 30;
}

.admin-menu__panel h3 {
    font-size: 1rem;
    font-weight: 600;
}

/* Historique coloré */
.table tr.row-revenue td {
    color: #16a34a;
}

.table tr.row-expense td {
    color: #ef4444;
}

.table td a {
    transition: color 0.2s ease;
}

.table td a:hover {
    color: #ef4444;
}

/* responsive */

@media (max-width: 860px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 18px;
    }

    .credentials {
        justify-items: flex-start;
    }

    details.admin-menu {
        width: 100%;
    }

    .admin-menu__panel {
        width: 100%;
        position: relative;
        right: auto;
    }
}

@media (max-width: 640px) {
    .page {
        width: min(100%, 100% - 24px);
    }

    .tab-controls {
        grid-auto-flow: row;
        width: 100%;
    }

    .tab-controls label {
        text-align: center;
    }
}

/* === CALENDRIER VISUEL === */

.calendar-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 15px 0 10px;
    font-weight: 600;
    font-size: 1.1rem;
}

.calendar-nav a {
    text-decoration: none;
    color: var(--accent);
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
}

.calendar-nav a:hover {
    color: #4338ca;
    border-color: var(--accent);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    gap: 8px;
    margin-top: 10px;
}

.calendar-grid--head {
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
}

.calendar-grid--body {
    background: #f8fafc;
    padding: 8px;
    border-radius: 18px;
    border: 1px solid var(--border);
}

.calendar-cell {
    background: #ffffff;
    border-radius: 8px;
    padding: 6px 5px;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    box-shadow: inset 0 0 0 1px #e5e7eb;
    transition: background 0.2s ease;
    font-size: 0.8rem;
}

.calendar-cell:hover {
    background: #eef2ff;
}

.calendar-cell--empty {
    background: transparent;
    box-shadow: none;
}

.calendar-cell__day {
    font-weight: 700;
    color: #111827;
    margin-bottom: 2px;
}

.calendar-cell--has-events .calendar-cell__day {
    color: var(--accent);
}

.calendar-cell__events {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    margin-top: 2px;
}

.calendar-cell__event {
    background: var(--accent);
    color: white;
    border-radius: 6px;
    padding: 2px 4px;
    font-size: 0.7rem;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-cell__event .agenda__delete {
    color: rgba(255,255,255,0.8);
    font-weight: bold;
    text-decoration: none;
}

.calendar-cell__event .agenda__delete:hover {
    color: #fecaca;
}

/* Liste des rdv à venir */
.rdv-next {
    list-style: none;
    padding-left: 0;
    margin: 8px 0 16px;
    display: grid;
    gap: 4px;
    font-size: 0.9rem;
}

.rdv-next li {
    background: #f3f4f6;
    padding: 6px 10px;
    border-radius: 6px;
}

.rdv-next li strong {
    color: var(--accent);
}

/* petits ajustements mobile */

@media (max-width: 640px) {
    .calendar-cell {
        min-height: 60px;
    }
}
.calendar-cell__event {
    display: block;
    max-width: 130px;          /* ajuste la largeur ici */
    white-space: normal;       /* permet les retours à la ligne */
    overflow-wrap: break-word; /* coupe automatiquement les mots trop longs */
    word-break: break-word;    /* casse si nécessaire */
    line-height: 1.2;
    padding: 4px 6px;
    background: #6366f1;
    color: #fff;
    border-radius: 6px;
    font-size: 0.75rem;
}

/* --- Interface Upload ZIP --- */

.upload-container {
  max-width: 600px;
  margin: 40px auto;
  background: #fff;
  border-radius: 12px;
  padding: 30px 32px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.upload-container h1 {
  font-size: 22px;
  margin-bottom: 18px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.upload-container label {
  font-weight: 600;
  font-size: 14px;
  margin-top: 12px;
  display: block;
}

.upload-container input[type="text"],
.upload-container input[type="file"] {
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 14px;
}

.upload-container button {
  margin-top: 20px;
  padding: 12px 20px;
  background: #000;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 14px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: 0.2s;
}

.upload-container button:hover {
  background: #444;
}

.upload-msg {
  background: #f6f6f6;
  padding: 14px;
  border-left: 4px solid #999;
  margin-bottom: 18px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.4em;
}
.alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.alert--success {
    background: #dcfce7;
    color: #166534;
}

.alert--error {
    background: #fee2e2;
    color: #b91c1c;
}

.alert--warning {
    background: #fef3c7;
    color: #92400e;
}
/* Onglet ALBUM actif dans la barre */
#tab-album:checked ~ .tab-controls label[for="tab-album"] {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent);
    border-color: rgba(99, 102, 241, 0.22);
}

/* Affichage du panel ALBUM */
#tab-album:checked ~ .tab-panels #panel-album {
    display: grid;   /* comme les autres panels */
}

/* === Barre de progression upload ZIP === */

.upload-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--muted);
}

.upload-progress__bar {
    flex: 1;
    height: 10px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.4);
}

.upload-progress__fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #22c55e);
    border-radius: 999px;
    transition: width 0.15s linear;
}

.upload-progress__label {
    min-width: 40px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.upload-status {
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--muted);
}

.upload-progress {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 8px;
}

.upload-progress__bar {
    height: 100%;
    width: 0;
    background: #6366f1;
    transition: width 0.2s ease;
}

.upload-progress__text {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 4px;
}
.clients-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
}

.clients-list {
  border-right: 1px solid rgba(148, 163, 184, 0.4);
  padding-right: 16px;
}

.clients-list__ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.clients-list__item {
  padding: 8px 10px;
  border-radius: 8px;
  background: #f3f4f6;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.clients-list__item:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
}

.clients-list__item--active {
  background: #111827;
  color: #fff;
}

.clients-list__item--active .clients-list__tag {
  background: rgba(255,255,255,0.15);
  color: #e5e7eb;
}

.clients-list__tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #e5e7eb;
  border-radius: 999px;
  padding: 2px 6px;
}

.clients-detail {
  min-height: 180px;
}

.clients-detail h3 {
  margin-bottom: 6px;
}

.clients-detail__infos p {
  margin: 2px 0;
  font-size: 0.9rem;
}

.clients-detail__section {
  margin-top: 14px;
}

.clients-detail__section h4 {
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.clients-detail__list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
}

.clients-detail__list li {
  padding: 3px 0;
  border-bottom: 1px dashed #e5e7eb;
}
