/* Nakria Calendar — nouvelle direction artistique. Se charge après nakria-ui.css (couleurs, police, animations).
   Les couleurs des agendas sont celles des modules : le texte posé dessus est toujours l'encre #221B3A. */

:root {
  --cal: #FFDDCD; --cal-soft: #FFEEE6; --line-2: #D8C9AE;
  --danger: #D6336C; --now: #FF5C7A; --hour: 48px;
  color-scheme: light;
}

h1, h2, h3, .brand, .btn, .vtab { font-synthesis: none; }
html, body { height: 100%; }
body { font-size: 15px; line-height: 1.5; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { text-decoration: none; }

/* --- Boutons -------------------------------------------------------------- */
.btn { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); box-shadow: 0 3px 0 var(--line); padding: 9px 18px; font: 700 14px/1.2 var(--font-b); white-space: nowrap; }
.btn:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--ink); box-shadow: 0 3px 0 var(--line), 0 12px 16px -8px rgba(34, 27, 58, .22); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.btn-primary { background: var(--acc); color: #fff; border-color: transparent; box-shadow: 0 4px 0 var(--acc-d); }
.btn-primary:hover:not(:disabled) { background: var(--acc); border-color: transparent; box-shadow: 0 4px 0 var(--acc-d), 0 14px 18px -8px rgba(108, 77, 255, .4); }
.btn-primary:active:not(:disabled) { box-shadow: 0 2px 0 var(--acc-d); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { background: none; border: 0; padding: 6px 11px; font-size: 22px; line-height: 1; color: var(--soft); border-radius: 50%; transition: background .2s, color .2s; }
.icon-btn:hover { color: var(--ink); background: var(--cal-soft); }
.link { background: none; border: 0; padding: 4px 2px; color: var(--soft); font-size: 13.5px; font-weight: 600; }
.link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.form-error { margin: 0; font-size: 14px; font-weight: 600; color: var(--danger); }
.hint { margin: 0; font-size: 13px; line-height: 1.55; color: var(--soft); }

.boot { position: fixed; inset: 0; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; color: var(--soft); }
.boot p { text-align: center; padding: 0 24px; }
.boot-logo { animation: spin 6s linear infinite; filter: drop-shadow(0 8px 14px rgba(34, 27, 58, .16)); }

/* --- Structure ------------------------------------------------------------ */
.app { display: grid; grid-template-columns: 296px minmax(0, 1fr); height: 100%; height: 100dvh; }
.side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--card); overflow-y: auto; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.side-top { padding: 16px 18px 0; }
.hub { display: inline-block; padding: 4px 0; font-size: 13.5px; font-weight: 600; color: var(--soft); }
.hub:hover { color: var(--ink); }
.side-head { padding: 6px 18px 14px; }
.brand { display: flex; align-items: center; gap: 10px; font: 400 22px/1 var(--font-d); white-space: nowrap; }
.brand b { font-weight: 400; color: var(--soft); }
.app-icon { flex: none; }
.side-new { padding: 0 18px 16px; }
.side-new .btn { width: 100%; padding: 12px 16px; font-size: 15px; }

/* Mini-calendrier */
.mini { padding: 0 14px 14px; }
.mini-bar { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 6px; }
.mini-bar h2 { font: 400 17px/1.2 var(--font-d); }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.mini-h { font-size: 11.5px; font-weight: 600; color: var(--soft); padding: 4px 0; }
.mini-d { background: none; border: 0; padding: 0; width: 32px; height: 32px; justify-self: center; border-radius: 50%; font-size: 13px; color: var(--ink); transition: background .2s; }
.mini-d:hover { background: var(--cal-soft); }
.mini-d.out { color: var(--soft); opacity: .55; }
.mini-d.sel { box-shadow: inset 0 0 0 2px var(--acc); }
.mini-d.today { background: var(--acc); color: #fff; font-weight: 700; }
.mini-d.today.sel { box-shadow: none; }

/* Agendas */
.cals-wrap { padding: 4px 18px 16px; border-top: 1px solid var(--line); margin-top: 4px; flex: 1; }
.cals-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 0 4px; }
.cals-head h2 { font: 400 17px/1.2 var(--font-d); color: var(--soft); }
.cals { list-style: none; margin: 0; padding: 0; }
.cal { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-row { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 7px 0; cursor: pointer; flex: 1; }
.cal-row input { accent-color: var(--acc); margin: 0; width: 16px; height: 16px; }
.cal-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; font-weight: 500; }
.dot { flex: none; width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.cal .icon-btn { font: 600 12.5px/1 var(--font-b); padding: 5px 8px; opacity: 0; border-radius: 999px; }
.cal:hover .icon-btn, .cal .icon-btn:focus-visible { opacity: 1; }
.side-foot { display: flex; flex-direction: column; gap: 4px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.me-address { font-size: 12.5px; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-links { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 2px 12px; }
.side-links form { margin: 0; }
.side-links a.link { text-decoration: none; }
.side-links a.link:hover { text-decoration: underline; }

/* --- Barre d'outils ------------------------------------------------------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 22px 14px; }
.toolbar .btn { padding: 9px 18px; font-size: 14px; }
.nav { display: flex; }
.toolbar h1 { flex: 1 1 auto; min-width: 0; font: 400 clamp(26px, 3vw, 34px)/1.1 var(--font-d); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { display: none; }

/* Affichage : slider (même principe que la page du compte) */
.vtabs { --slide: cubic-bezier(.3, 1.25, .5, 1); position: relative; isolation: isolate; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 5px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; }
.vtabs::before { content: ''; position: absolute; z-index: 0; top: 5px; bottom: 5px; left: 5px; width: calc((100% - 10px) / 4); border-radius: 999px; background: var(--ink); box-shadow: 0 8px 16px -8px rgba(34, 27, 58, .55); transition: transform .5s var(--slide); }
.vtabs:has(.vtab:nth-child(2).on)::before { transform: translateX(100%); }
.vtabs:has(.vtab:nth-child(3).on)::before { transform: translateX(200%); }
.vtabs:has(.vtab:nth-child(4).on)::before { transform: translateX(300%); }
.vtab { position: relative; z-index: 1; background: none; border: 0; border-radius: 999px; padding: 8px 14px; min-width: 74px; font: 700 13.5px/1.2 var(--font-b); color: var(--soft); transition: color .3s var(--ease); }
.vtab:hover { color: var(--ink); }
.vtab.on, .vtab.on:hover { color: #fff; }
.vtab:focus-visible { outline-offset: -3px; }
@supports not selector(:has(*)) { .vtabs::before { display: none; } .vtab.on { background: var(--ink); } }
.notice { margin: 0 22px 10px; padding: 10px 16px; border-radius: 16px; background: #FFF0F4; font-size: 13.5px; font-weight: 600; color: var(--danger); }

/* La vue est une carte blanche arrondie */
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 0 22px 22px; background: var(--card); border: 1px solid var(--line); border-radius: 26px; overflow: hidden; }
.view[data-view="month"], .view[data-view="agenda"] { overflow: auto; }

/* --- Puces d'événement ---------------------------------------------------- */
.chip { display: flex; align-items: baseline; gap: 6px; width: 100%; margin-top: 2px; padding: 2px 8px; border: 0; border-radius: 8px; text-align: left; color: var(--ink); font: 500 12.5px/1.45 var(--font-b); letter-spacing: 0; overflow: hidden; transition: transform .2s var(--ease), filter .2s; }
.chip::before { display: none; }
.chip:hover { filter: brightness(1.05); transform: translateY(-1px); }
.chip-t { flex: none; font-weight: 700; font-size: 11.5px; }
.chip-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.compact { display: inline-block; width: 9px; height: 9px; margin: 3px 3px 0 0; padding: 0; border-radius: 50%; }
.chip.compact .chip-n { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* --- Vue mois ------------------------------------------------------------- */
.month { display: flex; flex-direction: column; flex: 1; min-height: 480px; }
.month-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.month-head span { padding: 10px; font-size: 12.5px; font-weight: 700; color: var(--soft); }
.month-grid { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(92px, 1fr)); }
.day { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px 6px 6px; min-width: 0; overflow: hidden; cursor: pointer; transition: background .2s; }
.day:hover { background: #FFFBF4; }
.day:nth-child(7n) { border-right: 0; }
.day.out { background: var(--bg); }
.day.out .day-n { color: var(--soft); opacity: .6; }
.day-n { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; margin-bottom: 2px; background: none; border: 0; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink); transition: background .2s; }
.day-n:hover { background: var(--cal-soft); }
.day.today .day-n { background: var(--acc); color: #fff; font-weight: 700; box-shadow: 0 3px 0 var(--acc-d); }
.more { background: none; border: 0; padding: 2px 4px; font-size: 12px; font-weight: 600; color: var(--soft); }
.more:hover { color: var(--ink); text-decoration: underline; }

/* --- Vues semaine et jour ------------------------------------------------- */
.tg { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-x: auto; }
.tg-head, .tg-all, .tg-body { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); min-width: calc(56px + var(--cols) * 110px); }
.tg-head { border-bottom: 1px solid var(--line); }
.tg-day { background: none; border: 0; padding: 12px 6px; font: 400 15px/1.2 var(--font-d); color: var(--soft); text-align: center; }
.tg-day:hover { color: var(--ink); }
.tg-day.today { color: var(--acc); font-weight: 400; }
.tg-all { border-bottom: 1px solid var(--line-2); }
.tg-gutter { padding: 8px 6px 0 0; font-size: 11px; color: var(--soft); text-align: right; }
.tg-allcell { min-height: 30px; padding: 3px 3px 5px; border-left: 1px solid var(--line); cursor: pointer; }
.tg-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; min-width: calc(56px + var(--cols) * 110px); }
.tg-body { position: relative; }
.tg-hours { position: relative; }
.tg-hour { position: absolute; right: 8px; font-size: 11px; color: var(--soft); }
.tg-col { position: relative; border-left: 1px solid var(--line); cursor: pointer; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour) - 1px), var(--line) calc(var(--hour) - 1px), var(--line) var(--hour)); }
.tg-col.today { background-color: rgba(108, 77, 255, .05); }
.blk { position: absolute; display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 4px 8px; border: 0; border-left: 4px solid rgba(34, 27, 58, .35); border-radius: 10px; color: var(--ink); text-align: left; overflow: hidden; font-size: 12.5px; line-height: 1.35; box-shadow: 0 2px 0 rgba(34, 27, 58, .08); transition: transform .2s var(--ease), filter .2s; }
.blk:hover { filter: brightness(1.05); z-index: 2; transform: translateY(-1px); }
.blk-n { font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blk-t { font-size: 11.5px; opacity: .8; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now { position: absolute; left: 0; right: 0; height: 2px; background: var(--now); pointer-events: none; z-index: 3; }
.now::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--now); }

/* --- Vue liste ------------------------------------------------------------ */
.agenda { padding: 10px 26px 48px; max-width: 780px; width: 100%; }
.ag-day { padding-top: 20px; }
.ag-day h2 { margin: 0 0 6px; font: 400 20px/1.3 var(--font-d); color: var(--soft); }
.ag-day h2.today { color: var(--acc); }
.ag-row { display: grid; grid-template-columns: 12px 108px minmax(0, 1fr); gap: 12px; align-items: baseline; width: 100%; padding: 11px 10px; background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; text-align: left; transition: background .2s; }
.ag-row:hover { background: var(--cal-soft); }
.ag-when { font-size: 13.5px; font-weight: 600; color: var(--soft); white-space: nowrap; }
.ag-txt { display: flex; flex-direction: column; min-width: 0; }
.ag-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ag-meta { font-size: 13px; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { margin: 0; padding: 40px 0; color: var(--soft); line-height: 1.65; max-width: 46ch; }

/* --- Fenêtres ------------------------------------------------------------- */
.dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 28px; border: 0; border-radius: 28px; background: var(--card); color: var(--ink); overflow-y: auto; box-shadow: 0 30px 70px rgba(34, 27, 58, .3); }
.dialog[open] { animation: pop .45s var(--ease); }
.dialog.small { width: min(420px, calc(100vw - 24px)); overflow: visible; }
.dialog::backdrop { background: rgba(34, 27, 58, .45); }
.dialog h2 { margin: 0 0 16px; font: 400 30px/1.1 var(--font-d); }
.dialog label, .dialog .lab { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 600; color: var(--soft); }
.dialog input[type="text"]:not(.nk-date-text):not(.nk-search), .dialog input[type="date"], .dialog input[type="time"], .dialog input[type="number"], .dialog select, .dialog textarea {
  width: 100%; padding: 11px 15px; border-radius: var(--r2); border: 1.5px solid var(--line); background: var(--bg); font-size: 15.5px; transition: border-color .2s, box-shadow .2s, background .2s;
}
.dialog input:not(.nk-date-text):not(.nk-search):hover, .dialog select:hover, .dialog textarea:hover { border-color: #D8C9AE; }
.dialog textarea { resize: vertical; min-height: 72px; }
.dialog input:not(.nk-date-text):not(.nk-search):focus, .dialog select:focus, .dialog textarea:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 4px rgba(108, 77, 255, .16); background: #fff; }
.dialog input.big:not(.nk-date-text):not(.nk-search) { padding: 12px 16px; font: 400 24px/1.3 var(--font-d); margin-bottom: 16px; }
.row { margin-bottom: 14px; }
.check { display: flex !important; align-items: center; gap: 10px; margin: 0 0 14px !important; font-size: 14.5px !important; color: var(--ink) !important; cursor: pointer; }
.check input { accent-color: var(--acc); width: 18px; height: 18px; margin: 0; }
.when { display: grid; gap: 10px; margin-bottom: 14px; }
.when-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 10px; }
.dialog .when-l { margin: 0; }
.pair { display: flex; gap: 8px; min-width: 0; }
.pair .nk-date { flex: 1 1 auto; }
.pair .nk-time { flex: 0 0 112px; }
.repbox { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: -4px 0 14px; font-size: 14px; color: var(--soft); }
.repbox input[type="number"] { width: 64px; }
.repbox .nk-select { flex: 1 1 160px; }
.repbox .until { margin: 0 0 0 6px; }
.dialog .hint { margin: 0 0 12px; }
.dialog .form-error { margin: 0 0 12px; }
.dialog-actions { display: flex; align-items: center; gap: 10px; margin-top: 20px; }
.grow { flex: 1; }
.del-choice p { margin: 18px 0 0; font-size: 14.5px; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.sw { display: inline-block; margin: 0 !important; position: relative; cursor: pointer; }
.sw input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sw span { display: block; width: 30px; height: 30px; border-radius: 50%; box-shadow: 0 0 0 2px var(--card); transition: transform .25s var(--ease); }
.sw:hover span { transform: scale(1.12); }
.sw input:checked + span { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }
.sw input:focus-visible + span { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--acc); }

.fab { display: none; position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 10; width: 58px; height: 58px; border: 0; border-radius: 50%; background: var(--acc); color: #fff; font: 400 32px/1 var(--font-d); box-shadow: 0 5px 0 var(--acc-d), 0 16px 24px -8px rgba(108, 77, 255, .5); transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.fab:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--acc-d); }
.backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(34, 27, 58, .45); }

/* --- Mobile : le menu devient un tiroir ----------------------------------- */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; z-index: 30; width: min(320px, 86vw); transform: translateX(-100%); transition: transform .3s var(--ease); padding-top: env(safe-area-inset-top, 0px); }
  .side.open { transform: none; box-shadow: 0 0 60px rgba(34, 27, 58, .25); }
  .menu-btn { display: inline-block; margin-left: -8px; }
  .fab { display: block; }
  .toolbar { padding: 10px 14px 8px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); gap: 8px; }
  .toolbar .btn { padding: 8px 14px; }
  .toolbar h1 { order: 5; flex: 1 1 100%; font-size: 26px; }
  .vtabs { margin-left: auto; padding: 4px; }
  .vtabs::before { top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 4); }
  .vtab { padding: 7px 10px; min-width: 0; font-size: 12.5px; }
  .view { margin: 0 10px 10px; border-radius: 22px; }
  .notice { margin: 0 10px 8px; }
  .agenda { padding: 6px 14px 40px; }
  .ag-row { grid-template-columns: 12px 84px minmax(0, 1fr); gap: 10px; }
  .month-grid { grid-template-rows: repeat(6, minmax(64px, 1fr)); }
  .day { padding: 2px 3px; }
  .month-head span { padding: 6px 4px; font-size: 11.5px; text-align: center; }
  .dialog { padding: 20px; border-radius: 24px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } .vtabs::before { transition: none !important; } }

/* Widgets du compte (définis dans nakria-ui.css) : taille compacte pour les fenêtres */
.nk-btn, .nk-date input.nk-date-text { padding-top: 11px; padding-bottom: 11px; font-size: 15.5px; }
.nk-date input.nk-date-text { width: 100%; font: 400 15.5px/1.3 var(--font-b); color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: var(--r2); padding-left: 15px; padding-right: 58px; }
.nk-date-btn { width: 36px; height: 36px; }
.nk-pop input.nk-search { width: 100%; }