:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d8dee6;
  --primary: #0f6cbd;
  --primary-dark: #0a4f8c;
  --danger: #b42318;
  --success: #146c43;
  --accent: #f3b23c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

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

a:hover {
  text-decoration: underline;
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 26px;
  background: #18212f;
  color: #fff;
  border-bottom: 4px solid var(--accent);
}

.brand {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.topbar nav {
  align-items: center;
  display: flex;
  gap: 14px;
}

.topbar nav a {
  color: #fff;
  font-weight: 600;
}

.user-chip {
  color: #d8dee6;
  font-size: 13px;
  font-weight: 700;
}

.logout-form {
  margin: 0;
}

.inline-form {
  margin: 0;
}

.compact-actions {
  gap: 6px;
}

.logout-form button {
  min-height: 32px;
  padding: 5px 10px;
  border-color: rgba(255, 255, 255, .35);
  background: transparent;
  color: #fff;
}

.page {
  width: min(1240px, calc(100% - 32px));
  margin: 24px auto 60px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2,
h3 {
  margin: 0 0 8px;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 20px;
  margin-top: 6px;
}

h3 {
  font-size: 16px;
}

p {
  margin: 0 0 12px;
}

.page-head p,
.muted,
small {
  color: var(--muted);
}

section,
.table-wrap,
.toolbar,
.alert {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.page-head {
  background: transparent;
  border: 0;
  padding: 0;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.toolbar input {
  flex: 1;
}

.button,
button {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  font-weight: 700;
  text-decoration: none;
}

.button:hover,
button:hover {
  text-decoration: none;
  border-color: #9aa7b6;
}

.button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.button.danger:hover {
  background: #8f1f16;
  border-color: #8f1f16;
}

.google-button {
  width: 100%;
}

.login-separator {
  display: grid;
  place-items: center;
  margin: 14px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.section-title,
.timeline-head,
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title {
  margin-bottom: 8px;
}

.icon-button {
  min-height: 34px;
  width: auto;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c6ced8;
  border-radius: 6px;
  padding: 10px 11px;
  min-height: 40px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.field-hint {
  align-self: end;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.warranty-valid {
  color: var(--success);
  font-weight: 700;
}

.warranty-expired {
  color: var(--danger);
  font-weight: 800;
}

.check-field {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  align-content: center;
}

.check-field input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
}

.form-subtitle {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 4px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.wide {
  grid-column: 1 / -1;
}

.stack {
  display: grid;
  gap: 12px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
  gap: 18px;
  margin-bottom: 18px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: #344054;
  font-size: 13px;
  background: #f8fafc;
}

.filter-row th {
  background: #fff;
  padding: 8px;
}

.filter-row input,
.filter-row select {
  min-width: 110px;
  min-height: 34px;
  padding: 6px 8px;
  font-size: 13px;
}

.dashboard-main-row:hover {
  background: #eef6ff;
}

.row-toggle {
  width: 30px;
  min-height: 30px;
  padding: 0;
  margin-right: 8px;
  font-size: 14px;
  line-height: 1;
  transition: transform .15s ease;
}

.row-toggle.open {
  transform: rotate(180deg);
}

.rma-link {
  font-weight: 800;
}

.dashboard-extra-row td {
  background: #fbfcfe;
  padding: 14px 18px;
}

.dashboard-extra-details {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 18px;
  margin: 0;
}

.dashboard-extra-details dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 3px;
}

.dashboard-extra-details dd {
  margin: 0;
  word-break: break-word;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e9f3ff;
  color: #0a4f8c;
  font-weight: 700;
  font-size: 13px;
}

.details {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 8px 14px;
  margin: 0 0 16px;
}

.details dt {
  color: var(--muted);
  font-weight: 700;
}

.details dd {
  margin: 0;
  word-break: break-word;
}

.detail-groups {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.detail-groups hr {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2px 0;
}

.detail-row,
.detail-pair {
  display: grid;
  gap: 6px 14px;
}

.detail-row {
  grid-template-columns: 150px minmax(0, 1fr);
}

.detail-row.stacked {
  grid-template-columns: 1fr;
}

.detail-pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-row span,
.detail-pair span {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.detail-row strong,
.detail-pair strong {
  display: block;
  font-weight: 500;
  word-break: break-word;
}

.preline {
  white-space: pre-line;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  border-left: 4px solid var(--primary);
  background: #f8fafc;
  border-radius: 6px;
  padding: 14px;
}

.timeline-head h3 {
  margin-bottom: 0;
}

.timeline-date {
  display: grid;
  align-content: start;
  gap: 4px;
}

.timeline-date span {
  color: var(--muted);
}

.attachments {
  display: grid;
  gap: 8px;
  padding-left: 18px;
  margin: 10px 0 0;
}

.notes {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.notes article {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.notes time {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.alert {
  margin-bottom: 16px;
  font-weight: 700;
}

.alert.success {
  border-color: #b7dfc8;
  color: var(--success);
  background: #edf9f1;
}

.alert.danger {
  border-color: #f1b8b3;
  color: var(--danger);
  background: #fff2f1;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.print-sheet {
  max-width: 860px;
  margin: 0 auto;
}

.report-intervention {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 0 0;
  margin-top: 10px;
}

.login-panel {
  max-width: 420px;
  margin: 70px auto;
}

.admin-split {
  margin-top: 18px;
}

.inner-table {
  border: 0;
  padding: 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.modal {
  width: min(560px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--text);
}

.modal::backdrop {
  background: rgba(16, 24, 40, .45);
}

.print-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

@media (max-width: 860px) {
  .topbar,
  .page-head,
  .toolbar,
  .split {
    display: grid;
  }

  .form-grid,
  .split,
  .timeline-item {
    grid-template-columns: 1fr;
  }

  .details {
    grid-template-columns: 1fr;
  }

  .detail-row,
  .detail-pair,
  .checkbox-grid,
  .dashboard-extra-details {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .print-actions {
    display: none;
  }

  .page {
    width: auto;
    margin: 0;
  }

  section,
  .table-wrap {
    border: 0;
    padding: 0;
  }
}
