/* Polices locales / système uniquement — pas de dépendance Google hors ligne */
:root {
  --navy: #1e293b;
  --ink: #1e293b;
  --ink-soft: #475569;
  --muted: #94a3b8;
  --cyan: #6366f1;
  --cyan-deep: #4f46e5;
  --mint: #a7f3d0;
  --sky: #e0f2fe;
  --lilac: #ddd6fe;
  --baby: #bfdbfe;
  --bg: #e0f2fe;
  --bg-elev: #ffffff;
  --line: #e2e8f0;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-soft: #818cf8;
  --secondary: #1e293b;
  --accent-soft: #bfdbfe;
  --grad: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
  --grad-soft: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(129, 140, 248, 0.16));
  --danger: #e11d48;
  --ok: #059669;
  --warn: #d97706;
  --shadow: 0 12px 36px rgba(30, 41, 59, 0.08);
  --radius: 14px;
  --sidebar: 252px;
  --font: "Avenir Next", "Nunito", "Segoe UI", "Trebuchet MS", sans-serif;
  --mono: "Cascadia Code", "Consolas", "Courier New", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1000px 520px at 8% -8%, rgba(129, 140, 248, 0.22), transparent 55%),
    radial-gradient(900px 480px at 100% 0%, rgba(186, 230, 253, 0.55), transparent 50%),
    var(--bg);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary-dark); }

.app { min-height: 100%; }

.brand-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  aspect-ratio: 834 / 239;
  object-fit: contain;
  object-position: center;
}
.brand-logo.hero {
  width: min(240px, 70vw);
  height: auto;
  margin: 0 auto 0.15rem;
}
.brand-logo.boot {
  width: min(200px, 64vw);
  height: auto;
  margin: 0 auto;
}
.brand-logo.side {
  width: min(148px, 100%);
  height: auto;
  padding: 0.1rem 0.25rem;
}

.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 0.85rem;
  text-align: center;
  padding: 1.5rem;
}
.boot-msg { color: var(--muted); margin: 0; font-weight: 500; }

/* Auth */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow);
  padding: 2rem 1.6rem 1.6rem;
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--grad);
}
.auth-brand-wrap {
  text-align: center;
  margin-bottom: 0.35rem;
}
.auth-sub {
  margin: 0 0 1.4rem;
  color: var(--ink-soft);
  text-align: center;
  font-weight: 500;
}
.field { display: grid; gap: 0.35rem; margin-bottom: 0.9rem; }
.field label { font-size: 0.9rem; color: var(--ink-soft); font-weight: 600; }
.field input, .field textarea, .field select,
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field textarea:focus, .field select:focus,
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}
.field-hint {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.choice-set {
  margin: 0;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 0.55rem;
  background: #fbfefe;
}
.choice-set legend {
  padding: 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy);
}
.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  align-items: start;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 500;
}
.choice:has(input:checked) {
  border-color: var(--cyan);
  background: var(--grad-soft);
}
.choice input {
  margin-top: 0.2rem;
  accent-color: var(--cyan);
}
.choice strong { display: block; color: var(--navy); }
.choice .meta { display: block; margin-top: 0.15rem; }
.field-date input[type="date"] {
  min-height: 2.75rem;
  color-scheme: light;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.field-date input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.7;
  padding: 0.2rem;
  border-radius: 6px;
}
.field-date input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  background: rgba(99, 102, 241, 0.15);
}
.field-date .date-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  align-items: center;
}
.field-date .date-clear {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: none;
}
.field-date .date-clear:hover {
  border-color: var(--cyan);
  color: var(--navy);
  filter: none;
}
.field textarea, .textarea { min-height: 110px; resize: vertical; }
.auth-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
.auth-actions .btn { width: 100%; }
.auth-error {
  background: #fdecea;
  color: var(--danger);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.8rem;
  font-size: 0.92rem;
}
.auth-switch { margin-top: 1rem; color: var(--muted); font-size: 0.92rem; text-align: center; }
.auth-switch button {
  background: none;
  border: 0;
  color: var(--primary-dark);
  padding: 0;
  text-decoration: underline;
  font-weight: 700;
}

/* Shell */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  color: var(--navy);
  padding: 1.15rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 4px 0 24px rgba(30, 41, 59, 0.04);
}
.side-brand {
  padding: 0.35rem 0.35rem 0.55rem;
  border-bottom: 1px solid var(--line);
}
.side-user {
  padding: 0 0.5rem 0.75rem;
  margin-bottom: 0.15rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
  color: var(--navy);
  word-break: break-word;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.settings {
  width: 100%;
  max-width: none;
}
.settings-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 1.35rem;
}
.settings-tabs button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0.85rem 0.75rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.25;
  min-height: 3.1rem;
}
.settings-tabs button:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--navy);
}
.settings-tabs button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.settings-body { display: flex; flex-direction: column; gap: 1.15rem; }
.settings-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.45rem 1.5rem 1.55rem;
  min-height: 12rem;
}
@media (max-width: 720px) {
  .settings-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .settings-tabs button {
    font-size: 0.9rem;
    padding: 0.75rem 0.55rem;
    min-height: 2.75rem;
  }
}
.settings-h {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy);
}
.settings-lead {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.45;
}
.settings-email {
  margin: -0.35rem 0 1.1rem;
  color: var(--muted);
  font-size: 0.88rem;
  word-break: break-all;
}
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
  grid-column: 1 / -1;
  margin-top: 0.25rem;
}
.settings-danger {
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.55rem;
}
.otp-setup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 1.75rem;
}
.otp-qr {
  flex: 0 0 auto;
  padding: 0.65rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  line-height: 0;
}
.otp-qr svg { display: block; width: 180px; height: 180px; max-width: 100%; }
.otp-secret {
  display: inline-block;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  background: rgba(30, 41, 59, 0.05);
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  word-break: break-all;
  color: var(--navy);
  font-weight: 600;
}
.account-list { display: grid; gap: 0.65rem; margin: 0 0 1.15rem; }
.account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.account-row.active {
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.08);
  box-shadow: inset 3px 0 0 var(--cyan);
}
.account-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.nav { display: grid; gap: 0.25rem; }
.nav button {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  border-radius: 12px;
  padding: 0.7rem 0.75rem;
  font-weight: 600;
}
.nav button:hover { background: rgba(99, 102, 241, 0.1); color: var(--navy); }
.nav button.active {
  background: var(--grad-soft);
  color: var(--navy);
  box-shadow: inset 3px 0 0 var(--cyan);
}
.side-foot { margin-top: auto; display: grid; gap: 0.5rem; }
.sync-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  padding: 0.4rem 0.5rem;
  font-weight: 600;
}
.sync-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
}
.sync-dot.online { background: var(--mint); box-shadow: 0 0 0 3px rgba(167, 243, 208, 0.28); }
.sync-dot.syncing { background: #f0c14a; animation: pulse 1s infinite; }
.sync-dot.offline { background: #e07a6a; }
@keyframes pulse { 50% { opacity: 0.45; } }

.main {
  padding: 1.25rem 1.5rem 2.5rem;
  min-width: 0;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}
.topbar h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
  letter-spacing: -0.03em;
  font-weight: 800;
  color: var(--navy);
}
.topbar .sub { margin: 0.2rem 0 0; color: var(--ink-soft); font-size: 0.95rem; font-weight: 500; }
.topbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-left: auto;
}
.toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Champ recherche toolbar — même hauteur que les boutons */
.search {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.4rem;
  width: min(220px, 46vw);
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}
.search-icon {
  flex-shrink: 0;
  color: var(--muted);
  display: block;
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0.45rem 0;
  outline: none;
  box-shadow: none;
  font: inherit;
  color: var(--ink);
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { cursor: pointer; }

.notif {
  position: relative;
  /* espace badge sans décaler le bouton */
  padding: 0.15rem 0.15rem 0 0;
}
.notif-btn {
  position: relative;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  box-shadow: none;
}
.notif-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.notif-btn:hover,
.notif-btn.open {
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.1);
}
.notif-badge {
  position: absolute;
  top: -0.15rem;
  right: -0.15rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  background: #e07a6a;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.15rem;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
  pointer-events: none;
}
.notif-panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  width: min(380px, calc(100vw - 2rem));
  max-height: min(70vh, 440px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(30, 41, 59, 0.14);
  z-index: 40;
  overflow: hidden;
  animation: notif-in 0.18s ease;
}
@keyframes notif-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 251, 253, 0.9);
}
.notif-panel-head strong {
  font-size: 0.95rem;
  color: var(--navy);
}
.notif-empty {
  padding: 1.35rem 1.1rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.45;
}
.notif-list {
  overflow: auto;
  display: grid;
  gap: 0;
}
.notif-item {
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
}
.notif-item:last-child { border-bottom: 0; }
.notif-item.overdue { background: rgba(224, 122, 106, 0.06); }
.notif-item-body strong {
  display: block;
  font-size: 0.9rem;
  color: var(--navy);
  margin-bottom: 0.15rem;
}
.notif-item-body p {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.35;
}
.notif-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.5rem 1rem;
  min-height: 2.4rem;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover { filter: brightness(1.04); }
.btn.secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}
.btn.ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
  box-shadow: none;
}
.btn.danger {
  background: var(--danger);
  color: #fff;
  box-shadow: none;
}
.btn.small { padding: 0.35rem 0.65rem; font-size: 0.88rem; font-weight: 600; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Suppression clairement identifiable, calée à droite */
.btn-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  border: 1px solid #f0b4ae;
  background: #fff;
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: none;
  flex-shrink: 0;
}
.btn-del:hover {
  background: #fdecea;
  border-color: var(--danger);
  filter: none;
}
.btn-del:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  margin-left: auto;
  gap: 0.4rem;
}
.row.row-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 1.25rem;
  width: 100%;
}
.row.row-item > :first-child {
  min-width: 0;
}
/* Checkbox + contenu + actions (Jalons) — pas de style inline (CSP) */
.row.row-check {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 1rem;
  width: 100%;
}
.row.row-check > :nth-child(2) {
  min-width: 0;
}
.row.row-check .row-actions {
  margin-left: 0;
}
.row.row-check.is-done {
  background:
    linear-gradient(135deg, rgba(167, 243, 208, 0.35), rgba(224, 242, 254, 0.55));
  border-color: rgba(52, 211, 153, 0.45);
  box-shadow: inset 3px 0 0 #34d399;
}
.row.row-check.is-done h3 {
  color: var(--ink-soft);
  text-decoration: line-through;
  text-decoration-color: rgba(30, 41, 59, 0.28);
}
.row.row-check.is-done .meta {
  color: #059669;
  font-weight: 600;
}
.row.row-check.is-done .check {
  accent-color: #059669;
}
.step-edit {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  border-radius: 8px;
}
.step-edit:hover h3 { color: var(--primary-dark); }
.step-edit:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.row.row-single {
  grid-template-columns: minmax(0, 1fr);
}
.row.row-split {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}
.journal-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-pad { padding: 1.1rem; }

/* Empilement vertical avec espace régulier (évite les blocs collés) */
.stack {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.stack-sm { gap: 0.55rem; }
.stack-lg { gap: 1.15rem; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.section-head h3,
.section-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy);
}
.section-head .toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}
.inline-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.meta.meta-tight { margin: 0; }
.tabs.tabs-flush { margin-bottom: 0; }

.list { display: grid; gap: 0.7rem; }
.list-inset {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
}
.row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.row.clickable { cursor: pointer; }
.row.clickable:hover { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12); }
.row.selected {
  border-color: var(--cyan);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(167, 243, 208, 0.08));
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
}
.row h3 { margin: 0 0 0.2rem; font-size: 1rem; font-weight: 700; }
.row p { margin: 0; color: var(--ink-soft); font-size: 0.9rem; }
.meta { color: var(--muted); font-size: 0.8rem; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  background: rgba(99, 102, 241, 0.16);
  color: #1f6f7d;
  font-weight: 700;
}
.badge.warn { background: #fff4d9; color: #8a5a00; }
.badge.ok { background: rgba(167, 243, 208, 0.28); color: #1f6b4a; }
.badge.danger { background: #fdecea; color: var(--danger); }
.badge.muted { background: #eef1f4; color: var(--muted); }

.empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-weight: 500;
}

.split {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  min-height: 60vh;
}
.split > * { min-width: 0; }

.folder-list { display: grid; gap: 0.25rem; padding: 0.6rem; }
.folder-list button {
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.folder-list button.active {
  background: var(--grad-soft);
  color: var(--navy);
}

.tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0;
}
.tabs button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.tabs button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.form-grid { display: grid; gap: 0.8rem; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) {
  .form-grid.two { grid-template-columns: 1fr; }
}

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(30, 41, 59, 0.42);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 50;
}
.modal {
  width: min(560px, 100%);
  max-height: min(90vh, 900px);
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.2rem;
}
.modal h2 { margin: 0 0 0.35rem; color: var(--navy); font-weight: 800; }
.modal-lead {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.45;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.1rem;
  flex-wrap: wrap;
}
.modal-actions .btn.danger { margin-right: auto; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}
.cal-day {
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 0.55rem;
}
.cal-day.today { outline: 2px solid var(--cyan); }
.cal-day h4 { margin: 0 0 0.45rem; font-size: 0.85rem; color: var(--ink-soft); font-weight: 700; }
.cal-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: rgba(99, 102, 241, 0.18);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.35rem 0.45rem;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
}
.cal-item.task { background: #fff4d9; }
.cal-item.milestone { background: #fdecea; }

.priority-0 { color: var(--muted); }
.priority-1 { color: var(--primary-dark); }
.priority-2 { color: var(--warn); }
.priority-3 { color: var(--danger); font-weight: 700; }

.check {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  accent-color: var(--cyan);
}

.menu-toggle { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    z-index: 40;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .split { grid-template-columns: 1fr; }
  .cal-grid { grid-template-columns: 1fr 1fr; }
  .backdrop {
    position: fixed;
    inset: 0;
    background: rgba(30, 41, 59, 0.35);
    z-index: 30;
  }
}

@media (max-width: 560px) {
  .cal-grid { grid-template-columns: 1fr; }
  .main { padding: 1rem; }
}
