:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --sidebar: #12263f;
  --sidebar-2: #0c1b2d;
  --primary: #1f5eff;
  --primary-dark: #1647c7;
  --primary-soft: #eaf0ff;
  --text: #162033;
  --muted: #6b778c;
  --border: #e3e8f0;
  --success: #168a4a;
  --success-soft: #e8f8ef;
  --warning: #c26a00;
  --warning-soft: #fff6e6;
  --danger: #c53030;
  --danger-soft: #fff0f0;
  --info: #2563eb;
  --info-soft: #eaf2ff;
  --radius: 14px;
  --shadow: 0 10px 34px rgba(18, 38, 63, 0.07);
  --shadow-sm: 0 4px 14px rgba(18, 38, 63, 0.05);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at 88% 4%, rgba(31, 94, 255, 0.07), transparent 28rem),
    var(--bg);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB",
    system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code,
.mono {
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono",
    monospace;
  font-size: 0.92em;
}

code {
  padding: 1px 5px;
  border-radius: 5px;
  background: #eef2f8;
  color: #31425c;
}

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

h2 {
  font-size: 24px;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 16px;
  letter-spacing: -0.01em;
}

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

.nowrap {
  white-space: nowrap;
}

.break-all {
  word-break: break-all;
}

/* Layout */

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 20;
  top: 0;
  bottom: 0;
  left: 0;
  width: 236px;
  padding: 24px 16px 18px;
  color: #d9e5f5;
  background:
    radial-gradient(circle at 20% 0%, rgba(57, 128, 255, 0.22), transparent 18rem),
    linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 22px;
  color: #fff;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  color: #fff;
  font-weight: 800;
  font-size: 19px;
  background: linear-gradient(145deg, #4a86ff, #1f5eff 55%, #103fc0);
  box-shadow: 0 7px 18px rgba(31, 94, 255, 0.35);
}

.brand-mark-lg {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
  border-radius: 14px;
  font-size: 23px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-text strong {
  font-size: 16px;
  letter-spacing: 0.02em;
}

.brand-text small {
  margin-top: 3px;
  color: #8ea6c5;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border-radius: 10px;
  color: #b9c9dd;
  font-weight: 500;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  text-decoration: none;
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(31, 94, 255, 0.9), rgba(31, 94, 255, 0.62));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}

.nav-icon {
  width: 18px;
  text-align: center;
  opacity: 0.9;
  font-size: 15px;
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px 8px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-foot p {
  margin-top: 8px;
  color: #7f96b3;
  font-size: 11px;
  line-height: 1.6;
}

.env-pill {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid rgba(126, 165, 255, 0.28);
  border-radius: 999px;
  color: #a9c4ff;
  background: rgba(31, 94, 255, 0.12);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.main-column {
  min-height: 100vh;
  margin-left: 236px;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  height: 66px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(227, 232, 240, 0.85);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
}

.topbar-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

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

.user-chip {
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: #46556b;
  font-size: 12px;
  font-weight: 600;
}

.content {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.16s ease, background 0.16s ease,
    border-color 0.16s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #2d6bff, var(--primary));
  box-shadow: 0 6px 16px rgba(31, 94, 255, 0.24);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1f5eff, var(--primary-dark));
  box-shadow: 0 8px 20px rgba(31, 94, 255, 0.3);
}

.btn-ghost {
  color: #31425c;
  border-color: var(--border);
  background: var(--surface);
}

.btn-ghost:hover {
  border-color: #c9d4e5;
  background: #f8faff;
}

.btn-danger {
  color: var(--danger);
  border-color: #f3c7c7;
  background: #fff7f7;
}

.btn-danger:hover {
  border-color: #eaa5a5;
  background: var(--danger-soft);
}

.btn-sm {
  min-height: 31px;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
  min-height: 42px;
}

.btn.disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}

.text-link {
  color: var(--primary);
  font-weight: 600;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

/* Page heads and hero */

.hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
  padding: 26px 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 8%, rgba(72, 136, 255, 0.38), transparent 20rem),
    linear-gradient(135deg, #142b47 0%, #1c3a60 58%, #173152 100%);
  box-shadow: 0 16px 38px rgba(18, 38, 63, 0.18);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -80px;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(255, 255, 255, 0.025),
    0 0 0 78px rgba(255, 255, 255, 0.018);
  pointer-events: none;
}

.hero h2 {
  margin-top: 6px;
  font-size: 26px;
}

.hero p {
  max-width: 640px;
  margin-top: 7px;
  color: #b9cbe1;
  font-size: 13px;
}

.hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero .btn-ghost {
  color: #e4edf9;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.hero .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.14);
}

.eyebrow {
  color: #7ea5d8;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.page-head {
  margin-bottom: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.page-head h2 {
  margin-top: 4px;
}

.page-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.head-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
}

.proxy-balance {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.proxy-balance-label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.proxy-balance-value {
  color: var(--success);
  font-size: 19px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.proxy-balance-value.is-low {
  color: var(--warning);
}

.proxy-balance-value.is-empty {
  color: var(--danger);
  font-size: 14px;
}

.proxy-balance-value.is-unknown {
  color: #8b98aa;
  font-size: 14px;
}

.proxy-balance-time {
  color: #9aa7ba;
  font-size: 10.5px;
  white-space: nowrap;
}

/* Cards and stats */

.stats-grid {
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

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

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  padding: 17px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, #4a86ff, #1f5eff);
  opacity: 0.9;
}

.stat-card-warn::before {
  background: linear-gradient(180deg, #ffb547, #e07b00);
}

.stat-card-good::before {
  background: linear-gradient(180deg, #44c97c, #168a4a);
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.stat-card strong {
  margin: 5px 0 2px;
  color: #13233a;
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-card strong small {
  margin-left: 2px;
  color: #9aa7ba;
  font-size: 14px;
  font-weight: 500;
}

.stat-card strong.stat-time {
  font-size: 15px;
  letter-spacing: 0;
  line-height: 1.55;
}

.stat-note {
  color: #93a0b3;
  font-size: 10.5px;
}

.panel {
  margin-bottom: 20px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

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

.panel-head h3 {
  color: #1b2a40;
}

.panel-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

/* Tables */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid #edf1f6;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #66758b;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: #fafcff;
}

td {
  color: #31425c;
  font-size: 13px;
}

.cell-title {
  color: #17263c;
  font-weight: 600;
}

.cell-title a {
  color: inherit;
}

.cell-title a:hover {
  color: var(--primary);
}

.actions {
  white-space: nowrap;
}

.actions .btn {
  margin-left: 5px;
}

.actions .inline-form .btn {
  margin-left: 5px;
}

.align-right {
  text-align: right;
}

.snippet {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
}

.target-row {
  background: #f0fbf4;
}

.target-row:hover {
  background: #e9f8ef;
}

.ad-row {
  background: #fbfbfc;
  color: #7d8797;
}

.ad-row .cell-title {
  color: #7d8797;
}

/* Badges */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-success {
  color: var(--success);
  background: var(--success-soft);
}

.badge-warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.badge-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.badge-info {
  color: var(--info);
  background: var(--info-soft);
}

.badge-muted {
  color: #68758a;
  background: #f0f3f8;
}

.rank-badge {
  color: #1747c9;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Filters */

.filter-bar {
  margin-bottom: 18px;
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.filter-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-form label {
  min-width: 140px;
  display: flex;
  flex: 1 1 150px;
  flex-direction: column;
  gap: 5px;
}

.filter-form label > span {
  color: #69778c;
  font-size: 11px;
  font-weight: 700;
}

.filter-form input,
.filter-form select {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 12.5px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  padding-bottom: 1px;
}

/* Forms */

.form-panel {
  max-width: 760px;
}

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

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

.stack label > span,
.readonly-field > span {
  color: #34445c;
  font-size: 12.5px;
  font-weight: 700;
}

.stack label > span em {
  color: var(--danger);
  font-style: normal;
}

.stack small {
  color: #8b98aa;
  font-size: 11.5px;
  line-height: 1.5;
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="date"],
input[type="file"],
select {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid #d8e0eb;
  border-radius: 9px;
  color: var(--text);
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: #86a9ff;
  box-shadow: 0 0 0 3px rgba(31, 94, 255, 0.12);
}

input[type="file"] {
  padding: 7px;
  cursor: pointer;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.checkbox-row {
  flex-direction: row !important;
  align-items: center;
  gap: 9px !important;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-soft);
}

.checkbox-row span {
  font-weight: 600;
  color: #40516a;
}

.form-actions {
  display: flex;
  gap: 9px;
  padding-top: 3px;
}

.readonly-field {
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.readonly-field strong {
  font-size: 14px;
}

.meta-line {
  margin-top: 14px;
  color: #8b98aa;
  font-size: 11.5px;
}

.hint-line {
  margin-top: 4px;
  color: #8b98aa;
  font-size: 11.5px;
  line-height: 1.7;
}

.form-grid small.rounds-warning {
  color: var(--danger);
  font-size: 11.5px;
  line-height: 1.5;
}

#total-count.over-limit {
  color: var(--danger);
}

/* Split layout / import */

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(300px, 0.88fr);
  gap: 20px;
  align-items: start;
}

.info-panel {
  background:
    linear-gradient(180deg, rgba(234, 240, 255, 0.55), transparent 120px),
    var(--surface);
}

.rule-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.rule-list li {
  position: relative;
  padding-left: 17px;
  color: #4a5b72;
  font-size: 12.5px;
  line-height: 1.65;
}

.rule-list li::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7da2ff;
}

.info-callout {
  margin-top: 17px;
  padding: 12px 13px;
  border: 1px solid #d9e5ff;
  border-radius: 9px;
  color: #3e5a8a;
  background: #f4f8ff;
  font-size: 12px;
  line-height: 1.65;
}

.error-list {
  margin: 0;
  padding: 13px 16px 13px 32px;
  border: 1px solid #f2d3d3;
  border-radius: 10px;
  color: #8f2f2f;
  background: #fffafa;
  font-size: 12.5px;
  line-height: 1.8;
}

/* Flash */

.flash {
  margin-bottom: 15px;
  padding: 11px 15px;
  border: 1px solid transparent;
  border-left-width: 4px;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.6;
}

.flash-success {
  color: #146c3d;
  border-color: #c9eed9;
  border-left-color: #29a663;
  background: #f0fbf5;
}

.flash-error {
  color: #9f2b2b;
  border-color: #f2cccc;
  border-left-color: #e04b4b;
  background: #fff5f5;
}

.flash-warning {
  color: #8a5200;
  border-color: #f2ddb5;
  border-left-color: #e39a1c;
  background: #fffaf0;
}

.flash-info {
  color: #2455a4;
  border-color: #cddcfb;
  border-left-color: #4a83ed;
  background: #f4f8ff;
}

/* Empty */

.empty-state {
  padding: 38px 22px;
  border: 1px dashed #d5dfec;
  border-radius: 11px;
  text-align: center;
  background: #fbfcfe;
}

.empty-mark {
  width: 42px;
  height: 42px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #8ea4c1;
  background: #eef3f9;
  font-size: 22px;
}

.empty-state strong {
  display: block;
  color: #3c4c63;
  font-size: 14px;
}

.empty-state p {
  max-width: 520px;
  margin: 5px auto 14px;
  color: #8b98aa;
  font-size: 12px;
}

/* Detail */

.detail-grid {
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.detail-card {
  min-height: 94px;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.detail-card > span {
  color: #7d8a9e;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.detail-card strong {
  color: #1b2a40;
  font-size: 15px;
  line-height: 1.45;
  word-break: break-word;
}

.detail-card small {
  color: #94a0b1;
  font-size: 10.5px;
  line-height: 1.5;
  word-break: break-word;
}

.kv-list {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.kv-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f6;
  background: #fff;
}

.kv-row:last-child {
  border-bottom: 0;
}

.kv-row > span {
  color: #7a879a;
  font-size: 11.5px;
  font-weight: 700;
}

.kv-row > div {
  color: #31425c;
  font-size: 12.5px;
  line-height: 1.7;
  word-break: break-word;
}

.shot {
  display: block;
  max-width: 100%;
  max-height: 620px;
  border: 1px solid var(--border);
  border-radius: 10px;
  object-fit: contain;
}

/* Site tour */

.tour-summary {
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 10px;
}

.tour-stat {
  min-height: 78px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tour-stat > span {
  color: #7d8a9e;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.tour-stat strong {
  color: #1b2a40;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.tour-stat small {
  color: #94a0b1;
  font-size: 10.5px;
  line-height: 1.45;
}

.tour-description {
  margin-bottom: 16px;
  padding: 11px 14px;
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  background: #f5f8ff;
}

.tour-description > span {
  color: #7d8a9e;
  font-size: 10.5px;
  font-weight: 700;
}

.tour-description p {
  margin-top: 3px;
  color: #42536a;
  font-size: 12.5px;
}

.tour-subhead {
  margin: 18px 0 10px;
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex-wrap: wrap;
}

.tour-subhead h4 {
  margin: 0;
  color: #2b3c54;
  font-size: 13px;
}

.tour-subhead span {
  color: #94a0b1;
  font-size: 11px;
}

.tour-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tour-chip {
  min-width: 122px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  color: #2c3c53;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.tour-chip:hover {
  border-color: #b8caf5;
  background: #f8faff;
  text-decoration: none;
}

.tour-chip strong {
  font-size: 12.5px;
}

.tour-chip small {
  color: #94a0b1;
  font-size: 10.5px;
}

.tour-table {
  min-width: 980px;
}

.tour-error {
  color: var(--danger);
}

.tour-shot {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcfe;
}

.tour-shot summary {
  color: #405470;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.tour-shot .shot {
  margin-top: 12px;
}

/* Pagination */

.pagination {
  padding-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
}

.page-info {
  color: #7d8a9e;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

/* Login / errors */

.login-body,
.error-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 10%, rgba(31, 94, 255, 0.2), transparent 24rem),
    radial-gradient(circle at 90% 90%, rgba(31, 94, 255, 0.09), transparent 28rem),
    linear-gradient(135deg, #0d1d32 0%, #142d4c 52%, #0d1d32 100%);
}

.login-wrap {
  width: 100%;
  max-width: 410px;
}

.login-card {
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
}

.login-brand {
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand h1 {
  color: #13233a;
  font-size: 21px;
  letter-spacing: -0.02em;
}

.login-brand p {
  margin-top: 2px;
  color: #8491a5;
  font-size: 11.5px;
}

.login-card .flash {
  margin-bottom: 14px;
}

.login-hint {
  margin-top: 17px;
  color: #9aa6b7;
  font-size: 10.5px;
  line-height: 1.6;
  text-align: center;
}

.error-card {
  width: min(460px, 100%);
  padding: 38px 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  color: #dbe7f6;
  background: rgba(19, 42, 68, 0.72);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.3);
  text-align: center;
  backdrop-filter: blur(12px);
}

.error-code {
  display: block;
  color: #6f9bff;
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 1;
}

.error-card h1 {
  margin: 10px 0 6px;
  color: #fff;
  font-size: 22px;
}

.error-card p {
  margin-bottom: 20px;
  color: #a8bcd4;
  font-size: 12.5px;
}

/* P2: tasks, proxies, city codes */

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

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

.progress-text {
  display: inline-block;
  margin-bottom: 4px;
  color: #68758a;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.progress-bar {
  width: 100%;
  min-width: 76px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f7;
}

.progress-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4a86ff, #1f5eff);
  transition: width 0.35s ease;
}

.progress-bar-lg {
  height: 10px;
}

.progress-cell {
  min-width: 110px;
}

.task-progress-card {
  margin-bottom: 20px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.task-progress-head {
  margin-bottom: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.task-progress-head .stat-label {
  display: block;
  margin-bottom: 3px;
}

.task-progress-numbers {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: #7d8a9e;
  font-size: 12px;
}

.task-progress-numbers strong {
  color: #1b2a40;
  font-size: 26px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

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

.task-counts > div {
  padding: 9px 11px;
  border: 1px solid #edf1f6;
  border-radius: 9px;
  background: #fafcff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.task-counts span {
  color: #7d8a9e;
  font-size: 11px;
}

.task-counts strong {
  color: #1b2a40;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.badge-pulse {
  animation: badge-pulse 1.6s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(197, 48, 48, 0.25); }
  50% { box-shadow: 0 0 0 5px rgba(197, 48, 48, 0); }
}

.captcha-panel {
  margin-bottom: 20px;
  padding: 21px 22px;
  border: 1px solid #f0c4c4;
  border-left: 4px solid var(--danger);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 240, 240, 0.75), transparent 140px),
    var(--surface);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 330px);
  gap: 22px;
  align-items: start;
}

.captcha-copy h3 {
  margin-top: 4px;
  color: #8f2f2f;
  font-size: 18px;
}

.captcha-copy p {
  margin-top: 7px;
  color: #6b4a4a;
  font-size: 12.5px;
  line-height: 1.7;
}

.captcha-copy .form-actions {
  margin-top: 14px;
}

.captcha-shot {
  display: block;
  border: 1px solid #f0c4c4;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.captcha-shot img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
}

.keyword-picker {
  max-height: 470px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 2px;
}

.keyword-option {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fbfcfe;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.keyword-option:hover {
  border-color: #c9d8f8;
  background: #f7faff;
}

.keyword-option:has(input:checked) {
  border-color: #9db9ff;
  background: #f1f6ff;
}

.keyword-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.45;
}

.keyword-main strong {
  color: #26364e;
  font-size: 12.5px;
  font-weight: 600;
  word-break: break-word;
}

.keyword-main small {
  color: #8b98aa;
  font-size: 10.5px;
}

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

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-grid label > span {
  color: #34445c;
  font-size: 12.5px;
  font-weight: 700;
}

.form-grid label > span em {
  color: var(--danger);
  font-style: normal;
}

.form-grid small {
  color: #8b98aa;
  font-size: 11.5px;
  line-height: 1.5;
}

.compact-filter {
  margin-bottom: 13px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.task-item-message {
  max-width: 340px;
  color: #5d6c82;
  font-size: 11.5px;
  line-height: 1.55;
  word-break: break-word;
}

/* P3 / P4: schedules, trends, exports, push */

input[type="number"],
input[type="time"],
textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid #d8e0eb;
  border-radius: 9px;
  color: var(--text);
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  min-height: 220px;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
  resize: vertical;
}

input[type="number"]:focus,
input[type="time"]:focus,
textarea:focus {
  outline: none;
  border-color: #86a9ff;
  box-shadow: 0 0 0 3px rgba(31, 94, 255, 0.12);
}

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

.form-toggles {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.form-toggles .checkbox-row {
  padding: 10px 12px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #7d8a9e;
  font-size: 11px;
  white-space: nowrap;
}

.chart-swatch {
  display: inline-block;
  width: 16px;
  height: 3px;
  margin-left: 8px;
  border-radius: 999px;
}

.chart-swatch:first-child {
  margin-left: 0;
}

.chart-swatch-hit {
  background: #1f5eff;
}

.chart-swatch-rank {
  background: #e08b12;
}

.chart-wrap {
  padding: 6px 2px 2px;
  overflow-x: auto;
}

.chart-wrap svg {
  display: block;
  width: 100%;
  min-width: 680px;
  height: auto;
}

.chart-grid {
  stroke: #e6ecf5;
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.chart-axis {
  fill: #8b98aa;
  font-size: 10px;
  font-family: inherit;
}

.chart-axis-title {
  font-weight: 700;
  fill: #6b86ad;
}

.chart-axis-rank {
  fill: #b87300;
}

.chart-line-hit {
  fill: none;
  stroke: #1f5eff;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line-rank {
  fill: none;
  stroke: #e08b12;
  stroke-width: 1.8;
  stroke-dasharray: 5 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-dot {
  fill: #1f5eff;
  stroke: #fff;
  stroke-width: 1.5;
}

.subhead {
  margin: 14px 0 8px;
  color: #4a5b72;
  font-size: 13px;
}

.code-block {
  margin: 0;
  padding: 14px;
  max-height: 340px;
  overflow: auto;
  border: 1px solid #20344f;
  border-radius: 10px;
  color: #d8e6f7;
  background: #0f1e32;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
}

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

  .chart-legend {
    flex-wrap: wrap;
  }
}

@media (max-width: 1040px) {
  .captcha-panel {
    grid-template-columns: 1fr;
  }

  .keyword-picker {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .stats-grid-3,
  .task-counts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 560px) {
  .task-counts {
    grid-template-columns: 1fr 1fr;
  }

  .captcha-panel {
    padding: 16px;
  }
}

@media (max-width: 1280px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 1040px) {
  .sidebar {
    width: 210px;
  }

  .main-column {
    margin-left: 210px;
  }

  .content {
    padding: 22px;
  }

  .split-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 16px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
  }

  .brand {
    padding: 0 4px;
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  .nav-item {
    padding: 7px 10px;
    font-size: 12px;
  }

  .nav-icon {
    display: none;
  }

  .sidebar-foot {
    display: none;
  }

  .main-column {
    margin-left: 0;
  }

  .topbar {
    height: 58px;
    padding: 0 18px;
  }

  .content {
    padding: 18px;
  }

  .hero,
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero {
    padding: 22px;
  }

  .hero-actions,
  .head-actions {
    width: 100%;
  }

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

  .filter-form label {
    flex: 1 1 100%;
  }

  .filter-actions {
    width: 100%;
  }

  .filter-actions .btn {
    flex: 1;
  }

  .kv-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

@media (max-width: 560px) {
  .content {
    padding: 14px;
  }

  .stats-grid,
  .stats-grid-compact {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    min-height: 104px;
    padding: 14px;
  }

  .stat-card strong {
    font-size: 24px;
  }

  .stat-card strong.stat-time {
    font-size: 13px;
  }

  .panel {
    padding: 16px;
  }

  .topbar-actions {
    gap: 7px;
  }

  .user-chip {
    display: none;
  }

  .hero h2,
  .page-head h2 {
    font-size: 21px;
  }

  .login-card {
    padding: 25px 21px;
  }
}