:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #eef3f8;
  --text: #17202a;
  --muted: #64748b;
  --line: #dce4ee;
  --green: #16b75f;
  --blue: #2c7be5;
  --g4-blue: #8bbcf0;
  --red: #e04f5f;
  --amber: #dd9b22;
  --sidebar: #102845;
  --sidebar-active: #1d3f69;
  --shadow: 0 18px 42px rgba(21, 32, 43, 0.1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08111d;
  --panel: #101a27;
  --panel-2: #162233;
  --text: #eff5fb;
  --muted: #91a0b5;
  --line: #223148;
  --shadow: 0 22px 54px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

html,
body,
#root {
  width: 100%;
  min-height: 100%;
}

html {
  overflow-x: hidden;
  overflow-y: auto;
}

body,
#root {
  overflow: visible;
}

button {
  min-height: 36px;
  border: 1px solid var(--green);
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-weight: 600;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  cursor: pointer;
}

button:hover:not(:disabled) {
  filter: brightness(1.08);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
}

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

input::placeholder {
  color: var(--muted);
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  overflow: visible;
}

.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  width: 254px;
  height: 100vh;
  min-height: 0;
  border-right: 1px solid #0a1b31;
  background: var(--sidebar);
  color: #fff;
  padding: 18px 14px 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  min-height: 0;
  margin-bottom: 22px;
  box-sizing: border-box;
}

.brand img {
  width: 170px;
  height: auto;
  max-height: none;
  object-fit: contain;
  display: block;
}

.brand-dark,
html[data-theme="dark"] .brand-light {
  display: none;
}

html[data-theme="dark"] .brand-dark {
  display: block;
}

.brand small {
  color: #c6ddf3;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  text-align: center;
  width: 100%;
}

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

.side-nav button {
  min-height: 32px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 0 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  color: #d8e8f7;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.1;
  text-decoration: none;
  background: transparent;
  cursor: pointer;
}

.side-nav button svg {
  display: block;
  flex: 0 0 auto;
  color: #c9dbef;
}

.side-nav button > svg:first-child {
  width: 15px;
  height: 15px;
  stroke-width: 1.8;
}

.side-nav .nav-chevron {
  width: 12px;
  height: 12px;
}

.nav-group .nav-icon svg {
  width: 13px;
  height: 13px;
}

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

.side-nav .nav-block {
  min-height: 32px;
  color: #d8e8f7;
  font-weight: 500;
  background: transparent;
}

.side-nav button:hover,
.side-nav button.active {
  background: var(--sidebar-active);
  color: #fff;
  filter: none;
}

.nav-group {
  display: grid;
  gap: 4px;
  margin: -2px 0 2px 18px;
  padding-left: 8px;
  border-left: 1px solid #33547a;
}

.nav-group button {
  min-height: 29px;
  background: transparent;
  color: #d8e8f7;
  font-size: 12px;
}

.nav-group .nav-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  flex: 0 0 18px;
  font-size: 16px;
  line-height: 1;
}

.nav-menu-toggle .nav-chevron {
  margin-left: auto;
  font-size: 11px;
  line-height: 1.1;
}

.sidebar-credit {
  margin-top: auto;
  padding: 0;
  color: #c6ddf3;
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
}

.sidebar-credit span {
  display: block;
  text-align: center;
}

.sidebar-credit span + span {
  margin-top: 5px;
  font-size: 11px;
}

.content {
  width: calc(100% - 254px);
  min-height: 100vh;
  margin-left: 254px;
  padding: 20px 24px 64px;
  min-width: 0;
  overflow: visible;
}

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

.title-row {
  gap: 16px;
}

.panel-head {
  min-height: 36px;
  margin-bottom: 12px;
}

.topbar {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.search-wrap {
  flex: 1;
  min-width: 190px;
  position: relative;
}

.top-search {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 0 12px;
}

.top-search input {
  flex: 1;
  min-height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  outline: 0;
}

.top-search input::placeholder {
  color: #757575;
}

.top-search-icon {
  width: 9px;
  min-width: 9px;
  height: 9px;
}

.search-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.search-results button {
  width: 100%;
  min-height: 48px;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  display: grid;
  gap: 3px;
  justify-content: stretch;
  justify-items: start;
  padding: 7px 12px;
}

.search-results button:last-child {
  border-bottom: 0;
}

.search-results strong,
.search-results span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-results strong {
  font-weight: 400;
}

.search-results span,
.search-results p {
  color: var(--muted);
  font-size: 12px;
}

.search-results p {
  margin: 0;
  padding: 12px;
}

.icon-button,
.secondary,
.panel-head button {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
}

.icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.topbar > .icon-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: 6px;
}

.topbar > .icon-button svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

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

.login-shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin-left: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  position: relative;
  width: min(430px, 100%);
  padding: 30px 28px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-logo {
  width: 128px;
  height: auto;
  margin: 0 0 26px;
  display: block;
}

html[data-theme="dark"] .login-logo.brand-light,
html[data-theme="light"] .login-logo.brand-dark {
  display: none;
}

.login-panel h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.1;
}

.login-panel label {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.login-panel button[type="submit"] {
  width: 100%;
  margin-top: 18px;
}

.login-theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  min-width: 40px;
  width: 40px;
  height: 36px;
  min-height: 36px;
  padding: 0 10px;
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--text);
}

.login-error {
  margin: 14px 0 0;
  color: var(--red);
}

.login-guidance {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.login-panel .login-sign-out {
  width: 100%;
  margin-top: 0;
}

.form-grid,
.compact-form {
  display: grid;
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.compact-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.compact-form button,
.compact-form .span-2 {
  grid-column: 1 / -1;
}

.movement-wide-form {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.movement-wide-form .span-2 {
  grid-column: span 2;
}

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

.loan-kit-form {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.loan-kit-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.loan-kit-form label input,
.loan-kit-form label select {
  width: 100%;
}

.integration-mapping-form {
  grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 1fr) minmax(180px, 1fr) auto auto;
}

.integration-mapping-form button {
  grid-column: auto;
}

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

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

.recycling-device-row,
.recycling-drive-row {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.recycling-device-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.recycling-drive-row {
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  align-items: stretch;
}

.recycling-drive-row .check-row {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.recycling-form button {
  grid-column: 1 / -1;
}

.recycling-form-actions {
  grid-column: 1 / -1;
}

.recycling-form-actions button {
  flex: 1;
}

.currency-input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  display: flex;
  align-items: center;
  overflow: hidden;
}

.currency-input span {
  padding-left: 11px;
  color: var(--muted);
  font-size: 13px;
}

.currency-input input {
  min-height: 36px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding-left: 5px;
  outline: 0;
}

.csv-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0 12px;
}

.file-picker {
  min-height: 38px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-size: 13px;
  cursor: pointer;
}

.file-picker input {
  display: none;
}

.secondary-file-picker {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 14px;
}

.summary-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 88%, var(--panel-2) 12%);
  padding: 10px;
}

.summary-grid strong,
.summary-grid span {
  display: block;
}

.summary-grid span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.status-strip {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 800;
}

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

.success-text {
  color: var(--green);
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.profile > span {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 700;
}

.profile strong,
.profile small {
  display: block;
}

.profile small {
  margin-top: 2px;
  font-size: 11px;
}

.profile small,
.title-row p,
.metric span,
.metric small,
.list-row span {
  color: var(--muted);
}

h1 {
  margin: 0 0 6px;
  font-size: 26px;
}

.title-row {
  margin-bottom: 18px;
}

.title-row p {
  margin: 0;
}

h2 {
  margin: 0;
  font-size: 16px;
}

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

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  min-height: 108px;
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  position: relative;
}

.metric-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.metric strong {
  display: block;
  font-size: 23px;
  line-height: 1;
  margin: 7px 0 3px;
}

.green {
  background: rgba(22, 183, 95, 0.18);
  color: var(--green);
}

.blue {
  background: rgba(44, 123, 229, 0.18);
  color: var(--blue);
}

.red {
  background: rgba(224, 79, 95, 0.18);
  color: var(--red);
}

.amber {
  background: rgba(221, 155, 34, 0.18);
  color: var(--amber);
}

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

.custom-dashboard {
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  grid-auto-flow: row dense;
  width: 100%;
  min-width: 0;
  margin-top: 18px;
}

.custom-dashboard > * {
  min-width: 0;
}

.custom-dashboard > .panel:not(.wide) {
  grid-column: span 2;
}

.custom-dashboard > .wide {
  grid-column: 1 / -1;
}

.custom-dashboard > .dashboard-stock-widget {
  grid-column: span 2;
}

.custom-dashboard > .panel.dashboard-item-widget {
  grid-column: span 3;
  overflow-x: auto;
}

.dashboard-card {
  cursor: grab;
}

.dashboard-card:active {
  cursor: grabbing;
}

.dashboard-grip {
  color: var(--muted);
  flex: 0 0 auto;
}

.metric .dashboard-grip {
  position: absolute;
  top: 10px;
  right: 10px;
}

.panel-head h2 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-search {
  width: min(220px, 32vw);
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
}

.table-search input {
  width: 100%;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: 0;
}

.panel-collapse-toggle {
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent !important;
  border-color: transparent !important;
  color: var(--muted) !important;
}

.panel-collapse-toggle:hover {
  background: var(--panel-2) !important;
  color: var(--text) !important;
}

.panel-head.is-collapsed {
  margin-bottom: 0;
}

.panel-head.is-collapsed ~ * {
  display: none !important;
}

.panel:has(> .panel-head.is-collapsed) {
  min-height: 0;
  align-self: start;
}

.split-tables {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 14px;
}

.admin-tools-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 14px;
  align-items: start;
}

.split-tables .panel {
  overflow-x: auto;
}

.check-row {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 11px;
  font-size: 13px;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions button {
  min-height: 30px;
  padding: 0 10px;
}

.reason-reference {
  display: grid;
  gap: 3px;
}

.reason-reference small {
  color: var(--muted);
  line-height: 1.35;
}

.select-manager {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.manager-actions {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 88%, var(--panel-2) 12%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
}

.manager-actions strong,
.manager-actions span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manager-actions span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

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

.panel {
  padding: 16px;
  min-width: 0;
  min-height: 0;
}

.compact-panel {
  align-self: start;
  min-height: 0;
}

.compact-panel.matched-panel-height {
  align-self: stretch;
}

.wide {
  grid-column: 1 / -1;
  min-height: 0;
  overflow-x: auto;
}

.wide.compact-panel {
  min-height: 0;
}

.bars,
.stack {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.slim-list {
  margin-top: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 120px) minmax(120px, 1fr) 42px 72px;
  gap: 6px;
  align-items: center;
  font-size: 13px;
}

.bar-row div {
  height: 12px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}

.bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--g4-blue);
}

.stock-destination-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 5px 0 1px;
  color: var(--muted);
  font-size: 11px;
}

.stock-destination-divider::before,
.stock-destination-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.customer-stock-row i {
  background: var(--blue);
}

.stock-destination-empty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.audit-summary-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.audit-summary-grid div:last-child strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.list-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 88%, var(--panel-2) 12%);
}

.list-row[role="button"],
.clickable-row {
  cursor: pointer;
}

.compact-location-stack {
  gap: 7px;
}

.compact-place-row {
  min-height: 38px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 7px 10px;
}

.compact-place-row .place-type {
  color: var(--muted);
  font-size: 12px;
  margin-top: 0;
  text-align: right;
}

.thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  font-weight: 900;
}

.list-row strong,
.list-row span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-row span {
  font-size: 12px;
  margin-top: 3px;
}

em {
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 8px;
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
}

.in {
  background: rgba(22, 183, 95, 0.16);
  color: var(--green);
}

.out {
  background: rgba(224, 79, 95, 0.16);
  color: var(--red);
}

.pending {
  background: rgba(222, 166, 33, 0.16);
  color: var(--amber);
}

.neutral-status {
  background: var(--panel-2);
  color: var(--muted);
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  margin-top: 12px;
  background: var(--panel);
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

th {
  color: var(--muted);
  background: var(--panel-2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

th.sortable-column {
  padding: 0;
}

.sortable-header-button {
  width: 100%;
  min-height: 35px;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  text-align: left;
  cursor: pointer;
}

.sortable-header-button:hover,
.sortable-header-button:focus-visible {
  background: var(--panel-2);
  color: var(--text);
}

.sortable-header-button svg {
  flex: 0 0 auto;
}

tbody tr:hover {
  background: rgba(44, 123, 229, 0.08);
}

.item-register-table th,
.item-register-table td {
  padding: 7px 10px;
}

.item-register-table th.sortable-column {
  padding: 0;
}

.item-register-table .sortable-header-button {
  min-height: 34px;
  padding: 7px 10px;
}

.item-register-table em {
  min-height: 20px;
  padding: 3px 7px;
}

.place-stock-table th,
.place-stock-table td {
  padding: 6px 10px;
}

.place-stock-table th.sortable-column {
  padding: 0;
}

.place-stock-table .sortable-header-button {
  min-height: 32px;
  padding: 6px 10px;
}

.place-stock-table .quantity-link {
  min-height: 26px;
}

.quantity-link {
  min-width: 34px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.quantity-link:hover,
.quantity-link:focus-visible {
  border-color: var(--green);
  color: var(--green);
}

.item-name-link {
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.item-name-link:hover,
.item-name-link:focus-visible {
  color: var(--green);
  text-decoration: underline;
}

.item-stock-summary-table {
  margin-top: 18px;
}

.clickable-metric {
  --metric-link-accent: var(--red);
  cursor: pointer;
}

.clickable-metric.metric-link-amber {
  --metric-link-accent: var(--amber);
}

.clickable-metric.metric-link-green {
  --metric-link-accent: var(--green);
}

.clickable-metric.metric-link-blue {
  --metric-link-accent: var(--g4-blue);
}

.clickable-metric:hover,
.clickable-metric:focus-visible {
  border-color: var(--metric-link-accent);
}

.stock-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 10, 18, 0.72);
}

.stock-detail-dialog {
  width: min(920px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  padding: 20px;
  overflow: auto;
}

.permission-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.permission-group {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.permission-group legend {
  padding: 0 5px;
  color: var(--muted);
  font-size: 12px;
}

.permission-row {
  min-height: 34px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.permission-row input {
  width: 17px;
  height: 17px;
  min-height: 17px;
  margin: 0;
  accent-color: var(--green);
}

@media (max-width: 720px) {
  .permission-groups { grid-template-columns: 1fr; }
  .permission-dialog .stock-detail-heading { grid-template-columns: 1fr; }
  .permission-dialog .stock-detail-heading-actions { justify-content: flex-start; flex-wrap: wrap; }
}

.stock-detail-heading,
.serial-detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.stock-detail-heading h2,
.stock-detail-heading p {
  margin: 0;
}

.stock-detail-heading p {
  margin-top: 4px;
  color: var(--muted);
}

.stock-detail-heading-actions,
.stock-position-editor-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.stock-detail-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

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

.stock-detail-summary > span,
.stock-detail-summary > label {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  overflow-wrap: anywhere;
}

.stock-detail-summary strong {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.stock-detail-summary label input {
  margin-top: 4px;
}

.stock-position-editor-actions {
  grid-column: 1 / -1;
}

.editable-stock-note {
  grid-column: span 1;
}

.stock-note-editor,
.stock-note-value {
  display: grid;
  gap: 8px;
}

.stock-note-value {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.stock-note-value button,
.stock-note-editor button,
.serial-detail-row button {
  min-height: 32px;
}

.serial-detail-list {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.serial-detail-row {
  grid-template-columns: minmax(190px, 0.8fr) minmax(260px, 1.2fr) minmax(170px, auto);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.customer-serial-detail-list .serial-detail-row {
  grid-template-columns: minmax(180px, 0.8fr) minmax(160px, 0.7fr) minmax(220px, 1.2fr) minmax(120px, auto);
}

.low-stock-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.3fr) minmax(130px, 0.5fr) auto auto;
  gap: 10px;
  align-items: center;
  margin: 12px 0 18px;
}

.serial-detail-row:last-child {
  border-bottom: 0;
}

.serial-detail-labels {
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
}

.serial-detail-list > .muted {
  margin: 0;
  padding: 14px 12px;
}

.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 12px;
}

.pagination div {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pagination button {
  min-height: 30px;
  padding: 0 10px;
}

.pagination button.active {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.compact-pagination .icon-button {
  width: 32px;
  padding: 0;
}

.pagination-gap {
  min-width: 18px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.table-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 12px;
}

.table-footer .pagination {
  margin-top: 0;
}

.more-button {
  min-height: 30px;
}

.location-map-form {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(120px, 0.55fr) minmax(120px, 0.55fr) minmax(260px, 1.5fr) auto auto;
  gap: 10px;
  align-items: center;
}

.location-map-selector select {
  min-width: 240px;
}

.location-map-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 12px;
}

.location-map-bay {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel-2);
  transition: border-color 140ms ease, opacity 140ms ease, transform 140ms ease;
}

.location-map-bay.dragging {
  opacity: 0.55;
  border-color: var(--g4-blue);
  transform: scale(0.99);
}

.location-map-bay > header {
  min-height: 42px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  color: #ffffff;
  background: #1d75bc;
  cursor: grab;
  user-select: none;
}

.location-map-bay > header:active {
  cursor: grabbing;
}

.location-map-grip {
  color: #d9ecff;
}

.location-map-bay > header strong {
  font-weight: 600;
}

.location-map-bay > header span {
  font-size: 11px;
  color: #e5f2ff;
}

.location-map-shelves {
  display: grid;
}

.location-map-shelf {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(76px, auto) minmax(120px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
}

.location-map-shelf:last-child {
  border-bottom: 0;
}

.location-map-shelf > strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 500;
}

.shelf-marker {
  color: var(--g4-blue);
  font-size: 12px;
  white-space: nowrap;
}

.location-map-empty {
  margin: 0;
  padding: 34px 16px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
}

.movement-date {
  white-space: nowrap;
}

.settings-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.settings-links button {
  min-height: 72px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-align: left;
}

.settings-links button span {
  display: grid;
  gap: 4px;
}

.settings-links button strong {
  font-weight: 400;
}

.settings-links button small {
  color: var(--muted);
  line-height: 1.4;
}

.audit-log-panel {
  align-self: start;
}

.audit-log-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.audit-log-filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.audit-log-filters button {
  min-width: 88px;
}

.audit-log-table {
  overflow-x: auto;
}

.audit-user-email {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 980px) {
  .audit-log-filters {
    grid-template-columns: 1fr 1fr;
  }

  .audit-log-filters button {
    grid-column: 1 / -1;
  }

  .location-map-form,
  .location-map-board {
    grid-template-columns: 1fr;
  }

  .location-map-selector select {
    min-width: 0;
    width: 100%;
  }

  .audit-summary-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

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

  .integration-mapping-form button {
    grid-column: auto;
  }
  .metrics,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

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

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

  .custom-dashboard > .metric,
  .custom-dashboard > .panel,
  .custom-dashboard > .wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: 84px;
  }

  .content {
    width: calc(100% - 84px);
    margin-left: 84px;
  }

  .brand {
    min-height: 72px;
  }

  .brand img,
  .brand small,
  .sidebar-credit,
  .nav-chevron {
    display: none;
  }

  .side-nav button,
  .nav-group button {
    justify-content: center;
    font-size: 0;
  }

  .nav-group {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }

  .profile div {
    display: none;
  }
}

.bar-row > strong {
  text-align: right;
  white-space: nowrap;
}

.bar-row-head {
  color: var(--muted);
  font-size: 11px;
}

.bar-row-head span:nth-child(n + 3) {
  text-align: right;
  white-space: nowrap;
}

.bar-row.clickable-row {
  border-radius: 6px;
  padding: 4px 6px;
  margin: -4px -6px;
}

.bar-row.clickable-row:hover {
  background: var(--panel-2);
}

.report-builder form,
.report-filters {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.report-basics {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 2fr) minmax(180px, 1fr);
  gap: 10px;
}

.report-builder h3 {
  margin: 2px 0 0;
  font-size: 14px;
}

.report-field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 8px;
}

.report-filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.report-filter-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(170px, 1fr) minmax(180px, 1fr) 40px;
  gap: 8px;
  align-items: center;
}

.report-builder-actions {
  justify-content: flex-end;
}

#report-results {
  scroll-margin-top: 18px;
}

@media (max-width: 680px) {
  .audit-log-filters {
    grid-template-columns: 1fr;
  }

  .audit-log-filters button {
    grid-column: auto;
  }

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

  .settings-links {
    grid-template-columns: 1fr;
  }

  .panel-head-actions {
    width: 100%;
    align-items: stretch;
  }

  .panel-head:has(.panel-head-actions) {
    flex-wrap: wrap;
  }

  .table-search {
    width: 100%;
  }

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

  .sidebar {
    display: none;
  }

  .content {
    width: 100%;
    margin-left: 0;
    padding: 14px;
  }

  .topbar {
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .search-wrap {
    min-width: 100%;
    order: 2;
  }

  .title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .profile {
    display: flex;
    margin-left: auto;
  }

  .actions button {
    flex: 1;
  }

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

  .movement-wide-form .span-2 {
    grid-column: auto;
  }

  .recycling-device-row,
  .recycling-drive-row {
    grid-template-columns: 1fr;
  }

  .report-basics,
  .report-field-grid,
  .report-filter-row {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 96px minmax(64px, 1fr) 38px 66px;
    gap: 5px;
    font-size: 12px;
  }

  .stock-detail-summary,
  .serial-detail-row,
  .low-stock-form {
    grid-template-columns: 1fr;
  }
}

/* G4GlueSync domain additions. Shared shell rules above remain the design source of truth. */
[hidden] { display: none !important; }

.mobile-menu { display: none; }

.page-tools,
.filter-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-row select,
.filter-row input { width: min(230px, 100%); }

.submission-filter-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.submission-filter-search {
  min-width: 0;
  height: 38px;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
}

.submission-filter-search svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.submission-filter-search input {
  min-width: 0;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  outline: 0;
}

.submission-filter-row select {
  width: 210px;
  flex: 0 0 210px;
  background: var(--panel-2);
}

.table-wrap { width: 100%; overflow-x: auto; }

.status-badge {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.status-uploaded,
.status-manually_completed { background: rgba(22,183,95,.16); color: var(--green); }
.status-needs_customer,
.status-needs_folder,
.status-received { background: rgba(221,155,34,.16); color: var(--amber); }
.status-retry_required { background: rgba(224,79,95,.16); color: var(--red); }

.metric-button {
  width: 100%;
  border-color: var(--line);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  justify-content: flex-start;
}

.metric-button:hover { filter: none !important; }

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

.empty-state svg { margin-bottom: 8px; }

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

.integration-status {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.integration-status:last-child { border-bottom: 0; }
.integration-status strong,
.integration-status small { display: block; }
.integration-status small { margin-top: 4px; color: var(--muted); }

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

.field-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.field-grid .span-2 { grid-column: 1 / -1; }

.detail-value {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 18px;
}

.modal-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.modal-section h3 { margin: 0 0 10px; font-size: 14px; }

.suggestion-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.suggestion-heading h3 { margin-bottom: 4px; }

.suggestion-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.suggestion-card {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 16px;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  text-align: left;
}

.suggestion-card:hover,
.suggestion-card.selected {
  border-color: var(--green);
  filter: none !important;
}

.suggestion-card.selected { background: rgba(22, 183, 95, 0.1); }

.suggestion-card strong,
.suggestion-card small { display: block; }

.suggestion-card strong { font-weight: 600; }
.suggestion-card small { margin-top: 4px; color: var(--muted); font-weight: 400; }
.suggestion-card > svg { width: 15px; height: 15px; color: var(--muted); }

.suggestion-card mark {
  border-radius: 3px;
  padding: 0 1px;
  background: rgba(22, 183, 95, 0.2);
  color: inherit;
}

.suggestion-score {
  border-radius: 999px;
  padding: 4px 7px;
  background: rgba(44, 123, 229, 0.14);
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.suggestion-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
}

.suggestion-selection {
  margin: 9px 0 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
}

.text-button {
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  justify-content: flex-start;
}

.text-button:hover { color: var(--green); filter: none !important; text-decoration: underline; }

.button-link {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.status-badge svg { width: 14px; height: 14px; }

.sort-indicator { width: 13px; height: 13px; }

.notice-success { border-color: rgba(22,183,95,.45); color: var(--green); }
.notice-error { border-color: rgba(224,79,95,.45); color: var(--red); }

.mobile-backdrop { display: none; }

@media (max-width: 980px) {
  .integration-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .mobile-menu { display: inline-flex; }
  .sidebar.mobile-open {
    display: flex;
    width: min(254px, calc(100vw - 48px));
    box-shadow: var(--shadow);
  }
  .sidebar.mobile-open .brand { min-height: 0; }
  .sidebar.mobile-open .brand img,
  .sidebar.mobile-open .brand small,
  .sidebar.mobile-open .sidebar-credit,
  .sidebar.mobile-open .nav-chevron { display: block; }
  .sidebar.mobile-open .side-nav button,
  .sidebar.mobile-open .nav-group button { justify-content: flex-start; font-size: 13px; }
  .sidebar.mobile-open .nav-group button { font-size: 12px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-grid .span-2 { grid-column: auto; }
  .suggestion-list { grid-template-columns: 1fr; }
  .filter-row > * { width: 100% !important; }

  .submission-filter-row { gap: 8px; }
  .submission-filter-row select { width: 142px; flex-basis: 142px; }
}
