:root {
  --green: #16a34a;
  --green-dark: #15803d;
  --green-light: #dcfce7;
  --blue: #2563eb;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-700: #334155;
  --slate-900: #0f172a;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 4px 12px rgba(15,23,42,.06);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--slate-50); color: var(--slate-900); min-height: 100%; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 16px; }

.header {
  display: flex; align-items: center; gap: 12px;
  justify-content: space-between;
  margin-bottom: 20px;
}
.header img { width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0; }
.header-text { flex: 1; min-width: 0; }
.header h1 { margin: 0; font-size: 1.5rem; line-height: 1.2; }
.header .sub { color: var(--slate-500); font-size: .9rem; }

.card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 16px;
}

.big-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 72px; padding: 18px 20px;
  border: none; border-radius: 18px; font-size: 1.25rem; font-weight: 700;
  color: #fff; cursor: pointer; margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(22,163,74,.25);
}
.big-btn:active { transform: scale(.98); }
.big-btn.km { background: linear-gradient(180deg, #22c55e, var(--green-dark)); }
.big-btn.admin { background: linear-gradient(180deg, #3b82f6, #1d4ed8); box-shadow: 0 4px 14px rgba(37,99,235,.25); }
.big-btn.send { display: none; }
.big-btn.secondary {
  background: #fff; color: var(--slate-700); border: 2px solid var(--slate-200);
  box-shadow: none; min-height: 56px; font-size: 1.05rem;
}
.big-btn.secondary.compact {
  width: auto;
  min-height: 44px;
  padding: 10px 18px;
  margin-bottom: 0;
  font-size: 1rem;
  flex-shrink: 0;
}

label { display: block; font-weight: 600; margin: 12px 0 6px; color: var(--slate-700); }
input, select, textarea {
  width: 100%; padding: 14px 16px; font-size: 1.1rem;
  border: 2px solid var(--slate-200); border-radius: 14px; background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-light);
}
textarea { min-height: 80px; resize: vertical; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 12px 18px; border-radius: 14px;
  border: none; font-size: 1.05rem; font-weight: 700; cursor: pointer;
}
.btn-primary { background: var(--green); color: #fff; width: 100%; }
.btn-primary:disabled { opacity: .6; }
.btn-ghost { background: transparent; color: var(--slate-500); }
.btn-danger { background: var(--red-light); color: var(--red); }

.error {
  background: var(--red-light); color: var(--red); padding: 12px 14px;
  border-radius: 12px; margin-bottom: 12px; font-weight: 600;
}
.ok {
  background: var(--green-light); color: var(--green-dark); padding: 12px 14px;
  border-radius: 12px; margin-bottom: 12px; font-weight: 600;
}
.muted { color: var(--slate-500); font-size: .9rem; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  padding: 8px 14px; border-radius: 999px; border: 2px solid var(--slate-200);
  background: #fff; font-weight: 600; cursor: pointer; font-size: .95rem;
}
.chip.active { background: var(--green-light); border-color: var(--green); color: var(--green-dark); }

.entry {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 14px 0; border-bottom: 1px solid var(--slate-100);
}
.entry:last-child { border-bottom: none; }
.entry .type {
  display: inline-block; font-size: .75rem; font-weight: 800; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; margin-bottom: 4px;
}
.entry .type.km { background: var(--green-light); color: var(--green-dark); }
.entry .type.admin { background: #dbeafe; color: #1d4ed8; }
.entry .qty { font-size: 1.2rem; font-weight: 800; white-space: nowrap; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
  width: 100%;
}
.stat {
  background: #fff;
  border-radius: 18px;
  padding: 20px 12px;
  text-align: center;
  box-shadow: var(--shadow);
  min-height: 100px;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.stat .n { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.stat .l {
  font-size: .85rem; color: var(--slate-500); font-weight: 700;
  margin-top: 6px; line-height: 1.25;
}

.login-wrap { display: flex; flex-direction: column; justify-content: center; min-height: 85vh; }
.login-wrap .card { padding: 28px 22px; }
.login-logo { text-align: center; margin-bottom: 18px; }
.login-logo img { width: 88px; height: 88px; border-radius: 20px; }
.login-logo h1 { margin: 10px 0 4px; }

.banner {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: .95rem;
}
.banner.warn {
  background: var(--amber-light);
  color: var(--amber);
  border: 1px solid #fcd34d;
}
