:root {
  color-scheme: light;
  --bg: #f2f5f0;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-2: #edf4ef;
  --ink: #14211b;
  --muted: #65736c;
  --line: #d7e3dc;
  --primary: #006b50;
  --primary-2: #00825f;
  --brand: #006b50;
  --emerald-deep: #071d16;
  --emerald-ink: #0f3528;
  --gold: #b79a5c;
  --danger: #b42318;
  --warn: #c27700;
  --ok: #16784f;
  --shadow: 0 18px 46px rgba(16, 45, 34, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    url("/assets/backgrounds/app-emerald-texture.png") center / cover fixed,
    linear-gradient(135deg, rgba(0, 107, 80, 0.1), rgba(183, 154, 92, 0.07) 42%, rgba(255, 255, 255, 0) 74%),
    repeating-linear-gradient(135deg, rgba(15, 53, 40, 0.035) 0 1px, transparent 1px 14px),
    var(--bg);
  background-attachment: fixed;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(0, 107, 80, 0.16);
}

button:hover {
  background: linear-gradient(135deg, #005a44, var(--primary-2));
}

button:disabled {
  cursor: not-allowed;
  background: #d8e1dd;
  color: #7a8782;
}

button.secondary {
  background: #e7eee9;
  color: var(--ink);
  box-shadow: none;
}

button.secondary:hover {
  background: #dbe8e0;
}

input,
select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  padding: 8px 10px;
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 3px solid rgba(0, 107, 80, 0.14);
  border-color: var(--primary);
}

.login-page {
  display: grid;
  place-items: center;
  background:
    url("/assets/backgrounds/login-emerald-bg.png") center / cover fixed,
    linear-gradient(135deg, rgba(0, 107, 80, 0.16), rgba(183, 154, 92, 0.09) 48%, rgba(255, 255, 255, 0.34)),
    repeating-linear-gradient(135deg, rgba(15, 53, 40, 0.04) 0 1px, transparent 1px 14px),
    #f5f7f2;
}

.login-shell {
  width: min(440px, calc(100vw - 32px));
}

.login-card {
  background: var(--surface);
  border: 1px solid rgba(15, 53, 40, 0.13);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 34px;
  backdrop-filter: blur(10px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.login-brand-lockup {
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
  text-align: center;
}

.brand-full-logo {
  display: block;
  width: min(210px, 68vw);
  height: auto;
}

.brand-lockup strong {
  display: block;
  font-size: 18px;
}

.brand-lockup span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: linear-gradient(135deg, #063a2c, var(--primary-2));
  color: #fff;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(183, 154, 92, 0.22), 0 12px 24px rgba(0, 107, 80, 0.16);
}

.brand-mark img {
  width: 36px;
  height: 36px;
  display: block;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: 0;
}

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

.login-form,
.settings-form,
.entry-form {
  display: grid;
  gap: 14px;
}

.login-form label,
.settings-form label,
.entry-form label {
  display: grid;
  gap: 6px;
  color: #344350;
  font-size: 14px;
}

.login-form .remember-me {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}

.remember-me input {
  width: 16px;
  height: 16px;
  min-height: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.form-error {
  min-height: 20px;
  color: var(--danger);
}

.form-note {
  min-height: 20px;
  color: var(--primary);
}

.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    linear-gradient(180deg, #061b15, var(--emerald-deep) 46%, #0d3025),
    var(--emerald-deep);
  color: #fff;
  padding: 22px 14px;
  border-right: 1px solid rgba(183, 154, 92, 0.22);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05), 12px 0 36px rgba(8, 37, 29, 0.08);
}

.logo {
  display: flex;
  align-items: center;
  padding: 4px 6px 24px;
}

.logo strong {
  font-size: 16px;
  line-height: 1.15;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  background: transparent;
  color: #cbd8d2;
  box-shadow: none;
}

.nav-btn img {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  opacity: 0.72;
}

.nav-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-btn:hover,
.nav-btn.active {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(183, 154, 92, 0.12));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(183, 154, 92, 0.16);
}

.nav-btn:hover img,
.nav-btn.active img {
  opacity: 1;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.icon-button img {
  width: 16px;
  height: 16px;
  filter: brightness(0) saturate(100%) invert(13%) sepia(20%) saturate(928%) hue-rotate(93deg) brightness(93%) contrast(90%);
}

.main {
  padding: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0) 260px),
    transparent;
}

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

.compact-topbar {
  justify-content: flex-end;
  margin-bottom: 12px;
}

.topbar h1 {
  margin: 0 0 5px;
  font-size: 26px;
  letter-spacing: 0;
  color: var(--emerald-ink);
}

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

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 18px;
}

.upload-band,
.panel {
  background: var(--surface);
  border: 1px solid rgba(15, 53, 40, 0.13);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.upload-band {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px;
}

.upload-band h2,
.panel h2 {
  margin: 0 0 4px;
  font-size: 18px;
  letter-spacing: 0;
}

.upload-band p,
.panel-head span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.import-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.import-footer {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(237, 244, 239, 0.8));
  box-shadow: none;
}

.import-footer h2 {
  font-size: 16px;
}

.import-footer p + p {
  margin-top: 4px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
}

.kpi {
  min-height: 112px;
  background: var(--surface);
  border: 1px solid rgba(15, 53, 40, 0.13);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 17px;
  backdrop-filter: blur(10px);
}

.dashboard-kpi-panel .kpi-grid {
  padding: 18px;
}

.kpi[data-dashboard-target],
.metric-card[data-dashboard-target],
.rank-card[data-dashboard-target] {
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.kpi[data-dashboard-target]:hover,
.metric-card[data-dashboard-target]:hover,
.rank-card[data-dashboard-target]:hover,
.kpi[data-dashboard-target]:focus-visible,
.metric-card[data-dashboard-target]:focus-visible,
.rank-card[data-dashboard-target]:focus-visible {
  border-color: rgba(18, 107, 93, 0.4);
  box-shadow: 0 16px 32px rgba(15, 67, 52, 0.14);
  transform: translateY(-1px);
  outline: none;
}

.kpi .label {
  color: var(--muted);
  font-size: 13px;
}

.kpi .value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0;
}

.kpi .hint {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.kpi.risk .value {
  color: var(--danger);
}

.dashboard-filter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
}

.dashboard-filter h2 {
  font-size: 16px;
}

.dashboard-filter .date-range-filter {
  justify-content: flex-end;
}

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

.metric-card,
.rank-card {
  background: var(--surface);
  border: 1px solid rgba(15, 53, 40, 0.13);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  backdrop-filter: blur(10px);
}

.metric-card {
  min-height: 128px;
}

.metric-title,
.rank-head span {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  margin-top: 10px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0;
}

.metric-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.metric-sub.up {
  color: var(--ok);
  font-weight: 700;
}

.metric-sub.down {
  color: var(--danger);
  font-weight: 700;
}

.rank-card.wide {
  grid-column: span 2;
}

.rank-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

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

.rank-list.compact {
  gap: 8px;
}

.rank-row {
  display: grid;
  gap: 6px;
}

.rank-row-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.rank-row-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-row-main span {
  color: var(--muted);
  white-space: nowrap;
}

.rank-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfeae3;
}

.rank-bar span {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--gold));
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel {
  overflow: hidden;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(237, 244, 239, 0.82));
}

.register-panel .panel-head {
  padding: 12px 18px;
}

.register-panel h2 {
  margin-bottom: 0;
}

.table-head {
  align-items: center;
}

.bar-list {
  display: grid;
  gap: 12px;
  padding: 16px 18px 18px;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.bar-track {
  height: 9px;
  background: #dfeae3;
  border-radius: 99px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  background: linear-gradient(90deg, var(--primary), var(--gold));
}

.month-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 210px;
  padding: 18px;
}

.month-item {
  display: grid;
  align-items: end;
  gap: 8px;
  height: 180px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.month-column {
  display: grid;
  align-items: end;
  height: 140px;
  background: #dfeae3;
  border-radius: 6px 6px 0 0;
  overflow: hidden;
}

.month-column span {
  display: block;
  min-height: 2px;
  background: linear-gradient(180deg, var(--primary-2), var(--primary));
}

.filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.wide-filter-input {
  min-width: 280px;
  flex: 1 1 320px;
}

.table-search-band {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid rgba(21, 91, 64, 0.08);
  border-bottom: 1px solid var(--line);
  background: rgba(248, 251, 248, 0.78);
}

.table-search-band select {
  flex: 0 0 150px;
}

.table-search-band input {
  flex: 1 1 520px;
  min-width: 320px;
}

.table-search-band button {
  min-width: 86px;
}

.receive-search-band {
  justify-content: center;
}

.receive-search-band input {
  flex: 0 1 760px;
  max-width: 760px;
}

.date-range-filter {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.date-range-filter select {
  min-width: 120px;
}

.date-range-filter input[type="date"] {
  width: 142px;
}

.range-separator {
  color: var(--muted);
  font-size: 13px;
}

.clamp-2 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.checkline {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

.checkline input {
  min-height: auto;
}

.table-count {
  padding: 10px 18px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.mini-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(237, 244, 239, 0.76));
}

.mini-kpi {
  display: grid;
  gap: 4px;
  min-height: 64px;
  border: 1px solid rgba(15, 53, 40, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 10px 12px;
}

.mini-kpi span {
  color: var(--muted);
  font-size: 12px;
}

.mini-kpi strong {
  font-size: 22px;
}

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

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 13px;
}

.register-table {
  min-width: 1360px;
}

.refund-retention-table {
  min-width: 1480px;
}

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

tr.duplicate-row td {
  background: #fff4df;
}

tr.duplicate-row:hover td {
  background: #ffedc2;
}

tr.starred-row td {
  background: #fff8df;
}

tr.starred-row:hover td {
  background: #ffefb9;
}

.warehouse-alert {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 5px 8px;
  border: 1px solid rgba(178, 134, 46, 0.36);
  border-radius: 7px;
  color: #76540a;
  background: rgba(255, 247, 218, 0.92);
  font-size: 12px;
}

.warehouse-alert strong {
  color: #5f4105;
}

tr.muted-row td {
  background: #f8fbf8;
}

th {
  color: #40505d;
  font-weight: 700;
  background: #f8fbf8;
  position: sticky;
  top: 0;
}

td .main-text {
  font-weight: 700;
}

td .sub-text {
  margin-top: 4px;
  color: var(--muted);
  max-width: 320px;
  line-height: 1.35;
}

.copyable-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: start;
  max-width: 360px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.copyable-line span {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.copy-chip {
  min-width: 56px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid rgba(0, 112, 86, 0.22);
  border-radius: 7px;
  background: rgba(230, 244, 239, 0.95);
  color: var(--brand);
  box-shadow: none;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.copy-chip:hover {
  border-color: rgba(0, 112, 86, 0.38);
  background: rgba(214, 238, 230, 0.95);
}

.copy-chip:disabled {
  cursor: default;
  opacity: 0.72;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: #344350;
  white-space: nowrap;
}

.badge.pending,
.badge.in_transit,
.badge.not_returned,
.badge.pending_review,
.badge.pending_return,
.badge.pending_check,
.badge.timeout,
.badge.follow_later,
.badge.no_answer {
  background: #fff1dc;
  color: #8a4f00;
}

.badge.not_returned,
.badge.refunded,
.badge.ineligible,
.badge.small_issue,
.badge.platform_popup,
.badge.missing_time,
.badge.invalid {
  background: #ffe6e2;
  color: var(--danger);
}

.badge.received,
.badge.eligible,
.badge.shipped,
.badge.retained,
.badge.completed {
  background: #e4f6ee;
  color: var(--ok);
}

.refund-retention-table .badge.shipped {
  background: #ffe6e2;
  color: var(--danger);
}

.badge.checked,
.badge.claimed {
  background: #e8f0ff;
  color: #2452a6;
}

.badge.retained {
  background: #e8f0ff;
  color: #2452a6;
}

.badge.waived {
  background: #f0edf7;
  color: #5f477f;
}

.badge.voided,
.badge.cancelled {
  background: #e8eff2;
  color: var(--muted);
}

.badge.pending_receive,
.badge.checking {
  background: #fff1dc;
  color: #8a4f00;
}

.badge.abnormal {
  background: #ffe6e2;
  color: var(--danger);
}

.badge.rejected,
.badge.out_of_stock {
  background: #ffe6e2;
  color: var(--danger);
}

.badge.repairing,
.badge.processing,
.badge.low_stock {
  background: #e8f0ff;
  color: #2452a6;
}

.badge.repaired,
.badge.returned_to_service,
.badge.in_stock {
  background: #e4f6ee;
  color: var(--ok);
}

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

.duplicate-flag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #b42318;
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}

.row-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  min-width: 120px;
}

.row-actions button {
  padding: 7px 9px;
  background: #e7eee9;
  color: var(--ink);
  box-shadow: none;
}

.row-actions .danger-button,
.danger-button {
  background: #f6e7e7;
  color: #a42424;
  box-shadow: none;
}

.row-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.register-row-tools {
  display: grid;
  gap: 7px;
  min-width: 170px;
}

.inline-warehouse-fields {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(120px, 0.9fr) auto;
  gap: 6px;
  align-items: center;
  min-width: 360px;
}

.inline-notice-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 210px;
}

.inline-note-fields {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-width: 240px;
  margin-top: 7px;
}

.refund-extra-field {
  display: grid;
  gap: 4px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  min-width: 160px;
}

.refund-extra-field input {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 13px;
}

.inline-return-fields {
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) minmax(130px, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-width: 330px;
  margin-top: 7px;
}

.inline-warehouse-fields input {
  min-height: 34px;
  padding: 6px 8px;
}

.inline-return-fields input,
.inline-note-fields input {
  min-height: 34px;
  padding: 6px 8px;
}

.inline-warehouse-fields button,
.inline-return-fields button,
.inline-note-fields button {
  padding: 7px 10px;
}

.inline-warehouse-status {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
}

.return-follow-box {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid rgba(21, 91, 64, 0.16);
  border-radius: 7px;
  background: rgba(244, 248, 245, 0.9);
  min-width: 260px;
}

.return-follow-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.return-follow-latest {
  display: grid;
  gap: 3px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.return-follow-latest strong {
  color: var(--primary);
  font-size: 13px;
}

.return-follow-latest p,
.follow-history-item p {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
}

.tracking-link {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.tracking-link:hover {
  text-decoration: underline;
}

.settings-form {
  padding: 18px;
}

.simple-list {
  display: grid;
  gap: 8px;
  padding: 0 18px 18px;
}

.simple-list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  width: 100%;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: left;
  background: transparent;
  box-shadow: none;
}

.simple-list-row strong {
  color: var(--ink);
  font-size: 14px;
}

button.simple-list-row {
  border-radius: 0;
  padding: 10px 0 0;
}

button.simple-list-row:hover {
  background: transparent;
  color: var(--primary);
}

.permission-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
}

.permission-check {
  min-width: 110px;
}

.credential-row span {
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 0;
}

.entry-form {
  padding: 18px;
}

.compact-form {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.shop-field {
  display: grid;
  gap: 6px;
}

.inline-custom-input {
  min-height: 36px;
}

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

.register-form {
  gap: 12px;
  padding-top: 12px;
}

.register-form .form-note:empty {
  display: none;
}

.register-grid {
  grid-template-columns: minmax(140px, 0.75fr) minmax(180px, 1fr) minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 10px;
}

.register-grid .span-1 {
  grid-column: span 1;
}

.register-grid .span-2 {
  grid-column: span 2;
}

.register-grid .span-3 {
  grid-column: span 3;
}

.register-grid .register-item-field {
  grid-column: span 3;
}

.register-grid .register-remark-field {
  grid-column: span 2;
}

.register-grid input,
.register-grid select {
  min-height: 38px;
}

.register-grid label {
  gap: 4px;
}

.offline-payment-toggle {
  align-self: end;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 0 10px;
  color: #344350;
  font-weight: 700;
}

.offline-payment-toggle input {
  min-height: auto;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.compact-paste {
  min-height: 58px;
  align-content: start;
  padding: 9px 10px;
}

.compact-paste .thumb-list {
  gap: 6px;
}

.compact-paste .thumb-item {
  width: 58px;
}

.compact-paste .thumb-list img,
.compact-paste .thumb-item button {
  width: 54px;
}

.compact-paste .thumb-list img {
  height: 54px;
}

.register-proof-zone {
  align-self: end;
  min-height: 74px;
}

.register-proof-zone .thumb-list {
  min-height: 0;
}

.checkbox-panel,
.advanced-fields {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 251, 248, 0.9);
  padding: 10px 12px;
}

.field-title,
.advanced-fields summary {
  color: #344350;
  font-size: 14px;
  font-weight: 700;
}

.advanced-fields summary {
  cursor: pointer;
}

.advanced-fields .settings-grid {
  margin-top: 12px;
}

.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 7px;
}

.checkbox-panel p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.paste-zone {
  display: grid;
  gap: 6px;
  min-height: 92px;
  border: 1px dashed #8fb3a4;
  border-radius: 8px;
  background: rgba(247, 251, 249, 0.88);
  padding: 12px;
  cursor: text;
}

.paste-zone:focus {
  outline: 3px solid rgba(0, 107, 80, 0.14);
  border-color: var(--primary);
}

.paste-zone strong {
  font-size: 14px;
}

.paste-zone span {
  color: var(--muted);
  font-size: 13px;
}

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

.thumb-item {
  display: grid;
  gap: 4px;
  width: 72px;
}

.thumb-list img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
}

.thumb-preview {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
  cursor: zoom-in;
}

.thumb-preview img {
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.thumb-preview:hover img {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.thumb-item button {
  width: 64px;
  padding: 4px 0;
  font-size: 12px;
  background: #e7eee9;
  color: var(--ink);
  box-shadow: none;
}

.table-thumbs {
  margin-top: 6px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  background: #0f241c;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  box-shadow: var(--shadow);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(9, 33, 24, 0.38);
  backdrop-filter: blur(10px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: rgba(250, 252, 250, 0.98);
  box-shadow: 0 24px 70px rgba(7, 36, 25, 0.24);
}

.register-edit-modal {
  width: min(980px, 100%);
}

.repair-edit-modal {
  width: min(980px, 100%);
}

.modal-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.icon-close {
  width: auto;
  padding: 7px 10px;
  background: #e7eee9;
  color: var(--ink);
  box-shadow: none;
}

.follow-history {
  display: grid;
  gap: 10px;
  max-height: 240px;
  overflow: auto;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.follow-history-item {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(21, 91, 64, 0.14);
  border-radius: 7px;
  background: #fff;
}

.follow-history-item > div:first-child {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.follow-history-item strong {
  color: var(--primary);
}

.follow-history-item span,
.empty-follow-note {
  color: var(--muted);
  font-size: 12px;
}

.modal-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 18px 18px;
}

.modal-form label:not(.checkline) {
  display: grid;
  gap: 6px;
  align-content: start;
  color: #344350;
  font-size: 14px;
}

.modal-form input,
.modal-form select,
.modal-form textarea {
  width: 100%;
  box-sizing: border-box;
}

.modal-form .wide,
.modal-actions {
  grid-column: 1 / -1;
}

.modal-checkline {
  min-height: 38px;
  align-items: center;
}

.modal-form textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
}

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

.image-preview-card {
  width: min(980px, 100%);
}

.image-preview-stage {
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 14px;
  background: #f4f8f6;
}

.image-preview-stage img {
  max-width: 100%;
  max-height: min(72vh, 760px);
  object-fit: contain;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(7, 36, 25, 0.18);
}

@media (max-width: 920px) {
  body {
    background-attachment: scroll;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: auto;
  }

  .logo {
    padding: 0 12px 0 0;
    white-space: nowrap;
  }

  .nav-btn {
    width: auto;
    margin-bottom: 0;
    white-space: nowrap;
  }

  .main {
    padding: 16px;
  }

  .topbar,
  .upload-band,
  .dashboard-filter,
  .panel-head,
  .table-head {
    display: grid;
  }

  .filters,
  .date-range-filter,
  .table-search-band {
    width: 100%;
  }

  .filters select,
  .filters input,
  .filters button,
  .date-range-filter input[type="date"],
  .date-range-filter select,
  .wide-filter-input,
  .table-search-band select,
  .table-search-band input,
  .table-search-band button {
    width: 100%;
    min-width: 0;
  }

  .kpi-grid,
  .grid-2,
  .dashboard-insights,
  .mini-kpis {
    grid-template-columns: 1fr;
  }

  .rank-card.wide {
    grid-column: auto;
  }

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

  .register-grid .span-1 {
    grid-column: span 1;
  }

  .register-grid .span-2,
  .register-grid .span-3,
  .register-grid .register-item-field,
  .register-grid .register-remark-field,
  .register-grid .wide {
    grid-column: 1 / -1;
  }

  .import-form,
  .top-actions {
    flex-wrap: wrap;
  }
}

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

  .register-grid .span-1,
  .register-grid .span-2,
  .register-grid .span-3,
  .register-grid .register-item-field,
  .register-grid .register-remark-field,
  .register-grid .wide {
    grid-column: 1 / -1;
  }

  .form-actions button {
    width: 100%;
  }

  .inline-warehouse-fields {
    grid-template-columns: 1fr;
    min-width: 220px;
  }

  .inline-return-fields {
    grid-template-columns: 1fr;
    min-width: 220px;
  }

  .return-follow-box {
    min-width: 220px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .modal-card {
    max-height: calc(100vh - 20px);
  }

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

  .image-preview-stage {
    min-height: 260px;
  }
}

body {
  background:
    linear-gradient(180deg, #ffffff 0, #f7faf8 360px),
    #f7faf8;
}

.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
  background: #f7faf8;
  transition: grid-template-columns 0.18s ease;
}

.sidebar {
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  background:
    radial-gradient(circle at 30% 0, rgba(0, 130, 95, 0.28), transparent 34%),
    linear-gradient(180deg, #06251c 0, #003d30 58%, #00281f 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 12px 0 34px rgba(0, 48, 37, 0.1);
}

.logo {
  gap: 10px;
  min-height: 54px;
  padding: 0 0 22px;
}

.logo img {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.logo strong {
  display: block;
  font-size: 18px;
  line-height: 1.15;
  white-space: nowrap;
}

.logo span {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.sidebar-icon-button {
  margin-left: auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
  color: #fff;
  line-height: 1;
}

.sidebar-icon-button:hover {
  background: rgba(255, 255, 255, 0.16);
}

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

.nav-btn {
  min-height: 46px;
  margin: 0;
  border-radius: 8px;
  padding: 0 13px;
  font-size: 15px;
  font-weight: 700;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.nav-btn:hover,
.nav-btn.active {
  background: linear-gradient(135deg, #00946d, #00775a);
  box-shadow: 0 12px 26px rgba(0, 28, 21, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.nav-btn img {
  width: 19px;
  height: 19px;
  filter: brightness(0) invert(1);
}

.sidebar-account {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 15px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, #20c997, #00825f);
  font-weight: 800;
}

.sidebar-account strong,
.sidebar-account small {
  display: block;
  white-space: nowrap;
}

.sidebar-account small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.62);
}

.main {
  min-width: 0;
  padding: 0 28px 32px;
  background: #fbfcfb;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  margin: 0 -28px 22px;
  padding: 0 28px;
  border-bottom: 1px solid #dde6e1;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.compact-topbar {
  justify-content: space-between;
}

.page-heading {
  min-width: 0;
  margin-right: auto;
}

.topbar h1 {
  margin: 0;
  color: #101b16;
  font-size: 24px;
  line-height: 1.2;
}

.topbar p {
  margin-top: 5px;
  color: #7a8680;
  font-size: 13px;
}

.top-actions {
  justify-content: flex-end;
  gap: 10px;
  margin-left: 20px;
}

.icon-button {
  min-height: 36px;
  border: 1px solid #d8e2dd;
  border-radius: 7px;
  background: #fff;
  color: #26342e;
}

.icon-button:hover {
  border-color: #b9c9c0;
  background: #f5faf7;
}

.notification-dot {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #e93628;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.mobile-menu-button {
  display: none;
  width: 38px;
  padding: 0;
  justify-content: center;
  margin-right: 10px;
}

.panel,
.upload-band,
.metric-card,
.rank-card,
.kpi {
  border-color: #dfe7e2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(27, 52, 42, 0.06);
  backdrop-filter: none;
}

.panel-head {
  min-height: 56px;
  align-items: center;
  background: linear-gradient(180deg, #ffffff, #f8fbf9);
}

.dashboard-insights,
.kpi-grid,
.grid-2 {
  gap: 16px;
}

.metric-card,
.rank-card,
.kpi {
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.metric-card:hover,
.rank-card:hover,
.kpi:hover {
  border-color: rgba(0, 107, 80, 0.24);
  box-shadow: 0 14px 34px rgba(18, 84, 61, 0.11);
}

input,
select,
textarea {
  max-width: 100%;
}

select {
  min-width: min(124px, 100%);
  padding-right: 34px;
  appearance: none;
  -webkit-appearance: none;
  background-color: rgba(255, 255, 255, 0.96);
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.4 6.2 8 9.8l3.6-3.6' fill='none' stroke='%2365756c' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
}

.filters select,
.date-range-filter select,
.table-search-band select {
  min-width: 140px;
}

.filters input,
.filters select,
.filters button,
.date-range-filter input,
.date-range-filter select,
.date-range-filter button {
  min-height: 38px;
}

.table-wrap {
  border-radius: 0 0 8px 8px;
}

table {
  font-size: 13px;
}

th,
td {
  padding: 12px 14px;
  vertical-align: middle;
}

th {
  background: #f6f8f7;
  color: #56645e;
  font-size: 12px;
}

tbody tr {
  transition: background 0.14s ease;
}

tbody tr:hover td {
  background: #f8fbf9;
}

.badge {
  height: 24px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
}

.row-actions {
  grid-template-columns: repeat(auto-fit, minmax(82px, max-content));
  align-items: center;
  min-width: 190px;
}

.row-actions button {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #dce6e1;
  border-radius: 7px;
  background: #fff;
  color: #006b50;
  font-weight: 800;
}

.row-actions button:hover {
  border-color: rgba(0, 107, 80, 0.28);
  background: #eff8f4;
}

.row-actions .danger-button,
.danger-button {
  border-color: #f1c7c2;
  background: #fff7f6;
  color: #c6281c;
}

.toast {
  z-index: 80;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 78px minmax(0, 1fr);
}

body.sidebar-collapsed .sidebar {
  padding-left: 12px;
  padding-right: 12px;
}

body.sidebar-collapsed .logo {
  justify-content: center;
  padding-bottom: 18px;
}

body.sidebar-collapsed .logo > div,
body.sidebar-collapsed .nav-btn span,
body.sidebar-collapsed .sidebar-account div {
  display: none;
}

body.sidebar-collapsed .sidebar-icon-button {
  position: absolute;
  top: 17px;
  right: 8px;
  width: 26px;
  height: 26px;
}

body.sidebar-collapsed .nav-btn {
  justify-content: center;
  padding: 0;
}

body.sidebar-collapsed .sidebar-account {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.sidebar-scrim {
  display: none;
}

@media (max-width: 1180px) {
  .dashboard-insights {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .mini-kpis {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 16px 12px;
    overflow: visible;
  }

  .logo {
    justify-content: center;
    padding-bottom: 18px;
  }

  .logo > div,
  .nav-btn span,
  .sidebar-account div {
    display: none;
  }

  .sidebar-icon-button {
    display: none;
  }

  .nav-btn {
    width: 100%;
    justify-content: center;
    padding: 0;
  }

  .main {
    padding: 0 18px 28px;
  }

  .topbar {
    margin-left: -18px;
    margin-right: -18px;
    padding-left: 18px;
    padding-right: 18px;
  }
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, calc(100vw - 54px));
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(8, 30, 22, 0.42);
  }

  body.sidebar-open .sidebar-scrim {
    display: block;
  }

  .logo {
    justify-content: flex-start;
  }

  .logo > div,
  .nav-btn span,
  .sidebar-account div {
    display: block;
  }

  .nav-btn {
    justify-content: flex-start;
    padding: 0 13px;
  }

  .mobile-menu-button {
    display: inline-flex;
  }

  .topbar {
    align-items: center;
    min-height: 66px;
  }

  .topbar p,
  .header-status-button span:last-child,
  .header-help-button span:last-child {
    display: none;
  }

  .top-actions {
    gap: 6px;
    margin-left: 10px;
  }

  .dashboard-insights,
  .kpi-grid,
  .mini-kpis {
    grid-template-columns: 1fr;
  }

  .table-search-band {
    display: grid;
    grid-template-columns: 1fr;
  }
}
