:root {
  --bg: #0f172a;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --success: #16a34a;
  --error: #dc2626;
  --border: #e2e8f0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: #f8fafc;
}

header {
  background: var(--bg);
  color: white;
  padding: 20px 20px 16px;
}

header h1 {
  margin: 0;
  font-size: 20px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logout-btn {
  width: auto;
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  border: 1px solid #475569;
  color: #cbd5e1;
  border-radius: 8px;
}
.logout-btn:active { background: #1e293b; }

header p {
  margin: 4px 0 0;
  color: #94a3b8;
  font-size: 13px;
}

.badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #fbbf24;
  color: #451a03;
}

main {
  padding: 16px;
}

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
select {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

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

.km-result {
  text-align: center;
  padding: 14px;
  border-radius: 10px;
  background: #eff6ff;
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 14px;
}

button {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  color: white;
}

button.primary:active { background: var(--accent-dark); }

button.secondary {
  background: #e2e8f0;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  padding: 10px;
}

button:disabled {
  opacity: 0.5;
}

.msg {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 14px;
}

.msg.success { background: #dcfce7; color: #166534; }
.msg.error { background: #fee2e2; color: #991b1b; }

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.hidden { display: none !important; }

.trip-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.trip-item:last-child { border-bottom: none; }
.trip-item .trip-info { flex: 1; min-width: 0; }
.trip-item .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.trip-item .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.trip-icons {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-btn:active { background: #e2e8f0; }
.icon-btn.delete-icon:active { background: #fee2e2; color: var(--error); }
.icon-btn svg { width: 17px; height: 17px; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.pagination button { width: auto; flex: 0 0 auto; padding: 8px 12px; font-size: 13px; }
.pagination .hint { margin: 0; white-space: nowrap; }

#newClientForm { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.login-wrap h1 { color: white; font-size: 22px; }
.login-wrap p { color: #94a3b8; font-size: 14px; margin-bottom: 20px; }
