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

:root {
  --primary: #1a56db;
  --primary-dark: #1e429f;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
}
body.page-splash {
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(212, 175, 55, 0.16), transparent 60%),
    radial-gradient(1100px 800px at 110% 10%, rgba(26, 86, 219, 0.28), transparent 60%),
    linear-gradient(160deg, #e8edf7 0%, #eef2fb 42%, #f4f6fb 100%);
  background-attachment: fixed;
}
body.page-splash > * { position: relative; z-index: 1; }

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

.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }
.container-sm { max-width: 720px; }

.header {
  background:
    radial-gradient(900px 320px at 15% -10%, rgba(212, 175, 55, 0.22), transparent 55%),
    radial-gradient(850px 360px at 105% 0%, rgba(37, 99, 235, 0.30), transparent 60%),
    linear-gradient(135deg, #0B1F4E 0%, #112B68 34%, #1e3a8a 68%, #1B4492 100%);
  color: #fff;
  min-height: 96px;
  padding: 24px 0 22px;
  box-shadow: 0 2px 12px rgba(10, 25, 70, 0.25), 0 0 0 1px rgba(255,255,255,0.04) inset;
  position: relative;
  overflow: hidden;
}
.header::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0) 45%, rgba(11, 31, 78, 0.18) 100%);
  pointer-events: none;
  z-index: 0;
}
.header .container {
  position: relative;
  z-index: 1;
}
.header .container { display: flex; justify-content: space-between; align-items: center; padding-top: 0; padding-bottom: 0; }
.brand { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.brand span { color: var(--accent); }
.header .user { font-size: 14px; opacity: .95; display: flex; align-items: center; gap: 12px; }
.header .user form { display: inline; }
.header .logout-btn {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.header .logout-btn:hover { background: rgba(255,255,255,.25); }

.page-title { font-size: 24px; font-weight: 700; margin-bottom: 20px; letter-spacing: -0.5px; }
.page-subtitle { color: var(--muted); margin-top: -12px; margin-bottom: 20px; font-size: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card-title { font-size: 17px; font-weight: 600; margin-bottom: 12px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.fuel-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.fuel-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; background: #f9fafb; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px;
}
.fuel-item .status { font-size: 12px; padding: 3px 8px; border-radius: 999px; font-weight: 600; }
.status-ok { background: #d1fae5; color: #065f46; }
.status-missing { background: #fee2e2; color: #991b1b; }
.status-date { color: var(--muted); font-weight: 500; background: #f3f4f6; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; font-size: 14px; font-weight: 600;
  border-radius: 8px; border: 1px solid transparent; cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f9fafb; }
.btn-accent { background: var(--accent); color: #1f2937; }
.btn-accent:hover { background: #d97706; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.station-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.station-name { font-size: 16px; font-weight: 600; }
.station-address { font-size: 13px; color: var(--muted); }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #374151; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 12px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
  font-family: inherit; color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 540px) { .form-row { grid-template-columns: 1fr; } }

.alert {
  padding: 12px 16px; border-radius: 8px; font-size: 14px;
  margin-bottom: 18px; border: 1px solid transparent;
}
.alert-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 420px at 8% -8%, rgba(212, 175, 55, 0.34), transparent 55%),
    radial-gradient(1100px 500px at 112% 4%, rgba(37, 99, 235, 0.42), transparent 60%),
    radial-gradient(900px 520px at 50% 120%, rgba(17, 43, 104, 0.55), transparent 60%),
    linear-gradient(135deg, #0B1F4E 0%, #112B68 38%, #1e3a8a 72%, #1A4A9B 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(11,31,78,0.18) 0%, rgba(30,58,138,0.10) 50%, rgba(11,31,78,0.28) 100%);
  pointer-events: none;
}
.login-card {
  position: relative;
  z-index: 2;
  background: rgba(17, 24, 39, 0.78);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%; max-width: 420px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
  color: #ffffff;
}
.login-card .brand {
  color: #ffffff !important;
  text-align: center;
  margin-bottom: 6px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.login-card .brand span {
  color: var(--accent) !important;
  text-shadow: 0 2px 10px rgba(245,158,11,0.4);
}
.login-card .tagline,
.login-card .form-group label {
  color: #f9fafb !important;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.login-card .tagline {
  text-align: center; font-size: 14px; margin-bottom: 28px;
}
.login-card .alert {
  color: #111827 !important;
  text-shadow: none;
}
.login-card .form-group input {
  color: #111827 !important;
  text-shadow: none;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(255,255,255,0.6);
}
.login-card .form-group input:focus {
  background: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.35);
}

.btn-back { display: inline-flex; align-items: center; gap: 6px; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
  margin-bottom: 20px; align-items: center;
}

.meta-row {
  display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px;
  font-size: 14px; padding: 6px 0;
}
.meta-row .k { color: var(--muted); font-weight: 500; }
.meta-row .v { color: var(--text); font-weight: 500; word-break: break-word; }

.pdf-frame {
  width: 100%; height: 72vh; min-height: 520px;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; overflow: hidden;
}
.pdf-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.pdf-empty {
  height: 420px; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 14px; color: var(--muted); text-align: center;
  border: 2px dashed var(--border); border-radius: 10px; background: #fafafa;
}
.pdf-empty svg { opacity: .4; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: #e0e7ff; color: #3730a3;
}

.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.qr-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; text-align: center; page-break-inside: avoid; break-inside: avoid;
}
.qr-card .qr-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.qr-card .qr-sub { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.qr-card .qr-fuel { font-size: 14px; font-weight: 600; color: var(--primary); margin-bottom: 10px; }
.qr-card img { width: 200px; height: 200px; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 6px; }
.qr-card .qr-url {
  margin-top: 10px; font-size: 11px; color: var(--muted); word-break: break-all;
  padding: 6px 8px; background: #f9fafb; border-radius: 6px;
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .header { display: none; }
  .container { max-width: 100%; padding: 10mm; }
  .qr-grid {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }
  .qr-card {
    page-break-after: always;
    break-after: page;
    page-break-inside: avoid;
    height: calc(100vh - 20mm) !important;
    min-height: calc(100vh - 20mm) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    border: 0 !important;
    padding: 20mm !important;
    box-sizing: border-box;
    text-align: center !important;
  }
  .qr-card:last-child { page-break-after: auto; }
  .qr-card .qr-title {
    font-size: 28pt !important;
    font-weight: 700 !important;
    margin-bottom: 6mm !important;
  }
  .qr-card .qr-stations {
    font-size: 18pt !important;
    color: #1e3a8a !important;
    margin-bottom: 8mm !important;
  }
  .qr-card .qr-fuel {
    font-size: 24pt !important;
    font-weight: 700 !important;
    margin-bottom: 12mm !important;
  }
  .qr-card img {
    width: 160mm !important;
    height: 160mm !important;
    max-width: 160mm !important;
    border-width: 1mm !important;
    margin-bottom: 12mm !important;
  }
  .qr-card .qr-cert-number,
  .qr-card .qr-cert-date {
    font-size: 16pt !important;
    color: #111827 !important;
    margin-bottom: 4mm !important;
  }
  .qr-card .qr-url {
    font-size: 11pt !important;
    margin-top: 6mm !important;
  }
}

.footer {
  text-align: center; color: var(--muted); font-size: 12px;
  padding: 30px 0 20px;
}

.actions-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

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

hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

.tabs {
  display: flex; flex-wrap: wrap; gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  background: transparent;
  border: 0;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s ease;
  font-family: inherit;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn .15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: slideUp .2s ease-out;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
  font-size: 18px; font-weight: 700; color: var(--text);
}
.modal-close {
  background: transparent;
  border: 0;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 6px;
  font-family: inherit;
}
.modal-close:hover { background: #f3f4f6; color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-danger:disabled { background: #fca5a5; cursor: not-allowed; }

.fuel-block {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.station-fuels {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
}
.station-fuels .fuel-block {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 100%;
}
.station-fuels .fuel-block form {
  margin-top: auto;
  display: flex;
  flex-direction: column;
}
.station-fuels .fuel-block h3 {
  margin-bottom: 6px;
}

