:root{
  --bg: #ffffff;
  --panel: #f9fafb;
  --text: #0f172a;
  --muted: rgba(15,23,42,0.72);
  --border: rgba(15,23,42,0.14);
  --focus: rgba(37,99,235,0.35);
  --primary: rgba(37,99,235,0.95);
  --primary-soft: rgba(37,99,235,0.10);
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(2,6,23,0.08);
  --shadow-soft: 0 8px 18px rgba(2,6,23,0.06);

  /* Colori vibranti per noleggio auto */
  --color-clients: #3b82f6;
  --color-clients-light: #60a5fa;
  --color-rentals: #10b981;
  --color-rentals-light: #34d399;
  --color-docs: #f59e0b;
  --color-docs-light: #fbbf24;
  --color-payments: #ef4444;
  --color-payments-light: #f87171;
  --color-accent: #8b5cf6;
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(1200px 600px at 20% 10%, rgba(59,130,246,0.12), transparent 55%),
    radial-gradient(1000px 500px at 90% 20%, rgba(16,185,129,0.11), transparent 55%),
    linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  color: var(--text);
}

.container{ width: 100%; margin: 0; padding: 28px 24px 44px; }

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding: 14px 16px;
  border: 1px solid rgba(59,130,246,0.15);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255,255,255,0.92) 0%, rgba(243,244,246,0.95) 100%);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 28px rgba(2,6,23,0.09);
}

.brand{ font-weight: 800; letter-spacing: 0.2px; color: var(--color-clients); }

.nav{ display:flex; align-items:center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.nav a{
  color: var(--muted);
  text-decoration:none;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all 120ms ease;
}
.nav a:hover{ 
  color: var(--color-clients); 
  background: rgba(59,130,246,0.08); 
  border-color: rgba(59,130,246,0.15); 
}

a{ color: var(--primary); text-decoration: none; }
a:hover{ text-decoration: underline; }

.card{
  margin-top: 18px;
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255,255,255,0.92) 0%, rgba(249,250,251,0.95) 100%);
  backdrop-filter: blur(8px);
  padding: 22px;
  box-shadow: 0 14px 32px rgba(2,6,23,0.08);
}

.h1{ font-size: 28px; margin: 0 0 8px; letter-spacing: -0.4px; font-weight: 800; }
.h2{ font-size: 18px; margin: 0 0 8px; letter-spacing: -0.1px; font-weight: 700; }
.p{ color: var(--muted); margin: 0 0 14px; line-height: 1.5; }

.grid{ display:grid; gap: 14px; }
@media (max-width: 920px){
  .grid{ grid-template-columns: 1fr !important; }
}

.form{ display:grid; gap: 12px; max-width: 420px; }
.label{ display:grid; gap: 6px; color: var(--muted); font-size: 13px; }
.input{
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(15,23,42,0.12);
  background: rgba(255,255,255,0.9);
  color: var(--text);
  outline: none;
  transition: box-shadow 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.input:focus{ box-shadow: 0 0 0 3px var(--focus); border-color: rgba(37,99,235,0.35); }

.btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(37,99,235,0.25);
  background: var(--primary-soft);
  color: var(--primary);
  cursor:pointer;
  font-weight: 700;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
.btn:hover{ background: rgba(37,99,235,0.16); box-shadow: 0 10px 22px rgba(37,99,235,0.12); text-decoration:none; }
.btn:active{ transform: translateY(1px); }

.btn--primary{ 
  background: linear-gradient(135deg, var(--color-clients) 0%, var(--color-clients-light) 100%);
  color: #fff; 
  border-color: rgba(59,130,246,0.5);
  box-shadow: 0 8px 16px rgba(59,130,246,0.2);
}
.btn--primary:hover{ 
  background: linear-gradient(135deg, var(--color-clients-light) 0%, var(--color-clients) 100%);
  box-shadow: 0 12px 24px rgba(59,130,246,0.3);
}

.btn--ghost{ 
  background: rgba(255,255,255,0.75); 
  color: var(--text); 
  border-color: rgba(15,23,42,0.15);
  box-shadow: 0 4px 12px rgba(15,23,42,0.06);
}
.btn--ghost:hover{ 
  background: rgba(255,255,255,0.95); 
  box-shadow: 0 8px 18px rgba(15,23,42,0.10);
}

.kbd{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255,255,255,0.75);
}

.list{ margin: 10px 0 0; padding-left: 18px; color: var(--muted); }
.footer{ margin-top: 18px; color: rgba(15,23,42,0.55); font-size: 12px; text-align:center; }

.table{ width:100%; border-collapse: collapse; }
.table th, .table td{ text-align:left; padding: 10px 10px; border-bottom: 1px solid rgba(15,23,42,0.10); vertical-align: top; }
.table th{ font-size: 12px; letter-spacing: 0.2px; color: var(--muted); text-transform: uppercase; }
.table tr:hover td{ background: rgba(59,130,246,0.03); }
.table a{ font-weight: 700; color: var(--color-clients); }

.tag{ 
  display:inline-block; 
  padding: 4px 10px; 
  border-radius: 999px; 
  border: 1px solid rgba(59,130,246,0.2); 
  background: rgba(59,130,246,0.06); 
  color: var(--color-clients); 
  font-size: 12px; 
  font-weight: 700;
}
.tag--ok{ 
  border-color: rgba(16,185,129,0.35); 
  background: rgba(16,185,129,0.10); 
  color: var(--color-rentals);
}
.tag--muted{ 
  border-color: rgba(148,163,184,0.45); 
  background: rgba(148,163,184,0.12); 
  color: rgba(51,65,85,0.95);
}

.tabs{ 
  display:flex; 
  gap: 8px; 
  flex-wrap: wrap; 
  padding: 6px; 
  background: rgba(59,130,246,0.04); 
  border: 1px solid rgba(59,130,246,0.1); 
  border-radius: 999px;
}
.tabs .btn{ 
  border-radius: 999px; 
  border-color: transparent; 
  background: transparent; 
  box-shadow: none;
  color: var(--muted);
}
.tabs .btn:hover{ 
  background: rgba(59,130,246,0.1); 
  box-shadow: none;
  color: var(--color-clients);
}

.hero{
  padding: 24px;
  background: linear-gradient(135deg, rgba(59,130,246,0.09) 0%, rgba(16,185,129,0.07) 100%);
  border-radius: 20px;
  border: 1px solid rgba(59,130,246,0.12);
  margin-top: 18px;
}

.tiles{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.tile{
  grid-column: span 6;
  display:block;
  padding: 20px;
  border-radius: 18px;
  border: 1.5px solid rgba(15,23,42,0.10);
  background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(249,250,251,0.98) 100%);
  box-shadow: 0 8px 20px rgba(2,6,23,0.06);
  transition: transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
  position: relative;
  overflow: hidden;
}

.tile::before{
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 200ms ease;
}

.tile:hover{
  transform: translateY(-8px);
  border-color: var(--color-clients);
  background: linear-gradient(135deg, rgba(255,255,255,1) 0%, rgba(249,250,251,1) 100%);
  box-shadow: 0 28px 56px rgba(59,130,246,0.18);
  text-decoration:none;
}

.tile:hover::before{
  opacity: 1;
}

.tile__title{ 
  font-weight: 800; 
  letter-spacing: -0.3px; 
  margin: 0 0 8px; 
  color: var(--text);
  font-size: 18px;
}

  /* Client profile stats (bootstrap-like markup, scoped) */
  .client-profile-stats .row{
    display:flex;
    flex-wrap:wrap;
  }
  .client-profile-stats .g-2{
    gap: 8px;
  }
  .client-profile-stats .card{
    margin: 0;
    padding: 0;
    border-radius: 14px;
    border: 1px solid rgba(15,23,42,0.10);
    background: rgba(255,255,255,0.85);
    box-shadow: 0 6px 16px rgba(2,6,23,0.06);
    backdrop-filter: blur(6px);
  }
  .client-profile-stats .border-0{ border: 0 !important; }
  .client-profile-stats .bg-light{ background: rgba(15,23,42,0.045) !important; }
  .client-profile-stats .h-100{ height: 100%; }
  .client-profile-stats .card-body{ padding: 10px 10px; }
  .client-profile-stats .text-center{ text-align:center; }
  .client-profile-stats .py-2{ padding-top: 8px !important; padding-bottom: 8px !important; }
  .client-profile-stats .fs-4{ font-size: 22px !important; }
  .client-profile-stats .mb-1{ margin-bottom: 4px !important; }
  .client-profile-stats .mb-0{ margin-bottom: 0 !important; }
  .client-profile-stats .small{ font-size: 12px !important; }
  .client-profile-stats .fw-semibold{ font-weight: 700 !important; }
  .client-profile-stats .text-decoration-none{ text-decoration: none !important; }
  .client-profile-stats a.text-decoration-none:hover{ text-decoration: none !important; }
  .client-profile-stats .text-muted{ color: rgba(15,23,42,0.55) !important; }

  .client-profile-stats .text-primary{ color: var(--color-clients) !important; }
  .client-profile-stats .text-info{ color: var(--color-accent) !important; }
  .client-profile-stats .text-success{ color: var(--color-rentals) !important; }
  .client-profile-stats .text-warning{ color: var(--color-docs) !important; }
  .client-profile-stats .text-danger{ color: var(--color-payments) !important; }
  .client-profile-stats .text-secondary{ color: rgba(51,65,85,0.90) !important; }

  .client-profile-stats .card-title{
    margin: 0 0 4px;
    font-weight: 800;
    letter-spacing: -0.1px;
    color: rgba(15,23,42,0.80);
  }
  .client-profile-stats .card-text{ margin: 0; }

.tile__desc{ 
  margin: 0; 
  color: var(--muted); 
  line-height: 1.6;
  font-size: 14px;
}

/* Varianti colorate per tiles */
.tile[href*="/clients"],
.tile[href*="type=private"],
.tile[href*="type=business"] {
  border-color: rgba(59,130,246,0.25);
  background: linear-gradient(135deg, rgba(59,130,246,0.04) 0%, rgba(96,165,250,0.02) 100%);
}
.tile[href*="/clients"]:hover,
.tile[href*="type=private"]:hover,
.tile[href*="type=business"]:hover {
  border-color: var(--color-clients);
  background: linear-gradient(135deg, rgba(59,130,246,0.08) 0%, rgba(96,165,250,0.04) 100%);
  box-shadow: 0 28px 56px rgba(59,130,246,0.22);
}

.tile[href*="rental"] {
  border-color: rgba(16,185,129,0.25);
  background: linear-gradient(135deg, rgba(16,185,129,0.04) 0%, rgba(52,211,153,0.02) 100%);
}
.tile[href*="rental"]:hover {
  border-color: var(--color-rentals);
  background: linear-gradient(135deg, rgba(16,185,129,0.08) 0%, rgba(52,211,153,0.04) 100%);
  box-shadow: 0 28px 56px rgba(16,185,129,0.22);
}

.tile[href*="document"] {
  border-color: rgba(245,158,11,0.25);
  background: linear-gradient(135deg, rgba(245,158,11,0.04) 0%, rgba(251,191,36,0.02) 100%);
}
.tile[href*="document"]:hover {
  border-color: var(--color-docs);
  background: linear-gradient(135deg, rgba(245,158,11,0.08) 0%, rgba(251,191,36,0.04) 100%);
  box-shadow: 0 28px 56px rgba(245,158,11,0.22);
}

.tile[href*="payment"] {
  border-color: rgba(239,68,68,0.25);
  background: linear-gradient(135deg, rgba(239,68,68,0.04) 0%, rgba(248,113,113,0.02) 100%);
}
.tile[href*="payment"]:hover {
  border-color: var(--color-payments);
  background: linear-gradient(135deg, rgba(239,68,68,0.08) 0%, rgba(248,113,113,0.04) 100%);
  box-shadow: 0 28px 56px rgba(239,68,68,0.22);
}

.tile--disabled{
  opacity: 0.65;
  filter: saturate(0.82);
  cursor: not-allowed;
  position: relative;
}

.tile--disabled:hover{
  transform: translateY(0);
  border-color: rgba(15,23,42,0.10);
  background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(249,250,251,0.98) 100%);
  box-shadow: 0 8px 20px rgba(2,6,23,0.06);
}

.tile--disabled::after{
  content: '✨ Presto';
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11px;
  font-weight: 800;
  color: rgba(15,23,42,0.45);
  background: rgba(255,255,255,0.8);
  padding: 4px 8px;
  border-radius: 8px;
  letter-spacing: 0.3px;
}

@media (max-width: 720px){
  .tile{ grid-column: span 12; }
  .h1{ font-size: 24px; }
}

/* Mobile Hamburger Menu */
.hamburger{
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  gap: 5px;
}

.hamburger span{
  width: 24px;
  height: 2px;
  background: var(--color-clients);
  border-radius: 2px;
  transition: all 200ms ease;
}

.hamburger.active span:nth-child(1){
  transform: rotate(45deg) translate(10px, 10px);
}

.hamburger.active span:nth-child(2){
  opacity: 0;
}

.hamburger.active span:nth-child(3){
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Menu Overlay */
.nav-mobile{
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

.nav-mobile.active{
  display: block;
}

.nav-mobile-menu{
  position: absolute;
  top: 60px;
  right: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.98) 0%, rgba(249,250,251,0.98) 100%);
  border: 1px solid rgba(59,130,246,0.15);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(2,6,23,0.15);
  min-width: 200px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding: 8px 0;
  backdrop-filter: blur(8px);
}

.nav-mobile-menu a{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--muted);
  text-decoration: none;
  border: none;
  border-radius: 0;
  transition: all 120ms ease;
  width: 100%;
  text-align: left;
  background: none;
  cursor: pointer;
  font-size: 14px;
}

.nav-mobile-menu a:hover{
  background: rgba(59,130,246,0.10);
  color: var(--color-clients);
}

.nav-mobile-menu a i{
  width: 16px;
  text-align: center;
}

/* Media Query per Mobile */
@media (max-width: 768px){
  .container{
    padding: 16px 16px 40px;
  }

  .topbar{
    padding: 12px 14px;
    border-radius: 16px;
  }

  .brand{
    font-size: 16px;
  }

  .nav{
    display: none !important;
  }

  .hamburger{
    display: flex;
  }

  .h1{
    font-size: 22px;
  }

  .card{
    margin-top: 14px;
    padding: 18px;
  }

  .form{
    max-width: 100%;
  }

  .input{
    padding: 12px 14px;
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .btn{
    padding: 12px 14px;
    font-size: 14px;
  }

  .tile{
    grid-column: span 12;
    padding: 16px;
  }

  .tile__title{
    font-size: 16px;
  }

  .tile__desc{
    font-size: 13px;
  }

  .p{
    font-size: 14px;
  }

  .label{
    font-size: 12px;
  }

  .hero{
    padding: 18px;
    margin-top: 14px;
  }

  .h2{
    font-size: 16px;
  }

  /* Table responsiveness */
  .table{
    font-size: 13px;
  }

  .table th, .table td{
    padding: 8px 6px;
  }

  .table a{
    display: block;
    word-break: break-word;
  }
}

@media (max-width: 480px){
  .container{
    padding: 12px 12px 36px;
  }

  .topbar{
    padding: 10px 12px;
    gap: 10px;
  }

  .brand{
    font-size: 14px;
    flex: 1;
  }

  .h1{
    font-size: 20px;
  }

  .card{
    margin-top: 12px;
    padding: 16px;
    border-radius: 16px;
  }

  .input{
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 16px;
  }

  .btn{
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
  }

  .btn--primary{
    width: 100%;
  }

  .form{
    gap: 10px;
  }

  .label{
    gap: 5px;
    font-size: 11px;
  }

  .p{
    font-size: 13px;
  }

  .hero{
    padding: 14px;
  }

  .h2{
    font-size: 15px;
  }

  .tiles{
    gap: 10px;
  }

  .nav-mobile-menu{
    right: -10px;
    min-width: 180px;
    padding: 6px 0;
  }

  .nav-mobile-menu a{
    padding: 10px 14px;
    font-size: 13px;
  }
}

/* Clients Page - Desktop/Mobile */
.clients-table-desktop {
  display: block;
  overflow: auto;
}

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

.client-card {
  display: block;
  padding: 14px;
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(15,23,42,0.10);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: all 120ms ease;
  cursor: pointer;
}

.client-card:hover {
  background: rgba(255,255,255,0.95);
  border-color: var(--color-clients);
  box-shadow: 0 8px 20px rgba(59,130,246,0.15);
  text-decoration: none;
}

.btn--sm {
  padding: 8px 10px;
  font-size: 12px;
  border-radius: 8px;
}

@media (max-width: 768px) {
  .clients-table-desktop {
    display: none;
  }

  .clients-list-mobile {
    display: flex;
  }

  .btn--sm {
    padding: 8px 10px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .client-card {
    padding: 12px;
    border-radius: 10px;
  }

  .client-card h3 {
    font-size: 14px !important;
  }

  .btn--sm {
    padding: 8px 9px;
    font-size: 10px;
  }
}

/* Hero Header - Responsive Layout */
.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-header > div:first-child {
  flex: 1;
  min-width: 200px;
}

.hero-header > div:last-child {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .hero-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .hero-header > div:first-child {
    min-width: auto;
  }

  .hero-header > div:last-child {
    gap: 8px;
  }

  .hero-header .h1 {
    font-size: 22px;
  }

  .hero-header .p {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .hero-header > div:last-child {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .hero-header .h1 {
    font-size: 20px;
  }

  .hero-header .p {
    font-size: 12px;
  }

  .hero-header .btn {
    width: 100%;
    text-align: center;
    font-size: 12px;
  }
}

/* Client Show Page - Mobile Optimization */
.rentals-table-desktop {
  display: block;
  overflow: auto;
}

.rentals-list-mobile {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.rental-card {
  display: block;
  background: white;
  border: 1px solid rgba(15,23,42,0.10);
  border-radius: 12px;
  padding: 14px;
  text-decoration: none;
  color: inherit;
  transition: all 120ms ease;
}

.rental-card:hover {
  background: rgba(255,255,255,0.95);
  border-color: var(--color-rentals);
  box-shadow: 0 8px 20px rgba(16,185,129,0.15);
  text-decoration: none;
}

.rental-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(15,23,42,0.08);
}

.rental-card-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.rental-card-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 12px;
  margin-bottom: 10px;
}

.rental-card-detail {
  display: flex;
  flex-direction: column;
}

.rental-card-detail-label {
  font-size: 10px;
  opacity: .6;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.rental-card-detail-value {
  font-weight: 600;
  color: var(--text);
}

.rental-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid rgba(15,23,42,0.08);
  font-size: 13px;
}

.rental-card-total {
  font-weight: 700;
  color: var(--color-rentals);
}

.rental-card-action {
  text-align: right;
}

.data-grid-mobile {
  display: block;
}

.data-grid-mobile > div {
  display: block;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(15,23,42,0.08);
}

.data-grid-mobile > div:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.summary-grid-mobile {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.summary-grid-mobile > div {
  padding: 12px;
  background: rgba(15,23,42,0.02);
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: 8px;
}

@media (max-width: 768px) {
  .rentals-table-desktop {
    display: none;
  }

  .rentals-list-mobile {
    display: flex;
  }

  .data-grid-desktop {
    display: none;
  }

  .data-grid-mobile {
    display: block !important;
  }

  .summary-grid-desktop {
    display: none;
  }

  .summary-grid-mobile {
    display: grid;
  }

  .hero-header {
    flex-direction: column;
  }

  .hero-header > div:last-child {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  .hero-header .btn {
    flex: 1;
    min-width: auto;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .rental-card {
    padding: 12px;
    border-radius: 10px;
  }

  .rental-card-header h3 {
    font-size: 14px;
  }

  .rental-card-details {
    grid-template-columns: 1fr;
    gap: 8px;
    font-size: 11px;
  }

  .rental-card-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
  }

  .rental-card-total {
    font-size: 13px;
  }

  .data-grid-mobile > div {
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .card {
    padding: 14px;
  }

  .h2 {
    font-size: 16px;
  }

  .summary-grid-mobile {
    grid-template-columns: 1fr;
  }

  .summary-grid-mobile > div {
    padding: 10px;
    font-size: 12px;
  }
}

/* Sections Navigation - Responsive */
.sections-card {
  margin-bottom: 14px;
}

.sections-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sections-tabs .btn {
  padding: 10px 12px;
  font-size: 13px;
  white-space: nowrap;
  border-radius: 999px;
}

@media (max-width: 768px) {
  .sections-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .sections-tabs .btn {
    padding: 9px 10px;
    font-size: 12px;
    text-align: center;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .sections-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .sections-tabs .btn {
    padding: 8px 8px;
    font-size: 11px;
    text-align: center;
    width: 100%;
  }

  .sections-card {
    margin-bottom: 12px;
  }

  .sections-card .h2 {
    font-size: 15px;
    margin: 0 0 8px;
  }
}

/* Rentals Tables - Mobile Optimization */
.rentals-table-main {
  display: block;
  overflow: auto;
}

.rentals-table-extras {
  display: block;
  overflow: auto;
  margin-top: 12px;
}

.rentals-table-main .table,
.rentals-table-extras .table {
  width: 100%;
  margin: 0;
}

@media (max-width: 768px) {
  .rentals-table-main,
  .rentals-table-extras {
    display: none;
  }

  .section-rentals-mobile {
    display: block;
  }
}

@media (max-width: 480px) {
  .section-rentals-mobile {
    display: block;
  }

  .rental-item-card {
    display: block;
    background: white;
    border: 1px solid rgba(15,23,42,0.10);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    text-decoration: none;
    color: inherit;
  }

  .rental-item-card:hover {
    border-color: var(--color-rentals);
    background: rgba(255,255,255,0.95);
    box-shadow: 0 8px 20px rgba(16,185,129,0.15);
  }

  .rental-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(15,23,42,0.08);
    font-weight: 700;
    font-size: 14px;
  }

  .rental-item-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 11px;
  }

  .rental-item-detail {
    display: flex;
    flex-direction: column;
  }

  .rental-item-detail-label {
    font-size: 9px;
    opacity: .6;
    margin-bottom: 2px;
    text-transform: uppercase;
  }

  .rental-item-detail-value {
    font-weight: 600;
    color: var(--text);
  }

  .rental-item-extras {
    background: rgba(15,23,42,0.02);
    border: 1px solid rgba(15,23,42,0.08);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 10px;
    font-size: 11px;
  }

  .rental-item-extra {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    align-items: flex-start;
  }

  .rental-item-extra:last-child {
    margin-bottom: 0;
  }

  .rental-item-extra i {
    flex-shrink: 0;
    margin-top: 1px;
  }

  .rental-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid rgba(15,23,42,0.08);
    font-weight: 600;
    font-size: 12px;
  }

  .rental-item-total {
    color: var(--color-rentals);
  }

  .rental-item-action {
    text-align: right;
  }
}

/* ============================================
   RESPONSIVE TABLES - Mobile Optimization
   ============================================ */

/* TABLET (768px - 1024px) */
@media (max-width: 768px) {
  .table {
    font-size: 12px !important;
  }

  .table thead th {
    padding: 8px 6px !important;
    font-size: 11px !important;
    font-weight: 600;
  }

  .table tbody td {
    padding: 8px 6px !important;
  }

  .table th[style*="width"],
  .table td[style*="width"] {
    width: auto !important;
  }

  /* Nascondi colonne secondarie su tablet */
  .table th:nth-child(3),
  .table td:nth-child(3),
  .table th:nth-child(4),
  .table td:nth-child(4) {
    display: none;
  }
}

/* MOBILE (≤480px) */
@media (max-width: 480px) {
  .table {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100% !important;
  }

  .table thead {
    display: none !important;
  }

  .table tbody {
    display: contents;
  }

  /* CARD CONTAINER */
  .table tbody tr {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #e8ecf1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    padding: 16px;
    gap: 12px;
    page-break-inside: avoid;
  }

  .table tbody tr:active {
    background: #fafbfc;
  }

  /* NASCONDI RIGHE EXTRAS */
  .table tbody tr[style*="background"] {
    display: flex !important;
    flex-direction: column;
    background: #f8f9fa;
    border: none !important;
    border-top: 1px solid #e8ecf1;
    padding: 12px 0 !important;
    margin: 0 !important;
    gap: 8px;
    box-shadow: none !important;
  }

  .table tbody tr[style*="background"] td {
    padding: 0 16px !important;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #6c757d;
  }

  .table tbody tr[style*="background"] span {
    color: #10b981;
    font-weight: 700;
    font-size: 13px;
  }

  /* ==========================================
     ID NOLEGGIO + VEICOLO (Header)
     ========================================== */
  .table tbody td:nth-child(1),
  .table tbody td:nth-child(2) {
    padding: 0 !important;
    border: none !important;
    display: block;
    margin-bottom: 8px;
  }

  .table tbody td:nth-child(1) {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 4px 0;
  }

  .table tbody td:nth-child(1)::before {
    content: "";
    display: none;
  }

  .table tbody td:nth-child(2) {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
    margin: 0;
  }

  .table tbody td:nth-child(2) strong {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    display: inline;
  }

  .table tbody td:nth-child(2)::before {
    content: "";
    display: none;
  }

  /* ==========================================
     DATI IN COLONNA (verticale)
     ========================================== */
  .table tbody td:nth-child(n+3) {
    padding: 8px 0 !important;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
  }

  .table tbody td:nth-child(3)::before { content: "📍 Ritiro"; font-weight: 600; color: #6c757d; margin-right: 12px; flex-shrink: 0; }
  .table tbody td:nth-child(4)::before { content: "📍 Riconsegna"; font-weight: 600; color: #6c757d; margin-right: 12px; flex-shrink: 0; }
  .table tbody td:nth-child(5)::before { content: "⏱ Durata"; font-weight: 600; color: #6c757d; margin-right: 12px; flex-shrink: 0; }
  .table tbody td:nth-child(6)::before { content: "📊 Stato"; font-weight: 600; color: #6c757d; margin-right: 12px; flex-shrink: 0; }
  .table tbody td:nth-child(7)::before { content: "💶 Totale"; font-weight: 600; color: #6c757d; margin-right: 12px; flex-shrink: 0; }
  
  /* AZIONE - pulsanti a sinistra */
  .table tbody td:nth-child(8) {
    padding: 8px 0 !important;
    border: none !important;
    display: flex;
    align-items: center;
    gap: 2px;
    justify-content: flex-start;
  }

  .table tbody td:nth-child(8)::before {
    content: "⚙ Azione";
    font-weight: 600;
    color: #6c757d;
    margin-right: 8px;
    flex-shrink: 0;
  }

  .table tbody td:nth-child(8) .btn {
    padding: 4px 8px !important;
    margin: 0 !important;
  }

  /* Contenuto a destra per dati normali */
  .table tbody td:nth-child(-n+7) strong,
  .table tbody td:nth-child(-n+7) small {
    margin: 0;
    text-align: right;
  }

  .table tbody td:nth-child(-n+7) strong {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    display: inline;
  }

  .table tbody td:nth-child(-n+7) small {
    font-size: 12px;
    color: #6c757d;
    display: block;
  }

  /* TAG STATO */
  .table .tag {
    font-size: 11px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    display: inline-block;
  }

  /* BOTTONI - in riga con etichetta */
  .table .btn {
    font-size: 12px !important;
    padding: 8px 14px !important;
    border-radius: 6px;
    font-weight: 600;
    border: none;
    transition: all 0.2s ease;
    display: inline-block;
  }

  .table .btn--primary {
    background: #10b981;
    color: white;
  }

  .table .btn--primary:active {
    background: #059669;
  }

  .table .btn--ghost {
    background: #f0f2f5;
    color: #495057;
  }

  .table .btn--ghost:active {
    background: #e9ecef;
  }
}

