:root {
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-muted: #f8faf9;
  --line: #dfe7e4;
  --line-strong: #cbd7d3;
  --ink: #18332e;
  --muted: #657772;
  --brand: #0f766e;
  --brand-dark: #123b36;
  --brand-soft: #dff4ef;
  --blue: #2563a8;
  --blue-soft: #e7f0fa;
  --amber: #ad6812;
  --amber-soft: #fff1d8;
  --red: #b4233b;
  --red-soft: #fdebed;
  --green: #257653;
  --green-soft: #e5f5ec;
  --shadow-sm: 0 1px 2px rgba(17, 50, 44, 0.05);
  --shadow-md: 0 12px 30px rgba(17, 50, 44, 0.12);
  --radius-sm: 6px;
  --radius-md: 9px;
  --sidebar-width: 252px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  color: #edf8f5;
  background: var(--brand-dark);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 78px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(4, 24, 21, 0.18);
  overflow: hidden;
}

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

.brand-copy {
  min-width: 0;
}

.brand-copy strong {
  display: block;
  overflow: hidden;
  color: #ffffff;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy span {
  display: block;
  margin-top: 1px;
  color: #9fc3ba;
  font-size: 10px;
}

.nav-list {
  flex: 1;
  padding: 13px 11px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.nav-label {
  margin: 15px 10px 6px;
  color: #7da89d;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  margin: 2px 0;
  padding: 0 11px;
  color: #c5dcd6;
  text-decoration: none;
  border-radius: 7px;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.active {
  color: #092e29;
  background: #d8f6ee;
  font-weight: 650;
}

.nav-item i,
.icon-button i,
.button i {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke-width: 1.8;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 12px;
  padding: 12px;
  color: #b8d5cd;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.sidebar-footer strong,
.sidebar-footer span {
  display: block;
}

.sidebar-footer strong {
  color: #edf8f5;
  font-size: 12px;
  font-weight: 600;
}

.sidebar-footer span {
  max-width: 150px;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  background: #36d18a;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(54, 209, 138, 0.12);
}

.sidebar-logout {
  display: flex;
  width: 30px;
  height: 30px;
  margin-left: auto;
  flex: 0 0 30px;
  align-items: center;
  justify-content: center;
  color: #b8d5cd;
  border-radius: 6px;
}

.sidebar-logout:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-logout svg {
  width: 16px;
  height: 16px;
}

.sidebar-backdrop {
  display: none;
}

.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 14px;
  padding: 12px 26px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar-title {
  min-width: 0;
  flex: 1;
}

.topbar-title h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 680;
  letter-spacing: -0.01em;
}

.topbar-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.mobile-menu {
  display: none;
}

.page-content {
  padding: 22px 26px 40px;
}

.page-loading,
.empty-state {
  display: flex;
  min-height: 250px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
}

.empty-state {
  flex-direction: column;
  padding: 34px;
  text-align: center;
}

.empty-state i {
  width: 34px;
  height: 34px;
  color: #9ab0aa;
  stroke-width: 1.3;
}

.empty-state strong {
  color: var(--ink);
  font-size: 15px;
}

.empty-state p {
  max-width: 420px;
  margin: 0;
  font-size: 12px;
}

.loader {
  width: 20px;
  height: 20px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.page-section {
  margin-bottom: 20px;
}

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

.section-heading h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.section-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.stat-card {
  position: relative;
  min-height: 112px;
  padding: 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.stat-card::after {
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: var(--stat-color, var(--brand));
  content: "";
  opacity: 0.85;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
}

.stat-icon {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: var(--stat-color, var(--brand));
  background: var(--stat-bg, var(--brand-soft));
  border-radius: 7px;
}

.stat-icon i {
  width: 17px;
  height: 17px;
}

.stat-value {
  margin-top: 12px;
  font-size: 24px;
  font-weight: 720;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.stat-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 14px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.panel-header p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.panel-body {
  padding: 16px;
}

.panel-body.flush {
  padding: 0;
}

.chart {
  display: grid;
  min-height: 250px;
  grid-template-columns: repeat(6, minmax(42px, 1fr));
  align-items: end;
  gap: 12px;
  padding: 12px 4px 0;
}

.chart-group {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.bars {
  display: flex;
  width: 100%;
  height: 190px;
  align-items: end;
  justify-content: center;
  gap: 5px;
  border-bottom: 1px solid var(--line);
}

.bar {
  position: relative;
  width: min(22px, 36%);
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  transition: height 0.35s ease;
}

.bar.purchase {
  background: #4a82c4;
}

.bar.sale {
  background: #31a67e;
}

.chart-label {
  color: var(--muted);
  font-size: 11px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 11px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.legend-dot.purchase {
  background: #4a82c4;
}

.legend-dot.sale {
  background: #31a67e;
}

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.alert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 11px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.alert-row strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-row span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.alert-value {
  flex: 0 0 auto;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}

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

.toolbar-left,
.toolbar-right,
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-field {
  position: relative;
  min-width: 230px;
}

.search-field i {
  position: absolute;
  top: 50%;
  left: 10px;
  width: 16px;
  height: 16px;
  color: #8fa19c;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input {
  padding-left: 34px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: #aebfba;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.11);
}

.input:disabled,
.select:disabled {
  color: #778783;
  background: #eef3f1;
}

.textarea {
  min-height: 76px;
  resize: vertical;
}

.select {
  min-width: 120px;
  padding-right: 30px;
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  color: var(--muted);
  white-space: nowrap;
}

.check-field input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
}

.button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 12px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.button:hover {
  background: #f3f7f6;
  border-color: #aabdb7;
}

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

.button.primary:hover {
  background: #0b655e;
  border-color: #0b655e;
}

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

.button.danger:hover {
  background: var(--red-soft);
}

.button.small {
  min-height: 30px;
  padding: 4px 9px;
  font-size: 12px;
}

.button.icon-only {
  width: 36px;
  padding: 0;
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

.icon-button:hover {
  background: #f2f6f5;
}

.table-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

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

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

.data-table th {
  color: #60736e;
  background: #f8faf9;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.data-table td {
  font-size: 12px;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: #fbfdfc;
}

.data-table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table .actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.primary-cell strong {
  display: block;
  font-size: 12px;
  font-weight: 620;
}

.primary-cell span {
  display: block;
  max-width: 360px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  color: #42544f;
  background: #edf2f0;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.badge.green {
  color: #176044;
  background: var(--green-soft);
}

.badge.blue {
  color: #24598e;
  background: var(--blue-soft);
}

.badge.amber {
  color: #8a510b;
  background: var(--amber-soft);
}

.badge.red {
  color: #902036;
  background: var(--red-soft);
}

.muted {
  color: var(--muted);
}

.table-link {
  color: var(--green);
  font-weight: 620;
  text-decoration: none;
}

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

.taobao-import {
  display: grid;
  gap: 12px;
}

.taobao-import .textarea {
  width: 100%;
  font-family: inherit;
  line-height: 1.5;
}

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

.taobao-import .taobao-summary {
  margin: 0;
  font-size: 11px;
}

.taobao-import .data-table th:first-child,
.taobao-import .data-table td:first-child {
  width: 1%;
  text-align: center;
}

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

.positive-text {
  color: var(--green);
  font-weight: 650;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 9px 13px;
  color: var(--muted);
  background: #fbfcfc;
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 5px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(9, 30, 27, 0.48);
  backdrop-filter: blur(3px);
}

.modal {
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.modal.wide {
  width: min(1080px, 100%);
}

.modal.medium {
  width: min(840px, 100%);
}

.modal-header {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 680;
}

.modal-header p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.modal-body {
  max-height: calc(100vh - 184px);
  padding: 18px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 18px;
  background: #fbfcfc;
  border-top: 1px solid var(--line);
}

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

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

.form-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field {
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  color: #46605a;
  font-size: 11px;
  font-weight: 620;
}

.field label em {
  color: var(--red);
  font-style: normal;
}

.line-table {
  width: 100%;
  min-width: 800px;
  border-collapse: collapse;
}

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

.line-table th {
  color: var(--muted);
  background: #f8faf9;
  font-size: 10px;
  font-weight: 650;
}

.line-table input,
.line-table select {
  min-height: 34px;
}

.line-product {
  position: relative;
  min-width: 260px;
}

.line-product .input {
  padding-right: 30px;
}

.line-product-status {
  position: absolute;
  top: 8px;
  right: 9px;
  color: var(--brand);
  pointer-events: none;
}

.line-product-status i {
  width: 15px;
  height: 15px;
}

.product-suggestions {
  position: fixed;
  z-index: 200;
  top: 0;
  left: 0;
  display: none;
  width: min(420px, 80vw);
  max-height: 260px;
  padding: 5px;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  box-shadow: 0 10px 28px rgba(20, 54, 48, 0.18);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.product-suggestions.visible {
  display: block;
}

.suggestion-item {
  width: 100%;
  padding: 8px 9px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 5px;
}

.suggestion-item:hover {
  background: var(--brand-soft);
}

.suggestion-item strong,
.suggestion-item span {
  display: block;
}

.suggestion-item strong {
  font-size: 12px;
}

.suggestion-item span {
  color: var(--muted);
  font-size: 10px;
}

.line-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 22px;
  margin-top: 14px;
  padding: 12px 14px;
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.line-summary span {
  color: var(--muted);
  font-size: 11px;
}

.line-summary strong {
  font-size: 17px;
}

.danger-zone {
  border-color: #f0cbd1;
}

.danger-zone .panel-header {
  border-bottom-color: #f0cbd1;
}

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

.status-block {
  padding: 13px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.status-block span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.status-block strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.inline-note {
  padding: 10px 12px;
  color: #475f59;
  background: #f3f8f6;
  border: 1px solid #d7e8e3;
  border-radius: 7px;
  font-size: 11px;
}

.permission-count {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

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

.permission-group {
  min-width: 0;
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.permission-group > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  background: #f3f8f6;
  border-bottom: 1px solid var(--line);
}

.permission-group > header strong {
  font-size: 12px;
}

.permission-group > header span {
  color: var(--muted);
  font-size: 10px;
}

.permission-options {
  display: grid;
  padding: 4px;
}

.permission-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.permission-option:hover {
  background: var(--surface-muted);
}

.permission-option input {
  width: 15px;
  height: 15px;
  margin: 3px 0 0;
  accent-color: var(--brand);
}

.permission-option input:disabled {
  cursor: not-allowed;
}

.permission-option span {
  min-width: 0;
}

.permission-option strong,
.permission-option small {
  display: block;
}

.permission-option strong {
  font-size: 11px;
}

.permission-option small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.toast-stack {
  position: fixed;
  z-index: 120;
  right: 20px;
  bottom: 20px;
  display: flex;
  width: min(360px, calc(100vw - 40px));
  flex-direction: column;
  gap: 8px;
}

/* ---------- 登录页 ---------- */

.login-page {
  display: grid;
  min-height: 100vh;
  padding: 28px 18px;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.16), transparent 45%),
    linear-gradient(135deg, #1b4a80 0%, #2060a0 26%, #2e93d0 52%, #4f9c4a 80%, #86b93f 100%);
  place-items: center;
}

.login-shell {
  width: min(420px, 100%);
}

.login-card {
  padding: 34px 30px 28px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 22px 48px rgba(12, 38, 66, 0.28);
}

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

.login-logo {
  width: 92px;
  height: 92px;
  margin: 0 auto 12px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid #dbe7f2;
  border-radius: 50%;
}

.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-brand h1 {
  margin: 0;
  color: #1f4d87;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 2px;
}

.login-brand p {
  margin: 6px 0 0;
  color: #6b7f93;
  font-size: 12px;
  letter-spacing: 1px;
}

.login-error {
  margin-top: 18px;
  padding: 10px 12px;
  color: #b4233b;
  background: #fdebed;
  border: 1px solid #f3c9d0;
  border-radius: 6px;
  font-size: 12px;
}

.login-form {
  display: flex;
  margin-top: 22px;
  flex-direction: column;
  gap: 14px;
}

.login-field {
  display: block;
}

.login-field > span:first-child {
  display: block;
  margin-bottom: 6px;
  color: #47586b;
  font-size: 12px;
  font-weight: 600;
}

.login-input {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid #d7e2ec;
  border-radius: 7px;
  background: #f8fbfd;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.login-input:focus-within {
  border-color: #2e93d0;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(46, 147, 208, 0.16);
}

.login-input > svg {
  width: 16px;
  height: 16px;
  margin-left: 12px;
  flex: 0 0 16px;
  color: #7d94a8;
}

.login-input input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  color: #18332e;
  background: transparent;
  border: 0;
  outline: none;
  font-size: 14px;
}

.login-eye {
  display: flex;
  width: 38px;
  height: 44px;
  align-items: center;
  justify-content: center;
  color: #7d94a8;
  background: transparent;
  border: 0;
}

.login-eye svg {
  width: 16px;
  height: 16px;
}

.login-options {
  display: flex;
  margin-top: -2px;
  align-items: center;
  justify-content: space-between;
}

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #47586b;
  font-size: 12px;
  cursor: pointer;
}

.login-remember input {
  width: 15px;
  height: 15px;
  accent-color: #2e93d0;
}

.login-link {
  padding: 0;
  color: #2060a0;
  background: transparent;
  border: 0;
  font-size: 12px;
}

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

.login-submit {
  display: flex;
  height: 46px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #ffffff;
  background: linear-gradient(135deg, #2060a0 0%, #2e93d0 58%, #4f9c4a 100%);
  border: 0;
  border-radius: 7px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 4px;
  transition: filter 0.16s ease;
}

.login-submit:hover {
  filter: brightness(1.06);
}

.login-submit svg {
  width: 17px;
  height: 17px;
}

.login-contact {
  margin-top: 16px;
  padding: 14px;
  text-align: center;
  background: #f2f8fc;
  border: 1px solid #d7e7f4;
  border-radius: 7px;
}

.login-contact strong {
  display: block;
  color: #1f4d87;
  font-size: 13px;
}

.login-contact p {
  margin: 6px 0 0;
  color: #6b7f93;
  font-size: 12px;
}

.login-phone {
  color: #257653 !important;
  font-size: 16px !important;
  font-weight: 700;
  letter-spacing: 1px;
}

.login-footnote {
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
  font-size: 12px;
  letter-spacing: 1px;
}

@media (max-width: 480px) {
  .login-page {
    padding: 20px 14px;
  }

  .login-card {
    padding: 26px 20px 22px;
  }
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 13px;
  color: #eaf6f2;
  background: #173f38;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.22s ease-out;
}

.toast.error {
  background: #782a37;
}

.toast i {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  margin-top: 1px;
}

.toast span {
  font-size: 12px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

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

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

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

@media (max-width: 820px) {
  :root {
    --sidebar-width: 248px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

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

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: block;
    background: rgba(8, 29, 25, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .workspace {
    margin-left: 0;
  }

  .mobile-menu {
    display: inline-grid;
  }

  .topbar {
    padding: 10px 14px;
  }

  .page-content {
    padding: 16px 14px 32px;
  }

  .form-grid,
  .form-grid.three,
  .form-grid.four {
    grid-template-columns: 1fr;
  }

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

  .permission-groups {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar-title p {
    display: none;
  }

  .topbar-actions .button .button-label {
    display: none;
  }

  .topbar-actions .button {
    width: 36px;
    padding: 0;
  }

  .stats-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: 98px;
  }

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

  .toolbar-left,
  .toolbar-right {
    width: 100%;
  }

  .search-field {
    min-width: 100%;
  }

  .search-field + .button {
    width: 100%;
  }

  .modal-backdrop {
    padding: 0;
    place-items: end center;
  }

  .modal,
  .modal.wide,
  .modal.medium {
    width: 100%;
    max-height: 94vh;
    border-radius: 12px 12px 0 0;
  }

  .modal-body {
    max-height: calc(94vh - 124px);
  }

  .chart {
    gap: 5px;
    overflow-x: auto;
  }

  .chart-group {
    min-width: 48px;
  }
}
