@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500&family=DM+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f4f1;
  --surface: #ffffff;
  --surface2: #f0efe9;
  --border: #e2e0d8;
  --border-strong: #ccc9be;
  --text: #1a1917;
  --text-2: #6b6860;
  --text-3: #a09e98;
  --accent: #1a1917;
  --green: #2d6a4f;
  --green-bg: #e8f5ee;
  --blue: #1a4a8a;
  --blue-bg: #e8f0fa;
  --amber: #7a4a0a;
  --amber-bg: #fef3e2;
  --red: #8a1a1a;
  --red-bg: #faeaea;
  --gray-bg: #f0efe9;
  --radius: 8px;
  --radius-lg: 12px;
  font-size: 14px;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

/* ── LAYOUT ── */
#app {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
#sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

#sidebar-top {
  padding: 24px 18px 16px;
  border-bottom: 1px solid var(--border);
}

#user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

#user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

#user-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  padding: 12px 8px 5px;
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}

.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-item.active {
  background: var(--surface2);
  color: var(--text);
  font-weight: 500;
}

.nav-icon {
  width: 16px;
  height: 16px;
  opacity: 0.6;
  flex-shrink: 0;
}

.nav-item.active .nav-icon { opacity: 1; }

#logout-btn {
  margin: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-3);
  cursor: pointer;
  border: 1px solid var(--border);
  background: none;
  font-family: 'DM Sans', sans-serif;
  text-align: left;
  transition: background 0.12s;
  display: flex;
  align-items: center;
  gap: 8px;
}

#logout-btn:hover { background: var(--surface2); }

/* ── CONTENT ── */
#content {
  flex: 1;
  padding: 36px 40px;
  max-width: 860px;
}

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.18s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── TYPOGRAPHY ── */
h2 {
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.page-sub {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 28px;
}

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-3);
  margin: 24px 0 12px;
  font-weight: 500;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}

.card:hover { border-color: var(--border-strong); }

.card-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
}

.card-detail {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 2px;
}

.card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  align-items: center;
}

/* ── AVATAR ── */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  flex-shrink: 0;
}

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-gray   { background: var(--gray-bg);   color: var(--text-2); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  padding: 6px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-2);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}

.btn:hover { background: var(--surface2); color: var(--text); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover { opacity: 0.85; color: #fff; }

.btn-danger { border-color: #e0b0b0; color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 10px;
  font-size: 13.5px;
  margin-top: 6px;
}

.btn-group {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ── PLACES BAR ── */
.places-bar {
  width: 48px;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}

.places-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
}

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 5px;
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="time"],
input[type="date"],
select,
textarea {
  width: 100%;
  font-size: 13.5px;
  font-family: 'DM Sans', sans-serif;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(26,25,23,0.07);
}

textarea { resize: vertical; line-height: 1.5; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

/* ── TOAST ── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: var(--radius);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 999;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
  font-size: 13px;
}

.empty-state p { margin-top: 6px; }

/* ── LOADING ── */
.loading {
  text-align: center;
  padding: 32px;
  color: var(--text-3);
  font-size: 13px;
}

/* ── MODAL EDIT VEHICULE ── */
#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

#modal-overlay.show { display: flex; }

#modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 480px;
  max-width: 95vw;
  border: 1px solid var(--border);
}

#modal h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 18px;
}

#modal .btn-group { margin-top: 16px; justify-content: flex-end; }

/* ── MONO ── */
.mono {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 4px;
}


/* ── LOGIN ── */
#login-screen {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  width: 360px;
  max-width: 92vw;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
}

.login-hint {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
}
