:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --text: #0f172a;
  --muted: #64748b;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #dbeafe 0%, #eef4ff 30%, #f8fafc 100%);
}

.page {
  width: min(1280px, 94%);
  margin: 30px auto;
}

.topbar h1 {
  margin: 0;
  font-size: 30px;
}

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

.topbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

.card {
  margin-top: 16px;
  background: #fff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

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

.search-form {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

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

.toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: end;
}

.admin-name {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
}

input,
select,
button {
  height: 38px;
  border-radius: 10px;
  font-size: 14px;
}

input,
select {
  border: 1px solid #dbe2f0;
  outline: none;
  padding: 0 12px;
  min-width: 180px;
  background: #fff;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

button {
  border: 0;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  padding: 0 16px;
  font-weight: 600;
}

button:hover {
  background: var(--primary-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ghost-btn {
  background: #e8efff;
  color: var(--primary);
}

.ghost-btn:hover {
  background: #dbe7ff;
}

.danger-ghost-btn {
  background: #fee2e2;
  color: var(--danger);
}

.danger-ghost-btn:hover {
  background: #fecaca;
}

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

.login-wrap {
  width: min(460px, 100%);
}

.login-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 26px 22px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.12);
}

.login-head h1 {
  margin: 0;
  font-size: 28px;
  color: #0f172a;
}

.login-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

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

.login-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #334155;
}

.login-form input {
  min-width: 0;
}

.login-footer {
  margin-top: 12px;
  color: #64748b;
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  text-align: left;
  border-bottom: 1px solid #edf2f7;
  padding: 10px 8px;
  font-size: 13px;
}

th {
  font-weight: 700;
  color: #334155;
  background: #f8fafc;
}

th.op-col,
td.op-col {
  position: sticky;
  right: 0;
  width: 200px;
  min-width: 170px;
}

th.op-col {
  z-index: 4;
  background: #f8fafc;
  box-shadow: -10px 0 12px -12px rgba(15, 23, 42, 0.35);
}

td.op-col {
  z-index: 3;
  background: #ffffff;
  box-shadow: -10px 0 12px -12px rgba(15, 23, 42, 0.35);
}

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

.store-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.store-name-text {
  min-width: 0;
  word-break: break-all;
}

.row-store-thumb,
.view-store-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  object-fit: cover;
  background: #eef2ff;
  color: #1d4ed8;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.row-store-thumb {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.view-store-thumb {
  width: 72px;
  height: 72px;
  border-radius: 18px;
}

.thumb-fallback {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.view-btn {
  height: 32px;
  border-radius: 8px;
  background: #eaf7ef;
  color: #166534;
  padding: 0 10px;
}

.view-btn:hover {
  background: #d7f0e1;
}

.edit-btn {
  height: 32px;
  border-radius: 8px;
  background: #e0ecff;
  color: #1e40af;
  padding: 0 10px;
}

.edit-btn:hover {
  background: #cfe0ff;
}

.delete-btn {
  height: 32px;
  border-radius: 8px;
  background: #fee2e2;
  color: var(--danger);
  padding: 0 10px;
}

.delete-btn:hover {
  background: #fecaca;
}

.empty-row td {
  text-align: center;
  color: var(--muted);
}

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

.page-info {
  color: #334155;
  font-size: 14px;
}

.page-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-controls label {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-controls select {
  min-width: auto;
  width: 70px;
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
}

.modal {
  width: min(560px, 92vw);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.24);
  overflow: hidden;
}

.modal-view {
  width: min(620px, 94vw);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #eef2f7;
}

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

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  color: #334155;
  background: #f1f5f9;
}

.icon-btn:hover {
  background: #e2e8f0;
}

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

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

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

.image-field {
  display: grid;
  gap: 10px;
}

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

.image-clear-btn {
  height: 34px;
  padding: 0 12px;
  justify-self: start;
}

.icon-upload-box {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 20px;
  border: 1px dashed #cbd5e1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.icon-upload-box:hover {
  border-color: #93c5fd;
  background: #f8fbff;
  box-shadow: 0 8px 18px rgba(59, 130, 246, 0.1);
}

.icon-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 3;
}

.icon-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 1;
}

.icon-preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  position: relative;
  z-index: 1;
}

.upload-mark {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  position: relative;
}

.upload-mark::before,
.upload-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: #60a5fa;
  transform: translate(-50%, -50%);
}

.upload-mark::before {
  width: 12px;
  height: 2px;
}

.upload-mark::after {
  width: 2px;
  height: 12px;
}

.upload-text {
  white-space: nowrap;
}

.service-fieldset {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #dbe2f0;
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
}

.service-fieldset legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.service-fieldset .service-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #334155;
  font-size: 14px;
  white-space: nowrap;
}

.service-fieldset .service-option input {
  min-width: 0;
  width: 16px;
  height: 16px;
  margin: 0;
}

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.view-content {
  padding: 16px;
  display: grid;
  gap: 10px;
}

.view-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  border-bottom: 1px dashed #e2e8f0;
  padding-bottom: 8px;
}

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

.view-value {
  color: #0f172a;
  font-size: 14px;
  word-break: break-all;
}

.view-name-value {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.view-name-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 10px;
  color: #fff;
  background: rgba(15, 23, 42, 0.92);
  opacity: 0;
  transition: opacity 0.22s;
  pointer-events: none;
  z-index: 90;
}

.toast.show {
  opacity: 1;
}

@media (max-width: 900px) {
  .modal-form {
    grid-template-columns: 1fr;
  }
}
