:root {
  color-scheme: light;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #f4f5f7;
  color: #111827;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.app {
  width: min(960px, 100%);
}

.admin-app {
  width: min(520px, 100%);
}

.card {
  background-color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  padding: 32px;
  margin-bottom: 24px;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.note-box {
  border: 1px solid #4f46e5;
  background-color: rgba(79, 70, 229, 0.08);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  color: #1f2937;
}

.note-box strong {
  font-weight: 600;
  color: #312e81;
  margin-right: 6px;
}

h1, h2, h3 {
  margin: 0 0 16px;
  font-weight: 600;
}

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

label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #334155;
}

input, select, button {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  font-size: 1rem;
}

input:focus, select:focus {
  outline: 3px solid rgba(59, 130, 246, 0.35);
  border-color: #3b82f6;
}

button {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  color: #ffffff;
  cursor: pointer;
  border: none;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.25);
}

.link-button {
  background: none;
  border: none;
  color: #3b82f6;
  padding: 0;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
  box-shadow: none;
  transform: none;
}

.link-button-danger {
  color: #ef4444;
}

.link-button-danger:hover {
  color: #dc2626;
}

.error-message {
  color: #ef4444;
  min-height: 1em;
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.filters form {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}

.form-group {
  display: grid;
  gap: 8px;
  min-width: 180px;
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.show-more-button {
  margin-top: 16px;
  width: 100%;
}

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

thead {
  background-color: #f1f5f9;
}

th, td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.95rem;
}

tbody tr:hover {
  background: rgba(59, 130, 246, 0.08);
}

tbody tr.properties-table-empty {
  background: transparent;
  border: none;
}

tbody tr.properties-table-empty td {
  text-align: center;
  padding: 24px 16px;
  border-bottom: none;
  color: #475569;
}

.status-tag {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1f2937;
}

.status-button {
  border: none;
  cursor: pointer;
  font: inherit;
  background: none;
}

.status-button:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.secondary-button {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #1f2937;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.secondary-button:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
  box-shadow: none;
  transform: none;
}

.daily-todo-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

#daily-todo-progress-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: #2563eb;
}

.daily-todo-tasks {
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.daily-todo-task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 1rem;
  font-weight: 500;
  color: #1f2937;
}

.daily-todo-task-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  margin-top: 2px;
}

.daily-todo-task-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.daily-todo-task-text {
  line-height: 1.3;
}

.daily-todo-task-frequency {
  font-size: 0.9rem;
  color: #475569;
}

.daily-todo-progress-bar {
  width: 100%;
  height: 12px;
  background-color: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.daily-todo-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  transition: width 0.3s ease;
}

.daily-todo-history {
  margin-top: 20px;
  padding: 16px;
  background-color: #f8fafc;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.daily-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.daily-history-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.daily-history-title span {
  min-width: 140px;
  text-align: center;
  font-weight: 600;
  color: #334155;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background-color: #ffffff;
  color: #1f2937;
  font-size: 1.2rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.icon-button:hover:not(:disabled) {
  background-color: #f1f5f9;
  border-color: #94a3b8;
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.daily-todo-calendar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.daily-todo-weekdays,
.daily-todo-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.daily-todo-weekdays span {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
}

.calendar-cell {
  min-height: 64px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background-color: #ffffff;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

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

.calendar-cell--clickable {
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.calendar-cell--clickable:hover {
  border-color: rgba(37, 99, 235, 0.4);
}

.calendar-cell--clickable:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.4);
  outline-offset: 2px;
}

.calendar-cell--today {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.calendar-cell--selected {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.2);
  background-color: rgba(37, 99, 235, 0.06);
}

.calendar-cell-day {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1f2937;
}

.calendar-cell-status {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-block;
}

.calendar-cell-status.achieved {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.calendar-cell-status.missed {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.calendar-cell-status.upcoming {
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

.daily-todo-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 0.85rem;
  color: #475569;
}

.legend-dot {
  width: 12px;
  height: 12px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  background: #e2e8f0;
}

.legend-dot.achieved {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.legend-dot.missed {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.legend-dot.upcoming {
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

.daily-todo-day-details {
  margin-top: 16px;
  padding: 16px;
  background-color: #ffffff;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.daily-todo-day-details h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
}

.daily-todo-day-empty {
  margin: 0;
  color: #64748b;
  font-size: 0.9rem;
}

.daily-todo-day-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.daily-todo-day-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background-color: #f8fafc;
}

.daily-todo-day-item--done {
  border-color: rgba(34, 197, 94, 0.4);
  background-color: rgba(34, 197, 94, 0.08);
}

.daily-todo-day-item--missed {
  border-color: rgba(239, 68, 68, 0.35);
  background-color: rgba(239, 68, 68, 0.08);
}

.daily-todo-day-item--upcoming {
  border-color: rgba(148, 163, 184, 0.4);
  background-color: rgba(148, 163, 184, 0.12);
}

.daily-todo-day-task {
  margin: 0;
  font-size: 0.95rem;
  color: #1f2937;
  flex: 1;
}

.daily-todo-day-status {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #1f2937;
  white-space: nowrap;
}

.daily-todo-day-item--done .daily-todo-day-status {
  color: #15803d;
}

.daily-todo-day-item--missed .daily-todo-day-status {
  color: #b91c1c;
}

.daily-todo-day-item--upcoming .daily-todo-day-status {
  color: #475569;
}

.status-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 0;
}

.status-option {
  border: none;
  cursor: pointer;
  font: inherit;
  background: none;
}

.status-option.active {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.4);
}

.status-picker-updating {
  opacity: 0.7;
  pointer-events: none;
}

.listing-link {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

.listing-link:hover {
  text-decoration: underline;
}


.note-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 220px;
  align-items: flex-start;
}

.note-text,
.note-placeholder {
  margin: 0;
  line-height: 1.4;
  width: 100%;
  word-break: break-word;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-text {
  color: #1f2937;
}

.note-placeholder {
  color: #94a3b8;
  font-style: italic;
}

.note-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 240px;
}

.note-editor-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 96px;
}

.note-editor-textarea:focus {
  outline: 3px solid rgba(59, 130, 246, 0.35);
  border-color: #3b82f6;
}

.note-editor-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.status-en_attente {
  background-color: rgba(59, 130, 246, 0.15);
  color: #1d4ed8;
}

.status-a_contacter {
  background-color: rgba(6, 182, 212, 0.18);
  color: #0f766e;
}

.status-appel_fait {
  background-color: rgba(56, 189, 248, 0.2);
  color: #0c4a6e;
}

.status-refus {
  background-color: rgba(248, 113, 113, 0.2);
  color: #b91c1c;
}

.status-visite_a_venir {
  background-color: rgba(250, 204, 21, 0.2);
  color: #92400e;
}

.status-visite_faite {
  background-color: rgba(129, 140, 248, 0.2);
  color: #4338ca;
}

.status-signature {
  background-color: rgba(16, 185, 129, 0.2);
  color: #047857;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.summary {
  font-size: 0.9rem;
  color: #475569;
  display: flex;
  gap: 12px;
}

.summary span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.form-row {
  display: grid;
  gap: 8px;
}

.form-row > input,
.form-row > select,
.form-row > textarea {
  width: 100%;
}

.rentability-inputs {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.rentability-results {
  margin-top: 24px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.dash-renta-toggle-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.dash-renta-toggle-row > input {
  width: auto;
  margin: 0;
}

.dash-renta-usage-hint {
  font-size: 0.85em;
  margin-left: 8px;
  color: #475569;
  white-space: nowrap;
}

.rentability-result {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 8px;
}

.rentability-result-airdna {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.rentability-result-airdna h4 {
  color: #1d4ed8;
}

.rentability-result-airbnb {
  background: #fff7ed;
  border-color: #fed7aa;
}

.rentability-result-airbnb h4 {
  color: #c2410c;
}

.rentability-result h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #1f2937;
}

.rentability-turnover,
.rentability-profit {
  margin: 0;
  font-size: 0.95rem;
  color: #334155;
}

.rentability-turnover {
  font-weight: 600;
}

.rentability-similar-listings {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #cbd5f5;
  display: grid;
  gap: 8px;
}

.rentability-similar-listings h5 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1f2937;
}

.rentability-similar-listings ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.rentability-similar-listings li {
  display: grid;
  gap: 2px;
}

.rentability-similar-title a {
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 600;
}

.rentability-similar-title a:hover {
  text-decoration: underline;
}

.rentability-similar-details {
  font-size: 0.85rem;
  color: #475569;
}

.rentability-similar-empty {
  margin: 0;
  font-size: 0.85rem;
  color: #64748b;
}

.rentability-inputs input[disabled] {
  background-color: #f1f5f9;
  color: #475569;
  cursor: not-allowed;
  opacity: 0.8;
}

.rentability-inputs input[disabled]::placeholder {
  color: #94a3b8;
}

.rentability-turnover-airdna {
  color: #1d4ed8;
}

.rentability-turnover-airbnb {
  color: #ea580c;
}

.rentability-profit[data-outcome="positive"] {
  color: #16a34a;
}

.rentability-profit[data-outcome="negative"] {
  color: #dc2626;
}

.rentability-profit[data-outcome="neutral"] {
  color: #0f172a;
}

@media (max-width: 1024px) {
  body {
    padding: 20px;
  }

  .card {
    padding: 24px;
  }
}

@media (max-width: 768px) {
  body {
    display: block;
    padding: 16px;
  }

  .app {
    width: 100%;
  }

  .card {
    padding: 20px;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .filters form {
    flex-direction: column;
    align-items: stretch;
  }

  .form-group {
    min-width: unset;
    width: 100%;
  }

  .summary {
    flex-wrap: wrap;
    gap: 8px;
  }

  .summary span {
    width: 100%;
  }

  .table-wrapper {
    overflow: visible;
  }

  table {
    display: block;
    border: 0;
  }

  thead {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
  }

  tbody {
    display: block;
  }

  tbody tr {
    display: block;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    background: #ffffff;
  }

  tbody tr:hover {
    background: #f8fafc;
  }

  td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
  }

  td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #475569;
    flex: 0 0 140px;
    max-width: 50%;
  }

  td > *:last-child {
    margin-bottom: 0;
  }

  tbody tr.properties-table-empty {
    padding: 0;
    margin-bottom: 0;
    background: transparent;
  }

  tbody tr.properties-table-empty td {
    display: block;
    padding: 16px;
  }

  tbody tr.properties-table-empty td::before {
    content: none;
  }

  .note-cell {
    max-width: none;
    width: 100%;
  }

  .note-editor {
    max-width: none;
  }

  .status-tag {
    width: fit-content;
  }

  button,
  input,
  select,
  textarea {
    font-size: 1rem;
  }

  #rentability-form button[type="submit"] {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .rentability-inputs,
  .rentability-results {
    grid-template-columns: 1fr;
  }
}

.form-feedback {
  margin-top: 4px;
  font-size: 0.85rem;
  color: #475569;
}

.form-feedback[data-status="loading"] {
  color: #2563eb;
}

.form-feedback[data-status="error"] {
  color: #dc2626;
}

.form-feedback[data-status="success"] {
  color: #16a34a;
}
