:root {
  --ale-navy: #00539f;
  --ale-blue: #007dc3;
  --ale-cyan: #00b5cc;
  --ale-red: #e20025;
  --ink: #434343;
  --ink-soft: #828282;
  --line: #e4e8ee;
  --paper: #f2f4f7;
  --white: #ffffff;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 46, 92, .12);
  font-family: "Lato", "LatoWeb", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
a { color: var(--ale-blue); }

/* --------- Login --------- */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
}
.hero {
  position: relative;
  overflow: hidden;
  color: var(--white);
  background: linear-gradient(135deg, #003e7a 0%, var(--ale-navy) 45%, var(--ale-blue) 100%);
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
/* faixas diagonais inspiradas no banner do site */
.hero::before, .hero::after {
  content: "";
  position: absolute;
  inset: auto;
  transform: skewX(-18deg);
  pointer-events: none;
}
.hero::before {
  right: -140px; top: 0; bottom: 0; width: 34%;
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.02));
}
.hero::after {
  right: calc(34% - 150px); top: 0; bottom: 0; width: 8px;
  background: var(--ale-red);
  opacity: .9;
}
.hero-brand {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 14px;
  background: var(--white);
  border-radius: 8px;
  padding: 10px 16px;
  width: max-content;
}
.hero-brand img { height: 36px; display: block; }
.hero-copy { position: relative; z-index: 1; max-width: min(460px, 68%); }
.hero-copy .eyebrow {
  display: inline-block;
  text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 700;
  color: var(--ale-cyan);
  margin-bottom: 14px;
}
.hero-copy h1 { font-size: 40px; line-height: 1.12; margin: 0 0 16px; font-weight: 900; }
.hero-copy p { font-size: 17px; line-height: 1.55; margin: 0; color: rgba(255,255,255,.85); }
.hero-foot { position: relative; z-index: 1; font-size: 13px; color: rgba(255,255,255,.7); }

.panel {
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  padding: 48px 24px;
}
.card { width: 100%; max-width: 380px; }
.card .mobile-logo { display: none; height: 40px; margin-bottom: 28px; }
.card h2 { color: var(--ale-navy); font-size: 28px; font-weight: 900; margin: 0 0 6px; }
.card .sub { margin: 0 0 32px; color: var(--ink-soft); }
.accent { width: 48px; height: 4px; background: var(--ale-red); border-radius: 2px; margin-bottom: 18px; }

.info {
  display: flex; gap: 12px; align-items: flex-start;
  background: #e8f3fa; border: 1px solid #cfe5f3; border-left: 4px solid var(--ale-blue);
  color: #0b3f6e; border-radius: 8px; padding: 12px 14px; margin: -14px 0 24px;
  font-size: 14px; line-height: 1.45;
}
.info svg { flex: none; color: var(--ale-blue); margin-top: 1px; }
.info p { margin: 0; }
.sub strong { color: var(--ale-navy); }

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--ink); }
.input-wrap { position: relative; }
.field input {
  width: 100%;
  height: 48px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: #fbfcfd;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus {
  outline: none;
  border-color: var(--ale-blue);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(0, 125, 195, .15);
}
.field input[aria-invalid="true"] { border-color: var(--ale-red); }
.field input.has-toggle { padding-right: 72px; }
.notice {
  border-left: 4px solid var(--ale-blue); background: #e8f3fa; color: #0b3f6e;
  padding: 12px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 18px;
}
.toggle-pass {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--ale-blue);
  font-size: 13px; font-weight: 700; padding: 8px 10px; cursor: pointer; border-radius: 6px;
}
.toggle-pass:hover { background: rgba(0,125,195,.08); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 48px; padding: 0 22px;
  border: 0; border-radius: 8px; cursor: pointer;
  font-weight: 700; letter-spacing: .02em;
  transition: background .15s, transform .05s, box-shadow .15s;
}
.btn-primary { width: 100%; background: var(--ale-navy); color: var(--white); box-shadow: 0 6px 16px rgba(0,83,159,.25); }
.btn-primary:hover { background: #00468a; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary[disabled] { opacity: .7; cursor: progress; }
.btn-ghost { background: transparent; color: var(--ale-navy); border: 1.5px solid var(--line); height: 40px; padding: 0 16px; }
.btn-ghost:hover { border-color: var(--ale-navy); }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.35); border-top-color: var(--white);
  animation: spin .8s linear infinite; display: none;
}
.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  display: none;
  border-left: 4px solid var(--ale-red);
  background: #fdecee; color: #9b0019;
  padding: 12px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 18px;
}
.alert.show { display: block; }
.help { margin-top: 22px; font-size: 13px; color: var(--ink-soft); text-align: center; }

/* --------- Topo das páginas internas --------- */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar-inner {
  max-width: 1160px; margin: 0 auto; padding: 0 24px;
  height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar img { height: 34px; display: block; }
.who { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.who-text { text-align: right; }
.summary-right { display: flex; align-items: center; gap: 12px; }
.who .name { font-weight: 700; color: var(--ale-navy); }
.who .email { color: var(--ink-soft); font-size: 12px; }
.navband { background: var(--ale-navy); color: var(--white); }
.navband-inner {
  max-width: 1160px; margin: 0 auto; padding: 28px 24px 30px;
  position: relative;
}
.navband h1 { margin: 0 0 4px; font-size: 28px; font-weight: 900; }
.navband p { margin: 0; color: rgba(255,255,255,.8); }
.navband-inner::after {
  content: ""; position: absolute; left: 24px; bottom: 0; width: 56px; height: 4px; background: var(--ale-red);
}

/* --------- RFIDs --------- */
.wrap { max-width: 1160px; margin: 0 auto; padding: 24px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--white); border-radius: var(--radius); padding: 18px 20px; box-shadow: 0 1px 0 var(--line); }
.stat .num { font-size: 30px; font-weight: 900; color: var(--ale-navy); line-height: 1; }
.stat .lbl { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }

.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.search { flex: 1; min-width: 220px; position: relative; }
.search input {
  width: 100%; height: 44px; border-radius: 8px; border: 1.5px solid var(--line);
  padding: 0 14px 0 40px; background: var(--white);
}
.search input:focus { outline: none; border-color: var(--ale-blue); box-shadow: 0 0 0 4px rgba(0,125,195,.15); }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); }

.stores { display: grid; gap: 14px; }
.store { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 0 var(--line); }
.store summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-left: 4px solid var(--ale-blue);
}
.store summary::-webkit-details-marker { display: none; }
.store[open] summary { border-left-color: var(--ale-red); border-bottom: 1px solid var(--line); }
.store .sname { font-weight: 900; color: var(--ale-navy); font-size: 16px; }
.store .sid { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.pill { background: #e6f2fa; color: var(--ale-navy); font-weight: 700; font-size: 13px; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.chev { transition: transform .2s; color: var(--ale-blue); }
.store[open] .chev { transform: rotate(180deg); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 700; padding: 12px 20px; background: #fafbfc; }
td { padding: 12px 20px; border-top: 1px solid var(--line); }
td.rfid { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; color: var(--ink); }
td.att { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; color: var(--ink-soft); }
.copy { border: 0; background: transparent; color: var(--ale-blue); cursor: pointer; font-weight: 700; font-size: 12px; padding: 4px 8px; border-radius: 6px; }
.copy:hover { background: rgba(0,125,195,.08); }

.state { text-align: center; padding: 56px 20px; background: var(--white); border-radius: var(--radius); color: var(--ink-soft); }
.state strong { display: block; color: var(--ale-navy); font-size: 18px; margin-bottom: 6px; }
.skeleton { height: 64px; border-radius: var(--radius); background: linear-gradient(90deg, #e9edf2 0%, #f5f7fa 50%, #e9edf2 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
mark { background: #fff3b0; color: inherit; border-radius: 2px; }

/* --------- CPF do frentista --------- */
td.att .att-name { display: block; font-family: "Lato", system-ui, sans-serif; font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
td.att .att-id { display: block; }
.cpf-cell { width: 1%; white-space: nowrap; }
.cpf-form { display: flex; gap: 8px; align-items: center; }
.cpf-form .cpf {
  width: 150px; height: 38px; border: 1.5px solid var(--line); border-radius: 8px; padding: 0 10px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; color: var(--ink); background: #fbfcfd;
}
.cpf-form .cpf:focus { outline: none; border-color: var(--ale-blue); background: var(--white); box-shadow: 0 0 0 3px rgba(0,125,195,.15); }
.cpf-form .cpf[aria-invalid="true"] { border-color: var(--ale-red); }
.cpf-form .cpf:disabled { opacity: .6; }
.btn-save { height: 38px; padding: 0 16px; background: var(--ale-navy); color: var(--white); font-size: 13px; }
.btn-save:hover { background: #00468a; }
.btn-save[disabled] { opacity: .7; cursor: progress; }
.btn-save .spinner { width: 14px; height: 14px; border-width: 2px; }
.cpf-msg { font-size: 12px; margin-top: 6px; min-height: 16px; color: var(--ink-soft); white-space: normal; max-width: 260px; }
.cpf-msg.ok { color: #0a7d3b; font-weight: 700; }
.cpf-msg.err { color: var(--ale-red); font-weight: 700; }

.badge-cpf { display: inline-block; font-family: "Lato", system-ui, sans-serif; font-size: 11px; font-weight: 700; color: #0a7d3b; background: #e3f5ea; border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }
.att-empty { font-family: "Lato", system-ui, sans-serif; font-size: 12px; color: #b0b6bf; font-style: italic; }
.stat .lbl span { color: var(--ale-navy); font-weight: 700; }

.cpf-msg.confirm { color: var(--ink); font-size: 13px; display: flex; flex-direction: column; gap: 8px; max-width: 280px; }
.cpf-msg.confirm strong { color: var(--ale-navy); }
.confirm-actions { display: flex; gap: 8px; }
[hidden] { display: none !important; }
.btn-cancel { height: 34px; padding: 0 14px; background: transparent; color: var(--ink-soft); border: 1.5px solid var(--line); font-size: 13px; }
.btn-cancel:hover { border-color: var(--ink-soft); color: var(--ink); }
.btn-confirm { height: 34px; }

/* --------- Filtro e identificação --------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: -6px 0 16px; }
.chip {
  border: 1.5px solid var(--line); background: var(--white); color: var(--ink);
  height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; gap: 8px;
}
.chip span { background: #eef1f5; color: var(--ink-soft); border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.chip:hover { border-color: var(--ale-blue); }
.chip[aria-pressed="true"] { background: var(--ale-navy); border-color: var(--ale-navy); color: var(--white); }
.chip[aria-pressed="true"] span { background: rgba(255,255,255,.18); color: var(--white); }

.rfid-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.rfid-meta {
  margin-top: 4px; font-family: "Lato", system-ui, sans-serif; font-size: 12px; font-weight: 400;
  color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center;
}
.rfid-meta .sep { color: #c3c9d1; }
.rfid-meta .meta-warn { color: #b25e00; font-weight: 700; }

.cpf-locked { display: flex; align-items: center; gap: 10px; }
.cpf-mask { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; color: var(--ink); letter-spacing: .02em; }
.btn-alterar { height: 32px; padding: 0 12px; background: transparent; color: var(--ale-blue); border: 1.5px solid var(--line); font-size: 13px; }
.btn-alterar:hover { border-color: var(--ale-blue); }
.cpf-form .btn-cancel-edit { height: 38px; }

/* --------- Responsivo --------- */
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .hero { display: none; }
  .card .mobile-logo { display: block; }
  .panel { align-items: flex-start; padding-top: 64px; border-top: 6px solid var(--ale-navy); }
}
@media (max-width: 640px) {
  .topbar-inner, .navband-inner, .wrap { padding-left: 16px; padding-right: 16px; }
  .navband-inner::after { left: 16px; }
  .who .email { display: none; }
  .stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .stat { padding: 14px; }
  .stat .num { font-size: 22px; }
  td.att { font-family: "Lato", system-ui, sans-serif; }
  td.att .att-empty { display: none; }
  thead { display: none; }
  tbody tr { display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--line); padding: 10px 0; }
  tbody td { border-top: 0; padding: 4px 14px; }
  .cpf-cell { width: auto; }
  .cpf-form .cpf { flex: 1; width: auto; }
  th, td { padding: 10px 14px; }
}
