:root {
  color-scheme: dark;
  --bg: #06121b;
  --panel: rgba(7, 27, 40, .72);
  --panel-2: rgba(10, 38, 53, .76);
  --line: rgba(57, 231, 255, .24);
  --cyan: #39e7ff;
  --mint: #39f3c4;
  --pink: #ff5db1;
  --text: #edfaff;
  --muted: #8fb4c3;
  --danger: #ff7187;
  --warning: #ffd166;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(circle at 88% 8%, rgba(57,231,255,.12), transparent 28%), radial-gradient(circle at 78% 84%, rgba(255,93,177,.1), transparent 25%), var(--bg);
  color: var(--text);
  font: 14px/1.5 "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(90deg, rgba(3, 14, 24, .42), rgba(3, 14, 24, .18)), url("./miku-dashboard-v2.png") center / cover no-repeat;
  opacity: .42;
  pointer-events: none;
  filter: saturate(1.1);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(116deg, transparent 0 64%, rgba(255,93,177,.07) 70%, transparent 84%), repeating-linear-gradient(90deg, rgba(57,231,255,.025) 0 1px, transparent 1px 46px);
  opacity: .7;
  pointer-events: none;
}
.page { position: relative; z-index: 1; }

button, input, select, textarea { font: inherit; }
button {
  border: 1px solid rgba(57, 231, 255, .45);
  border-radius: 8px;
  background: rgba(12, 47, 62, .62);
  color: var(--text);
  padding: 8px 13px;
  cursor: pointer;
}
button:hover { background: linear-gradient(135deg, rgba(57,231,255,.25), rgba(255,93,177,.12)); }
button.primary { background: var(--cyan); color: #04202a; font-weight: 700; }
button.danger { border-color: rgba(255, 113, 135, .55); color: #ff9bab; }
button:disabled { opacity: .4; cursor: not-allowed; }

input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(4, 21, 31, .76);
  color: var(--text);
  padding: 8px 10px;
  min-height: 36px;
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--cyan); }
input[type="checkbox"] { width: 14px; height: 14px; min-height: 0; padding: 0; accent-color: var(--cyan); vertical-align: middle; }

.page { padding: 18px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.page-title { margin: 0; font-size: 20px; letter-spacing: .04em; }
.page-subtitle { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 11px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(14px) saturate(1.12); }
.toolbar .spacer { flex: 1; }
.toolbar input[type="search"] { width: min(280px, 100%); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; backdrop-filter: blur(14px) saturate(1.12); box-shadow: 0 10px 34px rgba(0,0,0,.18); }
.table-wrap { overflow: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.table-wrap > table:not(#stockMatrix) { width: max-content !important; min-width: 0 !important; table-layout: auto !important; }
.table-wrap > table:not(#stockMatrix) th, .table-wrap > table:not(#stockMatrix) td { min-width: 0; }
th, td { overflow: hidden; padding: 6px 7px; text-align: left; text-overflow: ellipsis; border-bottom: 1px solid rgba(143, 180, 195, .13); }
th { position: sticky; top: 0; z-index: 1; background: rgba(7, 39, 53, .88); color: #c9f5ff; font-size: 12px; font-weight: 600; backdrop-filter: blur(12px); }
.column-resizer { position: absolute; top: 0; right: -3px; z-index: 4; width: 7px; height: 100%; cursor: col-resize; touch-action: none; user-select: none; }
.column-resizer:hover, .column-resizer.dragging { background: linear-gradient(90deg,transparent,var(--cyan),transparent); box-shadow: 0 0 9px rgba(57,231,255,.7); }
tbody tr:hover { background: rgba(57, 231, 255, .055); }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; background: rgba(143, 180, 195, .13); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status.ok::before { background: var(--mint); box-shadow: 0 0 8px var(--mint); }
.status.warn::before { background: var(--warning); }
.status.bad::before { background: var(--danger); }
.muted { color: var(--muted); }
.error { color: #ff9bab; }
.notice { min-height: 20px; margin: 9px 2px; color: var(--muted); }
.grid-stats { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { min-height: 86px; padding: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(14px) saturate(1.12); }
.stat b { display: block; margin-top: 5px; color: var(--cyan); font-size: 25px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 10px; }
.form-field { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.form-actions { display: flex; gap: 8px; align-items: end; }
.hidden { display: none !important; }
.admin-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; padding: 11px; background: rgba(38, 20, 46, .62); border: 1px solid rgba(255, 93, 177, .24); border-radius: var(--radius); backdrop-filter: blur(14px); }
.admin-bar input { width: min(360px, 100%); }
.section-title { margin: 18px 0 8px; font-size: 15px; color: #c9f7ff; }
.action-table td:first-child { width: 180px; color: var(--cyan); font-weight: 700; }
.action-table td:last-child { width: 1%; }
.action-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.compact-select { min-width: 118px; }
.segment { display: inline-flex; padding: 3px; gap: 3px; border: 1px solid var(--line); border-radius: 10px; background: #071923; }
.segment button { border: 0; background: transparent; padding: 6px 12px; }
.segment button[aria-pressed="true"] { background: var(--cyan); color: #04202a; font-weight: 700; }
.dense-table { max-height: calc(100vh - 190px); }
.dense-table th, .dense-table td { padding: 4px 6px; font-size: 12px; }
.dense-table .status { padding: 1px 6px; }
.account-table-wrap { max-height: calc(100vh - 178px); }
.account-table { min-width: 0; }
.account-table th, .account-table td { height: 26px; padding: 2px 4px; }
.account-table .state-col { width: 44px; text-align: center; }
.account-table td:first-child { text-align: center; }
.account-state-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 50%;
  background: #8295a0;
  box-shadow: 0 0 8px rgba(130,149,160,.55);
}
.account-state-dot.running { background: #35ee9d; box-shadow: 0 0 10px rgba(53,238,157,.82); }
.account-state-dot.success { background: #45a8ff; box-shadow: 0 0 10px rgba(69,168,255,.86); }
.account-state-dot.issue { background: #ffd166; box-shadow: 0 0 10px rgba(255,209,102,.76); }
.account-state-dot.stopped { background: #ff526d; box-shadow: 0 0 10px rgba(255,82,109,.78); }
.account-state-dot.waiting { background: #8398a4; }
.cookie-status { display: inline-flex; align-items: center; min-width: 4.4em; justify-content: center; padding: 2px 7px; border: 1px solid rgba(140,190,205,.35); border-radius: 999px; font-size: 11px; line-height: 1.35; white-space: nowrap; }
.cookie-status.valid { color: #7dffc1; background: rgba(53,238,157,.12); border-color: rgba(53,238,157,.38); }
.cookie-status.invalid { color: #ff9bab; background: rgba(255,82,109,.12); border-color: rgba(255,82,109,.42); }
.cookie-status.network { color: #ffd166; background: rgba(255,209,102,.12); border-color: rgba(255,209,102,.42); }
.cookie-status.checking { color: #8deaff; background: rgba(57,231,255,.12); border-color: rgba(57,231,255,.42); }
.cookie-status.unknown { color: #b7c8cf; background: rgba(131,152,164,.12); border-color: rgba(131,152,164,.35); }
.masked-password { color: #8edce9; letter-spacing: .08em; }
.device-code-value { display: inline-block; margin-left: 6px; color: var(--warning); font-size: 14px; letter-spacing: .12em; text-shadow: 0 0 8px rgba(255,209,102,.35); }
.eye-toggle { min-height: 0; margin-left: 3px; padding: 0 3px; border: 0; background: transparent; color: var(--cyan); font-size: 12px; line-height: 1; vertical-align: middle; }
.eye-toggle:hover { background: rgba(57,231,255,.14); }
.status-legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 11px; }
.status-legend span { display: inline-flex; align-items: center; gap: 5px; }
.row-select { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.batch-dialog { width: min(720px, calc(100vw - 24px)); padding: 0; border: 1px solid rgba(57,231,255,.38); border-radius: 14px; background: rgba(6,25,36,.94); color: var(--text); box-shadow: 0 24px 80px rgba(0,0,0,.62); backdrop-filter: blur(22px); }
.batch-dialog::backdrop { background: rgba(0,7,13,.66); backdrop-filter: blur(4px); }
.batch-dialog form { padding: 18px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dialog-head h2 { margin: 0; color: var(--cyan); font-size: 19px; }
.dialog-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.dialog-head button { min-width: 34px; padding: 3px 9px; font-size: 20px; }
.login-shot-dialog { width: min(1050px, calc(100vw - 24px)); padding: 16px; border: 1px solid rgba(57,231,255,.38); border-radius: 14px; background: rgba(6,25,36,.94); color: var(--text); box-shadow: 0 24px 80px rgba(0,0,0,.62); backdrop-filter: blur(22px); }
.login-shot-dialog::backdrop { background: rgba(0,7,13,.72); backdrop-filter: blur(4px); }
.login-shot-frame { min-height: 360px; max-height: calc(100vh - 150px); overflow: auto; border: 1px solid rgba(57,231,255,.24); border-radius: 10px; background: #fff; }
.login-shot-frame img { display: block; width: 100%; height: auto; min-height: 360px; object-fit: contain; }
.drag-selecting, .drag-selecting * { user-select: none !important; }
tbody tr.row-range-selected td { background: rgba(40, 220, 226, .13); }
.batch-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.span-2 { grid-column: span 2; }.span-3 { grid-column: span 3; }
.inline-field { display: flex; gap: 6px; }
.inline-field input { min-width: 0; flex: 1; }
.choice-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 32px; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: rgba(3,20,29,.42); }
.choice-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border: 1px solid rgba(57,231,255,.35); border-radius: 999px; background: rgba(57,231,255,.1); }
.choice-chip button { border: 0; padding: 0 2px; background: transparent; color: #ff9bab; }
.target-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.target-picker { min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: rgba(3,20,29,.38); }
.target-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.target-head span { color: var(--muted); font-size: 12px; }
.target-picker > input { width: 100%; }
.picker-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 7px; }
.picker-filters.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.picker-filters select { min-width: 0; width: 100%; padding: 6px 7px; }
.target-actions { display: flex; gap: 5px; margin: 6px 0; }
.target-actions button { padding: 4px 8px; font-size: 12px; }
.multi-options { height: 260px; overflow: auto; border: 1px solid rgba(116,219,235,.2); border-radius: 7px; background: rgba(1,14,21,.35); }
.multi-option { display: flex; gap: 7px; align-items: flex-start; padding: 5px 7px; border-bottom: 1px solid rgba(116,219,235,.1); cursor: pointer; white-space: normal; line-height: 1.3; }
.multi-option:hover { background: rgba(57,231,255,.1); }
.multi-option input { flex: 0 0 auto; margin-top: 2px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.page-actions { display: flex; gap: 8px; }
.switch-control { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(7,27,40,.65); color: var(--muted); cursor: pointer; }
.switch-control input { position: absolute; opacity: 0; pointer-events: none; }
.switch-control span { position: relative; width: 34px; height: 18px; border-radius: 99px; background: rgba(143,180,195,.35); transition: .2s; }
.switch-control span::after { content:""; position:absolute; top:3px; left:3px; width:12px; height:12px; border-radius:50%; background:#d7edf3; transition:.2s; }
.switch-control input:checked + span { background: rgba(57,243,196,.48); box-shadow: inset 0 0 0 1px var(--mint); }
.switch-control input:checked + span::after { transform: translateX(16px); background: var(--mint); box-shadow: 0 0 8px var(--mint); }
.switch-control b { font-size: 12px; font-weight: 600; }
.success-summary { align-items: stretch; }
.success-search-stat { grid-column: span 2; display: grid; align-content: center; gap: 8px; }
.success-search-stat label { color: #c9f5ff; font-size: 12px; }
.success-search-stat div { display: flex; gap: 8px; }
.success-search-stat input { width: 100%; }
.success-table { min-width: 0; }
.success-table-wrap { max-height: calc(100vh - 230px); }
.success-page .page { padding: 6px; }
.success-page .page-head { margin-bottom: 6px; gap: 6px; }
.success-page .success-summary { display: flex; flex-wrap: nowrap; width: 100%; gap: 6px; margin-bottom: 4px; }
.success-page .success-summary > .stat { flex: 0 0 auto; }
.success-page .stat { min-height: 48px; padding: 5px 8px; }
.success-page .stat b { display: inline; margin-left: 8px; font-size: 20px; }
.success-page .success-export-stat { display: flex; align-items: center; padding: 5px; }
.success-page .success-export-stat button { min-height: 36px; white-space: nowrap; }
.success-page .success-search-stat { flex: 1 1 auto; min-width: 260px; grid-column: auto; gap: 3px; }
.success-page .success-search-stat input { min-width: 0; min-height: 30px; padding: 4px 6px; }
.success-page #refresh { flex: none; white-space: nowrap; padding: 4px 9px; }
.success-page .notice { margin: 4px 1px; }
.success-page .dense-table th, .success-page .dense-table td { padding: 2px 3px; font-size: 12px; }
.success-page .success-table-wrap { max-height: calc(100vh - 135px); }
.success-page .row-export { min-height: 0; padding: 2px 6px; border-radius: 5px; color: var(--cyan); font-size: 11px; line-height: 1.35; }
.success-time { display: grid; gap: 0; font-size: 10px; line-height: 1.25; letter-spacing: 0; }
.success-time span:last-child { color: var(--muted); }
.success-text-panel { padding: 8px; }
.success-text-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.success-text-head b { color: var(--cyan); }
.success-text-head span { flex: 1; color: var(--muted); font-size: 12px; }
.success-text-panel textarea { width: 100%; height: calc(100vh - 180px); min-height: 320px; resize: vertical; border-radius: 8px; white-space: pre; overflow: auto; font: 12px/1.6 Consolas, "Microsoft YaHei", monospace; }
.payment-qr-thumb { display: inline-flex; width: 30px; height: 30px; padding: 1px; background: white; border: 0; border-radius: 2px; vertical-align: middle; }
.payment-qr-thumb img { width: 28px; height: 28px; object-fit: contain; color: #111; font-size: 8px; }
.order-email-send { padding: 2px 5px; font-size: 11px; }
.payment-qr-dialog { width: min(390px, calc(100vw - 24px)); padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #071b28; color: var(--text); }
.payment-qr-dialog::backdrop { background: rgba(0, 7, 13, .8); }
.payment-qr-dialog h2 { font-size: 16px; }
.payment-qr-dialog > img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: white; image-rendering: pixelated; }
.payment-qr-dialog p { font-size: 12px; color: var(--muted); margin-bottom: 0; }
.order-link { color: var(--cyan); text-decoration: none; font-weight: 700; }
.order-link:hover { text-decoration: underline; }
.context-menu { position: fixed; z-index: 1000; display: grid; min-width: 180px; padding: 5px; border: 1px solid rgba(57,231,255,.42); border-radius: 10px; background: rgba(5,22,32,.96); box-shadow: 0 16px 44px rgba(0,0,0,.56); backdrop-filter: blur(18px); }
.context-menu button { border: 0; padding: 8px 10px; background: transparent; text-align: left; }
.context-menu button:hover { background: rgba(57,231,255,.16); }
.context-menu button.danger { color: #ff9bab; }
.dashboard-secondary { margin-top: -2px; }
.dashboard-primary.public-mode { grid-template-columns: repeat(2,minmax(130px,1fr)); }
.stat-slot-empty { min-height: 1px; }
.performance-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 10px;
}
.gauge-card {
  min-height: 182px;
  padding: 13px 12px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: center;
  backdrop-filter: blur(14px) saturate(1.12);
  box-shadow: 0 10px 34px rgba(0,0,0,.18);
}
.gauge-title { color: #c9f5ff; font-size: 13px; font-weight: 700; letter-spacing: .06em; }
.gauge { display: block; width: min(220px, 100%); margin: 1px auto -3px; overflow: visible; }
.gauge-track, .gauge-value { fill: none; stroke-width: 15; stroke-linecap: round; }
.gauge-track { stroke: rgba(105, 141, 153, .23); }
.gauge-value { stroke: var(--mint); stroke-dasharray: 0 100; transition: stroke-dasharray .55s ease, stroke .3s ease; filter: drop-shadow(0 0 5px currentColor); }
.gauge-needle { stroke: var(--mint); stroke-width: 2.5; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 100px 100px; transition: transform .55s ease, stroke .3s ease; filter: drop-shadow(0 0 4px currentColor); }
.gauge-pin { fill: #d8faff; stroke: rgba(57,231,255,.7); stroke-width: 2; }
.gauge-number { fill: #effcff; text-anchor: middle; font-size: 17px; font-weight: 800; }
.gauge-min, .gauge-max { fill: #7899a6; font-size: 9px; }
.gauge-detail { color: var(--muted); font-size: 11px; }
.server-strip { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 10px; padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(7,27,40,.64); color: var(--muted); font-size: 12px; backdrop-filter: blur(12px); }
.server-strip b { color: #d9f8ff; }
.live-pulse { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 8px var(--mint); }

@media (max-width: 780px) {
  .page { padding: 12px; }
  .page-head { display: block; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  th, td { padding: 8px; }
  .action-table td:first-child { width: auto; }
  .performance-panel { grid-template-columns: 1fr; }
  .dashboard-secondary .stat-slot-empty { display: none; }
  .batch-grid { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: span 1; }
  .target-grid { grid-template-columns: 1fr; }
  .success-page .success-summary { flex-wrap: wrap; }
  .success-page .success-search-stat { flex-basis: 100%; }
  .success-search-stat { grid-column: span 2; }
  .success-page .success-search-stat { grid-column: 1 / -1; }
}

/* Project default: keep left and right page whitespace minimal. */
.page { padding-inline: 2px !important; margin-inline: 0 !important; max-width: none !important; }
