/**
 * AICamera 管理台统一样式表
 * 主题通过 html[data-admin-theme] 切换；默认暗黑。
 * 规范见 .cursor/rules/04-admin-web.mdc §4.10
 */

/* --- 暗黑（默认）--- */
:root,
[data-admin-theme="dark"] {
  --admin-bg: rgb(2 6 23);
  --admin-surface: rgb(30 41 59);
  --admin-surface-2: rgb(15 23 42);
  --admin-border: rgb(51 65 85);
  --admin-text: rgb(226 232 240);
  --admin-text-muted: rgb(148 163 184);
  --admin-text-dim: rgb(100 116 139);
  --admin-link: rgb(96 165 250);
  --admin-link-hover: rgb(147 197 253);
  --admin-danger: rgb(248 113 113);
  --admin-success: rgb(74 222 128);
  --admin-warning: rgb(251 191 36);
  --admin-overlay: rgba(15, 23, 42, 0.5);
  --admin-header-name: rgb(203 213 225);
  --admin-table-head-bg: rgb(15 23 42 / 0.85);
  --admin-table-row-hover: rgb(51 65 85 / 0.2);
  --admin-table-row-border: rgb(51 65 85 / 0.55);
  --admin-btn-primary-bg: rgb(51 65 85);
  --admin-btn-primary-hover: rgb(71 85 105);
  --admin-sidebar-link: rgb(203 213 225);
  --admin-sidebar-link-hover-bg: rgb(30 41 59 / 0.8);
  --admin-sidebar-section: rgb(100 116 139);
  --admin-date-picker-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e2e8f0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
}

/* --- 浅色 --- */
[data-admin-theme="light"] {
  --admin-bg: rgb(241 245 249);
  --admin-surface: rgb(255 255 255);
  --admin-surface-2: rgb(248 250 252);
  --admin-border: rgb(226 232 240);
  --admin-text: rgb(15 23 42);
  --admin-text-muted: rgb(100 116 139);
  --admin-text-dim: rgb(148 163 184);
  --admin-link: rgb(37 99 235);
  --admin-link-hover: rgb(29 78 216);
  --admin-danger: rgb(220 38 38);
  --admin-success: rgb(22 163 74);
  --admin-warning: rgb(217 119 6);
  --admin-overlay: rgba(15, 23, 42, 0.25);
  --admin-header-name: rgb(51 65 85);
  --admin-table-head-bg: rgb(248 250 252);
  --admin-table-row-hover: rgb(241 245 249);
  --admin-table-row-border: rgb(226 232 240);
  --admin-btn-primary-bg: rgb(51 65 85);
  --admin-btn-primary-hover: rgb(71 85 105);
  --admin-sidebar-link: rgb(51 65 85);
  --admin-sidebar-link-hover-bg: rgb(226 232 240);
  --admin-sidebar-section: rgb(100 116 139);
  --admin-date-picker-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
}

/* --- 深蓝 --- */
[data-admin-theme="ocean"] {
  --admin-bg: rgb(8 15 30);
  --admin-surface: rgb(20 35 60);
  --admin-surface-2: rgb(12 24 45);
  --admin-border: rgb(40 60 95);
  --admin-text: rgb(224 231 245);
  --admin-text-muted: rgb(140 160 195);
  --admin-text-dim: rgb(90 115 155);
  --admin-link: rgb(56 189 248);
  --admin-link-hover: rgb(125 211 252);
  --admin-danger: rgb(251 113 133);
  --admin-success: rgb(52 211 153);
  --admin-warning: rgb(251 191 36);
  --admin-overlay: rgba(8, 15, 30, 0.55);
  --admin-header-name: rgb(186 210 240);
  --admin-table-head-bg: rgb(12 24 45 / 0.9);
  --admin-table-row-hover: rgb(40 60 95 / 0.35);
  --admin-table-row-border: rgb(40 60 95 / 0.55);
  --admin-btn-primary-bg: rgb(30 58 95);
  --admin-btn-primary-hover: rgb(40 75 120);
  --admin-sidebar-link: rgb(186 210 240);
  --admin-sidebar-link-hover-bg: rgb(20 35 60 / 0.85);
  --admin-sidebar-section: rgb(90 115 155);
  --admin-date-picker-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e0e7f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
}

/* --- 粉萌（柔和亲和）--- */
[data-admin-theme="pink"] {
  --admin-bg: rgb(255 241 246);
  --admin-surface: rgb(255 255 255);
  --admin-surface-2: rgb(253 242 248);
  --admin-border: rgb(251 207 232);
  --admin-text: rgb(80 30 55);
  --admin-text-muted: rgb(157 23 77);
  --admin-text-dim: rgb(190 120 145);
  --admin-link: rgb(219 39 119);
  --admin-link-hover: rgb(190 24 93);
  --admin-danger: rgb(225 29 72);
  --admin-success: rgb(16 185 129);
  --admin-warning: rgb(217 119 6);
  --admin-overlay: rgba(131, 24, 67, 0.18);
  --admin-header-name: rgb(131 24 67);
  --admin-table-head-bg: rgb(252 231 243);
  --admin-table-row-hover: rgb(253 242 248);
  --admin-table-row-border: rgb(251 207 232);
  --admin-btn-primary-bg: rgb(244 114 182);
  --admin-btn-primary-hover: rgb(236 72 153);
  --admin-sidebar-link: rgb(131 24 67);
  --admin-sidebar-link-hover-bg: rgb(252 231 243);
  --admin-sidebar-section: rgb(190 120 145);
  --admin-date-picker-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23801e37' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
}

/* --- 暗色主题下 Tailwind 浅色 utility 对比度修正 --- */
.text-slate-600 { color: var(--admin-text-muted); }
.text-blue-700,
.text-blue-600 { color: var(--admin-link); }

/* --- 语义文字 / 链接 --- */
.admin-text { color: var(--admin-text); }
.admin-text-muted { color: var(--admin-text-muted); }
.admin-text-dim { color: var(--admin-text-dim); }
.admin-link {
  color: var(--admin-link);
  text-decoration: none;
}
.admin-link:hover {
  color: var(--admin-link-hover);
  text-decoration: underline;
}
.admin-link-danger {
  color: var(--admin-danger);
  text-decoration: none;
}
.admin-link-danger:hover { text-decoration: underline; }

/* --- 布局壳层 --- */
.admin-layout-body {
  background-color: var(--admin-bg);
  color: var(--admin-text);
  min-height: 100vh;
}
.admin-sidebar {
  background-color: var(--admin-bg);
  border-right: 1px solid var(--admin-border);
  color: var(--admin-text);
}
#admin-sidebar a.sidebar-nav-link.sidebar-nav-active {
  background-color: rgb(30 41 59);
  color: #fff;
  font-weight: 500;
}
.admin-content.htmx-request {
  opacity: 0.72;
  transition: opacity 0.15s ease;
}
.admin-main.htmx-request {
  opacity: 0.72;
  transition: opacity 0.15s ease;
}
.admin-nav-swap.htmx-request {
  opacity: 0.72;
  transition: opacity 0.15s ease;
}
.admin-sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: 0.5rem;
  border: 1px solid var(--admin-border);
  background: transparent;
  color: var(--admin-text-muted);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.admin-sidebar-toggle:hover {
  background: rgb(51 65 85 / 0.35);
  color: var(--admin-text);
}
.admin-header {
  background-color: var(--admin-surface-2);
  border-bottom: 1px solid var(--admin-border);
}
.admin-header-page {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}
.admin-header-page-inner {
  min-width: 0;
  width: 100%;
}
.admin-header-sep { color: var(--admin-text-dim); }
.admin-header-user { color: var(--admin-text-muted); }
.admin-header-name { color: var(--admin-header-name); }
.admin-header-brand {
  color: var(--admin-text);
  font-weight: 600;
}
.admin-header-brand:hover { color: var(--admin-header-name); }
.admin-header-settings {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  border: 1px solid var(--admin-border);
  background: transparent;
  color: var(--admin-text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.admin-header-settings:hover,
.admin-header-settings[aria-expanded="true"] {
  background: rgb(51 65 85 / 0.35);
  color: var(--admin-text);
  border-color: var(--admin-border);
}
.admin-settings-wrap { position: relative; }
.admin-settings-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.375rem);
  z-index: 70;
  min-width: 13rem;
}
.admin-settings-panel-inner {
  padding: 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}
.admin-settings-panel select {
  width: 100%;
  border-radius: 0.5rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  background-color: var(--admin-surface-2);
  border: 1px solid var(--admin-border);
  color: var(--admin-text);
}
.admin-settings-divider {
  border: none;
  border-top: 1px solid var(--admin-border);
  margin: 0.75rem 0;
}
.admin-settings-logout {
  display: block;
  text-align: center;
  font-size: 0.875rem;
  padding: 0.5rem;
  color: var(--admin-danger);
  text-decoration: none;
  border-radius: 0.5rem;
}
.admin-settings-logout:hover {
  background: rgb(127 29 29 / 0.15);
  text-decoration: none;
}

/* --- 卡片 / 面板 --- */
.admin-card {
  background-color: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  color: var(--admin-text);
}
.admin-card h2,
.admin-card h3,
.admin-section-title {
  color: var(--admin-text);
  font-weight: 500;
}
.admin-section-title { margin-bottom: 0.75rem; font-size: 0.875rem; }
.admin-section-title-lg { margin-bottom: 0.75rem; font-size: 1rem; }

/* 指标卡：随内容收缩，不参与 grid 等高拉伸 */
.admin-stat-card {
  width: fit-content;
  max-width: 100%;
}

/* --- 按钮 --- */
.admin-btn-primary {
  background-color: var(--admin-btn-primary-bg);
  color: white;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
}
.admin-btn-primary:hover { background-color: var(--admin-btn-primary-hover); }
.admin-btn-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: auto;
}
.admin-btn-disabled:hover { background-color: var(--admin-btn-primary-bg); }
.admin-btn-secondary {
  background-color: transparent;
  color: var(--admin-text);
  border: 1px solid var(--admin-border);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
}
.admin-btn-secondary:hover { background-color: rgb(51 65 85 / 0.5); }

/* 文件选择：仅显示自定义按钮，隐藏原生 input */
.admin-file-input-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.admin-file-input-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.admin-file-input-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-btn-cancel {
  background-color: transparent;
  color: var(--admin-text-muted);
  border: 1px solid var(--admin-border);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
}
.admin-btn-cancel:hover {
  background-color: rgb(51 65 85 / 0.5);
  color: var(--admin-text);
}
main button[onclick="AdminModal.close()"],
#admin-modal button[onclick="AdminModal.close()"] {
  background-color: transparent;
  color: var(--admin-text-muted);
  border: 1px solid var(--admin-border);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
}
main button[onclick="AdminModal.close()"]:hover,
#admin-modal button[onclick="AdminModal.close()"]:hover {
  background-color: rgb(51 65 85 / 0.5);
  color: var(--admin-text);
}

/* --- 表单控件（全站统一：main / modal / admin-card）--- */
.admin-input,
.admin-select,
.admin-textarea,
main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
main select,
main textarea,
#admin-modal input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
#admin-modal select,
#admin-modal textarea,
.admin-card input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
.admin-card select,
.admin-card textarea,
.admin-settings-panel input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
.admin-settings-panel select {
  background-color: var(--admin-surface-2);
  border: 1px solid var(--admin-border);
  border-radius: 0.5rem;
  color: var(--admin-text);
  font-size: 0.875rem;
}
.admin-input,
.admin-select,
.admin-textarea,
main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
main select,
main textarea,
#admin-modal input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
#admin-modal select,
#admin-modal textarea,
.admin-card input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
.admin-card select,
.admin-card textarea {
  padding: 0.5rem 0.75rem;
}
.admin-input-sm,
.admin-card input.admin-input-sm,
.admin-card select.admin-input-sm {
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
}
.admin-input-readonly,
.admin-input:read-only,
.admin-textarea:read-only,
main input:read-only,
#admin-modal input:read-only,
.admin-card input:read-only {
  background-color: rgb(51 65 85 / 0.45);
  color: var(--admin-text-muted);
}
[data-admin-theme="light"] .admin-input-readonly,
[data-admin-theme="light"] main input:read-only,
[data-admin-theme="light"] #admin-modal input:read-only,
[data-admin-theme="light"] .admin-card input:read-only,
[data-admin-theme="pink"] .admin-input-readonly,
[data-admin-theme="pink"] main input:read-only,
[data-admin-theme="pink"] #admin-modal input:read-only,
[data-admin-theme="pink"] .admin-card input:read-only {
  background-color: rgb(226 232 240 / 0.65);
}
.admin-input-highlight {
  background-color: rgb(120 53 15 / 0.25);
  color: rgb(251 191 36);
}
[data-admin-theme="light"] .admin-input-highlight,
[data-admin-theme="pink"] .admin-input-highlight {
  background-color: rgb(254 243 199 / 0.55);
  color: rgb(146 64 14);
}
main select option,
#admin-modal select option,
.admin-card select option {
  background-color: var(--admin-surface-2);
  color: var(--admin-text);
}
main input::placeholder,
#admin-modal input::placeholder,
.admin-card input::placeholder { color: var(--admin-text-dim); }
main input:focus,
main select:focus,
main textarea:focus,
#admin-modal input:focus,
#admin-modal select:focus,
#admin-modal textarea:focus,
.admin-card input:focus,
.admin-card select:focus,
.admin-card textarea:focus,
.admin-input:focus,
.admin-select:focus,
.admin-textarea:focus {
  outline: none;
  border-color: var(--admin-link);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--admin-link) 25%, transparent);
}
/* 浏览器 autofill 白底覆盖 */
main input:-webkit-autofill,
main input:-webkit-autofill:hover,
main input:-webkit-autofill:focus,
#admin-modal input:-webkit-autofill,
#admin-modal input:-webkit-autofill:hover,
#admin-modal input:-webkit-autofill:focus,
.admin-card input:-webkit-autofill,
.admin-card input:-webkit-autofill:hover,
.admin-card input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--admin-surface-2) inset !important;
  box-shadow: 0 0 0 1000px var(--admin-surface-2) inset !important;
  -webkit-text-fill-color: var(--admin-text) !important;
  caret-color: var(--admin-text);
  border: 1px solid var(--admin-border) !important;
  transition: background-color 99999s ease-out 0s;
}
/* 日期/时间控件右侧日历图标（默认即亮色，不依赖 hover） */
main input[type="date"]::-webkit-calendar-picker-indicator,
main input[type="datetime-local"]::-webkit-calendar-picker-indicator,
main input[type="time"]::-webkit-calendar-picker-indicator,
#admin-modal input[type="date"]::-webkit-calendar-picker-indicator,
#admin-modal input[type="datetime-local"]::-webkit-calendar-picker-indicator,
#admin-modal input[type="time"]::-webkit-calendar-picker-indicator,
.admin-card input[type="date"]::-webkit-calendar-picker-indicator,
.admin-card input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.admin-card input[type="time"]::-webkit-calendar-picker-indicator {
  background-image: var(--admin-date-picker-icon);
  background-size: 1rem 1rem;
  background-repeat: no-repeat;
  background-position: center;
  width: 1.125rem;
  height: 1.125rem;
  opacity: 1;
  cursor: pointer;
  filter: none;
}
main input[type="date"]::-moz-calendar-picker-indicator,
main input[type="datetime-local"]::-moz-calendar-picker-indicator,
main input[type="time"]::-moz-calendar-picker-indicator,
#admin-modal input[type="date"]::-moz-calendar-picker-indicator,
#admin-modal input[type="datetime-local"]::-moz-calendar-picker-indicator,
#admin-modal input[type="time"]::-moz-calendar-picker-indicator,
.admin-card input[type="date"]::-moz-calendar-picker-indicator,
.admin-card input[type="datetime-local"]::-moz-calendar-picker-indicator,
.admin-card input[type="time"]::-moz-calendar-picker-indicator {
  filter: invert(1) brightness(1.6);
  opacity: 1;
  cursor: pointer;
}
[data-admin-theme="light"] main input[type="date"]::-moz-calendar-picker-indicator,
[data-admin-theme="light"] main input[type="datetime-local"]::-moz-calendar-picker-indicator,
[data-admin-theme="light"] main input[type="time"]::-moz-calendar-picker-indicator,
[data-admin-theme="light"] #admin-modal input[type="date"]::-moz-calendar-picker-indicator,
[data-admin-theme="light"] #admin-modal input[type="datetime-local"]::-moz-calendar-picker-indicator,
[data-admin-theme="light"] #admin-modal input[type="time"]::-moz-calendar-picker-indicator,
[data-admin-theme="light"] .admin-card input[type="date"]::-moz-calendar-picker-indicator,
[data-admin-theme="light"] .admin-card input[type="datetime-local"]::-moz-calendar-picker-indicator,
[data-admin-theme="light"] .admin-card input[type="time"]::-moz-calendar-picker-indicator,
[data-admin-theme="pink"] main input[type="date"]::-moz-calendar-picker-indicator,
[data-admin-theme="pink"] main input[type="datetime-local"]::-moz-calendar-picker-indicator,
[data-admin-theme="pink"] main input[type="time"]::-moz-calendar-picker-indicator,
[data-admin-theme="pink"] #admin-modal input[type="date"]::-moz-calendar-picker-indicator,
[data-admin-theme="pink"] #admin-modal input[type="datetime-local"]::-moz-calendar-picker-indicator,
[data-admin-theme="pink"] #admin-modal input[type="time"]::-moz-calendar-picker-indicator,
[data-admin-theme="pink"] .admin-card input[type="date"]::-moz-calendar-picker-indicator,
[data-admin-theme="pink"] .admin-card input[type="datetime-local"]::-moz-calendar-picker-indicator,
[data-admin-theme="pink"] .admin-card input[type="time"]::-moz-calendar-picker-indicator {
  filter: none;
  opacity: 0.85;
}
main label,
#admin-modal label,
.admin-card label { color: var(--admin-text-muted); }

/* --- 列表表格 --- */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

.admin-table-wrap { width: 100%; }
.admin-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.admin-table-scroll > .admin-table {
  min-width: var(--admin-table-min-width, 100%);
}
.admin-table,
.admin-standalone-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  color: var(--admin-text);
}
.admin-table thead th,
.admin-table tbody td,
.admin-standalone-table thead th,
.admin-standalone-table tbody td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.admin-table thead th,
.admin-standalone-table thead th {
  padding-top: 0.625rem;
  padding-bottom: 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--admin-text-muted);
  white-space: nowrap;
  background: var(--admin-table-head-bg);
  border-bottom: 1px solid var(--admin-border);
}
.admin-table tbody td,
.admin-standalone-table tbody td {
  border-top: 1px solid var(--admin-table-row-border);
  color: var(--admin-text);
}
.admin-table tbody tr:hover td,
.admin-standalone-table tbody tr:hover td { background: var(--admin-table-row-hover); }
.admin-table .col-actions,
.admin-standalone-table .col-actions {
  text-align: left;
  white-space: nowrap;
}
.admin-table .col-mono,
.admin-standalone-table .col-mono {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  white-space: nowrap;
}
.admin-table .col-clip,
.admin-standalone-table .col-clip {
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-table-empty {
  padding: 2.5rem 0.75rem;
  text-align: left;
  color: var(--admin-text-muted);
}
.admin-th-sort {
  color: var(--admin-text-muted);
  text-decoration: none;
}
.admin-th-sort:hover {
  color: var(--admin-text);
  text-decoration: none;
}

/* 表格缩略图（列表 + 详情共用） */
.admin-table-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  overflow: hidden;
  border-radius: 0.25rem;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface-2);
  vertical-align: middle;
  flex-shrink: 0;
}
.admin-table-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 订单详情 · 缩略图（固定尺寸） */
.admin-order-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 4rem;
  overflow: hidden;
  border-radius: 0.25rem;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface-2);
  vertical-align: middle;
  flex-shrink: 0;
}
.admin-order-thumb--side {
  width: 3.75rem;
  height: 5rem;
}
.admin-order-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.admin-order-thumb__empty {
  font-size: 0.625rem;
  color: var(--admin-text-dim);
  border-style: dashed;
}
.admin-standalone-table .col-thumb,
.admin-table .col-thumb {
  width: 3.5rem;
  text-align: left;
}

/* 订单详情 · 统一左缘（标题区 px-4 与表格首列对齐） */
.admin-order-detail {
  --admin-order-gutter: 1rem;
}
.admin-order-detail-card .admin-order-detail-head {
  text-align: left;
}

/* 订单详情 · 顶部摘要（标签 + 值纵向堆叠，左缘对齐） */
.admin-order-summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem 1.75rem;
  align-items: flex-start;
}
.admin-order-summary-field {
  min-width: 3.25rem;
  max-width: 100%;
  text-align: left;
}
.admin-order-summary-label {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--admin-text-muted);
  line-height: 1.3;
  margin-bottom: 0.25rem;
}
.admin-order-summary-value {
  font-size: 0.75rem;
  color: var(--admin-text);
  line-height: 1.35;
  word-break: break-word;
}
.admin-order-summary-value.col-mono {
  font-family: ui-monospace, monospace;
  font-size: 0.6875rem;
}

/* 订单详情 · 表格区与标题共用左缘 */
.admin-order-detail-table-wrap {
  padding-left: var(--admin-order-gutter);
  padding-right: var(--admin-order-gutter);
}

/* 订单详情 · 操作按钮（左：退款审核 · 右：其余） */
.admin-order-toolbar {
  width: 100%;
}
.admin-order-actions-left {
  margin-left: 0.25rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--admin-border);
}
.admin-order-actions-right {
  margin-left: auto;
}

/* 订单详情 · 退款审核模态 */
.admin-refund-modal__shell {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: none;
}
.admin-refund-modal__card {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 32rem;
  max-height: min(90vh, 640px);
  overflow: hidden;
}
.admin-refund-modal__view {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.admin-refund-modal__view.hidden {
  display: none;
}
.admin-refund-modal__head,
.admin-refund-modal__foot {
  flex-shrink: 0;
}
.admin-refund-modal__panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.admin-refund-modal__img-link {
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--admin-surface-2) 60%, transparent);
  border: 1px solid var(--admin-border);
}
.admin-refund-modal__img {
  display: block;
  width: 100%;
  max-height: 12rem;
  object-fit: contain;
  border-radius: 0.5rem;
}
.admin-refund-modal__confirm-warn {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid color-mix(in srgb, var(--admin-warning) 45%, var(--admin-border));
  background: color-mix(in srgb, var(--admin-warning) 12%, var(--admin-surface-2));
  color: var(--admin-text);
  line-height: 1.5;
}

/* 订单详情 · 履约明细（左合并单元格 + 右多行） */
.admin-order-fulfillment-table .col-item-group {
  width: 9.5rem;
  min-width: 9.5rem;
  vertical-align: top;
  background: var(--admin-surface-2);
  border-right: 1px solid var(--admin-border);
}
.admin-order-fulfillment-table tr.item-group-last td {
  border-bottom: 1px solid var(--admin-border);
}
.admin-order-fulfillment-table tr.item-group-last td.col-item-group {
  border-bottom: 1px solid var(--admin-border);
}
.admin-order-item-cell {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.75rem;
}
.admin-order-item-cell__line1 {
  color: var(--admin-text);
  line-height: 1.35;
  font-weight: 500;
}
.admin-order-item-cell__line1 .col-mono {
  font-weight: 600;
}
.admin-order-item-cell__line2 {
  font-size: 0.6875rem;
  color: var(--admin-text-muted);
  line-height: 1.3;
}
.admin-order-fulfillment-table .row-print td {
  color: var(--admin-text-muted);
}
.admin-order-fulfillment-table .col-mono,
.admin-order-orphan-table .col-mono {
  font-family: ui-monospace, monospace;
  font-size: 0.6875rem;
  white-space: nowrap;
}
.admin-order-fulfillment-table .col-clip {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* admin-card 内嵌 table（详情页） */
.admin-card table { color: var(--admin-text); }
.admin-card table thead th { color: var(--admin-text-muted); }
.admin-card table tbody td { color: var(--admin-text); }

/* --- 响应式：表格弹性收缩 + 工具栏换行 --- */
/* 平板及以下：收紧表格内边距，让列更易收缩 */
@media (max-width: 768px) {
  .admin-table thead th {
    padding: 0.5rem 0.5rem;
    font-size: 0.7rem;
  }
  .admin-table tbody td {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
  }
  .admin-table .col-clip {
    max-width: 6rem;
  }
}
/* 手机端：工具栏允许换行，左右两栏各占整行 */
@media (max-width: 640px) {
  .admin-list-toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .admin-toolbar-left {
    flex: 1 1 100%;
    overflow-x: auto;
  }
  .admin-toolbar-right {
    flex: 1 1 100%;
    justify-content: flex-end;
  }
  .admin-table thead th {
    padding: 0.4rem 0.4rem;
    font-size: 0.65rem;
  }
  .admin-table tbody td {
    padding: 0.3rem 0.4rem;
    font-size: 0.7rem;
  }
  .admin-table .col-clip {
    max-width: 4.5rem;
  }
}
/* 超窄屏：表单 label 改为顶部布局，输入框占满宽度 */
@media (max-width: 480px) {
  .admin-form-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
  }
  .admin-form-row > label {
    width: auto;
    text-align: left;
    line-height: 1.4;
  }
  .admin-form-actions > div:first-child {
    display: none;
  }
}

/* --- Tab / 徽章 --- */
.admin-tab-active {
  background: rgb(51 65 85);
  color: white;
  border-color: rgb(71 85 105);
}
.admin-tab-inactive {
  background: var(--admin-surface-2);
  color: rgb(203 213 225);
  border-color: var(--admin-border);
}
.admin-badge-on {
  background: rgb(6 78 59 / 0.45);
  color: rgb(110 231 183);
}
.admin-badge-off {
  background: rgb(51 65 85);
  color: var(--admin-text-muted);
}
.admin-badge-ok {
  background: rgb(6 78 59 / 0.45);
  color: rgb(134 239 172);
}
.admin-badge-warn {
  background: rgb(120 53 15 / 0.45);
  color: rgb(252 211 77);
}
.admin-badge-err {
  background: rgb(127 29 29 / 0.45);
  color: rgb(252 165 165);
}

/* --- Dashboard 系统连通性 --- */
.admin-health-panel {
  width: 100%;
}
.admin-health-count-ok {
  color: rgb(134 239 172);
}
.admin-health-count-warn {
  color: rgb(252 211 77);
}
.admin-health-count-err {
  color: rgb(252 165 165);
}
.admin-health-group {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem 0.75rem;
}
.admin-health-group-label {
  flex: 0 0 5.5rem;
  font-size: 0.75rem;
  line-height: 1.625;
  color: var(--admin-text-muted);
}
.admin-health-badges {
  flex: 1 1 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  min-width: 0;
}
.admin-health-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  line-height: 1.4;
  white-space: nowrap;
  cursor: default;
}

/* --- 登录页品牌标语 --- */
.admin-slogan {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #67e8f9 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.admin-slogan-sub {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: var(--admin-text-muted);
}

/* --- 登录页内联错误提示 --- */
.admin-login-error {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.375rem;
  background: rgb(127 29 29 / 0.35);
  border: 1px solid rgb(220 38 38 / 0.5);
  color: rgb(252 165 165);
  font-size: 0.8125rem;
}
.admin-login-error svg {
  flex-shrink: 0;
}

/* --- 顶栏标题（page_top_bar）--- */
.admin-page-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--admin-text);
  line-height: 1.25;
}
.admin-page-subtitle {
  font-size: 0.75rem;
  color: var(--admin-text-muted);
  line-height: 1.375;
}

/* --- 工具栏 --- */
.admin-list-toolbar { color: var(--admin-text); }

/* --- 空状态 --- */
.admin-empty {
  padding: 2.5rem 0;
  text-align: center;
  color: var(--admin-text-muted);
}

/* --- 侧栏导航（Tailwind class 主题适配）--- */
[data-admin-theme="light"] .admin-sidebar .text-slate-300,
[data-admin-theme="light"] .admin-sidebar .text-slate-500 {
  color: var(--admin-sidebar-section);
}
[data-admin-theme="light"] .admin-sidebar a.text-slate-300,
[data-admin-theme="light"] .admin-sidebar summary.text-slate-300 {
  color: var(--admin-sidebar-link);
}
[data-admin-theme="light"] .admin-sidebar a.bg-slate-800,
[data-admin-theme="light"] .admin-sidebar a[class*="bg-slate-800"],
[data-admin-theme="light"] .admin-sidebar a.sidebar-nav-active {
  background-color: var(--admin-sidebar-link-hover-bg) !important;
  color: var(--admin-text) !important;
}
[data-admin-theme="light"] .admin-sidebar a:hover,
[data-admin-theme="light"] .admin-sidebar summary:hover {
  background-color: var(--admin-sidebar-link-hover-bg) !important;
  color: var(--admin-text) !important;
}
[data-admin-theme="light"] .admin-sidebar .border-slate-700\/80 {
  border-color: var(--admin-border) !important;
}

[data-admin-theme="ocean"] .admin-sidebar a.bg-slate-800,
[data-admin-theme="ocean"] .admin-sidebar a[class*="bg-slate-800"],
[data-admin-theme="ocean"] .admin-sidebar a.sidebar-nav-active {
  background-color: var(--admin-sidebar-link-hover-bg) !important;
  color: #fff !important;
}
[data-admin-theme="ocean"] .admin-sidebar a:hover,
[data-admin-theme="ocean"] .admin-sidebar summary:hover {
  background-color: var(--admin-sidebar-link-hover-bg) !important;
}

[data-admin-theme="pink"] .admin-sidebar .text-slate-300,
[data-admin-theme="pink"] .admin-sidebar .text-slate-500 {
  color: var(--admin-sidebar-section);
}
[data-admin-theme="pink"] .admin-sidebar a.text-slate-300,
[data-admin-theme="pink"] .admin-sidebar summary.text-slate-300 {
  color: var(--admin-sidebar-link);
}
[data-admin-theme="pink"] .admin-sidebar a.bg-slate-800,
[data-admin-theme="pink"] .admin-sidebar a[class*="bg-slate-800"],
[data-admin-theme="pink"] .admin-sidebar a.sidebar-nav-active {
  background-color: var(--admin-sidebar-link-hover-bg) !important;
  color: var(--admin-text) !important;
}
[data-admin-theme="pink"] .admin-sidebar a:hover,
[data-admin-theme="pink"] .admin-sidebar summary:hover {
  background-color: var(--admin-sidebar-link-hover-bg) !important;
  color: var(--admin-text) !important;
}
[data-admin-theme="pink"] .admin-sidebar .border-slate-700\/80 {
  border-color: var(--admin-border) !important;
}
[data-admin-theme="pink"] .admin-header-settings:hover,
[data-admin-theme="pink"] .admin-header-settings[aria-expanded="true"] {        
  background: rgb(251 207 232 / 0.55);
  color: var(--admin-text);
}

/* --- 滑块验证 --- */
.admin-slider {
  position: relative;
  width: 100%;
  height: 2.5rem;
  background-color: var(--admin-surface-2);
  border: 1px solid var(--admin-border);
  border-radius: 0.5rem;
  overflow: hidden;
  user-select: none;
  touch-action: none;
}
.admin-slider-track {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-slider-tip {
  font-size: 0.75rem;
  color: var(--admin-text-muted);
  pointer-events: none;
  transition: opacity .15s;
}
.admin-slider-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background-color: var(--admin-btn-primary-bg);
  opacity: 0.35;
  transition: width .1s;
}
.admin-slider-handle {
  position: absolute;
  left: 0;
  top: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--admin-btn-primary-bg);
  color: #fff;
  border: none;
  border-radius: 0.4rem;
  cursor: grab;
  z-index: 2;
  transition: left .1s, background-color .15s;
  touch-action: none;
}
.admin-slider-handle:active { cursor: grabbing; }
.admin-slider.is-success .admin-slider-handle {
  background-color: var(--admin-success);
  cursor: default;
}
.admin-slider.is-success .admin-slider-progress {
  background-color: var(--admin-success);
  opacity: 0.25;
}
.admin-slider.is-error .admin-slider-handle {
  background-color: var(--admin-danger);
  animation: admin-slider-shake .3s;
}
.admin-slider.is-error .admin-slider-progress {
  background-color: var(--admin-danger);
  opacity: 0.25;
}
@keyframes admin-slider-shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* --- 滑块验证提示消息 --- */
.admin-slider-msg {
  display: none;
  font-size: 0.75rem;
  margin-top: 0.375rem;
  color: var(--admin-danger);
  transition: color .15s;
}

/* --- 列表/区块自动刷新控件 --- */
.admin-list-poll-control {
  user-select: none;
}
.admin-poll-countdown {
  font-variant-numeric: tabular-nums;
  color: var(--admin-text);
  min-width: 1.25rem;
  text-align: center;
}
.admin-poll-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.admin-poll-switch-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.admin-poll-switch-track {
  display: block;
  width: 2.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  background: var(--admin-surface-2);
  border: 1px solid var(--admin-border);
  transition: background-color 0.15s, border-color 0.15s;
  position: relative;
}
.admin-poll-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 9999px;
  background: var(--admin-text-muted);
  transition: transform 0.15s, background-color 0.15s;
}
.admin-poll-switch-input:checked + .admin-poll-switch-track {
  background: rgb(6 78 59 / 0.45);
  border-color: rgb(52 211 153 / 0.35);
}
.admin-poll-switch-input:checked + .admin-poll-switch-track::after {
  transform: translateX(1rem);
  background: rgb(110 231 183);
}
.admin-poll-switch-input:focus-visible + .admin-poll-switch-track {
  outline: 2px solid var(--admin-link);
  outline-offset: 2px;
}
