/* Clear IT Asset Hub — identidade visual própria: azul-petróleo + verde-água, foco em legibilidade. */
:root {
  --navy: #0f2a44;
  --navy-2: #173a5c;
  --teal: #1f9e8f;
  --teal-strong: #12786c;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #17212b;
  --muted: #5b6875;
  --line: #dde3ea;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --warn: #9a6700;
  --warn-bg: #fff4d6;
  --ok: #1a7f37;
  --ok-bg: #e6f4ea;
  --info: #1f5fae;
  --info-bg: #e7f0fb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --sidebar: 232px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 15px;
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
a { color: var(--info); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #7cc8ff; outline-offset: 2px; }
.boot { padding: 2rem; color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 1rem; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #dce7f2; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1rem; font-weight: 700; color: #fff; text-decoration: none; }
.brand svg { flex: none; }
.brand small { display: block; font-weight: 400; color: #9fb4c8; font-size: .75rem; }
.nav { display: flex; flex-direction: column; padding: .25rem .5rem; gap: 2px; }
.nav a { display: flex; align-items: center; gap: .65rem; padding: .6rem .75rem; border-radius: 8px; color: #dce7f2; text-decoration: none; }
.nav a:hover { background: var(--navy-2); }
.nav a.active { background: var(--teal); color: #fff; }
.nav .sep { margin: .75rem .75rem .25rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #8aa2b9; }
.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar .me { margin-top: auto; padding: .9rem 1rem; border-top: 1px solid var(--navy-2); font-size: .85rem; }
.sidebar .me button { background: none; border: 0; color: #9fd9cf; padding: 0; cursor: pointer; text-decoration: underline; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; gap: 1rem; align-items: center; padding: .75rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.search { position: relative; flex: 1; max-width: 560px; }
.search input { width: 100%; padding: .55rem .8rem .55rem 2.2rem; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.search svg { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 16px; color: var(--muted); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 60vh; overflow: auto; z-index: 20; }
.search-results a { display: block; padding: .55rem .8rem; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line); }
.search-results a:hover, .search-results a:focus { background: var(--bg); }
.search-results .kind { font-size: .72rem; text-transform: uppercase; color: var(--teal-strong); font-weight: 600; margin-right: .4rem; }
.content { padding: 1.5rem; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.page-head h1 { margin: 0; font-size: 1.45rem; }
.page-head p { margin: .25rem 0 0; color: var(--muted); }
.crumb { font-size: .85rem; margin-bottom: .35rem; }
.crumb a { text-decoration: none; }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; }
.card h2 { font-size: 1.05rem; margin: 0 0 .8rem; }
.card h3 { font-size: .95rem; margin: 1rem 0 .5rem; }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.main-aside { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .9rem; }
.kpi { display: block; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); border-left: 4px solid var(--teal); }
.kpi:hover { border-color: var(--teal); }
.kpi .v { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: .9rem; }
.kpi.warn { border-left-color: #e0a100; }
.kpi.danger { border-left-color: var(--danger); }
.kpi.info { border-left-color: var(--info); }

.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem .95rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-decoration: none; color: var(--text); font-weight: 500; }
.btn:hover { border-color: #b8c3cf; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-strong); }
.btn.danger { color: var(--danger); border-color: #f1b8b2; }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }
.btn.link { border: 0; background: none; color: var(--info); padding: 0; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; background: #eef1f5; color: #3d4b59; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }

.notice { padding: .75rem 1rem; border-radius: 8px; background: var(--info-bg); color: #163d6b; border: 1px solid #c9dcf3; }
.notice.warn { background: var(--warn-bg); color: #5c4100; border-color: #f0dca0; }
.notice.danger { background: var(--danger-bg); color: #7a1610; border-color: #f1b8b2; }
.notice.ok { background: var(--ok-bg); color: #145a29; border-color: #b7dfc2; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfc; position: sticky; top: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #f6f9fb; }
tbody tr:last-child td { border-bottom: 0; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: .9rem; }
.filters .field { min-width: 160px; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs a { padding: .55rem .9rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; font-weight: 500; }
.tabs a.active { color: var(--text); border-bottom-color: var(--teal); }

.field { display: flex; flex-direction: column; gap: .3rem; }
.field label { font-size: .86rem; font-weight: 600; color: #34414e; }
.field .hint { font-size: .8rem; color: var(--muted); }
.field input, .field select, .field textarea { padding: .5rem .65rem; border: 1px solid #c9d2dc; border-radius: 8px; background: #fff; width: 100%; }
.field textarea { min-height: 90px; resize: vertical; }
.field input:invalid:not(:placeholder-shown) { border-color: var(--danger); }
.req::after { content: " *"; color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: .5rem; align-items: center; }

dl.props { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.2rem; margin: 0; }
dl.props dt { color: var(--muted); font-size: .9rem; }
dl.props dd { margin: 0; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.4rem; border-left: 2px solid var(--line); margin-left: .4rem; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: .3rem; width: 12px; height: 12px; border-radius: 50%; background: var(--teal); border: 2px solid #fff; }
.timeline .when { font-size: .82rem; color: var(--muted); }

.dropzone { border: 2px dashed #b8c6d4; border-radius: var(--radius); padding: 1.5rem; text-align: center; background: #fbfcfd; cursor: pointer; }
.dropzone.over { border-color: var(--teal); background: #eefaf8; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(15, 25, 35, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 1rem; z-index: 50; overflow: auto; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 620px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { max-width: 920px; }
.modal header { padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal header h2 { margin: 0; font-size: 1.1rem; }
.modal .body { padding: 1.1rem 1.2rem; }
.modal footer { padding: .9rem 1.2rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .5rem; }
.x { background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--muted); line-height: 1; }

#toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 60; max-width: min(420px, calc(100vw - 2rem)); }
.toast { padding: .75rem 1rem; border-radius: 8px; background: #1d2b38; color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* Login */
.auth-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy), #11475a); padding: 1rem; }
.auth-card { background: var(--surface); padding: 2rem; border-radius: 14px; width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-card h1 { margin: 0 0 .25rem; font-size: 1.35rem; }

/* Etiquetas */
.labels { display: grid; grid-template-columns: repeat(auto-fill, 62mm); gap: 4mm; }
.label { width: 62mm; height: 30mm; border: 1px dashed #aab; border-radius: 2mm; display: flex; align-items: center; gap: 2mm; padding: 2mm; background: #fff; overflow: hidden; }
.label img { width: 25mm; height: 25mm; image-rendering: pixelated; }
.label .t { font-weight: 700; font-size: 11pt; font-family: Consolas, monospace; }
.label .s { font-size: 7.5pt; color: #333; }

.scanner video { width: 100%; max-width: 420px; border-radius: 8px; background: #000; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; top: auto; height: auto; width: 100%; z-index: 30; flex-direction: row; }
  .brand, .sidebar .me, .nav .sep, .nav .secondary { display: none; }
  .nav { flex-direction: row; justify-content: space-around; width: 100%; padding: .25rem; }
  .nav a { flex-direction: column; gap: .15rem; font-size: .7rem; padding: .4rem .3rem; }
  .content { padding: 1rem 1rem 5.5rem; }
  .topbar { padding: .6rem 1rem; }
  .grid.cols-2, .grid.cols-3, .grid.main-aside, .form-grid { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}

@media print {
  .sidebar, .topbar, .no-print, #toasts { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .card, .table-wrap { box-shadow: none; border: 0; }
  .label { border: 0; break-inside: avoid; }
}
