:root {
  --accent: #FF385C;
  --accent-dark: #E31C5F;
  --accent-light: #FFE8EC;
  --ink: #222222;
  --ink-soft: #6A6A6A;
  --border: #E4E4E4;
  --bg: #F7F7F7;
  --card: #FFFFFF;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --green: #0A8A3B;
  --green-bg: #E6F6EA;
  --orange: #B25F00;
  --orange-bg: #FFF1DC;
  --red: #C0392B;
  --red-bg: #FCE8E6;
  --blue: #1D5FA8;
  --blue-bg: #E8F1FC;
  --purple: #6B3FA0;
  --purple-bg: #F1E9FA;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}

.topbar .brand .logo-dot,
.auth-brand .logo-dot {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 800;
  animation: neon-pulse-red 1.6s ease-in-out infinite;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar nav a {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.topbar nav a.active,
.topbar nav a:hover {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.topbar nav a.icon-link {
  padding: 8px 10px;
  font-size: 16px;
}

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header h1 {
  margin: 0 0 4px;
  font-size: 26px;
}

.page-header p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 8px;
  transition: transform 0.05s ease, background 0.15s ease;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #f0f0f0; }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: #eee; }

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
}
.btn-danger:hover { background: #f6d3ce; }

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.montant-percu-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

.montant-percu-form input[type=number] {
  width: 80px;
  padding: 6px 8px;
  font-size: 13px;
}

.montant-percu-form input:disabled,
.montant-percu-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg);
}

.callout-airbnb {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  margin-bottom: 20px;
}

.callout-airbnb:hover {
  border-color: #d2d2d2;
  border-left-color: var(--accent-dark);
}

.callout-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.callout-text {
  flex: 1;
  min-width: 0;
}

.callout-title {
  font-weight: 700;
  font-size: 14px;
}

.callout-sub {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.callout-arrow {
  font-size: 18px;
  color: var(--accent);
  flex-shrink: 0;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.dash-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.dash-value {
  font-size: 24px;
  font-weight: 800;
}

.dash-label {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.dash-tile.dash-percu .dash-value { color: var(--accent); }

.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft);
}

.chip.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.chip.has-today {
  border-color: var(--accent);
  color: var(--accent);
  animation: neon-pulse-red 1.6s ease-in-out infinite;
}

.chip.has-late {
  border-color: var(--red);
  color: var(--red);
  animation: neon-pulse-red 1.6s ease-in-out infinite;
}

@keyframes neon-pulse-red {
  0%, 100% {
    box-shadow: 0 0 4px rgba(255,56,92,0.7), 0 0 10px rgba(255,56,92,0.5), 0 0 18px rgba(255,56,92,0.3);
  }
  50% {
    box-shadow: 0 0 8px rgba(255,56,92,1), 0 0 18px rgba(255,56,92,0.8), 0 0 30px rgba(255,56,92,0.5);
  }
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.aircover-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  cursor: pointer;
}

.aircover-row:hover {
  border-color: #d2d2d2;
}

.aircover-row .col-main {
  flex: 1;
  min-width: 0;
}

.aircover-row .title-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.aircover-row h3 {
  margin: 0;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-line {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-soft);
}

.meta-line span { display: inline-flex; align-items: center; gap: 4px; }

.col-price {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}

.col-date {
  text-align: right;
  min-width: 130px;
}

.col-date .label { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; }
.col-date .value { font-size: 14px; font-weight: 600; }

.chevron { color: #bbb; font-size: 18px; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-today { background: var(--orange-bg); color: var(--orange); }
.badge-late { background: var(--red-bg); color: var(--red); }
.badge-upcoming { background: var(--blue-bg); color: var(--blue); }
.badge-waiting { background: var(--purple-bg); color: var(--purple); }
.badge-done { background: var(--green-bg); color: var(--green); }

.alert-sign {
  flex-shrink: 0;
  animation: neon-pulse-cat 1.6s ease-in-out infinite;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}

.empty-state .big-emoji { font-size: 40px; margin-bottom: 10px; }
.empty-state .empty-cat {
  margin-bottom: 10px;
  animation: neon-pulse-cat 1.6s ease-in-out infinite;
}

.empty-state .cat-body { fill: var(--accent); }

@keyframes neon-pulse-cat {
  0%, 100% {
    filter: drop-shadow(0 0 3px rgba(255,56,92,0.7)) drop-shadow(0 0 7px rgba(255,56,92,0.5)) drop-shadow(0 0 12px rgba(255,56,92,0.3));
  }
  50% {
    filter: drop-shadow(0 0 5px rgba(255,56,92,1)) drop-shadow(0 0 12px rgba(255,56,92,0.8)) drop-shadow(0 0 20px rgba(255,56,92,0.5));
  }
}

/* Form */
.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.form-section {
  margin-bottom: 26px;
}

.form-section:last-child { margin-bottom: 0; }

.form-section h2 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: 0 0 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  margin-bottom: 16px;
}

.field:last-child { margin-bottom: 0; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

.field .hint, .hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 5px;
}

input[type=text],
input[type=number],
input[type=date],
input[type=email],
input[type=password],
input[type=file],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  color: var(--ink);
}

textarea { resize: vertical; min-height: 90px; }

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 26px;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.attachment-chip:hover {
  border-color: var(--accent);
}

.attachment-chip img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 4px;
}

.attachment-chip .remove {
  cursor: pointer;
  color: var(--ink-soft);
  font-weight: 700;
}

/* Lightbox pièce jointe */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.92);
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  color: #fff;
}

.lightbox-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.lightbox-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 12px 18px 24px;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.lightbox-file-card {
  color: #fff;
  text-align: center;
  font-size: 16px;
}

.lightbox-file-icon {
  font-size: 64px;
  margin-bottom: 12px;
}

/* Detail page */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
}
.back-link:hover { color: var(--ink); }

.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  align-items: start;
}

.info-block {
  margin-bottom: 20px;
}
.info-block:last-child { margin-bottom: 0; }

.info-block h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: 0 0 8px;
}

.info-block p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.side-card {
  padding: 20px;
}

.side-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.side-row:last-child { border-bottom: none; }
.side-row .k { color: var(--ink-soft); }
.side-row .v { font-weight: 600; text-align: right; }

.owner-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.owner-name { font-weight: 700; font-size: 14px; }
.owner-email { font-size: 13px; color: var(--ink-soft); }

.email-preview {
  background: #fbfbfb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-size: 13px;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.6;
  color: #333;
  max-height: 340px;
  overflow-y: auto;
}

.email-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--green-bg);
  color: var(--green);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
}

.reminder-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--orange-bg);
  color: var(--orange);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
}

.alert-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--red-bg);
  color: var(--red);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.checkbox-row input { width: auto; }

/* Auth (login / signup) */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  justify-content: center;
  margin-bottom: 24px;
}

.auth-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--ink-soft);
}

.auth-footer a { color: var(--accent-dark); font-weight: 600; }

.auth-error {
  background: var(--red-bg);
  color: var(--red);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  display: none;
}
.auth-error.show { display: block; }

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 42px;
}

.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  line-height: 1;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
}
.password-toggle:hover { color: var(--ink); }
.password-toggle svg { display: block; }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
  .grid-2 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .topbar { padding: 12px 16px; gap: 8px; }
  .topbar .brand { font-size: 15px; gap: 6px; }
  .topbar .brand .logo-dot { width: 24px; height: 24px; font-size: 12px; }
  .topbar nav a { padding: 6px 10px; font-size: 13px; }

  .dashboard { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .dash-tile { padding: 12px; }
  .dash-value { font-size: 19px; }
  .dash-label { font-size: 11px; }

  .list { gap: 6px; }
  .aircover-row {
    padding: 8px 10px;
    gap: 8px;
  }
  .aircover-row h3 { font-size: 13px; }
  .badge { padding: 1px 6px; font-size: 10px; }
  .meta-line { font-size: 10.5px; gap: 6px; }
  .meta-line span:nth-child(n+4) { display: none; }
  .col-price { font-size: 12px; }
  .col-date { min-width: auto; text-align: right; }
  .col-date .label { display: none; }
  .col-date .value { font-size: 11px; }
  .chevron { display: none; }
}
