:root {
  --primary: #4f8cff;
  --primary-2: #6c63ff;
  --accent: #28c7b7;
  --success: #18a058;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #f6fbff;
  --bg-2: #eef8ff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-2: #ffffff;
  --surface-3: #f8fbff;
  --line: #dcebf7;
  --line-strong: #b7d7ff;
  --text: #1f2a44;
  --muted: #5f7190;
  --dim: #8ba0b8;
  --soft-blue: #eaf4ff;
  --soft-mint: #e9fbf8;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 14px 36px rgba(62, 118, 169, 0.12);
  --shadow-sm: 0 8px 22px rgba(62, 118, 169, 0.09);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 12% -6%, rgba(79, 140, 255, 0.22), transparent 30%),
    radial-gradient(circle at 92% 5%, rgba(40, 199, 183, 0.18), transparent 32%),
    linear-gradient(180deg, #f7fcff 0%, #eef8ff 48%, #f9fffc 100%);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid rgba(220, 235, 247, 0.78);
}
.account-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.account-actions form { margin: 0; }
.account-name {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.75);
}
header h1 {
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -0.02em;
  color: var(--text);
}
.muted {
  color: var(--dim);
  font-size: 11px;
  margin-top: 2px;
}

.grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px;
}

.card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  background: var(--surface);
  border: 1px solid rgba(220, 235, 247, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #8ec5ff, #9df0e7, #d6c9ff);
}
.card h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 780;
  letter-spacing: -0.01em;
  color: var(--text);
}
.section-desc {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.card h2::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 0 0 5px rgba(79, 140, 255, 0.12);
  flex-shrink: 0;
}
.card h3 {
  margin: 16px 0 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 780;
  letter-spacing: 0.04em;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.row, .btn-group, .input-group {
  display: flex;
  gap: 8px;
  align-items: center;
}
.row, .btn-group { flex-wrap: wrap; }
.input-group { flex: 1; min-width: 0; }
.input-group input { flex: 1; min-width: 0; }

button {
  min-height: 38px;
  padding: 9px 14px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 760;
  color: white;
  cursor: pointer;
  white-space: nowrap;
  background: linear-gradient(135deg, var(--primary), #6aa6ff);
  box-shadow: 0 9px 22px rgba(79, 140, 255, 0.22);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}
button:hover { box-shadow: 0 11px 26px rgba(79, 140, 255, 0.28); }
button:active { transform: scale(0.97); }
button.sm { min-height: 32px; padding: 6px 11px; font-size: 12px; }
button.outline, button.gray {
  color: #426484;
  background: #f7fbff;
  border: 1px solid var(--line);
  box-shadow: none;
}
button.outline:hover, button.gray:hover {
  border-color: var(--line-strong);
  background: #eef7ff;
}
button.accent {
  background: linear-gradient(135deg, var(--accent), #3bd6c9);
  box-shadow: 0 9px 22px rgba(40, 199, 183, 0.2);
}
button.danger {
  background: linear-gradient(135deg, #ff7b88, var(--danger));
  box-shadow: 0 9px 22px rgba(239, 68, 68, 0.16);
}
button.live-on {
  background: linear-gradient(135deg, #ff7b88, var(--danger));
  animation: pulse-red 1.8s infinite;
}
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 rgba(239,68,68,0); }
  50% { box-shadow: 0 0 20px rgba(239,68,68,0.18); }
}

input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: #8fc2ff;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(79, 140, 255, 0.1);
}
input::placeholder { color: #a5b5c8; }
input[type="text"], input[type="tel"], input[type="number"], textarea { -webkit-appearance: none; appearance: none; }
input[type="datetime-local"], input[type="date"], input[type="time"], select { -webkit-appearance: auto; appearance: auto; color-scheme: light; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--primary); }

.hint {
  color: #55708f;
  font-size: 12px;
  padding: 10px 12px;
  border: 1px solid #d8efff;
  border-radius: 14px;
  background: linear-gradient(135deg, #f1f9ff, #f1fffc);
}
.flow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.flow-steps span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid #d8efff;
  border-radius: 999px;
  background: #f7fcff;
  color: #4c7ca7;
  font-size: 11px;
  font-weight: 800;
}
.mode-indicator {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--dim);
  background: #f7fbff;
  font-size: 12px;
  font-weight: 760;
}
.mode-indicator.active {
  color: #15988d;
  border-color: #bdece7;
  background: var(--soft-mint);
}

#screenWrap { margin-top: 12px; }
#floatingScreen {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.floating-screen-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 42, 68, 0.22);
  backdrop-filter: blur(5px);
}
.floating-screen-card {
  position: relative;
  width: min(420px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: rgba(255,255,255,0.96);
  box-shadow: 0 18px 48px rgba(62, 118, 169, 0.22);
  overflow: hidden;
}
.floating-screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}
.floating-close {
  min-height: 30px;
  width: 30px;
  padding: 0;
  border-radius: 50%;
  background: #f1f7ff;
  color: var(--muted);
  box-shadow: none;
  font-size: 20px;
  line-height: 1;
}
.floating-screen-body {
  padding: 12px;
  overflow: auto;
  display: flex;
  justify-content: center;
}
.floating-screen-body #screenWrap {
  margin-top: 0;
  width: 100%;
  max-width: 390px;
}
.floating-screen-body #screen {
  width: 390px;
  max-width: 100%;
}
#screen {
  display: block;
  width: 100%;
  max-width: 390px;
  height: auto;
  aspect-ratio: 9/19.5;
  margin: 0 auto;
  border: 1px solid #c9e2ff;
  border-radius: 26px;
  background: #f4f8ff;
  touch-action: none;
  box-shadow: 0 16px 36px rgba(63, 124, 184, 0.13), inset 0 0 0 6px rgba(255,255,255,0.65);
}
#browserStatus {
  display: none;
  max-height: 60px;
  margin-top: 8px;
  padding: 8px 10px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
  color: #237cbb;
  font: 11px/1.45 "SF Mono", "Fira Code", monospace;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 0;
  border-radius: 14px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}
.section-head h3 { margin: 0; }
.log-hint {
  color: var(--dim);
  font-size: 12px;
  margin: 6px 0 8px;
}
#runs {
  max-height: 360px;
  overflow: auto;
}
#runs .table { margin: 0; }
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  font-size: 12px;
}
.table th {
  padding: 0 10px 2px;
  color: var(--dim);
  font-size: 11px;
  font-weight: 780;
  text-align: left;
  white-space: nowrap;
}
.table td {
  padding: 10px;
  background: #ffffff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  word-break: break-word;
}
.table td:first-child { border-left: 1px solid var(--line); border-radius: 12px 0 0 12px; }
.table td:last-child { border-right: 1px solid var(--line); border-radius: 0 12px 12px 0; }

.card-list { display: flex; flex-direction: column; gap: 9px; }
.card-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}
.card-item-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.card-item-row:last-child { margin-bottom: 0; }
.card-item-label {
  flex-shrink: 0;
  color: var(--dim);
  font-size: 12px;
}
.card-item-value {
  color: var(--text);
  font-size: 13px;
  text-align: right;
  word-break: break-word;
}
.card-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.slot-row-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.slot-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.slot-row-main span {
  color: var(--text);
  font-size: 13px;
  font-weight: 780;
  word-break: break-word;
}
.slot-row-main small {
  color: var(--dim);
  font-size: 11px;
  word-break: break-word;
}
.slot-row-card .danger {
  flex-shrink: 0;
}
.time-toolbar {
  display: flex;
  margin-bottom: 8px;
}
.time-toolbar button {
  width: 100%;
  justify-content: center;
}
.manual-slot-row {
  padding: 8px;
  border: 1px dashed #c9e2ff;
  border-radius: 14px;
  background: #f8fcff;
}
.card-item-actions.compact button,
.table-actions button {
  min-height: 30px;
  padding: 5px 10px;
}
.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.task-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.task-title {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slot-summary {
  width: 100%;
  min-height: auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 6px;
  padding: 7px 9px;
  border: 1px solid #c9eee9;
  border-radius: 12px;
  background: var(--soft-mint);
  color: #167f77;
  box-shadow: none;
  text-align: left;
  white-space: normal;
}
.slot-summary span {
  font-size: 12px;
  font-weight: 800;
}
.slot-summary small {
  grid-column: 1 / -1;
  color: #6b879d;
  font-size: 10px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slot-more {
  align-self: start;
  padding: 1px 6px;
  border-radius: 999px;
  background: #ffffff;
  color: #15988d;
  font-size: 10px;
  font-weight: 800;
}
.slot-summary.empty {
  display: inline-flex;
  width: auto;
  color: var(--dim);
  background: #f7fbff;
  border-color: var(--line);
}
.slot-detail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.slot-detail-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fcff;
}
.slot-detail-item b {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--soft-blue);
  color: var(--primary);
  font-size: 12px;
}
.slot-detail-item span {
  color: var(--text);
  font-size: 13px;
  word-break: break-word;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(360px, 1.3fr);
  gap: 12px;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}
.form-grid label small,
.modal-form label small {
  color: var(--dim);
  font-size: 11px;
  font-weight: 520;
  line-height: 1.35;
}
.form-grid .full-width { grid-column: 1 / -1; }
.task-user-field select {
  min-width: 0;
  width: 100%;
}
.task-name-field input {
  min-width: 0;
}
.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}
.form-label em {
  padding: 3px 9px;
  border: 1px solid #c9eee9;
  border-radius: 999px;
  background: var(--soft-mint);
  color: #17988d;
  font-style: normal;
  font-size: 11px;
  white-space: nowrap;
}

#taskSlot {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 9px;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fcff;
}
.slot-choice {
  display: grid;
  grid-template-columns: 24px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 9px;
  row-gap: 3px;
  width: 100%;
  min-height: 58px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
  box-shadow: none;
}
.slot-choice.selected {
  border-color: #78dcd2;
  background: linear-gradient(135deg, #eafffc, #eef6ff);
  box-shadow: 0 0 0 3px rgba(40, 199, 183, 0.1);
}
.slot-check {
  grid-row: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid #cbddeb;
  border-radius: 50%;
  color: transparent;
  font-weight: 800;
}
.slot-choice.selected .slot-check {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--primary));
}
.slot-main { color: var(--text); font-size: 13px; font-weight: 760; word-break: break-word; }
.slot-sub { color: var(--dim); font-size: 11px; word-break: break-word; }
.empty-state {
  grid-column: 1 / -1;
  padding: 14px 10px;
  color: var(--dim);
  text-align: center;
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}
.ok { color: #0f8a49; background: #eafaf1; border: 1px solid #bdebcf; }
.warn { color: #b77900; background: #fff8e6; border: 1px solid #ffe1a3; }
.bad { color: #d92d43; background: #fff0f2; border: 1px solid #ffd0d7; }

#modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(31, 42, 68, 0.28); backdrop-filter: blur(6px); }
.modal-container {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 620px;
  max-height: 84vh;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: var(--shadow);
  animation: modalIn 0.18s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 14px; font-weight: 800; }
.modal-close {
  min-height: auto;
  padding: 4px 8px;
  background: transparent;
  box-shadow: none;
  color: var(--dim);
  font-size: 22px;
  line-height: 1;
}
.modal-body { flex: 1; overflow-y: auto; padding: 16px; }
.confirm-box,
.notice-box {
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
  padding: 8px 4px 2px;
}
.confirm-icon,
.notice-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: rgba(69, 143, 246, 0.14);
  color: var(--primary);
  font-size: 24px;
  font-weight: 900;
}
.success-notice .notice-icon {
  background: rgba(34, 197, 94, 0.14);
  color: #0f8a49;
}
.warning-notice .notice-icon,
.confirm-icon {
  background: rgba(255, 179, 71, 0.18);
  color: #d88700;
}
.danger-confirm .confirm-icon,
.danger-notice .notice-icon {
  background: rgba(255, 94, 94, 0.14);
  color: var(--danger);
}
.confirm-message,
.notice-message {
  max-width: 420px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  padding: 0;
  border: 0;
  background: transparent;
}
.confirm-actions,
.notice-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding-top: 2px;
}
.confirm-actions button,
.notice-actions button { min-width: 104px; }
.detail-live-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--dim);
  font-size: 12px;
}
.detail-live-head button { margin-left: auto; }
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.12);
}
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--dim);
  font-size: 12px;
}
.modal-form {
  display: grid;
  grid-template-columns: minmax(160px, 0.65fr) minmax(380px, 1.35fr);
  gap: 12px;
}
.modal-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}
.modal-form .full-width,
.modal-actions {
  grid-column: 1 / -1;
}
.password-form {
  grid-template-columns: 1fr;
}
.password-form label,
.password-form .modal-actions {
  grid-column: 1 / -1;
}
.edit-slot-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fcff;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}
.modal-body pre {
  max-height: 220px;
  overflow: auto;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f8fbff;
  color: #246b9a;
  white-space: pre-wrap;
  word-break: break-all;
  font: 11px/1.5 "SF Mono", "Fira Code", monospace;
}
.detail-section { margin-bottom: 13px; }
.detail-section h4 { margin-bottom: 6px; color: var(--muted); font-size: 12px; }

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-wrap {
  width: min(420px, 100%);
}
.login-card {
  padding: 24px;
}
.login-brand {
  margin-bottom: 12px;
  color: var(--text);
  font-size: 22px;
  font-weight: 880;
  letter-spacing: -0.03em;
}
.login-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0 14px;
  padding: 12px 13px;
  border: 1px solid rgba(245, 158, 11, .45);
  border-radius: 16px;
  background: linear-gradient(135deg, #fff7ed, #fffbeb);
  color: #7c2d12;
  box-shadow: 0 12px 26px rgba(245, 158, 11, .14);
}
.login-notice .notice-icon {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #f97316;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}
.login-notice strong {
  display: block;
  margin-bottom: 4px;
  color: #111827;
  font-size: 15px;
  font-weight: 900;
}
.login-notice span {
  display: block;
  color: #7c2d12;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.65;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}
.login-error {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fff1f2;
  color: #dc2626;
  font-size: 12px;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c8dcec; border-radius: 999px; }

.truncate { display: inline-block; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

@media (max-width: 600px) {
  header { padding: 12px 13px 10px; }
  header h1 { font-size: 17px; }
  .muted { font-size: 10px; line-height: 1.35; }
  .grid { padding: 10px; gap: 12px; }
  .card { padding: 14px; border-radius: 20px; }
  .card h2 { font-size: 15px; margin-bottom: 10px; }
  .card h3 { margin-top: 15px; }
  .btn-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 8px; }
  .btn-group .mode-indicator { grid-column: 1 / -1; width: 100%; }
  .row { width: 100%; margin: 0; }
  .input-group { width: 100%; }
  .input-group button { flex-shrink: 0; }
  button { min-height: 42px; padding: 10px 12px; font-size: 13px; }
  button.sm { min-height: 34px; padding: 7px 10px; font-size: 12px; }
  input, select { min-height: 44px; font-size: 16px; }
  .form-grid { grid-template-columns: 1fr; gap: 11px; }
  #taskSlot { grid-template-columns: 1fr; max-height: 280px; padding: 7px; }
  .slot-choice { min-height: 62px; padding: 12px; }
  .card-item { padding: 12px; }
  .card-item-value { max-width: 72%; }
  .card-item-actions { display: flex; flex-wrap: wrap; }
  .card-item-actions button { flex: 0 0 auto; }
  #screen { max-width: 100%; border-radius: 22px; }
  #floatingScreen { padding: 8px; align-items: flex-start; }
  .floating-screen-card { width: 100%; max-height: calc(100vh - 16px); border-radius: 20px; }
  .floating-screen-body { padding: 8px; justify-content: center; }
  .modal-container { max-height: 90vh; border-radius: 18px; }
  .modal-body { padding: 12px; }
  .modal-form { grid-template-columns: 1fr; gap: 10px; }
  .edit-slot-list { grid-template-columns: 1fr; max-height: 260px; padding: 7px; }
  .modal-actions { justify-content: stretch; }
  .modal-actions button { flex: 1; }
  .modal-body pre { font-size: 10px; }
}

@media (min-width: 1024px) {
  .grid { display: grid; grid-template-columns: minmax(420px, 480px) 1fr; }
  .full { grid-column: 1 / -1; }
}

/* ===== 代理总开关 ===== */
.proxy-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.proxy-switch input { display: none; }
.proxy-switch-slider {
  position: relative;
  width: 38px;
  height: 20px;
  background: var(--line);
  border-radius: 999px;
  transition: background .2s;
  flex: 0 0 auto;
}
.proxy-switch-slider::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.proxy-switch input:checked + .proxy-switch-slider {
  background: #2ecc71;
}
.proxy-switch input:checked + .proxy-switch-slider::before {
  transform: translateX(18px);
}
.proxy-switch-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.proxy-port-select {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
}
