* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f4f6f8;
  color: #182033;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

.hidden {
  display: none !important;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-panel {
  width: 360px;
  padding: 28px;
  background: #fff;
  border: 1px solid #e3e7ee;
  border-radius: 8px;
  text-align: center;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.login-panel h1 {
  font-size: 24px;
}

.login-panel p,
#adminInfo,
.login-status {
  margin-top: 10px;
  color: #657084;
  font-size: 14px;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.login-form input,
.login-form button {
  width: 100%;
  height: 42px;
}

#qrBox {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px auto 12px;
  width: 220px;
  height: 220px;
  border: 1px solid #e3e7ee;
}

#qrBox img,
#qrBox canvas {
  width: 200px;
  height: 200px;
}

.ticket-text {
  margin-top: 10px;
  padding: 8px;
  background: #f8fafc;
  border: 1px solid #edf0f5;
  border-radius: 6px;
  color: #657084;
  font-size: 12px;
  line-height: 18px;
  word-break: break-all;
}

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

.sidebar {
  background: #14213d;
  color: #fff;
  padding: 22px 14px;
}

.brand {
  padding: 0 12px 22px;
  font-size: 18px;
  font-weight: 700;
}

.nav {
  width: 100%;
  height: 42px;
  margin-bottom: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.nav.active,
.nav:hover {
  background: #0f766e;
  color: #fff;
}

.logout {
  margin-top: 24px;
}

.content {
  padding: 24px;
  overflow-x: auto;
}

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

.topbar h2 {
  font-size: 24px;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 18px;
  background: #fff;
  border: 1px solid #e3e7ee;
  border-radius: 8px;
}

.stat-card span {
  display: block;
  color: #657084;
  font-size: 13px;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  color: #182033;
  font-size: 30px;
  line-height: 36px;
}

.stat-card.warn strong {
  color: #c2410c;
}

.stat-card.ok strong {
  color: #047857;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 12px;
}

.panel-title h3 {
  font-size: 18px;
}

.chart-panel {
  position: relative;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid #e3e7ee;
  border-radius: 8px;
  background: #fff;
}

.chart-title {
  align-items: flex-start;
  margin-top: 0;
}

.date-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #657084;
  font-size: 14px;
}

.date-filter input {
  width: 150px;
}

.line-chart {
  display: block;
  width: 100%;
  height: 320px;
}

.chart-empty {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #657084;
  background: rgba(255, 255, 255, .82);
}

.btn,
input,
select,
textarea {
  height: 38px;
  border: 1px solid #cfd7e3;
  border-radius: 6px;
  background: #fff;
  padding: 0 12px;
  font-size: 14px;
}

textarea {
  width: 100%;
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
}

.btn {
  cursor: pointer;
}

.btn.primary {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
}

.btn.danger {
  border-color: #dc2626;
  color: #dc2626;
}

.btn.link {
  border: 0;
  background: transparent;
  color: #0f766e;
  padding: 0 6px;
}

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

.actions .btn {
  height: 30px;
}

.table-wrap {
  background: #fff;
  border: 1px solid #e3e7ee;
  border-radius: 8px;
  overflow: auto;
}

.empty-row {
  margin-top: 12px;
  padding: 28px;
  border: 1px dashed #cfd7e3;
  border-radius: 8px;
  background: #fff;
  color: #657084;
  text-align: center;
}

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

.pager-info {
  min-width: 180px;
  color: #657084;
  font-size: 14px;
  text-align: center;
}

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

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid #edf0f5;
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  color: #657084;
  background: #fafbfc;
  font-weight: 600;
}

.title-cell {
  font-weight: 700;
}

.sub {
  margin-top: 4px;
  color: #657084;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  font-size: 12px;
  background: #edf0f5;
}

.badge.pending {
  background: #fff7ed;
  color: #c2410c;
}

.badge.approved {
  background: #ecfdf5;
  color: #047857;
}

.badge.offline {
  background: #f1f5f9;
  color: #475569;
}

.badge.rejected {
  background: #fef2f2;
  color: #dc2626;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  min-width: 64px;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  justify-content: center;
}

.type-badge.seek {
  background: #eff6ff;
  color: #1d4ed8;
}

.type-badge.shop {
  background: #ecfdf5;
  color: #047857;
}

dialog {
  width: min(720px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
}

dialog::backdrop {
  background: rgba(15, 23, 42, .45);
}

.dialog-form {
  padding: 22px;
}

.dialog-form h3 {
  margin-bottom: 18px;
}

.dialog-form label {
  display: block;
  margin-bottom: 14px;
  color: #3f4858;
  font-size: 14px;
}

.dialog-form input,
.dialog-form select {
  display: block;
  width: 100%;
  margin-top: 7px;
}

.dialog-form textarea {
  display: block;
  margin-top: 7px;
}

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

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

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

.permission-item {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin: 0 !important;
  padding: 9px 10px;
  border: 1px solid #e3e7ee;
  border-radius: 6px;
  background: #fafbfc;
  color: #182033 !important;
}

.permission-item input {
  width: auto !important;
  height: auto;
  margin: 0 !important;
}

.upload-field {
  margin-bottom: 14px;
}

.map-field {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.inline-search {
  display: flex;
  gap: 8px;
  margin-top: 7px;
  margin-bottom: 8px;
}

.inline-search input {
  flex: 1;
  margin-top: 0 !important;
}

.inline-search .btn {
  flex: 0 0 auto;
}

.map-address {
  flex: 1;
}

.upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #3f4858;
  font-size: 14px;
}

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

.image-item {
  overflow: hidden;
  border: 1px solid #e3e7ee;
  border-radius: 8px;
  background: #fff;
}

.image-item.cover-selected {
  border-color: #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, .12);
}

.image-item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #edf0f5;
}

.image-actions {
  display: flex;
  justify-content: space-between;
  padding: 6px;
  gap: 4px;
}

.image-actions .btn {
  height: 28px;
  font-size: 12px;
  padding: 0 4px;
}

.upload-empty {
  grid-column: 1 / -1;
  padding: 22px;
  border: 1px dashed #cfd7e3;
  border-radius: 8px;
  color: #657084;
  text-align: center;
  background: #fafbfc;
}

.banner-thumb {
  width: 160px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  background: #edf0f5;
}

.banner-preview {
  margin: 10px 0 14px;
}

.banner-preview-img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e3e7ee;
}

.editor-field {
  margin-bottom: 14px;
}

.editor-field > label {
  margin-bottom: 8px;
}

.rich-editor {
  min-height: 180px;
  background: #ffffff;
}

.editor-field .ql-toolbar {
  border-color: #cfd7e3;
  border-radius: 6px 6px 0 0;
}

.editor-field .ql-container {
  min-height: 180px;
  border-color: #cfd7e3;
  border-radius: 0 0 6px 6px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
}

.editor-field .ql-editor {
  min-height: 180px;
  line-height: 1.8;
}


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

  .sidebar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
  }

  .brand {
    display: none;
  }

  .nav {
    width: auto;
    white-space: nowrap;
  }

  .topbar {
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }

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

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

  .date-filter {
    width: 100%;
    flex-wrap: wrap;
  }

  .date-filter input {
    flex: 1;
    min-width: 130px;
  }

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