/* ============================================================
   MAGNUM TIRES — Design System (baseado no LICITA-ACT)
   ============================================================ */

:root {
  --bg:        #090d13;
  --surface:   #0f1520;
  --surface-2: #151d2b;
  --border:    #1e2d42;
  --border-2:  #243245;
  --text:      #e2eaf4;
  --muted:     #6b7d93;
  --muted-2:   #4a5568;

  --primary:      #4898ff;
  --primary-glow: rgba(72,152,255,.18);
  --green:        #34d058;
  --green-glow:   rgba(52,208,88,.15);
  --orange:       #f0a429;
  --orange-glow:  rgba(240,164,41,.15);
  --purple:       #a78bfa;
  --purple-glow:  rgba(167,139,250,.15);
  --red:          #f75252;
  --red-glow:     rgba(247,82,82,.15);
  --yellow:       #e3b341;
  --yellow-glow:  rgba(227,179,65,.15);

  --sidebar-w: 228px;
  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,.45);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.55);

  --transition: .18s cubic-bezier(.4,0,.2,1);
}

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

html { scrollbar-color: var(--border-2) var(--bg); scrollbar-width: thin; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ── LOGIN ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 70% 60% at 20% 30%, rgba(72,152,255,.07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 70%, rgba(52,208,88,.06) 0%, transparent 60%),
    var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-card__header { text-align: center; margin-bottom: 32px; }
.login-card__icon   { font-size: 2.8rem; }
.login-card__title  { font-size: 1.65rem; font-weight: 700; color: var(--text); margin-top: 10px; letter-spacing: -.02em; }
.login-card__title span { color: var(--primary); }
.login-card__sub    { color: var(--muted); font-size: 0.88rem; margin-top: 6px; }

/* ── APP LAYOUT ─────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow: hidden;
}
.sidebar::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--green));
  flex-shrink: 0;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}
.brand__icon { font-size: 1.5rem; line-height: 1; }
.brand__name { font-weight: 700; color: var(--text); font-size: 1.05rem; letter-spacing: -.02em; }
.brand__name span { color: var(--primary); }

.sidebar__nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.nav__item span { font-size: 1rem; line-height: 1; }
.nav__item:hover { background: rgba(255,255,255,.04); color: var(--text); text-decoration: none; }
.nav__item.active { background: var(--primary-glow); color: var(--primary); font-weight: 600; }
.nav__item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}

.sidebar__footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.user__name { font-size: 0.8rem; color: var(--muted); word-break: break-all; font-weight: 500; }

.main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; }
.main__content { padding: 32px 36px; }

/* ── PAGE HEADER ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-title { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }
.page-count {
  color: var(--muted);
  font-size: 0.82rem;
  margin-left: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 20px;
}

/* ── SECTION TITLE ──────────────────────────────────────── */
.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 12px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── CARDS GRID ─────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 18px;
  border-top: 3px solid var(--border-2);
  position: relative;
  overflow: hidden;
}
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.025) 0%, transparent 60%);
  pointer-events: none;
}
.card--blue   { border-top-color: var(--primary); }
.card--green  { border-top-color: var(--green);   }
.card--orange { border-top-color: var(--orange);  }
.card--purple { border-top-color: var(--purple);  }
.card--red    { border-top-color: var(--red); background: rgba(247,82,82,.05); }
.card--yellow { border-top-color: var(--yellow);  }
.card--gray   { border-top-color: var(--muted-2); }

.card__icon {
  position: absolute;
  top: 14px; right: 16px;
  font-size: 1.6rem;
  opacity: .15;
  line-height: 1;
  pointer-events: none;
}
a.card--link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
a.card--link:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); text-decoration: none; }
a.card--link.card--blue:hover   { border-color: var(--primary); box-shadow: 0 6px 24px var(--primary-glow); }
a.card--link.card--green:hover  { border-color: var(--green);   box-shadow: 0 6px 24px var(--green-glow);   }
a.card--link.card--orange:hover { border-color: var(--orange);  box-shadow: 0 6px 24px var(--orange-glow);  }
a.card--link.card--purple:hover { border-color: var(--purple);  box-shadow: 0 6px 24px var(--purple-glow);  }
a.card--link.card--red:hover    { border-color: var(--red);     box-shadow: 0 6px 24px var(--red-glow);     }
a.card--link.card--yellow:hover { border-color: var(--yellow);  box-shadow: 0 6px 24px var(--yellow-glow);  }

.card__value     { font-size: 1.85rem; font-weight: 700; margin-bottom: 4px; letter-spacing: -.03em; line-height: 1.2; }
.card__value--sm { font-size: 1.05rem; font-weight: 600; margin-bottom: 4px; word-break: break-all; line-height: 1.3; }
.card__label     { color: var(--muted); font-size: 0.8rem; font-weight: 500; }
.card__hint      { color: var(--muted); font-size: 0.75rem; margin-top: 6px; line-height: 1.4; }

/* card com controle inline (ex: bot toggle) */
.card__body    { display: flex; flex-direction: column; gap: 10px; }
.card__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* ── FILTERS ────────────────────────────────────────────── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.filters .field__input { width: auto; min-width: 220px; margin-bottom: 0; }

/* ── FORMS ──────────────────────────────────────────────── */
.field         { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field__label  { font-size: 0.82rem; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.field__input  {
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 13px;
  font-size: 0.875rem;
  font-family: inherit;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field__input::placeholder { color: var(--muted-2); }
.field__input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  letter-spacing: .01em;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:hover  { opacity: .88; text-decoration: none; }
.btn--primary {
  background: var(--primary);
  color: #080e1a;
  box-shadow: 0 2px 8px rgba(72,152,255,.25);
}
.btn--primary:hover { opacity: 1; box-shadow: 0 4px 14px rgba(72,152,255,.35); }
.btn--ghost   { background: transparent; border: 1px solid var(--border-2); color: var(--text); }
.btn--ghost:hover { background: rgba(255,255,255,.04); border-color: var(--muted-2); opacity: 1; }
.btn--danger  { background: rgba(247,82,82,.12); color: var(--red); border: 1px solid rgba(247,82,82,.3); }
.btn--danger:hover { background: rgba(247,82,82,.22); opacity: 1; }
.btn--yellow  { background: rgba(227,179,65,.12); color: var(--yellow); border: 1px solid rgba(227,179,65,.3); }
.btn--yellow:hover  { background: rgba(227,179,65,.22); opacity: 1; }
.btn--green   { background: rgba(52,208,88,.12); color: var(--green); border: 1px solid rgba(52,208,88,.3); }
.btn--green:hover { background: rgba(52,208,88,.22); opacity: 1; }
.btn--sm      { padding: 5px 11px; font-size: 0.78rem; }
.btn--full    { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-logout {
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  padding: 0;
  font-family: inherit;
  transition: color var(--transition);
  text-decoration: none;
  display: inline-block;
}
.btn-logout:hover { color: var(--red); text-decoration: none; }

/* ── TABLE ──────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.table thead { background: var(--surface-2); }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table th {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  white-space: nowrap;
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: rgba(72,152,255,.04); }
.table tbody tr:last-child td { border-bottom: none; }
.table__empty { text-align: center; color: var(--muted); padding: 48px; font-size: 0.9rem; }
td.muted { color: var(--muted); }
td.actions { white-space: nowrap; width: 1%; }

/* ── BADGES / STATUS ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.73rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: .01em;
}
.badge::before { content: '●'; font-size: .5rem; }
.badge--green  { background: rgba(52,208,88,.12);  color: var(--green);   }
.badge--red    { background: rgba(247,82,82,.12);  color: var(--red);     }
.badge--blue   { background: rgba(72,152,255,.12); color: var(--primary); }
.badge--orange { background: rgba(240,164,41,.12); color: var(--orange);  }
.badge--yellow { background: rgba(227,179,65,.12); color: var(--yellow);  }
.badge--gray   { background: rgba(107,125,147,.1); color: var(--muted);   }

/* tag compacta sem bullet */
.tag {
  display: inline-block;
  font-size: 0.72rem;
  border-radius: 20px;
  padding: 2px 10px;
  font-weight: 600;
  border: 1px solid;
}
.tag--green  { color: var(--green);   background: rgba(52,208,88,.10);  border-color: rgba(52,208,88,.25); }
.tag--red    { color: var(--red);     background: rgba(247,82,82,.10);  border-color: rgba(247,82,82,.25); }
.tag--orange { color: var(--orange);  background: rgba(240,164,41,.10); border-color: rgba(240,164,41,.25); }
.tag--yellow { color: var(--yellow);  background: rgba(227,179,65,.10); border-color: rgba(227,179,65,.25); }
.tag--gray   { color: var(--muted);   background: rgba(107,125,147,.08); border-color: rgba(107,125,147,.2); }
.tag--blue   { color: var(--primary); background: rgba(72,152,255,.10); border-color: rgba(72,152,255,.25); }

/* ── PAGINATION ─────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  text-decoration: none;
  border: 1px solid var(--border-2);
  color: var(--muted);
  transition: border-color var(--transition), color var(--transition);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pagination span.atual { background: var(--primary-glow); color: var(--primary); border-color: var(--primary); font-weight: 600; }

/* ── DETAIL GRID ────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.detail-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.detail-card--full { grid-column: 1 / -1; }
.detail-card__title {
  color: var(--primary);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-card__title::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  opacity: .7;
}
.detail-rows { display: flex; flex-direction: column; gap: 10px; }
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.84rem;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.detail-row:last-child { border-bottom: none; padding-bottom: 0; }
.detail-row span   { color: var(--muted); flex-shrink: 0; font-weight: 500; }
.detail-row strong { text-align: right; word-break: break-word; }
.value--highlight  { color: var(--green); font-size: 1rem; font-weight: 700; }

/* ── ALERT ──────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.875rem; margin-bottom: 16px; border: 1px solid transparent; }
.alert--error,
.alert--danger  { background: rgba(247,82,82,.08);  color: var(--red);   border-color: rgba(247,82,82,.25); }
.alert--success { background: rgba(52,208,88,.08);  color: var(--green); border-color: rgba(52,208,88,.25); }

/* ── EMPTY STATE ────────────────────────────────────────── */
.empty-state { text-align: center; padding: 64px 20px; color: var(--muted); }
.empty-state__icon { font-size: 3.2rem; margin-bottom: 16px; opacity: .6; }
.empty-state p { font-size: 0.9rem; }

/* ── QR AREA ────────────────────────────────────────────── */
.qr-area {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.qr-area img { width: 200px; height: 200px; border-radius: 4px; }
.qr-area .qr-msg { text-align: center; color: var(--muted); font-size: 0.85rem; line-height: 1.6; margin-top: 8px; }

/* ── SPINNER ────────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TOAST ──────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 0.85rem;
  color: var(--text);
  opacity: 0;
  transition: opacity .3s;
  z-index: 999;
  pointer-events: none;
  max-width: 320px;
  box-shadow: var(--shadow-md);
}
#toast.show { opacity: 1; }
#toast.ok   { border-color: var(--green); color: var(--green); }
#toast.err  { border-color: var(--red);   color: var(--red);   }

/* ── TABLE ACTIONS ──────────────────────────────────────── */
.table__actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

/* ── PAGE HEADER ────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: .75rem; }
.page-title  { font-size: 1.25rem; font-weight: 700; color: var(--text); margin: 0; }
.page-count  { font-size: .85rem; color: var(--muted); }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .main__content { padding: 20px 16px; }
  .cards-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .cards-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
