:root {
  --tw-bg: #15171d;
  --tw-panel: #1c1f27;
  --tw-border: #2a2e38;
  --tw-text: #e9e9ee;
  --tw-muted: #9497a3;
  --tw-amber: #f5a623;
  --tw-amber-dim: #7a5719;
  --tw-red: #ff5c5c;
  --tw-green: #4ade80;
}

.tw-popup * {
  box-sizing: border-box;
}

.tw-popup {
  width: 360px;
  background: var(--tw-bg);
  color: var(--tw-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.tw-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tw-mark {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--tw-amber), #c97a12);
  position: relative;
}

.tw-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 3px;
  height: 14px;
  background: #15171d;
  border-radius: 2px;
  top: 7px;
}

.tw-title h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.tw-site {
  margin: 1px 0 0;
  font-size: 11px;
  color: var(--tw-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.tw-guard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--tw-panel);
  border: 1px solid var(--tw-border);
  border-radius: 10px;
  padding: 10px 12px;
}

.tw-label {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tw-text);
}

.tw-hint {
  margin: 3px 0 0;
  font-size: 11px;
  color: var(--tw-muted);
  line-height: 1.4;
}

.tw-switch {
  flex: 0 0 auto;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: none;
  background: #33384380;
  padding: 3px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.tw-switch[aria-checked="true"] {
  background: var(--tw-amber);
}

.tw-switch-knob {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e9e9ee;
  transition: transform 0.15s ease;
}

.tw-switch[aria-checked="true"] .tw-switch-knob {
  transform: translateX(18px);
  background: #15171d;
}

.tw-sensitivity {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tw-seg {
  display: flex;
  background: var(--tw-panel);
  border: 1px solid var(--tw-border);
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
}

.tw-seg-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--tw-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 0;
  border-radius: 7px;
  cursor: pointer;
}

.tw-seg-btn[aria-checked="true"] {
  background: var(--tw-amber-dim);
  color: var(--tw-amber);
}

.tw-stats {
  display: flex;
  border: 1px solid var(--tw-border);
  border-radius: 10px;
  overflow: hidden;
}

.tw-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px;
  background: var(--tw-panel);
}

.tw-stat + .tw-stat {
  border-left: 1px solid var(--tw-border);
}

.tw-stat-num {
  font-size: 17px;
  font-weight: 700;
  color: var(--tw-text);
}

.tw-stat-label {
  font-size: 9.5px;
  color: var(--tw-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.tw-log {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tw-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 176px;
  overflow-y: auto;
}

.tw-log-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--tw-panel);
  border: 1px solid var(--tw-border);
  border-radius: 8px;
  padding: 8px 10px;
}

.tw-log-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
}

.tw-log-dot.blocked {
  background: var(--tw-red);
}

.tw-log-dot.allowed {
  background: var(--tw-green);
}

.tw-log-body {
  flex: 1;
  min-width: 0;
}

.tw-log-action {
  font-size: 12px;
  font-weight: 600;
  color: var(--tw-text);
}

.tw-log-meta {
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--tw-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tw-hidden {
  display: none !important;
}

.tw-footer {
  border-top: 1px solid var(--tw-border);
  padding-top: 10px;
}

.tw-plan {
  margin: 0;
  font-size: 10.5px;
  color: var(--tw-muted);
  text-align: center;
}

.tw-plan a {
  color: var(--tw-amber);
  text-decoration: none;
}

.tw-plan a:hover {
  text-decoration: underline;
}
