/* ============================================
   PMA Karta – app.css v2
   Redesign: granat #003082, mobile-first
   ============================================ */

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

:root {
  --navy:      #003082;
  --navy-dk:   #002060;
  --navy-lt:   #e8f0fe;
  --green:     #2e7d32;
  --green-lt:  #e8f5e9;
  --red:       #c62828;
  --red-lt:    #fce4ec;
  --amber:     #e65100;
  --amber-lt:  #fff3e0;
  --gray-50:   #f8f9fa;
  --gray-100:  #f0f2f5;
  --gray-200:  #e9ecef;
  --gray-300:  #dee2e6;
  --gray-400:  #adb5bd;
  --gray-500:  #6c757d;
  --gray-700:  #495057;
  --gray-900:  #1a1a2e;
  --white:     #ffffff;
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,.06);
  --shadow:    0 2px 10px rgba(0,0,0,.08);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: var(--gray-900);
  background: var(--gray-100);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* ---- LOGIN ---- */
#screen-login {
  min-height: 100dvh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.login-logo {
  width: 96px; height: 96px;
  background: rgba(255,255,255,.12);
  border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
  overflow: hidden;
}

.login-logo img {
  width: 80px; height: 80px;
  object-fit: contain; border-radius: 12px;
}

.login-wrap {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; align-items: center;
}

.login-wrap h1 {
  font-size: 26px; font-weight: 700;
  color: var(--white); margin-bottom: 4px;
}

.login-sub {
  font-size: 13px; color: rgba(255,255,255,.6);
  margin-bottom: 32px;
}

.login-field {
  width: 100%;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--white);
  font-size: 15px;
  margin-bottom: 10px;
  outline: none;
  transition: border-color .15s, background .15s;
}

.login-field::placeholder { color: rgba(255,255,255,.4); }
.login-field:focus { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.18); }

#login-error {
  width: 100%;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,80,80,.4);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #ffb3b3;
  font-size: 13px;
  margin-bottom: 10px;
}

.login-btn {
  width: 100%;
  background: var(--white);
  color: var(--navy);
  border: none;
  border-radius: var(--radius);
  padding: 15px;
  font-size: 16px;
  font-weight: 700;
  margin-top: 8px;
  cursor: pointer;
  transition: opacity .15s;
}
.login-btn:active { opacity: .85; }

/* ---- APP LAYOUT ---- */
#screen-app { display: flex; flex-direction: column; min-height: 100dvh; }

/* ---- TOPBAR ---- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--navy);
  padding: 0 16px;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}

.topbar-title {
  font-size: 17px; font-weight: 700; color: var(--white);
}

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.2);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background .15s;
}
.avatar:active { background: rgba(255,255,255,.3); }

/* ---- DROPDOWN ---- */
.dropdown {
  position: fixed; top: 62px; right: 12px; z-index: 200;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  padding: 14px;
  min-width: 210px;
}
.dropdown-name { font-weight: 700; font-size: 15px; color: var(--gray-900); }
.dropdown-role {
  font-size: 12px; color: var(--gray-500);
  margin-bottom: 10px; margin-top: 2px;
}
.dropdown hr { border: none; border-top: 1px solid var(--gray-200); margin: 8px 0; }
.dropdown-item {
  display: block; width: 100%; text-align: left;
  padding: 10px 8px; background: none; border: none;
  font-size: 14px; color: var(--gray-700); cursor: pointer;
  border-radius: var(--radius-sm); transition: background .1s;
}
.dropdown-item:hover { background: var(--gray-50); }
#overlay { position: fixed; inset: 0; z-index: 150; }

/* ---- HERO BAND (dashboard header) ---- */
.hero-band {
  background: var(--navy);
  padding: 12px 16px 28px;
  color: var(--white);
}
.hero-greeting { font-size: 12px; color: rgba(255,255,255,.65); margin-bottom: 2px; }
.hero-name { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.hero-vehicle {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.12);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.hero-vehicle-name { font-size: 14px; font-weight: 700; }
.hero-vehicle-plate { font-size: 12px; color: rgba(255,255,255,.6); margin-top: 2px; }

/* ---- CONTENT ---- */
.content { flex: 1; padding: 16px 16px 80px; }

.sec { display: none; }
.sec.active { display: block; }

/* ---- STAT CARDS GRID ---- */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: -18px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.stat-card-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; margin-bottom: 10px;
}
.stat-card-icon.blue   { background: var(--navy-lt); }
.stat-card-icon.green  { background: var(--green-lt); }
.stat-card-icon.amber  { background: var(--amber-lt); }
.stat-card-icon.red    { background: var(--red-lt); }
.stat-card-val { font-size: 20px; font-weight: 700; color: var(--gray-900); }
.stat-card-unit { font-size: 12px; color: var(--gray-400); margin-left: 2px; }
.stat-card-label { font-size: 11px; color: var(--gray-400); margin-top: 3px; }

/* ---- SECTION HEADER ---- */
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.section-header h2 { font-size: 13px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .5px; }

/* ---- REPORT CARDS ---- */
.report-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow .15s, transform .1s;
}
.report-card:active { box-shadow: none; transform: scale(.99); }
.report-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.report-card-title { font-size: 15px; font-weight: 700; color: var(--gray-900); }
.report-card-sub { font-size: 12px; color: var(--gray-400); margin-top: 3px; }
.report-card-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.rc-stat { background: var(--gray-100); border-radius: var(--radius-sm); padding: 8px; text-align: center; }
.rc-stat-val { font-size: 14px; font-weight: 700; color: var(--gray-900); }
.rc-stat-label { font-size: 10px; color: var(--gray-400); margin-top: 2px; }

/* ---- BADGES ---- */
.badge {
  display: inline-block; padding: 4px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 700;
}
.badge-green  { background: var(--green-lt); color: var(--green); }
.badge-blue   { background: var(--navy-lt);  color: var(--navy); }
.badge-amber  { background: var(--amber-lt); color: var(--amber); }
.badge-gray   { background: var(--gray-200); color: var(--gray-500); }

/* ---- CARDS ---- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.card h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; color: var(--gray-900); }

/* ---- EXPENSE SUMMARY STRIP ---- */
.exp-summary {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 8px; margin-bottom: 16px;
  margin-top: -18px;
}
.exp-sum-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 12px 8px; text-align: center;
  box-shadow: var(--shadow);
}
.exp-sum-val { font-size: 15px; font-weight: 700; color: var(--gray-900); }
.exp-sum-label { font-size: 10px; color: var(--gray-400); margin-top: 2px; }

/* ---- EXPENSE ITEMS ---- */
.expense-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 13px 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}
.exp-icon {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.exp-icon.road   { background: var(--navy-lt); }
.exp-icon.park   { background: var(--amber-lt); }
.exp-icon.fuel   { background: var(--green-lt); }
.exp-icon.medic  { background: #f3e5f5; }
.exp-icon.other  { background: var(--gray-100); }
.exp-body { flex: 1; min-width: 0; }
.exp-name { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.exp-meta { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
.exp-amount { font-size: 15px; font-weight: 700; color: var(--gray-900); flex-shrink: 0; }

.exp-group-label {
  font-size: 11px; font-weight: 700; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .5px;
  margin: 14px 0 8px;
}

/* ---- FORMS ---- */
.form-group { margin-bottom: 12px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--gray-400); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 6px;
}
input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 15px; color: var(--gray-900);
  background: var(--white);
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0,48,130,.08);
}
textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  border: 1.5px solid var(--gray-200);
  background: var(--white); color: var(--gray-700);
  cursor: pointer; transition: background .1s, border-color .1s;
  text-align: center;
}
.btn:active { opacity: .85; }
.btn-primary {
  background: var(--navy); color: var(--white);
  border-color: var(--navy-dk);
}
.btn-primary:hover { background: var(--navy-dk); }
.btn-full { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-danger { background: var(--red-lt); color: var(--red); border-color: var(--red); }

/* ---- CHIPS ---- */
.chip-group { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.chip {
  padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 500;
  border: 1.5px solid var(--gray-200);
  background: var(--white); color: var(--gray-500);
  cursor: pointer; transition: all .15s;
}
.chip.active { background: var(--navy); color: var(--white); border-color: var(--navy-dk); }

/* ---- ALERTS ---- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 10px; }
.alert-error   { background: var(--red-lt);   color: var(--red); }
.alert-success { background: var(--green-lt); color: var(--green); }

/* ---- DAILY ENTRIES ---- */
.daily-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--gray-100);
}
.daily-row:last-child { border: none; }
.daily-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); flex-shrink: 0;
}
.daily-dot.miss { background: var(--gray-300); }
.daily-info { flex: 1; font-size: 13px; color: var(--gray-900); }
.daily-info b { font-weight: 700; }
.daily-km { font-size: 12px; color: var(--gray-400); }

/* ---- DETAIL VIEW ---- */
.detail-header { margin-bottom: 16px; }
.detail-header h2 { font-size: 18px; font-weight: 700; }
.detail-meta { font-size: 13px; color: var(--gray-400); margin-top: 4px; }

/* ---- TABS ---- */
.tabs {
  display: flex; gap: 4px; margin-bottom: 16px;
  border-bottom: 2px solid var(--gray-200);
}
.tablink {
  padding: 10px 18px; background: none; border: none;
  font-size: 14px; font-weight: 600; color: var(--gray-400);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tablink.active { color: var(--navy); border-bottom-color: var(--navy); }
.admin-tab { display: none; }
.admin-tab.active { display: block; }

/* ---- BOTTOM NAV ---- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  display: flex; background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 16px rgba(0,0,0,.06);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 10px 4px 8px;
  background: none; border: none;
  color: var(--gray-400); cursor: pointer;
  transition: color .15s;
}
.nav-item.active { color: var(--navy); }
.nav-item svg { transition: stroke .15s; }
.nav-item span { font-size: 10px; font-weight: 600; }

/* ---- VEHICLE / DRIVER CARDS ---- */
.item-card {
  background: var(--white); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: space-between;
}
.item-card-title { font-size: 14px; font-weight: 700; color: var(--gray-900); }
.item-card-sub { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

/* ---- AVATAR ---- */
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  background: var(--navy-lt); color: var(--navy);
  flex-shrink: 0;
}

/* ---- EMPTY / LOADING ---- */
.loading { text-align: center; padding: 40px 16px; color: var(--gray-400); font-size: 14px; }
.empty { text-align: center; padding: 48px 16px; color: var(--gray-400); }
.empty-icon { font-size: 44px; margin-bottom: 12px; }
.empty p { font-size: 14px; }

/* ---- BACK BUTTON ---- */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: rgba(255,255,255,.85); background: rgba(255,255,255,.15);
  border: none; border-radius: var(--radius-sm);
  padding: 7px 12px; font-size: 13px; font-weight: 600;
  cursor: pointer; margin-bottom: 12px; margin-top: 2px;
}

/* ---- PASSWORD CHANGE ---- */
.profile-wrap { max-width: 480px; }
