:root {
  --bg: #070d18;
  --bg-2: #0a1322;
  --surface: #0e1728;
  --surface-2: #111c31;
  --surface-3: #13233b;
  --text: #f7fbff;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, .18);
  --line-strong: rgba(56, 189, 248, .30);
  --primary: #38bdf8;
  --primary-2: #5865f2;
  --primary-soft: rgba(56, 189, 248, .14);
  --danger: #fb7185;
  --warning: #fbbf24;
  --ok: #86efac;
  --radius: 18px;
  --shadow: 0 22px 70px rgba(0, 0, 0, .42);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  background:
    linear-gradient(135deg, rgba(14, 165, 233, .08), transparent 30%),
    linear-gradient(180deg, #09111f 0%, #060b14 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(56, 189, 248, .035), transparent 22%, transparent 78%, rgba(88, 101, 242, .04));
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }

.app-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: rgba(5, 11, 20, .86);
  box-shadow: 14px 0 42px rgba(0, 0, 0, .28);
  backdrop-filter: blur(16px);
}
.brand {
  display: grid;
  place-items: center;
  gap: 14px;
  min-height: 184px;
  margin-bottom: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(15, 23, 42, .92), rgba(5, 11, 20, .78));
}
.brand-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, .38));
}
.brand-copy { text-align: center; }
.brand strong {
  display: block;
  color: var(--text);
  font-size: 16px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0;
}
.brand span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.nav {
  display: grid;
  gap: 8px;
}
.site-credit {
  margin: auto 0 0;
  padding-top: 18px;
  color: #7dd3fc;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0;
}
.login-credit {
  margin: 14px 0 0;
  padding-top: 0;
  text-align: left;
}
.nav-item {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #cbd5e1;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}
.nav-icon {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, .24);
  border-radius: 11px;
  background: rgba(8, 47, 73, .52);
}
.nav-item:hover,
.nav-item.active {
  color: #f8fafc;
  border-color: rgba(56, 189, 248, .35);
  background: linear-gradient(90deg, rgba(14, 165, 233, .22), rgba(88, 101, 242, .12));
  box-shadow: inset 4px 0 0 #22d3ee;
  transform: translateX(2px);
}
.main {
  position: relative;
  min-width: 0;
  padding: 22px;
  overflow: hidden;
}
.topbar {
  min-height: 152px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 16px;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(115deg, rgba(15, 23, 42, .94), rgba(12, 34, 58, .92));
  box-shadow: var(--shadow);
}
.topbar > div:first-child { min-width: 0; }
.eyebrow {
  margin: 0 0 8px;
  color: #7dd3fc;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 0;
  color: var(--text);
  font-size: 48px;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}
h2 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}
.topbar-subtitle {
  display: block;
  margin-top: 12px;
  color: #cbd5e1;
  font-size: 16px;
}
.topbar-actions,
.filters,
.form-actions,
.dialog-actions,
.items-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.primary,
.ghost,
.danger,
.small-btn,
.icon-btn {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text);
  background: rgba(15, 23, 42, .72);
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.primary {
  border: 0;
  background: linear-gradient(135deg, #38bdf8, #5865f2);
  color: white;
  font-weight: 900;
  box-shadow: 0 16px 34px rgba(56, 189, 248, .26);
}
.ghost:hover,
.small-btn:hover,
.icon-btn:hover {
  border-color: var(--line-strong);
  background: rgba(14, 165, 233, .12);
}
.primary:hover { transform: translateY(-1px); }
.danger {
  color: #ffe4e6;
  border-color: rgba(251, 113, 133, .28);
  background: rgba(251, 113, 133, .12);
}
.small-btn {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
}
.icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 24px;
}
.user-pill {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: #dbeafe;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 13, 24, .64);
  font-size: 14px;
  font-weight: 700;
}
.user-pill::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, .10);
}

.view { display: none; }
.view.active { display: grid; gap: 16px; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.panel,
.metric-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(15, 23, 42, .95), rgba(11, 21, 36, .95));
  box-shadow: 0 14px 36px rgba(0, 0, 0, .28);
}
.panel { padding: 20px; }
.dashboard-filter-panel .section-title {
  min-height: 62px;
  align-items: end;
}
.dashboard-filters label { min-width: 164px; }
.dashboard-filters .ghost { align-self: end; }
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.metric-card {
  min-height: 128px;
  padding: 20px 18px 18px 68px;
}
.metric-card::before {
  content: "□";
  position: absolute;
  left: 18px;
  top: 20px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, .28);
  border-radius: 11px;
  background: rgba(8, 47, 73, .56);
  font-size: 14px;
}
.metric-card:nth-child(1)::before { content: "OS"; font-weight: 900; font-size: 12px; }
.metric-card:nth-child(2)::before { content: "◎"; }
.metric-card:nth-child(3)::before { content: "▣"; }
.metric-card:nth-child(4)::before { content: "⚙"; }
.metric-card:nth-child(5)::before { content: "!"; font-weight: 900; }
.metric-card:nth-child(6)::before { content: "$"; font-weight: 900; }
.metric-card:nth-child(7)::before { content: "%"; font-weight: 900; }
.metric-card:nth-child(8)::before { content: "R$"; font-weight: 900; font-size: 12px; }
.metric-card:nth-child(9)::before { content: "BR"; font-weight: 900; font-size: 12px; }
.metric-card:nth-child(10)::before { content: "LJ"; font-weight: 900; font-size: 12px; }
.metric-card:nth-child(11)::before { content: "MC"; font-weight: 900; font-size: 12px; }
.metric-card:nth-child(12)::before { content: "✓"; }
.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.metric-card strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}
.metric-card small { margin-top: 9px; }
.two-col {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 14px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-title span {
  color: var(--muted);
  font-size: 13px;
}
.status-bars { display: grid; gap: 16px; }
.status-bar {
  display: grid;
  gap: 7px;
}
.status-bar header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: #dbeafe;
  font-size: 14px;
}
.status-bar header strong {
  min-width: 28px;
  text-align: right;
}
.track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, .10);
  background: rgba(30, 41, 59, .82);
}
.fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #5865f2);
}
.mini-list { display: grid; gap: 10px; }
.mini-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(15, 23, 42, .64);
}
.mini-item strong { display: block; color: var(--text); }
.mini-item span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}
.technician-mini strong { color: #7dd3fc; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-grid.compact { gap: 12px; }
.span-2 { grid-column: span 2; }
label {
  display: grid;
  gap: 7px;
  color: #cbd5e1;
  font-size: 13px;
}
input,
textarea,
select {
  width: 100%;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 13, 24, .72);
  padding: 12px 13px;
  outline: none;
}
select option {
  color: var(--text);
  background: #0f172a;
}
textarea { resize: vertical; }
input:focus,
textarea:focus,
select:focus {
  border-color: rgba(56, 189, 248, .70);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, .14);
}
.search { min-width: 240px; }
.table-wrap {
  width: 100%;
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 13px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(148, 163, 184, .10);
}
th {
  color: #93a4bd;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}
td { color: #e5edf8; }
tr:hover td { background: rgba(14, 165, 233, .06); }
.actions-cell {
  width: 1%;
  min-width: 238px;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}
.actions-cell .small-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  margin-left: 8px;
  white-space: nowrap;
}
.actions-cell .small-btn:first-child {
  margin-left: 0;
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #d1fae5;
  border: 1px solid rgba(134, 239, 172, .28);
  background: rgba(34, 197, 94, .16);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.badge.warn {
  color: #fef3c7;
  border-color: rgba(251, 191, 36, .30);
  background: rgba(251, 191, 36, .14);
}
.badge.danger {
  color: #ffe4e6;
  border-color: rgba(251, 113, 133, .30);
  background: rgba(251, 113, 133, .14);
}
.badge.neutral {
  color: #dbeafe;
  border-color: rgba(56, 189, 248, .28);
  background: rgba(14, 165, 233, .14);
}
.alerts {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}
.alert {
  padding: 12px 14px;
  border: 1px solid rgba(134, 239, 172, .30);
  border-radius: 13px;
  color: #dcfce7;
  background: rgba(34, 197, 94, .12);
}
.alert.error {
  color: #ffe4e6;
  border-color: rgba(251, 113, 133, .30);
  background: rgba(251, 113, 133, .12);
}

.order-dialog {
  width: min(1180px, calc(100vw - 34px));
  max-height: calc(100vh - 34px);
  padding: 0;
  border: 0;
  border-radius: 24px;
  color: var(--text);
  background: transparent;
}
.order-dialog::backdrop {
  background: rgba(2, 6, 23, .76);
  backdrop-filter: blur(8px);
}
.dialog-card {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(15, 23, 42, .98), rgba(8, 13, 24, .98));
  box-shadow: var(--shadow);
}
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}
.wizard-grid {
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding-right: 6px;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: rgba(15, 23, 42, .58);
}
legend {
  padding: 0 8px;
  color: #7dd3fc;
  font-weight: 900;
}
.check-grid {
  display: grid;
  gap: 8px;
}
.check-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 150px minmax(220px, 1.4fr);
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 13, 24, .50);
}
.check-row-title {
  display: grid;
  gap: 5px;
  align-self: center;
}
.check-row-title strong {
  color: var(--text);
}
.check-row-title small {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(8, 13, 24, .58);
}
.check-item input { width: auto; }
.technician-active,
.user-active {
  align-self: end;
  min-height: 44px;
}
.items-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.item-row {
  display: grid;
  grid-template-columns: 1.4fr .42fr .55fr .55fr .85fr .55fr auto auto;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 13, 24, .50);
}
.item-row.parts { grid-template-columns: 1.4fr .45fr .55fr .55fr .75fr .6fr auto; }
.upload-box {
  padding: 18px;
  border: 1px dashed rgba(56, 189, 248, .38);
  border-radius: 16px;
  background: rgba(14, 165, 233, .08);
}
.upload-box p {
  margin: 9px 0 0;
  color: var(--muted);
}
.images-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.image-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(15, 23, 42, .66);
}
.image-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}
.image-card .image-body {
  display: grid;
  gap: 8px;
  padding: 10px;
}
.totals-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(8, 13, 24, .64);
}
.totals-bar div { display: grid; gap: 5px; }
.totals-bar span {
  color: var(--muted);
  font-size: 12px;
}
.totals-bar strong { font-size: 19px; }
.totals-bar .grand { color: #7dd3fc; }
.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 16px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}
.login-shell {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 22px;
  align-items: stretch;
}
.login-brand-panel,
.login-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(15, 23, 42, .95), rgba(8, 18, 32, .94));
  box-shadow: var(--shadow);
}
.login-brand-panel {
  min-height: 540px;
  display: grid;
  align-content: space-between;
  gap: 28px;
  padding: 34px;
}
.login-logo {
  width: min(360px, 100%);
  max-height: 300px;
  object-fit: contain;
  filter: drop-shadow(0 24px 30px rgba(0, 0, 0, .42));
}
.login-brand-panel h1 {
  max-width: 620px;
  font-size: 44px;
}
.login-brand-panel span {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}
.login-card {
  display: grid;
  align-content: center;
  gap: 24px;
  padding: 34px;
}
.login-card-header h2 {
  font-size: 34px;
  color: var(--text);
}
.login-form {
  display: grid;
  gap: 16px;
}
.password-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.reset-request-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.password-toggle {
  min-width: 76px;
  height: 46px;
  padding-inline: 12px;
}
.login-message {
  min-height: 44px;
  display: grid;
  align-items: center;
  padding: 10px 12px;
  color: #ffe4e6;
  border: 1px solid rgba(251, 113, 133, .30);
  border-radius: 12px;
  background: rgba(251, 113, 133, .12);
  opacity: 0;
}
.login-message:not(:empty) { opacity: 1; }
.login-message.success {
  color: #dcfce7;
  border-color: rgba(134, 239, 172, .30);
  background: rgba(34, 197, 94, .12);
}
.login-submit { min-height: 48px; }
.login-secondary {
  width: 100%;
  justify-content: center;
}
.login-submit:disabled {
  cursor: wait;
  opacity: .76;
}

@media (max-width: 1180px) {
  .cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  h1 { font-size: 40px; }
}
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
  }
  .brand {
    grid-template-columns: 82px 1fr;
    place-items: center start;
    min-height: auto;
  }
  .brand-logo {
    width: 78px;
    height: 78px;
  }
  .brand-copy { text-align: left; }
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .images-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand-panel { min-height: auto; }
  .login-logo { max-height: 220px; }
}
@media (max-width: 720px) {
  .main,
  .sidebar { padding: 16px; }
  .topbar,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }
  .topbar { min-height: auto; }
  h1 { font-size: 34px; }
  .cards-grid,
  .form-grid,
  .check-grid,
  .totals-bar {
    grid-template-columns: 1fr;
  }
  .metric-card { padding-left: 68px; }
  .span-2 { grid-column: auto; }
  .status-bar {
    grid-template-columns: 1fr auto;
  }
  .status-bar .track {
    grid-column: 1 / -1;
    order: 3;
  }
  .check-row {
    grid-template-columns: 1fr;
  }
  .item-row,
  .item-row.parts { grid-template-columns: 1fr; }
  .images-preview { grid-template-columns: 1fr; }
  .order-dialog { width: calc(100vw - 16px); }
  .login-page { padding: 14px; }
  .login-brand-panel,
  .login-card {
    padding: 22px;
    border-radius: 18px;
  }
  .login-brand-panel h1 { font-size: 32px; }
  .password-control,
  .reset-request-control { grid-template-columns: 1fr; }
  .password-toggle { width: 100%; }
  .user-pill {
    width: 100%;
    justify-content: center;
  }
}

@media print {
  body {
    background: #fff;
    color: #111;
  }
  body::before,
  .sidebar,
  .topbar,
  .alerts,
  .nav,
  button {
    display: none !important;
  }
  .app-shell { display: block; }
  .main { padding: 0; }
  .panel,
  .metric-card {
    box-shadow: none;
    border-color: #ddd;
    background: #fff;
    color: #111;
  }
  .metric-card::before { display: none; }
  h1,
  h2,
  td,
  th,
  label,
  .mini-item strong {
    color: #111;
  }
}
