:root {
  --bg: #0b0d12;
  --bg-elev: #141823;
  --bg-elev-2: #1b2030;
  --border: #2a3142;
  --text: #e6e9f0;
  --text-dim: #9aa3b8;
  --text-faint: #6b7488;
  --accent: #6ea8fe;
  --accent-strong: #4a90e2;
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,.35);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: baseline; gap: 8px; }
.brand .logo { font-size: 20px; }
.brand .title { font-weight: 650; font-size: 16px; letter-spacing: .2px; }
.brand .tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-faint);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
}

.status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  font-size: 13px;
  color: var(--text-dim);
}
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 3px rgba(255,255,255,.04);
  transition: background .2s, box-shadow .2s;
}
.dot-ok { background: var(--green); box-shadow: 0 0 0 3px rgba(74,222,128,.12); }
.dot-err { background: var(--red); box-shadow: 0 0 0 3px rgba(248,113,113,.12); }
.dot-warn { background: var(--amber); }
.dot-unknown { background: var(--text-faint); }

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

.icon-btn {
  background: var(--bg-elev-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 34px; height: 34px;
  font-size: 16px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--border); color: var(--text); }

.switch {
  display: inline-flex; align-items: center; gap: 7px;
  cursor: pointer; user-select: none;
  font-size: 12px; color: var(--text-dim);
}
.switch input { display: none; }
.switch .track {
  width: 34px; height: 19px; border-radius: 999px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  position: relative;
  transition: background .2s;
}
.switch .thumb {
  position: absolute; top: 2px; left: 2px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--text-faint);
  transition: transform .2s, background .2s;
}
.switch input:checked + .track { background: var(--accent-strong); border-color: var(--accent-strong); }
.switch input:checked + .track .thumb { transform: translateX(15px); background: #fff; }

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 60px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
}
.meta { font-size: 12px; color: var(--text-faint); font-family: var(--mono); }

.clip-body {
  padding: 16px;
  min-height: 90px;
  max-height: 46vh;
  overflow: auto;
}
.clip-body .empty { color: var(--text-faint); font-style: italic; }
.clip-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.55;
}
.clip-text.overflowed {
  max-height: 38vh;
  overflow: auto;
}
.type-badge {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elev-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  margin-bottom: 10px;
}
.clip-image { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.clip-file {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,.12);
}
.card-foot .meta { margin-left: auto; }

.btn {
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s, transform .05s;
}
.btn:hover { background: var(--border); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-ghost { background: transparent; }

.send-text {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: 14px 16px;
  background: var(--bg);
  color: var(--text);
  border: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.55;
  outline: none;
  resize: vertical;
}
.send-text:focus { background: #0d1018; }

.hint { font-size: 12px; color: var(--text-faint); text-align: center; margin: 4px 0 0; }

dialog.dialog {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0;
  max-width: 460px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow);
}
dialog.dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
.dialog-form { padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 14px; }
.dialog-form h3 { margin: 0; font-size: 15px; font-weight: 650; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text-dim); }
.field input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 13px;
  font-family: var(--mono);
  outline: none;
}
.field input:focus { border-color: var(--accent); }
.field small { color: var(--text-faint); font-size: 11px; line-height: 1.4; }
.field code { font-family: var(--mono); color: var(--accent); }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.test-result { font-size: 12px; margin: 0; min-height: 16px; }
.test-result.ok { color: var(--green); }
.test-result.err { color: var(--red); }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 100;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--red); }

@media (max-width: 560px) {
  .topbar { gap: 8px; padding: 10px 12px; }
  .brand .tag { display: none; }
  .status { order: 3; width: 100%; margin-left: 0; }
  .container { padding: 14px 10px 50px; }
  .clip-body { max-height: 40vh; }
}
