:root {
  --primary: #007aff;
  --primary-dark: #0062cc;
  --success: #34c759;
  --danger: #ff3b30;
  --warning: #ff9500;
  --text: #1a1a1a;
  --text-secondary: #6b6b6b;
  --text-tertiary: #999;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --border: #e5e5e7;
  --border-strong: #d2d2d7;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

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

button { font-family: inherit; cursor: pointer; }

input, select, textarea {
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

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

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Boot screen */
.boot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 32px;
  padding: 0 8px;
}
.sidebar-brand-icon { font-size: 24px; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}
.nav-link:hover {
  background: var(--bg);
  text-decoration: none;
}
.nav-link.active {
  background: var(--primary);
  color: #ffffff;
}
.nav-link svg { width: 18px; height: 18px; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-user {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 0 8px;
}
.sidebar-user strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.main {
  padding: 32px 40px;
  max-width: 1200px;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-header h1 {
  font-size: 26px;
  font-weight: 700;
}
.page-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  margin-top: 4px;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: 16px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text);
  transition: opacity 0.15s, transform 0.1s;
}
.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #ffffff; }
.btn-success { background: var(--success); color: #ffffff; }
.btn-danger { background: var(--danger); color: #ffffff; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* Forms */
.form-row {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}
.form-row.two { grid-template-columns: 1fr 1fr; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }

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

.form-help {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.error-message {
  color: var(--danger);
  background: rgba(255, 59, 48, 0.08);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14px;
  margin-bottom: 16px;
}

.success-message {
  color: var(--success);
  background: rgba(52, 199, 89, 0.08);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* Login */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(135deg, #f5f5f7 0%, #e5e5e7 100%);
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-md);
}
.login-card h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}
.login-card p {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 32px;
  font-size: 14px;
}
.login-brand {
  text-align: center;
  font-size: 36px;
  margin-bottom: 8px;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: var(--bg);
}
.table tbody tr:hover { background: var(--bg); }
.table td .row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* Status badges */
.status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status.pending { background: var(--warning); }
.status.confirmed { background: var(--success); }
.status.declined { background: var(--danger); }
.status.cancelled { background: #999; }
.status.completed { background: var(--primary); }

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.role-badge.admin { background: rgba(0, 122, 255, 0.15); color: var(--primary); }
.role-badge.partner { background: rgba(52, 199, 89, 0.15); color: var(--success); }

/* Empty state */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
}
.empty h3 {
  color: var(--text);
  margin-bottom: 6px;
  font-size: 17px;
}
.empty p { font-size: 14px; }

/* Map */
.map-container {
  height: 280px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-strong);
}
.leaflet-container { font-family: inherit; }

/* Services chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip.selected {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}
.chip:hover:not(.selected) {
  background: var(--border);
}

/* Booking card */
.booking-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.booking-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.booking-card-title {
  font-size: 17px;
  font-weight: 600;
}
.booking-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 16px;
  font-size: 14px;
}
.booking-info-row strong {
  display: block;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.booking-notes {
  background: var(--bg);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
}
.booking-actions {
  display: flex;
  gap: 8px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 { font-size: 18px; font-weight: 600; }
.modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 24px; }

/* Address suggestions */
.address-suggestions {
  position: relative;
}
.suggestions-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
}
.suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--bg); }

/* Mobile */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    height: auto;
    flex-direction: row;
    padding: 12px;
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 100;
  }
  .sidebar-brand, .sidebar-footer { display: none; }
  .sidebar-nav { flex-direction: row; flex: 1; justify-content: space-around; }
  .nav-link { flex-direction: column; gap: 4px; padding: 8px; font-size: 11px; }
  .main { padding: 20px 16px 100px; }
  .form-row.two, .form-row.three { grid-template-columns: 1fr; }
  .table { font-size: 13px; }
  .table th, .table td { padding: 10px 8px; }
}
