/* Fernando Net · Inspeção de Material Técnico */
:root {
  --red: #ed3b4f;
  --red-strong: #d92a3f;
  --red-soft: rgba(237, 59, 79, .14);
  --navy-1: #1a1fa0;
  --navy-2: #0f1160;
  --navy-3: #0a0b3d;

  --ok: #16a34a;
  --ok-soft: rgba(22, 163, 74, .14);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, .16);
  --bad: #dc2626;
  --bad-soft: rgba(220, 38, 38, .14);

  --radius: 16px;
  --radius-sm: 10px;
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --sidebar-w: 260px;
}

:root[data-theme="dark"] {
  --bg: #070820;
  --surface: #0f1132;
  --surface-2: #161946;
  --border: rgba(255, 255, 255, .09);
  --text: #eef0ff;
  --muted: #9aa0c8;
  --input: #0b0d2a;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

:root[data-theme="light"] {
  --bg: #f3f4fb;
  --surface: #ffffff;
  --surface-2: #eef0fa;
  --border: #e1e4f2;
  --text: #12143d;
  --muted: #5d6290;
  --input: #ffffff;
  --shadow: 0 8px 24px rgba(17, 19, 122, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* boot */
.boot { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy-1), var(--navy-3)); }
.boot-logo { width: 200px; opacity: .9; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* auth */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(circle at 80% 0%, rgba(237, 59, 79, .25), transparent 45%),
              linear-gradient(135deg, var(--navy-1), var(--navy-3));
}
.auth-box { width: 100%; max-width: 420px; }
.auth-brand { text-align: center; margin-bottom: 22px; color: #fff; }
.auth-brand img { width: 230px; }
.auth-brand p { margin: 6px 0 0; color: rgba(255, 255, 255, .75); font-size: 14px; }
.auth-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card .muted { margin: 0 0 20px; font-size: 14px; }
.auth-foot { text-align: center; color: rgba(255, 255, 255, .6); font-size: 12px; margin-top: 18px; }

/* layout */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--navy-1), var(--navy-2) 55%, var(--navy-3));
  color: #fff; padding: 22px 14px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .logo { padding: 4px 10px 0; }
.sidebar .logo img { width: 170px; display: block; }
.sidebar .logo span { display: block; font-size: 12px; color: rgba(255, 255, 255, .7); margin-top: 6px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  text-decoration: none; color: rgba(255, 255, 255, .82); font-weight: 600; font-size: 14.5px;
}
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.active { background: rgba(237, 59, 79, .95); color: #fff; box-shadow: 0 6px 18px rgba(237, 59, 79, .35); }
.nav svg { width: 19px; height: 19px; flex: none; }
.nav .badge { margin-left: auto; background: #fff; color: var(--red); font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 99px; }
.nav a.active .badge { color: var(--red-strong); }
.theme-switch { display: grid; grid-template-columns: 1fr 1fr; background: rgba(0, 0, 0, .25); border-radius: 12px; padding: 4px; }
.theme-switch button {
  border: 0; background: transparent; color: rgba(255, 255, 255, .75); padding: 8px; border-radius: 9px;
  cursor: pointer; font-weight: 600; font-size: 13px;
}
.theme-switch button.on { background: #fff; color: var(--navy-2); }
.me { display: flex; align-items: center; gap: 10px; background: rgba(0, 0, 0, .22); border-radius: 14px; padding: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--red); color: #fff; font-weight: 800; font-size: 13px;
}
.me .who { flex: 1; min-width: 0; }
.me .who b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { font-size: 12px; color: rgba(255, 255, 255, .7); }
.icon-btn {
  border: 0; background: transparent; color: inherit; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, .1); }
.icon-btn svg { width: 18px; height: 18px; }

.main { padding: 28px 32px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); }

.topbar { display: none; }
.scrim { display: none; }

/* cards & grid */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.grid { display: grid; gap: 18px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.two { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.stat { padding: 20px; }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat .value { font-size: 32px; font-weight: 800; margin-top: 6px; line-height: 1.1; }
.stat .hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.stat.accent { background: linear-gradient(135deg, var(--red), #b8213a); color: #fff; border: 0; }
.stat.accent .label, .stat.accent .hint { color: rgba(255, 255, 255, .85); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent;
  padding: 11px 18px; border-radius: 12px; font-weight: 700; font-size: 14.5px; cursor: pointer;
  text-decoration: none; transition: transform .05s, background .15s, opacity .15s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--red-strong); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-bad { background: var(--bad); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn svg { width: 17px; height: 17px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 700; }
.input, select.input, textarea.input {
  width: 100%; background: var(--input); border: 1px solid var(--border); border-radius: 11px;
  padding: 11px 13px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { resize: vertical; min-height: 84px; }
.input:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1; min-width: 160px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; margin-bottom: 10px; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }
.form-error { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; font-weight: 600; margin-bottom: 14px; }
:root[data-theme="dark"] .form-error { color: #fca5a5; }

/* tables / lists */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 0 10px 10px; white-space: nowrap; }
td { padding: 12px 10px; border-top: 1px solid var(--border); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
.empty { text-align: center; padding: 34px 10px; color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.pendente { background: var(--warn-soft); color: var(--warn); }
.pill.aprovada, .pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.reprovada, .pill.faltando { background: var(--bad-soft); color: var(--bad); }
.pill.danificado { background: var(--warn-soft); color: var(--warn); }
.pill.off { background: var(--surface-2); color: var(--muted); }
:root[data-theme="dark"] .pill.reprovada, :root[data-theme="dark"] .pill.faltando { color: #f87171; }
:root[data-theme="dark"] .pill.aprovada, :root[data-theme="dark"] .pill.ok { color: #4ade80; }
:root[data-theme="dark"] .pill.pendente, :root[data-theme="dark"] .pill.danificado { color: #fbbf24; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; padding-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }

/* equipment chips */
.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 18px; }
.chips div { font-size: 14px; }

/* checklist */
.week-banner {
  display: flex; align-items: center; gap: 16px; padding: 20px 22px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--navy-1), var(--navy-3)); color: #fff; margin-bottom: 18px; flex-wrap: wrap;
}
.week-banner .grow { flex: 1; min-width: 200px; }
.week-banner p { margin: 4px 0 0; color: rgba(255, 255, 255, .78); font-size: 14px; }
.week-banner.done { background: linear-gradient(135deg, #15803d, #14532d); }

.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--red); border-radius: 99px; transition: width .2s; }

.cat-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; margin: 22px 0 10px; }
.cat-title:first-child { margin-top: 0; }
.check-item { scroll-margin-top: 80px; border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 10px; background: var(--surface); }
.check-item.ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.check-item.danificado { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.check-item.faltando { border-color: color-mix(in srgb, var(--bad) 55%, transparent); }
.check-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.check-top .name { flex: 1; min-width: 150px; font-weight: 700; }
.check-top .name small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.seg { display: inline-grid; grid-template-columns: repeat(3, auto); background: var(--surface-2); border-radius: 11px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button.on.ok { background: var(--ok); color: #fff; }
.seg button.on.danificado { background: var(--warn); color: #fff; }
.seg button.on.faltando { background: var(--bad); color: #fff; }
.check-extra { margin-top: 12px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; }
.check-extra .input { min-height: 44px; }

.photo-btn {
  position: relative; width: 84px; height: 64px; border: 1.5px dashed var(--border); border-radius: 11px;
  display: grid; place-items: center; cursor: pointer; overflow: hidden; color: var(--muted); font-size: 11px; text-align: center;
  background: var(--input);
}
.photo-btn:hover { border-color: var(--red); color: var(--red); }
.photo-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-btn img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-btn svg { width: 20px; height: 20px; display: block; margin: 0 auto 2px; }
.photo-btn.required:not(.has) { border-color: var(--red); }
.photo-btn.big { width: 100%; height: 140px; font-size: 13px; }

.sticky-submit {
  position: sticky; bottom: 0; margin-top: 18px; padding: 14px 0 6px;
  background: linear-gradient(180deg, transparent, var(--bg) 35%);
  display: flex; gap: 12px; align-items: center;
}
.sticky-submit .grow { flex: 1; }

/* detail */
.detail-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.detail-meta div span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.detail-meta div b { font-size: 15px; }
.thumb { width: 64px; height: 48px; border-radius: 8px; object-fit: cover; cursor: zoom-in; border: 1px solid var(--border); display: block; }
.big-photo { width: 100%; max-height: 360px; object-fit: contain; border-radius: 12px; background: var(--surface-2); cursor: zoom-in; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(3, 4, 20, .66); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow-y: auto; }
.modal h2 { margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .9); display: grid; place-items: center; z-index: 60; cursor: zoom-out; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast-msg { background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow); animation: up .2s ease-out; }
.toast-msg.err { background: var(--bad); color: #fff; }
@keyframes up { from { opacity: 0; transform: translateY(8px); } }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters .input { width: auto; min-width: 150px; padding: 9px 12px; }

.footer-note { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }

/* responsive */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 40; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .5);
  }
  .layout.menu-open .sidebar { transform: none; }
  .layout.menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 30; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20;
    background: linear-gradient(90deg, var(--navy-1), var(--navy-2)); color: #fff; padding: 10px 12px;
  }
  .topbar img { height: 30px; }
  .main { padding: 20px 16px 48px; }
  h1 { font-size: 23px; }
  .chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 16px; }
  .stat .value { font-size: 26px; }
  .card { padding: 18px; }
  .table-wrap { margin: 0 -18px; padding: 0 18px; }
  .check-top .seg { width: 100%; grid-template-columns: repeat(3, 1fr); }
  .chips { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  #toast { top: 64px; bottom: auto; width: calc(100% - 32px); }
  .toast-msg { text-align: center; }
}
