/* ================================================================
   BOTIQUE PORTALE PROPRIETARI — stylesheet v0.1
   Palette dal logo Botique (dark + oro)
================================================================ */

:root {
  --bg:        #1a1a1a;
  --panel:     #232323;
  --panel-2:   #2c2c2c;
  --border:    #333333;
  --gold:      #C8985A;
  --gold-2:    #D4A971;
  --ivory:     #E8DCC4;
  --text:      #EFEFEF;
  --text-2:    #B5B5B5;
  --text-3:    #7A7A7A;
  --pos:       #5BC890;
  --neg:       #E26B6B;
  --warn:      #E5C16A;
  --shadow:    0 6px 18px rgba(0,0,0,0.35);
  --radius:    12px;
  --radius-sm: 8px;
  --transition: 180ms cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }
a { color: inherit; text-decoration: none; }

/* ===== SPLASH ===== */
.splash {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.splash-inner { text-align: center; }
.splash-logo { width: 80px; height: 80px; animation: pulse 1.6s ease-in-out infinite; }
.splash-text { color: var(--text-2); margin-top: 16px; font-size: 14px; }
@keyframes pulse {
  0%, 100% { opacity: 0.7; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.04); }
}

/* ===== ERROR BANNER ===== */
.error-banner {
  position: fixed; top: 0; left: 0; right: 0;
  background: var(--neg); color: white;
  padding: 12px 24px; text-align: center; font-weight: 500;
  z-index: 200; box-shadow: var(--shadow);
}

/* ===== HEADER ===== */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky; top: 0; z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 14px; }
.logo { width: 42px; height: 42px; }
.logo-large { width: 56px; height: 56px; }
.logo-img { height: 56px; width: auto; display: block; }
.logo-link {
  display: inline-block;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}
.logo-link:hover { opacity: 0.85; }
.welcome-chip {
  background: var(--bg); color: var(--gold);
  padding: 8px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border);
}

/* ===== CONTROLS BAR ===== */
.controls-bar {
  display: flex; flex-wrap: wrap;
  gap: 16px; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.controls-left {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
}
.control-item {
  display: flex; flex-direction: column; gap: 4px;
}
.control-label {
  font-size: 11px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500;
}
.control-item select {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); padding: 8px 12px;
  border-radius: var(--radius-sm); font-family: inherit;
  font-size: 13px; cursor: pointer; transition: var(--transition);
  min-width: 240px;
}
.control-item select:hover { border-color: var(--gold); }

.period-toggle {
  display: flex; gap: 6px; align-self: flex-end;
  padding-bottom: 1px;
}
.period-btn {
  background: transparent; color: var(--text-3);
  border: 1px solid var(--border); padding: 8px 14px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  transition: var(--transition);
}
.period-btn:hover { color: var(--text); border-color: var(--gold); }
.period-btn.active {
  background: var(--gold); color: var(--bg); border-color: var(--gold);
}

.btn {
  display: inline-block; padding: 12px 20px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); transition: var(--transition);
}
.btn-gold {
  background: var(--gold); color: var(--bg); border-color: var(--gold);
}
.btn-gold:hover {
  background: var(--gold-2); border-color: var(--gold-2);
  transform: translateY(-1px); box-shadow: var(--shadow);
}

/* ===== MAIN ===== */
.main { max-width: 1400px; margin: 0 auto; padding: 32px; }
.section { margin-bottom: 40px; }

/* ===== CARDS GRID ===== */
.cards-grid { display: grid; gap: 16px; }
.cards-grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px; cursor: pointer;
  transition: var(--transition);
  position: relative; overflow: hidden;
}
.card::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 3px; height: 100%; background: var(--gold);
  opacity: 0.4; transition: var(--transition);
}
.card:hover {
  border-color: var(--gold); background: var(--panel-2);
  transform: translateY(-1px); box-shadow: var(--shadow);
}
.card:hover::before { opacity: 1; }

.card-label {
  font-size: 12px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 500; margin-bottom: 8px;
}
.card-value {
  font-size: 28px; font-weight: 700;
  color: var(--text); letter-spacing: -0.02em; line-height: 1.1;
}
.card-value.positive { color: var(--pos); }
.card-value.negative { color: var(--neg); }
.card-value.gold { color: var(--gold); }

.card-drill-hint {
  position: absolute; bottom: 8px; right: 12px;
  font-size: 10px; color: var(--text-3); letter-spacing: 0.04em;
}

.card.card-big { grid-column: span 2; }
.card.card-big .card-value { font-size: 38px; }
@media (max-width: 768px) {
  .card.card-big { grid-column: span 1; }
  .card.card-big .card-value { font-size: 28px; }
}

/* ===== CHARTS ===== */
.section-charts {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .section-charts { grid-template-columns: 1fr; }
}
.chart-block {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.chart-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px;
}
.chart-head h3 {
  margin: 0; font-size: 14px; font-weight: 600; color: var(--text);
  letter-spacing: 0.01em;
}
.chart-meta { font-size: 11px; color: var(--text-3); }
.chart-wrapper-small {
  height: 280px;
  position: relative;
  width: 100%;
  max-width: 100%;
}
.chart-wrapper-small canvas {
  max-width: 100% !important;
  width: 100% !important;
  height: 100% !important;
}

/* ===== BOOKINGS ===== */
.section-bookings .bookings-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border); padding-bottom: 8px;
}
.section-bookings h2 {
  font-size: 16px; font-weight: 600; margin: 0; color: var(--text);
}
.section-meta { font-size: 12px; color: var(--text-3); }

.bookings-layout {
  display: grid; grid-template-columns: 1fr 220px; gap: 16px;
}
@media (max-width: 900px) {
  .bookings-layout { grid-template-columns: 1fr; }
}

.bookings-table-wrap {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: auto; max-height: 500px;
}
.data-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.data-table thead th {
  text-align: left; padding: 10px 12px;
  background: var(--panel-2); color: var(--text-2);
  font-weight: 600; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1;
}
.data-table thead th.numeric { text-align: right; }
.data-table tbody td {
  padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text);
}
.data-table tbody tr:hover { background: var(--panel-2); }
.data-table tbody td.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody td.dimmed { color: var(--text-3); }

.bookings-kpi {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; height: fit-content;
  display: flex; flex-direction: column; gap: 16px;
}
.kpi-block {
  border-bottom: 1px solid var(--border); padding-bottom: 12px;
}
.kpi-block:last-child { border-bottom: none; padding-bottom: 0; }
.kpi-label {
  font-size: 11px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.kpi-value {
  font-size: 22px; font-weight: 700; color: var(--text);
  letter-spacing: -0.02em;
}

/* ===== FOOTER ===== */
.footer {
  display: flex; justify-content: space-between;
  padding: 16px 32px; border-top: 1px solid var(--border);
  background: var(--panel); font-size: 11px; color: var(--text-3);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 150; padding: 24px;
  animation: fadeIn 180ms ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); width: 100%; max-width: 720px;
  max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: slideUp 220ms cubic-bezier(.4,0,.2,1);
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}
.modal-head h3 {
  margin: 0; font-size: 16px; font-weight: 600; color: var(--text);
}
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }

.btn-close {
  background: transparent; border: none; color: var(--text-2);
  font-size: 28px; line-height: 1; width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.btn-close:hover { background: var(--panel-2); color: var(--text); }

/* Drill content */
.drill-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.drill-table th, .drill-table td {
  padding: 10px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.drill-table th {
  color: var(--text-3); font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.drill-table td.numeric, .drill-table th.numeric { text-align: right; font-variant-numeric: tabular-nums; }

.drill-row-pos { color: var(--pos); }
.drill-row-neg { color: var(--neg); }
.drill-row-tot { font-weight: 700; border-top: 2px solid var(--border); }

.empty-state {
  text-align: center; padding: 32px 16px;
  color: var(--text-3); font-style: italic;
}

.record-list { display: flex; flex-direction: column; gap: 8px; }
.record-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.record-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px;
}
.record-desc {
  font-size: 13px; color: var(--text); font-weight: 500;
  flex: 1; min-width: 0;
}
.record-amount {
  font-size: 14px; font-weight: 600;
  color: var(--neg); font-variant-numeric: tabular-nums;
}
.record-meta {
  font-size: 11px; color: var(--text-3); letter-spacing: 0.02em;
}
.record-attachment {
  font-size: 11px; color: var(--gold);
  padding: 2px 6px; border: 1px solid var(--border);
  border-radius: 4px; align-self: flex-start;
  transition: var(--transition);
}
.record-attachment:hover { background: var(--panel-2); border-color: var(--gold); }

/* ===== v0.1.2 Drill utile sezioni con titoli e note ===== */
.drill-section-title {
  font-size: 12px; font-weight: 600;
  color: var(--gold);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin: 18px 0 8px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.drill-section-title:first-child { margin-top: 0; }
.drill-note {
  font-size: 12px; color: var(--text-3);
  font-style: italic; line-height: 1.5;
  background: var(--bg);
  border-left: 2px solid var(--gold);
  padding: 8px 12px; margin: 8px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ===== v0.1.2 Stato prenotazione ===== */
.stato-cancellata {
  color: var(--neg);
  font-weight: 600;
}
.stato-confermata {
  color: var(--pos);
}
.row-cancellata { opacity: 0.6; }
.row-cancellata td { text-decoration: line-through; }
.row-cancellata td.stato-cancellata { text-decoration: none; }

/* ===== v0.1.3 Calendario stile Airbnb (barre continue) ===== */
.bookings-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.view-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.view-btn {
  background: transparent;
  color: var(--text-3);
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition);
}
.view-btn:hover { color: var(--text); }
.view-btn.active {
  background: var(--gold);
  color: var(--bg);
}

.calendar-view {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.calendar-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.cal-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cal-header-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-header-cell {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 6px 0;
  font-weight: 600;
}
.cal-week-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  position: relative;
  min-height: 60px;
}
.cal-day-bg {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  position: relative;
}
.cal-day-bg.cal-day-out {
  background: transparent;
}
.cal-day-bg.cal-weekend {
  background: var(--panel-2);
}
.cal-day-num {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 600;
}

.cal-bar {
  position: absolute;
  height: 22px;
  border-radius: 11px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--transition);
  line-height: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.cal-bar-confirmed {
  background: var(--gold);
  color: var(--bg);
}
.cal-bar-confirmed:hover {
  background: var(--gold-2);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  z-index: 5;
}
.cal-bar-cancelled {
  background: var(--text-3);
  color: var(--bg);
  text-decoration: line-through;
  opacity: 0.7;
}
.cal-bar-cancelled:hover { opacity: 1; z-index: 5; }

.calendar-legend {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
  padding: 0 4px;
}
.cal-bar-legend {
  font-size: 11px;
  padding: 3px 12px;
  border-radius: 999px;
  font-weight: 500;
}
.cal-bar-legend.cal-bar-confirmed { background: var(--gold); color: var(--bg); }
.cal-bar-legend.cal-bar-cancelled { background: var(--text-3); color: var(--bg); text-decoration: line-through; }

/* Cancellata Sì in tabella */
.cancellata-yes {
  color: var(--neg);
  font-weight: 700;
}

@media (max-width: 768px) {
  .cal-week-row { gap: 2px; min-height: 50px; }
  .cal-header-row { gap: 2px; }
  .cal-day-bg { padding: 2px 4px; }
  .cal-day-num { font-size: 10px; }
  .cal-bar { font-size: 9px; height: 18px; line-height: 12px; padding: 2px 6px; border-radius: 9px; }
  .cal-header-cell { font-size: 9px; padding: 4px 0; }
  .calendar-view { padding: 10px; }
}

/* ===== v0.1.2 Booking detail modal ===== */
.booking-detail-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  font-size: 13px;
}
.bd-label {
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.bd-value {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 600px) {
  .booking-detail-grid { grid-template-columns: 1fr; gap: 4px 0; }
  .booking-detail-grid .bd-value { margin-bottom: 8px; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .main { padding: 20px 16px; }
  .header { padding: 14px 16px; flex-wrap: wrap; gap: 12px; }
  .controls-bar { flex-direction: column; align-items: stretch; }
  .controls-left { flex-direction: column; align-items: stretch; }
  .control-item select { min-width: 0; width: 100%; }
  .period-toggle { width: 100%; }
  .period-btn { flex: 1; }
  .footer { flex-direction: column; gap: 8px; padding: 16px; }
  .modal-head, .modal-body { padding: 16px; }
}
