:root {
  color-scheme: light;
  --bg: #f4f7f4;
  --surface: #ffffff;
  --surface-soft: #eef4ef;
  --field: #ffffff;
  --ink: #16201a;
  --muted: #657168;
  --line: #d9e3dc;
  --green: #19784d;
  --green-dark: #0f4f35;
  --amber: #b16b00;
  --red: #a83a35;
  --blue: #2f6690;
  --shadow: 0 18px 38px rgba(24, 46, 34, 0.1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111713;
  --surface: #1a231d;
  --surface-soft: #222f27;
  --field: #151d18;
  --ink: #edf5ef;
  --muted: #a8b7ad;
  --line: #34453a;
  --green: #54bd83;
  --green-dark: #8ed5ad;
  --amber: #e7ae51;
  --red: #ef827b;
  --blue: #78acd2;
  --shadow: 0 18px 38px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

.login-page {
  display: grid;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 18%, rgba(215, 242, 223, 0.26), transparent 28%),
    linear-gradient(135deg, rgba(19, 37, 28, 0.96), rgba(25, 120, 77, 0.88)),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .combo-menu,
:root[data-theme="dark"] .combo-menu button,
:root[data-theme="dark"] .request-list article,
:root[data-theme="dark"] .inline-create-form input,
:root[data-theme="dark"] .login-form input {
  border-color: var(--line);
  background: var(--field);
  color: var(--ink);
}

:root[data-theme="dark"] .ghost-btn,
:root[data-theme="dark"] .upload-btn,
:root[data-theme="dark"] .qr-chip {
  background: var(--surface-soft);
  color: var(--green);
}

:root[data-theme="dark"] .status.Asignado,
:root[data-theme="dark"] .status.Disponible {
  background: #213c2c;
  color: #9de0b8;
}

:root[data-theme="dark"] .status.Mantenimiento {
  background: #49391d;
  color: #f4c873;
}

:root[data-theme="dark"] .status.Dado {
  background: #472725;
  color: #f2a09a;
}

:root[data-theme="dark"] .avatar,
:root[data-theme="dark"] .asset-thumb {
  background: #2b3b31;
  color: var(--green);
}

:root[data-theme="dark"] .qr-card img {
  border-color: #ffffff;
  background: #ffffff;
}

:root[data-theme="dark"] .login-panel {
  background: rgba(26, 35, 29, 0.97);
}

:root[data-theme="dark"] .form-error {
  border-color: #75413d;
  background: #3d2422;
}

.app-shell {
  display: block;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: 84px;
  padding: 20px 14px;
  background: #13251c;
  color: #f7fbf8;
  overflow: hidden;
  transition:
    width 0.18s ease,
    padding 0.18s ease,
    box-shadow 0.18s ease;
}

.sidebar:hover,
.sidebar:focus-within {
  width: 280px;
  padding: 24px;
  box-shadow: 16px 0 38px rgba(10, 24, 16, 0.22);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 232px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #d7f2df;
  color: var(--green-dark);
  font-weight: 800;
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.role-panel p {
  color: #bad0c4;
  font-size: 0.86rem;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: #dce8e0;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #244536;
  color: #ffffff;
}

.theme-toggle {
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.icon {
  flex: 0 0 28px;
  width: 28px;
  text-align: center;
}

.nav-item span:not(.icon) {
  line-height: 1.2;
}

.brand > div:last-child,
.nav-item span:not(.icon),
.role-panel {
  transition:
    opacity 0.14s ease,
    transform 0.14s ease;
}

.sidebar:not(:hover):not(:focus-within) .brand > div:last-child,
.sidebar:not(:hover):not(:focus-within) .nav-item span:not(.icon),
.sidebar:not(:hover):not(:focus-within) .role-panel {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-8px);
}

.role-panel {
  margin-top: auto;
  display: grid;
  gap: 10px;
  min-width: 232px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.role-emblem {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.role-panel label,
.equipment-form label,
.assignment-panel label {
  display: grid;
  gap: 7px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted);
}

.assignment-panel label small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.role-panel label {
  color: #dce8e0;
}

.role-panel select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  color: var(--ink);
}

.workspace {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 100vh;
  margin-left: 84px;
  padding: 24px;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(1.7rem, 3vw, 2.35rem);
}

h2 {
  font-size: 1.12rem;
}

.top-actions,
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inventory-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.inventory-filters select,
.multi-filter summary {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 34px 9px 11px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.multi-filter {
  position: relative;
}

.multi-filter summary {
  min-width: 150px;
  list-style: none;
  cursor: pointer;
}

.multi-filter summary::-webkit-details-marker {
  display: none;
}

.multi-filter summary::after {
  position: absolute;
  top: 11px;
  right: 12px;
  content: "⌄";
}

.multi-filter[open] summary::after {
  content: "⌃";
}

.multi-filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 25;
  display: grid;
  width: min(280px, calc(100vw - 32px));
  max-height: 290px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.multi-filter-menu label {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
}

.multi-filter-menu label:hover {
  background: var(--surface-soft);
}

.multi-filter-menu input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--green);
}

.filter-clear {
  min-height: 40px;
}

.logout-form {
  margin: 0;
}

.session-menu {
  position: relative;
}

.session-user {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  max-width: 260px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.session-user > span {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-dark);
  color: #ffffff;
  font-weight: 900;
  text-transform: uppercase;
}

.session-user div {
  min-width: 0;
}

.session-user strong,
.session-user small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-user strong {
  font-size: 0.86rem;
}

.session-user small {
  color: var(--muted);
  font-size: 0.72rem;
}

.session-user b {
  color: var(--muted);
  font-size: 0.8rem;
}

.session-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: grid;
  gap: 10px;
  width: min(260px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 38px rgba(22, 32, 26, 0.16);
}

.session-dropdown.form-collapsed {
  display: none;
}

.session-dropdown p {
  display: grid;
  gap: 4px;
  margin: 0;
}

.session-dropdown span {
  color: var(--muted);
  font-size: 0.8rem;
}

.session-dropdown .ghost-btn {
  width: 100%;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(360px, 38vw);
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.qr-chip,
.upload-btn,
.report-grid button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
}

.primary-btn {
  background: var(--green);
  color: #ffffff;
}

.ghost-btn {
  background: #edf5ef;
  color: var(--green-dark);
  border-color: var(--line);
}

.upload-btn,
.qr-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #edf5ef;
  color: var(--green-dark);
  border-color: var(--line);
  font-weight: 800;
}

.qr-chip {
  min-height: 30px;
  padding: 0 10px;
}

.upload-btn {
  padding: 0 14px;
}

.upload-btn input {
  display: none;
}

.icon-btn {
  width: 40px;
  padding: 0;
  background: var(--surface);
  border-color: var(--line);
}

.view {
  display: none;
}

.form-collapsed {
  display: none !important;
}

.view.active {
  display: block;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel,
.table-wrap,
.user-card,
.front-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 18px;
}

.metric span,
.metric small,
td,
.front-grid p,
.user-card p {
  color: var(--muted);
}

.metric strong {
  font-size: 2.2rem;
  line-height: 1;
}

.split-layout,
.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
}

.panel {
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

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

.timeline-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.timeline-action {
  width: 100%;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.timeline-action:hover strong,
.timeline-action:focus-visible strong {
  color: var(--green);
}

.timeline-item p {
  margin: 4px 0 0;
  color: var(--muted);
}

.timeline-item time {
  color: var(--muted);
  font-size: 0.84rem;
}

.dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--blue);
}

.dot.ok {
  background: var(--green);
}

.dot.warn {
  background: var(--amber);
}

.front-bars {
  display: grid;
  gap: 16px;
}

.front-bars div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 12px;
}

meter {
  width: 100%;
  height: 12px;
}

.filters select,
.equipment-form input,
.equipment-form textarea,
.assignment-panel input,
.assignment-panel select,
.admin-form input,
.admin-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--field);
  color: var(--ink);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  place-items: center;
  transform: translateY(-50%);
  cursor: pointer;
}

.password-toggle:hover,
.password-toggle:focus-visible,
.password-toggle.is-visible {
  background: var(--surface-soft);
  color: var(--green);
}

.eye-icon {
  position: relative;
  display: block;
  width: 19px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 70% 20%;
  transform: rotate(45deg);
}

.eye-icon::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  transform: translate(-50%, -50%);
}

.admin-form label small {
  color: var(--muted);
  font-weight: 600;
}

.sici-dialog {
  width: min(460px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(15, 29, 20, 0.28);
}

.sici-dialog::backdrop {
  background: rgba(13, 24, 17, 0.58);
}

.sici-dialog-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.sici-dialog-heading {
  display: grid;
  gap: 4px;
}

.sici-dialog-heading h2,
.sici-dialog-panel p {
  margin: 0;
}

.sici-dialog-panel > p {
  color: var(--muted);
  line-height: 1.5;
}

.sici-dialog-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.sici-dialog-field.form-collapsed {
  display: none;
}

.sici-dialog-field input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 46px 10px 10px;
  background: var(--field);
  color: var(--ink);
}

.sici-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

::placeholder {
  color: #8a988e;
  opacity: 1;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.import-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.import-panel p {
  margin: 6px 0 0;
  color: var(--muted);
}

.import-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.import-actions input {
  display: none;
}

.import-status {
  grid-column: 1 / -1;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-weight: 700;
}

.import-preview-dialog {
  width: min(840px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(15, 29, 20, 0.28);
}

.import-preview-dialog::backdrop {
  background: rgba(13, 24, 17, 0.62);
}

.import-preview-panel {
  display: grid;
  gap: 20px;
  max-height: calc(100dvh - 30px);
  overflow-y: auto;
  padding: 24px;
}

.import-preview-heading,
.import-preview-section-heading,
.import-preview-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.import-preview-heading h2,
.import-preview-heading p,
.import-preview-section h3,
.import-preview-section p {
  margin: 0;
}

.import-preview-heading p,
.import-preview-section p {
  color: var(--muted);
}

.import-preview-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.import-preview-summary div {
  display: grid;
  gap: 4px;
  padding: 16px;
  border-right: 1px solid var(--line);
}

.import-preview-summary div:last-child {
  border-right: 0;
}

.import-preview-summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.import-preview-summary strong {
  font-size: 1.65rem;
}

.import-preview-section {
  display: grid;
  gap: 10px;
}

.import-type-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.import-type-summary span {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--surface-soft);
  font-weight: 800;
}

.import-error-list {
  display: grid;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.import-error-item {
  display: grid;
  grid-template-columns: 70px minmax(120px, 0.35fr) minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.import-error-item:last-child {
  border-bottom: 0;
}

.import-error-item strong {
  color: var(--red);
}

.import-preview-actions {
  justify-content: flex-end;
}

.table-wrap {
  overflow: auto;
}

.table-scroll-top {
  display: none;
  margin-bottom: 6px;
  overflow-x: auto;
  overflow-y: hidden;
}

.table-scroll-top.has-overflow {
  display: block;
}

.table-scroll-top > div {
  height: 1px;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

#inventoryTable {
  table-layout: fixed;
}

#inventoryTable th,
#inventoryTable td {
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}

#inventoryTable th:nth-child(1) {
  width: 18%;
}

#inventoryTable th:nth-child(2) {
  width: 14%;
}

#inventoryTable th:nth-child(3) {
  width: 15%;
}

#inventoryTable th:nth-child(4) {
  width: 22%;
}

#inventoryTable th:nth-child(5),
#inventoryTable th:nth-child(6) {
  width: 9%;
}

#inventoryTable th:nth-child(7) {
  width: 6%;
}

#inventoryTable th:nth-child(8) {
  width: 16%;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: var(--surface-soft);
  color: #415047;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-align: left;
  text-transform: inherit;
}

.sort-button span {
  color: var(--muted);
  font-size: 1rem;
}

.sort-button.active {
  color: var(--green);
}

tr:last-child td {
  border-bottom: 0;
}

.equipment-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}

.equipment-cell > div {
  min-width: 0;
}

#inventoryTable td:last-child {
  white-space: normal;
}

#inventoryTable td:last-child .text-btn {
  margin: 0 6px 6px 0;
}

.asset-thumb {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #e3f0e7;
  color: var(--green-dark);
  font-weight: 900;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-weight: 800;
  font-size: 0.82rem;
}

.inventory-status {
  max-width: 100%;
  border: 0;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
}

.inventory-status:hover,
.inventory-status:focus-visible {
  box-shadow: 0 0 0 2px var(--green);
}

.status.Asignado {
  background: #e7f4ec;
  color: var(--green-dark);
}

.status.Disponible {
  background: #e8f0f7;
  color: #244d70;
}

.status.Mantenimiento {
  background: #fff1d8;
  color: #805000;
}

.status.Dado {
  background: #f2e7e5;
  color: var(--red);
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 900;
  margin-right: 8px;
}

.text-btn.danger {
  color: var(--red);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.form-layout {
  align-items: start;
}

.scan-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.scanner-panel {
  display: grid;
  gap: 14px;
}

.scanner-frame {
  position: relative;
  display: grid;
  min-height: 420px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10231a;
}

.scanner-frame video {
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: cover;
}

.scanner-frame::after {
  content: "";
  position: absolute;
  width: min(260px, 64%);
  aspect-ratio: 1;
  border: 2px solid #d7f2df;
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(8, 20, 14, 0.44);
}

.scanner-placeholder {
  position: absolute;
  z-index: 1;
  display: grid;
  gap: 6px;
  color: #f7fbf8;
  text-align: center;
}

.scanner-placeholder span {
  color: #bad0c4;
}

.scanner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.scan-result {
  display: grid;
  gap: 10px;
}

.scan-result p {
  margin: 0;
  color: var(--muted);
}

.scan-item-card {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.scan-item-card span:not(.asset-thumb):not(.status) {
  display: block;
  color: var(--muted);
}

.equipment-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

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

textarea {
  min-height: 92px;
  resize: vertical;
}

.assignment-panel {
  display: grid;
  gap: 14px;
}

.full {
  width: 100%;
}

.user-grid,
.front-grid,
.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.report-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.report-toolbar label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.report-toolbar select {
  width: 100%;
}

.report-filter-clear {
  align-self: end;
  min-height: 42px;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.report-summary div {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
}

.report-summary div:last-child {
  border-right: 0;
}

.report-summary span,
.report-note {
  color: var(--muted);
}

.report-summary strong {
  font-size: 1.45rem;
}

.report-note {
  margin: 12px 0 0;
  font-size: 0.86rem;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 14px;
  margin-bottom: 14px;
}

.admin-form-grid.single-panel {
  grid-template-columns: minmax(0, 1fr);
}

.admin-form-grid.form-collapsed {
  display: none;
}

.combo-action {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.combo-action .ghost-btn {
  min-height: 42px;
  width: 44px;
  padding: 0;
}

.type-combobox {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
}

.type-combobox input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.combo-toggle {
  min-height: 42px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
}

.combo-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(22, 32, 26, 0.16);
}

.combo-menu.form-collapsed {
  display: none;
}

.combo-menu button,
.combo-menu span {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.combo-menu button:hover {
  background: var(--surface-soft);
}

.combo-menu button:last-child,
.combo-menu span:last-child {
  border-bottom: 0;
}

.inline-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.inline-create-form.form-collapsed {
  display: none;
}

.inline-create-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.inline-create-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  color: var(--ink);
}

.type-request-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.request-list {
  display: grid;
  gap: 10px;
}

.request-list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.request-list article > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.request-list span {
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-form-panel {
  display: grid;
  gap: 14px;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  color: var(--green-dark);
  font-weight: 900;
  cursor: pointer;
}

.switch-control input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.switch-control span {
  position: relative;
  width: 52px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #dfe9e2;
  transition: background 0.18s ease;
}

.switch-control span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(22, 32, 26, 0.2);
  transition: transform 0.18s ease;
}

.switch-control input:checked + span {
  background: var(--green);
}

.switch-control input:checked + span::after {
  transform: translateX(22px);
}

.admin-form .full {
  grid-column: 1 / -1;
}

.form-status {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.permission-list,
.admin-actions {
  display: grid;
  gap: 10px;
}

.permission-list p {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.permission-list p:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.permission-list span {
  color: var(--muted);
}

.user-card,
.front-grid article {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: #e6ece8;
  color: var(--green-dark);
  font-weight: 900;
}

.user-card span,
.front-grid span {
  color: var(--green);
  font-weight: 800;
}

.report-grid button {
  min-height: 86px;
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  text-align: left;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 19;
  visibility: hidden;
  background: rgba(13, 24, 17, 0.42);
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.detail-backdrop.open {
  visibility: visible;
  opacity: 1;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  width: min(440px, 100vw);
  height: 100vh;
  height: 100dvh;
  padding: 28px 28px 48px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  box-shadow: -18px 0 44px rgba(22, 32, 26, 0.18);
  transform: translateX(105%);
  transition: transform 0.2s ease;
}

.detail-drawer.open {
  transform: translateX(0);
}

.close-drawer {
  position: absolute;
  top: 18px;
  right: 18px;
}

.drawer-list {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.qr-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 20px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.qr-card img {
  width: 180px;
  height: 180px;
  border: 8px solid #ffffff;
  border-radius: 8px;
  background: #ffffff;
}

.qr-card span,
.qr-card a {
  display: block;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 800;
}

.qr-card strong {
  display: block;
  margin: 4px 0 8px;
  word-break: break-word;
}

.drawer-list div {
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.drawer-list span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.history-list div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.history-list span,
.history-list small {
  color: var(--muted);
  font-size: 0.78rem;
}

.drawer-assignment {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.drawer-assignment label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.drawer-assignment input,
.drawer-assignment select,
.drawer-assignment textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  color: var(--ink);
}

.drawer-assignment textarea {
  min-height: 96px;
  resize: vertical;
}

.safekeeping-panel {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.safekeeping-panel h3 {
  margin: 3px 0 0;
  font-size: 1rem;
}

.safekeeping-panel > .ghost-btn,
.safekeeping-panel > .primary-btn {
  width: 100%;
}

.safekeeping-file-input {
  display: none;
}

.safekeeping-help {
  color: var(--muted);
  line-height: 1.4;
}

.safekeeping-list {
  display: grid;
  gap: 8px;
}

.safekeeping-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.safekeeping-record div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.safekeeping-record span,
.safekeeping-record small {
  color: var(--muted);
}

.hidden-by-role {
  display: none !important;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  display: grid;
  gap: 18px;
  width: min(460px, 100%);
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 60px rgba(8, 20, 14, 0.28);
}

.login-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.login-logos img {
  width: 82px;
  height: 82px;
  object-fit: contain;
}

.login-heading {
  text-align: center;
}

.login-heading h1 {
  margin-top: 2px;
  font-size: 2.15rem;
}

.login-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 4px;
}

.login-form p {
  margin: 6px 0 0;
  color: var(--muted);
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.login-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  color: var(--ink);
}

.form-error {
  padding: 10px 12px;
  border: 1px solid #e5b5b2;
  border-radius: 8px;
  background: #fff0ef;
  color: var(--red) !important;
  font-weight: 800;
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    left: auto;
    width: 100%;
    height: auto;
    gap: 12px;
    padding: 12px;
    overflow: visible;
    box-shadow: 0 10px 28px rgba(10, 24, 16, 0.16);
  }

  .sidebar:hover,
  .sidebar:focus-within {
    width: 100%;
    padding: 12px;
  }

  .brand {
    min-width: 0;
  }

  .brand > div:last-child,
  .nav-item span:not(.icon),
  .role-panel,
  .sidebar:not(:hover):not(:focus-within) .brand > div:last-child,
  .sidebar:not(:hover):not(:focus-within) .nav-item span:not(.icon),
  .sidebar:not(:hover):not(:focus-within) .role-panel {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .nav-list {
    display: flex;
    gap: 8px;
    margin-inline: -12px;
    padding: 0 12px 4px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 40px;
    padding: 9px 12px;
  }

  .nav-item span:not(.icon) {
    max-width: 150px;
  }

  .role-panel {
    min-width: 0;
    grid-template-columns: minmax(110px, 0.45fr) minmax(160px, 0.55fr);
    align-items: center;
    padding: 10px;
  }

  .role-panel p {
    grid-column: 1 / -1;
    margin: 0;
  }

  .workspace {
    margin-left: 0;
    padding: 18px;
  }

  .metrics-grid,
  .split-layout,
  .form-layout,
  .scan-layout,
  .admin-form-grid,
  .user-grid,
  .front-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .top-actions,
  .filters,
  .inventory-filters {
    align-items: stretch;
    flex-direction: column;
  }

  .inventory-filters {
    width: 100%;
  }

  .inventory-filters select,
  .inventory-filters details,
  .inventory-filters summary,
  .filter-clear {
    width: 100%;
  }

  .multi-filter-menu {
    left: 0;
    right: auto;
    width: 100%;
  }

  .search-box {
    width: 100%;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

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

  .report-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .front-bars div {
    grid-template-columns: minmax(0, 1fr) 2fr 32px;
  }
}

@media (max-width: 640px) {
  .import-preview-panel {
    padding: 18px;
  }

  .import-preview-summary {
    grid-template-columns: 1fr;
  }

  .import-preview-summary div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .import-preview-summary div:last-child {
    border-bottom: 0;
  }

  .import-error-item {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .import-preview-actions {
    display: grid;
  }

  .import-preview-actions button {
    width: 100%;
  }

  .workspace,
  .sidebar {
    padding: 16px;
  }

  .workspace {
    padding-bottom: 28px;
  }

  h1 {
    font-size: 1.55rem;
  }

  h2 {
    font-size: 1.04rem;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .nav-list {
    margin-inline: -16px;
    padding-inline: 16px;
  }

  .nav-item {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 0.88rem;
  }

  .icon {
    flex-basis: 22px;
    width: 22px;
  }

  .role-panel {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 14px;
  }

  .top-actions .primary-btn,
  .session-menu,
  .session-user,
  .logout-form,
  .logout-form .ghost-btn,
  .scanner-actions .primary-btn,
  .scanner-actions .ghost-btn,
  .upload-btn {
    width: 100%;
  }

  .session-user {
    max-width: none;
  }

  .session-dropdown {
    left: 0;
    right: auto;
    width: 100%;
  }

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

  .report-toolbar,
  .report-summary {
    grid-template-columns: 1fr;
  }

  .report-summary div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric {
    min-height: auto;
    padding: 14px;
  }

  .metric strong {
    font-size: 1.8rem;
  }

  .panel {
    padding: 14px;
  }

  .equipment-form {
    grid-template-columns: 1fr;
  }

  .admin-form {
    grid-template-columns: 1fr;
  }

  .inline-create-form {
    grid-template-columns: 1fr;
  }

  .front-bars div {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 12px minmax(0, 1fr);
  }

  .timeline-item time {
    grid-column: 2;
  }

  .table-wrap {
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  .table-scroll-top {
    display: none !important;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  table {
    min-width: 0;
    border-collapse: separate;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tr {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  td {
    display: grid;
    grid-template-columns: minmax(96px, 0.42fr) minmax(0, 0.58fr);
    gap: 10px;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
    white-space: normal;
  }

  td:first-child {
    grid-template-columns: 1fr;
    padding-top: 0;
  }

  td:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  td:first-child::before {
    display: none;
  }

  .equipment-cell {
    align-items: flex-start;
  }

  .qr-chip,
  .text-btn {
    justify-self: start;
  }

  .scanner-frame,
  .scanner-frame video {
    min-height: min(76vh, 360px);
  }

  .scanner-actions {
    display: grid;
  }

  .import-panel {
    grid-template-columns: 1fr;
  }

  .import-actions {
    display: grid;
    justify-content: stretch;
  }

  .detail-drawer {
    width: 100%;
    padding: 22px 16px 44px;
  }

  .qr-card {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .qr-card img {
    width: min(220px, 100%);
    height: auto;
  }

  .report-grid button {
    min-height: 64px;
  }

  .login-panel {
    padding: 22px 16px;
  }

  .login-logos img {
    width: 64px;
    height: 64px;
  }

  .login-heading h1 {
    font-size: 1.8rem;
  }
}
