:root{--blue:#0078d4;--blue-dk:#005a9e;--green:#107c10;--red:#d32f2f;--orange:#f59700;--gray-50:#f8f8f8;--gray-100:#f0f0f0;--gray-200:#e0e0e0;--gray-400:#9e9e9e;--gray-600:#616161;--gray-900:#212121;--radius:8px;--shadow:0 2px 8px rgba(0,0,0,.10);}
*{box-sizing:border-box;margin:0;padding:0;}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;font-size:15px;color:var(--gray-900);background:var(--gray-50);line-height:1.5;}

.navbar{display:flex;align-items:center;justify-content:space-between;background:#fff;border-bottom:1px solid var(--gray-200);padding:0 1.5rem;height:56px;position:sticky;top:0;z-index:100;box-shadow:var(--shadow);}
.navbar-brand{font-size:1.1rem;font-weight:600;color:var(--blue);text-decoration:none;}
.navbar-links{display:flex;align-items:center;gap:.75rem;}
.navbar-links a{color:var(--gray-600);text-decoration:none;font-size:.9rem;}
.navbar-links a:hover{color:var(--blue);}
.nav-sep{color:var(--gray-200);}
.nav-admin{color:var(--orange)!important;font-weight:600;}
.nav-user{color:var(--gray-400);font-size:.85rem;}

.container{max-width:1100px;margin:0 auto;padding:2rem 1.5rem;}
.page-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1.5rem;flex-wrap:wrap;gap:.75rem;}
.page-header h1{font-size:1.6rem;font-weight:600;}

.card{background:#fff;border-radius:var(--radius);padding:1.5rem;box-shadow:var(--shadow);border:1px solid var(--gray-200);}
.card-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem;}
.card-header h2{font-size:1.1rem;font-weight:600;}
.mb-3{margin-bottom:1rem;}.mb-4{margin-bottom:1.5rem;}.mt-4{margin-top:1.5rem;}

.btn{display:inline-flex;align-items:center;gap:.4rem;padding:.45rem 1rem;border:none;border-radius:6px;cursor:pointer;font-size:.9rem;font-weight:500;text-decoration:none;transition:opacity .15s;}
.btn:hover{opacity:.88;}
.btn-primary{background:var(--blue);color:#fff;}
.btn-danger{background:var(--red);color:#fff;}
.btn-outline{background:transparent;color:var(--blue);border:1px solid var(--blue);}
.btn-sm{padding:.3rem .7rem;font-size:.82rem;}
.btn-ms{display:flex;align-items:center;justify-content:center;gap:.75rem;width:100%;padding:.75rem 1.25rem;background:#fff;color:#333;border:1px solid var(--gray-200);border-radius:6px;font-size:1rem;font-weight:500;cursor:pointer;text-decoration:none;box-shadow:var(--shadow);transition:background .15s;}
.btn-ms:hover{background:var(--gray-50);}

.form-group{margin-bottom:1rem;flex:1;}
.form-row{display:flex;gap:1rem;flex-wrap:wrap;}
.form-group label{display:block;font-weight:500;margin-bottom:.3rem;font-size:.9rem;}
.form-control{width:100%;padding:.45rem .75rem;border:1px solid var(--gray-200);border-radius:6px;font-size:.9rem;background:#fff;transition:border-color .15s;}
.form-control:focus{outline:none;border-color:var(--blue);}
.form-control-inline{padding:.25rem .5rem;border:1px solid var(--gray-200);border-radius:6px;font-size:.85rem;background:#fff;cursor:pointer;}

.table{width:100%;border-collapse:collapse;}
.table th{text-align:left;padding:.6rem .75rem;border-bottom:2px solid var(--gray-200);font-size:.85rem;color:var(--gray-600);font-weight:600;}
.table td{padding:.7rem .75rem;border-bottom:1px solid var(--gray-100);font-size:.9rem;vertical-align:middle;}
.table tr:last-child td{border-bottom:none;}
.row-muted{opacity:.6;}

.badge{display:inline-block;padding:.2rem .6rem;border-radius:20px;font-size:.78rem;font-weight:600;}
.badge-approved{background:#e8f5e9;color:#2e7d32;}
.badge-cancelled{background:#fce4ec;color:#c62828;}
.badge-completed{background:#e3f2fd;color:#1565c0;}
.badge-pending{background:#fff8e1;color:#e65100;}
.badge-available{background:#e8f5e9;color:#2e7d32;}
.badge-maintenance{background:#fff3e0;color:#e65100;}
.badge-retired{background:#f5f5f5;color:#616161;}
.badge-admin{background:#e3f2fd;color:#1565c0;}
.badge-user-role{background:var(--gray-100);color:var(--gray-600);}
.badge-danger{background:#fce4ec;color:#b71c1c;}
.badge-warning{background:#fff3e0;color:#e65100;}
.badge-neutral{background:var(--gray-100);color:var(--gray-600);}

.alert{padding:.85rem 1.1rem;border-radius:var(--radius);margin-bottom:1rem;font-size:.92rem;}
.alert-danger{background:#fce4ec;color:#b71c1c;border:1px solid #ef9a9a;}
.alert-success{background:#e8f5e9;color:#1b5e20;border:1px solid #a5d6a7;}

.stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:1rem;}
.stat-card{background:#fff;border:1px solid var(--gray-200);border-radius:var(--radius);padding:1.25rem 1.5rem;box-shadow:var(--shadow);}
.stat-value{font-size:2rem;font-weight:700;color:var(--blue);}
.stat-label{color:var(--gray-600);font-size:.88rem;margin-top:.2rem;}
.stat-link{display:block;margin-top:.5rem;font-size:.82rem;color:var(--blue);text-decoration:none;}
.stat-sub{font-size:.78rem;color:var(--gray-400);margin-top:.2rem;}

.car-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1.25rem;}
.car-card{background:#fff;border:1px solid var(--gray-200);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow);display:flex;flex-direction:column;}
.car-card img{width:100%;height:180px;object-fit:cover;}
.car-placeholder{width:100%;height:120px;display:flex;align-items:center;justify-content:center;font-size:3rem;background:var(--gray-100);}
.car-info{padding:1rem;flex:1;display:flex;flex-direction:column;gap:.4rem;}
.car-category{font-size:.75rem;color:var(--blue);font-weight:600;text-transform:uppercase;letter-spacing:.05em;}
.car-info h3{font-size:1rem;font-weight:600;}
.car-details{font-size:.83rem;color:var(--gray-600);}
.car-desc{font-size:.85rem;color:var(--gray-600);flex:1;}
.car-info .btn{margin-top:auto;}

.auth-page{display:flex;align-items:center;justify-content:center;min-height:100vh;}
.auth-card{background:#fff;border-radius:var(--radius);padding:2.5rem 2rem;box-shadow:0 4px 24px rgba(0,0,0,.12);width:100%;max-width:420px;text-align:center;}
.auth-logo{font-size:3rem;margin-bottom:.5rem;}
.auth-card h1{font-size:1.6rem;font-weight:700;margin-bottom:.3rem;}
.auth-sub{color:var(--gray-600);margin-bottom:1.5rem;}
.auth-note{color:var(--gray-400);font-size:.82rem;margin-top:1rem;}
.dev-notice{background:#fff8e1;border:1px solid #ffe082;border-radius:6px;padding:.75rem 1rem;margin-bottom:1.25rem;font-size:.88rem;color:#5d4037;text-align:left;}
.user-list{display:flex;flex-direction:column;gap:.5rem;}
.user-btn{display:flex;align-items:center;gap:.75rem;width:100%;padding:.75rem 1rem;background:#fff;border:1px solid var(--gray-200);border-radius:8px;cursor:pointer;text-align:left;transition:border-color .15s,box-shadow .15s;}
.user-btn:hover{border-color:var(--blue);box-shadow:0 0 0 3px rgba(0,120,212,.1);}
.user-avatar{width:36px;height:36px;background:var(--blue);color:#fff;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:1rem;flex-shrink:0;}
.user-info{flex:1;display:flex;flex-direction:column;}
.user-info strong{font-size:.95rem;}
.user-info small{color:var(--gray-400);font-size:.78rem;}
.user-arrow{color:var(--gray-400);font-size:1.1rem;}

.car-admin-grid{display:flex;flex-direction:column;gap:.75rem;}
.car-admin-card{background:#fff;border:1px solid var(--gray-200);border-radius:var(--radius);display:flex;align-items:center;gap:1rem;padding:.75rem 1rem;box-shadow:var(--shadow);transition:border-color .15s;}
.car-admin-card:hover{border-color:var(--blue);}
.car-admin-card.is-retired{opacity:.55;}
.car-admin-img{position:relative;flex-shrink:0;width:90px;height:64px;border-radius:6px;overflow:hidden;background:var(--gray-100);}
.car-admin-img img{width:100%;height:100%;object-fit:cover;}
.car-img-placeholder{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:2rem;}
.car-status-badge{position:absolute;bottom:3px;left:3px;font-size:.65rem;padding:.1rem .35rem;}
.car-admin-info{flex:1;min-width:0;}
.car-admin-title{font-weight:600;font-size:1rem;display:flex;align-items:baseline;gap:.5rem;}
.car-year{font-size:.8rem;color:var(--gray-400);font-weight:400;}
.car-admin-meta{display:flex;flex-wrap:wrap;gap:.6rem;font-size:.82rem;color:var(--gray-600);margin-top:.2rem;}
.car-admin-desc{font-size:.83rem;color:var(--gray-400);margin-top:.2rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.car-admin-actions{display:flex;flex-direction:column;gap:.4rem;flex-shrink:0;}

details.card{padding:0;}
details.card summary.card-summary{padding:1rem 1.5rem;cursor:pointer;user-select:none;list-style:none;display:flex;align-items:center;gap:.5rem;}
details.card summary.card-summary::before{content:'▶';font-size:.7rem;color:var(--gray-400);transition:transform .2s;}
details[open].card summary.card-summary::before{transform:rotate(90deg);}
details.card .card-body{padding:0 1.5rem 1.5rem;}
.current-img-preview{display:flex;align-items:center;gap:1rem;padding:.75rem;background:var(--gray-50);border-radius:6px;margin-bottom:.5rem;}
.current-img-preview img{height:72px;border-radius:4px;object-fit:cover;}

.incident-list{display:flex;flex-direction:column;gap:.75rem;}
.incident-item{border:1px solid var(--gray-200);border-radius:8px;padding:1rem;border-left:4px solid var(--red);}
.incident-item.is-resolved{border-left-color:var(--gray-200);opacity:.65;}
.incident-header{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap;margin-bottom:.5rem;}
.incident-type{font-weight:600;font-size:.9rem;}
.incident-amount{background:#fce4ec;color:#b71c1c;padding:.15rem .5rem;border-radius:20px;font-size:.82rem;font-weight:600;}
.incident-desc{font-size:.9rem;color:var(--gray-900);white-space:pre-wrap;}
.incident-driver{font-size:.82rem;color:var(--gray-600);margin-top:.4rem;}
.booking-history-list{display:flex;flex-direction:column;gap:0;}
.booking-history-item{display:grid;grid-template-columns:2fr 140px 100px 2fr;gap:1rem;align-items:start;padding:.85rem .75rem;border-bottom:1px solid var(--gray-100);}
.booking-history-item:last-child{border-bottom:none;}
.booking-history-item.has-incident{background:#fff8f8;}
.bh-user{font-size:.9rem;}.bh-email{font-size:.78rem;margin-top:.1rem;}.bh-purpose{font-size:.8rem;color:var(--gray-600);margin-top:.2rem;}
.bh-dates{font-size:.85rem;line-height:1.6;}
.bh-status{display:flex;flex-direction:column;gap:.25rem;}
.bh-note textarea{font-size:.82rem;resize:vertical;}

.settings-tabs{display:flex;gap:.4rem;margin-bottom:1.25rem;flex-wrap:wrap;}
.settings-tab{display:inline-flex;align-items:center;gap:.4rem;padding:.5rem 1.1rem;border:1px solid var(--gray-200);border-radius:8px;text-decoration:none;color:var(--gray-600);font-size:.9rem;background:#fff;transition:all .15s;}
.settings-tab:hover{border-color:var(--blue);color:var(--blue);}
.settings-tab.active{background:var(--blue);color:#fff;border-color:var(--blue);}
.settings-card{padding:0;overflow:hidden;}
.settings-section{padding:1.5rem;border-bottom:1px solid var(--gray-100);}
.settings-section:last-child{border-bottom:none;}
.settings-section h2{font-size:1rem;font-weight:600;margin-bottom:.25rem;}
.settings-desc{color:var(--gray-600);font-size:.88rem;margin-bottom:1rem;}
.hint{color:var(--gray-400);font-size:.8rem;display:block;margin-top:.25rem;}
.toggle-row{display:flex;justify-content:space-between;align-items:center;gap:1rem;}
.toggle{position:relative;display:inline-block;width:44px;height:24px;flex-shrink:0;}
.toggle input{opacity:0;width:0;height:0;}
.toggle-slider{position:absolute;inset:0;background:var(--gray-200);border-radius:24px;cursor:pointer;transition:background .2s;}
.toggle-slider::before{content:'';position:absolute;width:18px;height:18px;left:3px;top:3px;background:#fff;border-radius:50%;transition:transform .2s;box-shadow:0 1px 3px rgba(0,0,0,.2);}
.toggle input:checked+.toggle-slider{background:var(--blue);}
.toggle input:checked+.toggle-slider::before{transform:translateX(20px);}
.info-box{background:#e8f4fd;border:1px solid #b3d9f5;border-radius:8px;padding:1rem 1.25rem;font-size:.88rem;color:#1a4a6e;}
.info-box a{color:var(--blue);}
.test-box{background:var(--gray-50);border:1px solid var(--gray-200);border-radius:8px;padding:1rem 1.25rem;margin-top:1rem;}
.status-grid{display:flex;flex-direction:column;gap:.5rem;}
.status-item{display:flex;align-items:center;gap:.6rem;font-size:.9rem;}
.status-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0;}
.status-item.ok .status-dot{background:var(--green);}
.status-item.warn .status-dot{background:var(--orange);}
.status-item.off .status-dot{background:var(--gray-400);}
.admin-list{margin-top:1rem;padding:.75rem 1rem;background:var(--gray-50);border-radius:8px;font-size:.88rem;}

.version-badge{display:inline-block;background:var(--gray-100);color:var(--gray-400);font-size:.75rem;padding:.15rem .5rem;border-radius:20px;margin-top:.2rem;font-family:monospace;}
.filter-bar{display:flex;gap:.5rem;flex-wrap:wrap;}
.text-muted{color:var(--gray-400);}
.text-danger{color:var(--red)!important;}
.empty-state{text-align:center;color:var(--gray-400);padding:2rem;}
.footer{text-align:center;padding:2rem;color:var(--gray-400);font-size:.82rem;}
code{background:var(--gray-100);padding:.1rem .4rem;border-radius:4px;font-size:.85rem;}

@media(max-width:768px){
  .booking-history-item{grid-template-columns:1fr 1fr;}.bh-note{grid-column:1/-1;}
  .navbar-links{gap:.4rem;}.nav-user{display:none;}
  .stats-grid{grid-template-columns:1fr 1fr;}
  .form-row{flex-direction:column;}
  .car-admin-actions{flex-direction:row;}
}

/* ---- Foto-inspektion upload -------------------------------- */
.photo-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: .5rem;
}
.photo-upload-card {
  border: 2px dashed var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .2s;
}
.photo-upload-card.has-photo { border-color: var(--green); border-style: solid; }
.photo-preview {
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  background: var(--gray-50);
  cursor: pointer;
}
.photo-icon  { font-size: 2.5rem; }
.photo-label { font-weight: 600; font-size: .9rem; }
.photo-hint  { font-size: .78rem; color: var(--gray-400); text-align: center; padding: 0 .5rem; }
.photo-upload-btn {
  display: block;
  width: 100%;
  padding: .6rem;
  background: var(--gray-100);
  text-align: center;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  color: var(--blue);
  transition: background .15s;
}
.photo-upload-btn:hover { background: var(--gray-200); }

/* ---- Inspektion-info kort ---------------------------------- */
.inspection-info-card {
  background: #e8f4fd;
  border: 1px solid #b3d9f5;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.inspection-car   { font-size: 1.1rem; font-weight: 600; margin-bottom: .3rem; }
.inspection-desc  { font-size: .9rem; color: #1a4a6e; }

/* ---- Foto-toggle box -------------------------------------- */
.inspection-toggle-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.badge-photo { background: #e8f4fd; color: #1565c0; font-size: .72rem; }

/* ---- Booking-kort (my_bookings) --------------------------- */
.booking-list { display: flex; flex-direction: column; gap: 1rem; }
.booking-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.booking-card.is-active { border-left: 4px solid var(--blue); }
.booking-card.is-past   { opacity: .7; }

.booking-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--gray-100);
}
.booking-car   { font-size: 1rem; font-weight: 600; margin-right: .5rem; }
.booking-plate { font-size: .82rem; background: var(--gray-100); padding: .1rem .4rem; border-radius: 4px; }

.booking-card-body { padding: .85rem 1rem; }
.booking-dates {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.booking-date-block {
  display: flex;
  flex-direction: column;
}
.date-label { font-size: .72rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: .05em; }
.date-value { font-weight: 600; font-size: .95rem; }
.date-time  { font-size: .85rem; color: var(--gray-600); }
.date-arrow { color: var(--gray-400); font-size: 1.2rem; }
.booking-purpose    { font-size: .85rem; color: var(--gray-600); margin-top: .5rem; }
.booking-admin-note { font-size: .83rem; background: #fff8e1; padding: .4rem .75rem; border-radius: 6px; margin-top: .5rem; border-left: 3px solid var(--orange); }

/* Inspektion-statusbar */
.inspection-status-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1rem;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  font-size: .85rem;
}
.insp-step         { padding: .25rem .65rem; border-radius: 20px; background: var(--gray-200); color: var(--gray-600); }
.insp-step.done    { background: #e8f5e9; color: #2e7d32; }
.insp-step.needed  { background: #e3f2fd; color: var(--blue); font-weight: 600; animation: pulse 2s infinite; }
.insp-divider      { color: var(--gray-400); }

@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(0,120,212,.3); }
  50%      { box-shadow: 0 0 0 5px rgba(0,120,212,0); }
}

.booking-card-actions {
  display: flex;
  gap: .5rem;
  padding: .75rem 1rem;
  border-top: 1px solid var(--gray-100);
  flex-wrap: wrap;
  align-items: center;
}

/* ---- Inspektion-billeder i admin -------------------------- */
.inspection-photos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin-top: .5rem;
}
.inspection-photo img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: transform .15s;
}
.inspection-photo img:hover { transform: scale(1.03); }
.inspection-photo span { display: block; font-size: .75rem; color: var(--gray-400); margin-top: .2rem; text-align: center; }
