:root {
  --bg: #0f1115;
  --panel: #141824;
  --panel-2: #0f1320;
  --card: #151a27;
  --border: rgba(255, 255, 255, 0.08);
  --text: rgba(255, 255, 255, 0.88);
  --muted: rgba(255, 255, 255, 0.6);
  --muted-2: rgba(255, 255, 255, 0.42);
  --primary: #f06d3b;
  --primary-2: #ff845a;
  --danger: #ff4d4f;
  --ok: #2ecc71;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --radius: 14px;
}

body[data-theme="light"] {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel-2: #f1f3f7;
  --card: #ffffff;
  --border: rgba(15, 17, 21, 0.12);
  --text: rgba(15, 17, 21, 0.92);
  --muted: rgba(15, 17, 21, 0.62);
  --muted-2: rgba(15, 17, 21, 0.42);
  --shadow: 0 10px 30px rgba(15, 17, 21, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: radial-gradient(1200px 600px at 20% 0%, rgba(240, 109, 59, 0.18), transparent 60%),
    radial-gradient(900px 600px at 90% 20%, rgba(90, 160, 255, 0.14), transparent 55%), var(--bg);
  color: var(--text);
}

body[data-theme="light"] {
  background: radial-gradient(1200px 600px at 20% 0%, rgba(240, 109, 59, 0.12), transparent 62%),
    radial-gradient(900px 600px at 90% 20%, rgba(90, 160, 255, 0.12), transparent 58%), var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  display: flex;
  height: 100%;
}

.sidebar {
  width: 268px;
  background: linear-gradient(180deg, rgba(21, 26, 39, 0.92), rgba(15, 19, 32, 0.92));
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  backdrop-filter: blur(10px);
  min-height: 0;
  overflow: hidden;
}

body[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(241, 243, 247, 0.92));
}

.mobile-toggle {
  display: none;
}

.mobile-toggle .icon-btn {
  width: 44px;
  height: 44px;
  background: rgba(20, 24, 36, 0.85);
  box-shadow: var(--shadow);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
}

body[data-theme="light"] .mobile-toggle .icon-btn {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(15, 17, 21, 0.12);
  color: rgba(15, 17, 21, 0.86);
  box-shadow: 0 10px 26px rgba(15, 17, 21, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
}

body[data-theme="light"] .brand {
  background: rgba(15, 17, 21, 0.03);
}
.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: grid;
  place-items: center;
  font-weight: 900;
}

.brand-title {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.brand-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 2px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: 160ms ease;
  min-width: 0;
}

.nav-icon {
  width: 24px;
  text-align: center;
}

.nav-item > span:not(.nav-icon) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

body[data-theme="light"] .nav-item:hover {
  background: rgba(15, 17, 21, 0.04);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(240, 109, 59, 0.22), rgba(255, 132, 90, 0.12));
  border-color: rgba(240, 109, 59, 0.28);
}

body[data-theme="light"] .nav-item.active {
  color: var(--text);
  background: rgba(240, 109, 59, 0.14);
}

.nav-item.disabled {
  opacity: 0.45;
  pointer-events: none;
}

body[data-authed="0"] .sidebar {
  display: none;
}

body[data-authed="0"] .pill {
  display: none;
}

body[data-authed="0"] #btnLogout {
  display: none;
}

body[data-authed="0"] .mobile-toggle {
  display: none !important;
}

.login-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(520px, 96vw);
}

.login-title {
  font-weight: 900;
  font-size: 20px;
  margin-bottom: 8px;
}

.login-sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 10px 2px 4px;
}

.sidebar-footer .pill {
  height: 44px;
  padding: 0 14px;
}

.sidebar-footer .btn {
  height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
}

.sidebar-footer .icon-btn {
  width: 44px;
  height: 44px;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12px;
}

body[data-theme="light"] .pill {
  background: rgba(15, 17, 21, 0.03);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.12);
}

.content {
  padding: 18px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.analytics-page {
  font-weight: 600;
}

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

.order-detail .kv-item .k {
  color: var(--muted);
  font-size: 12px;
}

.order-detail .kv-item .v {
  margin-top: 4px;
  word-break: break-word;
}

.order-detail .qr-img {
  max-width: 280px;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #fff;
  image-rendering: pixelated;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body[data-theme="light"] .order-detail .qr-img {
  border: 1px solid rgba(15, 17, 21, 0.12);
}

.flash-page .table-nowrap {
  width: max(980px, 100%);
  min-width: 980px;
}

.flash-detail .table-nowrap {
  width: max(860px, 100%);
  min-width: 860px;
}

.flash-detail-table {
  width: 100%;
  table-layout: auto;
}

.flash-detail-table th,
.flash-detail-table td {
  padding: 10px 8px;
}

.user-detail-table {
  width: 100%;
  table-layout: auto;
}

.user-detail-table th,
.user-detail-table td {
  padding: 10px 8px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(21, 26, 39, 0.66);
  box-shadow: var(--shadow);
  overflow: hidden;
}

body[data-theme="light"] .card {
  background: rgba(255, 255, 255, 0.9);
}

.card-head {
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-title {
  font-weight: 800;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filters {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filters-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
}

.filters-left .input {
  min-width: 220px;
  flex: 1;
}

.filters-left .select {
  width: 160px;
  flex: none;
}

.filters-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: none;
}

.filters .btn {
  height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
}

.card-body {
  padding: 14px;
}

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

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

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-title {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.cover-uploader {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.cover-thumb-wrap {
  position: relative;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  cursor: grab;
}

.cover-thumb-wrap.dragging {
  opacity: 0.65;
  cursor: grabbing;
}

.cover-thumb-wrap.drag-over {
  outline: 2px dashed rgba(240, 109, 59, 0.9);
  outline-offset: 2px;
}

.ticket-row {
  cursor: grab;
}

.ticket-row.dragging {
  opacity: 0.65;
  cursor: grabbing;
}

.ticket-row.drag-over {
  outline: 2px dashed rgba(240, 109, 59, 0.9);
  outline-offset: -2px;
}

.cover-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.cover-tag {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}

.cover-tag.primary {
  background: rgba(34, 197, 94, 0.9);
}

.cover-del {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 26px;
  height: 26px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 18px;
  line-height: 24px;
  cursor: pointer;
}

.cover-del:hover {
  background: rgba(0, 0, 0, 0.65);
}

.cover-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  border: 1px solid var(--border);
  object-fit: cover;
  background: rgba(255, 255, 255, 0.03);
}

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

.cover-actions .cover-clear {
  margin-left: auto;
}

.intro-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

body[data-theme="light"] .intro-editor {
  background: rgba(15, 17, 21, 0.02);
}

.intro-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.intro-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.intro-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(20, 24, 36, 0.5);
}

body[data-theme="light"] .intro-block {
  background: rgba(255, 255, 255, 0.92);
}

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

.intro-text-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.intro-rich-editor {
  min-height: 140px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  outline: none;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
  overflow: auto;
}

body[data-theme="light"] .intro-rich-editor {
  background: rgba(15, 17, 21, 0.02);
  color: rgba(15, 17, 21, 0.9);
}

.intro-rich-editor:focus {
  border-color: rgba(240, 109, 59, 0.35);
  box-shadow: 0 0 0 4px rgba(240, 109, 59, 0.12);
}

.intro-rich-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.ck {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  font-weight: 800;
  user-select: none;
}

body[data-theme="light"] .ck {
  color: rgba(15, 17, 21, 0.86);
}

.input.input-color {
  width: 46px;
  height: 34px;
  padding: 0;
}

.intro-rich-preview {
  margin-top: 10px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

body[data-theme="light"] .intro-rich-preview {
  background: rgba(15, 17, 21, 0.02);
}

.intro-block-type {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 800;
  font-size: 13px;
}

body[data-theme="light"] .intro-block-type {
  color: rgba(15, 17, 21, 0.82);
}

.intro-img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  object-fit: cover;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 10px;
}

body[data-theme="light"] .intro-img {
  background: rgba(15, 17, 21, 0.03);
}

.multi-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

body[data-theme="light"] .multi-box {
  background: rgba(15, 17, 21, 0.02);
}

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

.check-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(20, 24, 36, 0.5);
  cursor: pointer;
}

body[data-theme="light"] .check-item {
  background: rgba(255, 255, 255, 0.92);
}

.check-item input {
  margin-top: 4px;
}

.flash-items {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flash-item-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) 1fr 1fr 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(20, 24, 36, 0.5);
}

body[data-theme="light"] .flash-item-row {
  background: rgba(255, 255, 255, 0.92);
}

.flash-item-name {
  padding-top: 2px;
}

.todo-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

body[data-theme="light"] .todo-item {
  background: rgba(255, 255, 255, 0.92);
}

.todo-title {
  font-weight: 900;
  margin-bottom: 2px;
}

.mini-multi {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

body[data-theme="light"] .mini-multi {
  background: rgba(255, 255, 255, 0.92);
}

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

.mini-check {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(20, 24, 36, 0.5);
  cursor: pointer;
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
}

body[data-theme="light"] .mini-check {
  background: rgba(255, 255, 255, 0.92);
  color: rgba(15, 17, 21, 0.86);
}

.mini-check input {
  margin: 0;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

body[data-theme="light"] .panel {
  background: rgba(255, 255, 255, 0.92);
}

.panel-title {
  font-weight: 900;
  margin-bottom: 10px;
}

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

.panel-head .panel-title {
  margin-bottom: 0;
}

.panel-head .icon-btn {
  width: 44px;
  height: 44px;
}

.chart {
  width: 100%;
  height: auto;
  display: block;
}

body[data-theme="light"] svg.chart .chart-axis-text,
body[data-theme="light"] svg.chart .chart-empty-text,
body[data-theme="light"] svg.chart .pie-center-text {
  fill: rgba(15, 17, 21, 0.82);
}

body[data-theme="light"] svg.chart .pie-center {
  fill: rgba(255, 255, 255, 0.92);
  stroke: rgba(0, 0, 0, 0.08);
}

body[data-theme="light"] svg.chart .chart-tip-text {
  fill: rgba(255, 255, 255, 0.92);
}

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

.kpi-click {
  cursor: pointer;
  transition: 160ms ease;
}

.kpi-click:hover {
  transform: translateY(-1px);
  border-color: rgba(240, 109, 59, 0.28);
}

.kpi-click.active {
  border-color: rgba(240, 109, 59, 0.35);
  background: rgba(240, 109, 59, 0.08);
}

.field > label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.field > label.switch {
  display: inline-flex;
  margin-bottom: 0;
}

.input,
.select,
.textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  outline: none;
  color-scheme: dark;
}

.select.select-sm {
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  width: auto;
}

.intro-text-tools .select.select-sm {
  min-width: 86px;
}

.input,
.select {
  height: 44px;
  padding: 0 12px;
}

body[data-theme="light"] .input,
body[data-theme="light"] .select,
body[data-theme="light"] .textarea {
  background: rgba(15, 17, 21, 0.04);
  color-scheme: light;
}

.textarea {
  padding: 10px 12px;
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-row .input,
.input-row .select,
.input-row .textarea {
  flex: 1;
}

.select option,
.select optgroup {
  background: rgba(20, 24, 36, 0.98);
  color: rgba(255, 255, 255, 0.88);
}

body[data-theme="light"] .select option,
body[data-theme="light"] .select optgroup {
  background: #fff;
  color: rgba(15, 17, 21, 0.92);
}

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

.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(240, 109, 59, 0.45);
  box-shadow: 0 0 0 4px rgba(240, 109, 59, 0.12);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap-x {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding-bottom: 6px;
  scrollbar-gutter: stable;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.table-wrap-x::-webkit-scrollbar {
  height: 0;
}

.table-wrap-x::-webkit-scrollbar-thumb {
  background: transparent;
}

body[data-theme="light"] .table-wrap-x::-webkit-scrollbar-thumb {
  background: transparent;
}

.hscroll {
  margin-top: 10px;
  height: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 999px;
  scrollbar-gutter: stable;
}

.hscroll-inner {
  height: 1px;
}

.hscroll::-webkit-scrollbar {
  height: 12px;
}

.hscroll::-webkit-scrollbar-track {
  background: transparent;
}

.hscroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

body[data-theme="light"] .hscroll {
  background: rgba(15, 17, 21, 0.03);
}

body[data-theme="light"] .hscroll::-webkit-scrollbar-thumb {
  background: rgba(15, 17, 21, 0.18);
  border: 3px solid transparent;
  background-clip: padding-box;
}

.table-nowrap {
  min-width: 100%;
  width: max-content;
}

.orders-table.table-nowrap {
  min-width: 1200px;
  width: 100%;
  table-layout: fixed;
}

.orders-table th,
.orders-table td {
  padding: 10px 8px;
}

.orders-table td:nth-child(5) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-nowrap th,
.table-nowrap td {
  white-space: nowrap;
}

.table-nowrap td > div {
  display: inline-block;
  margin-left: 10px;
}

.table-nowrap td > div:first-child {
  margin-left: 0;
}

.table.has-actions th:last-child,
.table.has-actions td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: rgba(21, 26, 39, 0.92);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 14px rgba(0, 0, 0, 0.28);
}

.table.has-actions th:last-child {
  z-index: 3;
}

body[data-theme="light"] .table.has-actions th:last-child,
body[data-theme="light"] .table.has-actions td:last-child {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: -10px 0 14px rgba(15, 17, 21, 0.12);
}

.table th,
.table td {
  padding: 10px 8px;
  border-top: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  color: var(--muted);
  font-size: 13px;
}

.table th {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

body[data-theme="light"] .table th {
  color: rgba(15, 17, 21, 0.62);
}

.table td strong {
  color: inherit;
  font-weight: inherit;
}

body[data-theme="light"] .table td strong {
  color: rgba(15, 17, 21, 0.92);
}

strong,
b {
  font-weight: inherit;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

body[data-theme="light"] .badge {
  background: rgba(15, 17, 21, 0.03);
}

.badge.primary {
  border-color: rgba(240, 109, 59, 0.35);
  color: rgba(255, 255, 255, 0.9);
  background: rgba(240, 109, 59, 0.12);
}

.badge.danger {
  border-color: rgba(255, 77, 79, 0.35);
  background: rgba(255, 77, 79, 0.12);
  color: rgba(255, 255, 255, 0.9);
}

body[data-theme="light"] .badge.primary {
  color: rgba(15, 17, 21, 0.9);
  background: rgba(240, 109, 59, 0.14);
}

body[data-theme="light"] .badge.danger {
  color: rgba(15, 17, 21, 0.9);
  background: rgba(255, 77, 79, 0.14);
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  transition: 160ms ease;
  font-weight: 500;
  font-size: 13px;
}

body[data-theme="light"] .btn {
  background: rgba(15, 17, 21, 0.06);
  color: rgba(15, 17, 21, 0.88);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-sm {
  padding: 8px 10px;
  border-radius: 11px;
  font-size: 12px;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
}

body[data-theme="light"] .btn:hover {
  background: rgba(15, 17, 21, 0.08);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
  color: var(--muted);
}

body[data-theme="light"] .btn-ghost {
  background: rgba(15, 17, 21, 0.03);
}

.btn-danger {
  background: rgba(255, 77, 79, 0.12);
  border-color: rgba(255, 77, 79, 0.35);
  color: rgba(255, 255, 255, 0.9);
}

body[data-theme="light"] .btn-danger {
  color: rgba(15, 17, 21, 0.9);
}

.btn-danger:hover {
  background: rgba(255, 77, 79, 0.18);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  display: grid;
  place-items: center;
}

body[data-theme="light"] .icon-btn {
  background: rgba(15, 17, 21, 0.03);
  color: rgba(15, 17, 21, 0.85);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

body[data-theme="light"] .icon-btn:hover {
  background: rgba(15, 17, 21, 0.06);
}

.actions {
  display: flex;
  gap: 8px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-slider {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  position: relative;
  transition: 160ms ease;
  flex: 0 0 auto;
}

body[data-theme="light"] .switch-slider {
  background: rgba(15, 17, 21, 0.06);
}

.switch-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: 160ms ease;
}

body[data-theme="light"] .switch-slider::after {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 18px rgba(15, 17, 21, 0.18);
}

.switch.on .switch-slider {
  background: rgba(240, 109, 59, 0.22);
  border-color: rgba(240, 109, 59, 0.35);
}

.switch.on .switch-slider::after {
  transform: translateX(20px);
  background: rgba(240, 109, 59, 0.95);
}

.switch-sm .switch-slider {
  width: 40px;
  height: 20px;
}

.switch-sm .switch-slider::after {
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
}

.switch-sm.switch.on .switch-slider::after {
  transform: translateX(20px);
}

.switch-text {
  font-size: 12px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.8);
}

body[data-theme="light"] .switch-text {
  color: rgba(15, 17, 21, 0.72);
}

.msel {
  position: relative;
}

.msel-trigger {
  min-width: 260px;
  max-width: 420px;
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.88);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}

body[data-theme="light"] .msel-trigger {
  background: rgba(15, 17, 21, 0.03);
  color: rgba(15, 17, 21, 0.88);
}

.msel-trigger:focus {
  outline: none;
  border-color: rgba(240, 109, 59, 0.35);
  box-shadow: 0 0 0 4px rgba(240, 109, 59, 0.12);
}

.msel-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
  font-size: 13px;
}

.msel-caret {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  flex: 0 0 auto;
}

body[data-theme="light"] .msel-caret {
  color: rgba(15, 17, 21, 0.5);
}

.msel-panel {
  position: absolute;
  top: 50px;
  left: 0;
  z-index: 1200;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(20, 24, 36, 0.98);
  box-shadow: var(--shadow);
  padding: 10px;
  min-width: 320px;
  max-width: min(420px, calc(100vw - 40px));
  box-sizing: border-box;
}

body[data-theme="light"] .msel-panel {
  background: rgba(255, 255, 255, 0.98);
}

.msel-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.msel-search {
  height: 38px;
  flex: 1 1 180px;
  min-width: 180px;
}

.msel-top .actions {
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.msel-list {
  margin-top: 10px;
  max-height: 320px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.msel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
}

body[data-theme="light"] .msel-item {
  background: rgba(15, 17, 21, 0.03);
  color: rgba(15, 17, 21, 0.86);
}

.msel-item input {
  margin: 0;
}

.pie-legend {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 14px;
}

.pie-legend.is-dense {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.pie-legend-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  font-weight: 800;
}

body[data-theme="light"] .pie-legend-item {
  color: rgba(15, 17, 21, 0.86);
}

.pie-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.18);
  flex: 0 0 auto;
}

.pie-text {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}

.pie-legend.is-dense .pie-legend-item {
  align-items: center;
}

.pie-legend.is-dense .pie-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
}

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

.file {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 1000;
}

.submodal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 1100;
}

.modal {
  width: min(820px, 96vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(20, 24, 36, 0.95);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.submodal {
  width: min(760px, 94vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(20, 24, 36, 0.98);
  box-shadow: var(--shadow);
  overflow: hidden;
}

body[data-theme="light"] .modal {
  background: rgba(255, 255, 255, 0.98);
}

body[data-theme="light"] .submodal {
  background: rgba(255, 255, 255, 0.99);
}

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

.modal-title {
  font-weight: 900;
}

.modal-body {
  padding: 14px;
  overflow: auto;
  flex: 1;
}

.modal-foot {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.confirm-body {
  padding: 8px 2px;
}

.confirm-text {
  text-align: center;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.86);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-theme="light"] .confirm-text {
  color: rgba(15, 17, 21, 0.86);
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: rgba(20, 24, 36, 0.95);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  color: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  z-index: 2000;
}

body[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.98);
  color: rgba(15, 17, 21, 0.88);
}

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

.kpi-item {
  padding: 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
}

body[data-theme="light"] .kpi-item {
  background: rgba(255, 255, 255, 0.92);
}

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

.kpi-item .value {
  margin-top: 8px;
  font-weight: 500;
  font-size: 22px;
}

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

@media (max-width: 980px) {
  .mobile-toggle {
    position: fixed;
    left: 12px;
    top: 12px;
    z-index: 950;
    display: block;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-102%);
    transition: 180ms ease;
    z-index: 900;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .content {
    padding: 12px;
  }
  .kpi {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .check-list {
    grid-template-columns: 1fr;
  }

  .flash-item-row {
    grid-template-columns: 1fr;
  }

  .mini-multi-list {
    grid-template-columns: 1fr;
  }
}
