@font-face {
  font-family: Circe;
  src: url("brand/Circe-Regular.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Circe;
  src: url("brand/Circe-Bold.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: Circe;
  src: url("brand/Circe-Light.woff") format("woff");
  font-weight: 300;
  font-display: swap;
}

:root {
  --primary: #ffc20d;
  --secondary: #ff9f00;
  --ink: #1f1f1f;
  --muted: #6b6b6b;
  --border: #cecece;
  --divider: #e0e0e0;
  --danger: #f44336;
  --danger-text: #bf3028;
  font: 16px/1.5 Circe, Arial, Helvetica, sans-serif;
  color: #000;
  background: #fbfbfb;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { max-width: 820px; margin: auto; padding: 32px 18px 64px; }
header, .copy, .chat-tools, .chat-tools label, .new-chats {
  display: flex;
  align-items: center;
  gap: 12px;
}

header {
  min-height: 60px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--divider);
}

.brand { flex: none; }
.brand img { display: block; }
.product {
  margin: 0;
  padding-left: 12px;
  border-left: 1px solid var(--divider);
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 700;
}
#logout { margin-left: auto; }

h1 { font-size: 1.75rem; margin: 20px 0 12px; }
h2 { font-size: 1.25rem; margin: 0 0 14px; }
section {
  margin: 16px 0;
  padding: 22px;
  border-radius: 10px;
  background: white;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.05);
  overflow-wrap: anywhere;
}
section > :last-child { margin-bottom: 0; }
li { margin: 6px 0; }

#notice:empty { display: none; }
#notice, #warning {
  padding: 10px 14px;
  border-left: 3px solid var(--secondary);
  border-radius: 6px;
  background: #fff3df;
  overflow-wrap: anywhere;
}
.error-card { border-left: 3px solid var(--danger); }
#notice.error-message { border-color: var(--danger); background: #fff2f1; }
.error-message { color: var(--danger-text); }
a { color: var(--ink); text-underline-offset: 0.15em; }
a:hover { color: #945900; text-decoration-color: var(--secondary); }
button, input, textarea, select { font: inherit; }
button, #telegramLogin, .plugin-button {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--primary);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
button:enabled:hover, #telegramLogin:hover, .plugin-button:hover { background: var(--secondary); }
.secondary, .chat-filters button { background: white; border-color: var(--border); }
.secondary:enabled:hover, .chat-filters button:enabled:hover { background: #f3f3f3; }
.danger { color: var(--danger-text); background: white; border-color: var(--danger); }
#disconnectAll:enabled { color: white; background: var(--danger-text); border-color: var(--danger-text); }
.danger:enabled:hover { background: #fff2f1; }
button:disabled, input.switch:disabled { cursor: default; }
button:disabled { background: var(--border); color: #4a4a4a; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

label { display: block; margin: 10px 0 4px; }
input:not([type=checkbox]), textarea, select {
  max-width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--ink);
}
input::placeholder { color: var(--muted); opacity: 1; }
input[type=search], textarea, .copy input { width: 100%; }
.copy button { flex: none; }
textarea { display: block; margin-bottom: 8px; resize: vertical; }
#qr { display: block; max-width: 100%; height: auto; }
form:has(input[type=password]) { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
form:has(input[type=password]) label { width: 100%; margin-bottom: 0; }

#chatControls { min-width: 0; margin: 0; padding: 0; border: 0; }
.chat-tools, .chat-filters { flex-wrap: wrap; margin-top: 12px; }
.chat-tools label { margin: 0; gap: 8px; }
.chat-tools button { margin-left: auto; }
.chat-filters { display: flex; gap: 6px; }
.chat-filters button { border-radius: 999px; padding: 4px 13px; }
.chat-filters button[aria-pressed=true] { background: var(--primary); border-color: var(--primary); }
.chat-filters button[aria-pressed=true]:enabled:hover { background: var(--secondary); }

#chats { max-height: 340px; overflow: auto; margin-top: 12px; }
.chat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  margin: 0;
  padding: 8px 4px;
  border-top: 1px solid var(--divider);
  cursor: pointer;
}
.chat small, #chatCount, #dryHelp { color: var(--muted); }
.chat-kind { display: block; }
.visibility {
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f3f3f3;
  color: #555;
  font-size: 0.875rem;
}
.chat:has(:checked) .visibility {
  border-color: #5db461;
  background: #e8f4e9;
  color: #326b36;
}
.new-chats {
  gap: 8px;
  border-top: 1px solid var(--divider);
  padding-top: 14px;
  cursor: pointer;
}
input.switch {
  appearance: none;
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--border);
  cursor: pointer;
}
input.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}
input.switch:checked { background: var(--primary); }
input.switch:checked::after { left: 18px; }
input.switch:indeterminate { background: #ffe69b; }
input.switch:indeterminate::after { left: 10px; background: var(--ink); }

article + article { border-top: 1px solid var(--divider); margin-top: 16px; padding-top: 16px; }
#dashboard { margin-top: 16px; }
#dotSettings fieldset { min-width: 0; margin: 12px 0 0; padding: 0; border: 0; }
#dotSettings small, #safetyRules { display: block; margin-bottom: 6px; color: var(--muted); }
#dotSettings label { font-weight: 700; }
#dotSettings [role=status]:not(:empty) { display: block; margin-top: 8px; }

.dot-steps { padding-inline-start: 1.5em; }
.dot-steps li::marker { font-weight: 700; }
.dot-steps li + li { margin-top: 16px; }
.dot-steps li > div { margin-top: 6px; }
#pluginConnected { color: #326b36; margin-right: 8px; }
.plugin-reopen, #copyPrompt { font-size: 0.875rem; }
.dot-quote {
  display: flow-root;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fbfbfb;
}
.dot-quote #prompt { margin: 0; white-space: pre-wrap; }
#copyPrompt { float: right; margin: 0 0 4px 8px; padding: 4px 6px; }
#copyIcon svg { vertical-align: middle; }

@media (max-width: 520px) {
  main { padding: 18px 12px 40px; }
  header { gap: 8px; flex-wrap: wrap; }
  .brand img { width: 116px; height: auto; }
  .product { padding-left: 8px; font-size: 1.125rem; }
  section { padding: 16px; }
  .copy { display: grid; gap: 8px; }
  .chat-tools button { width: 100%; }
  ol, ul { padding-inline-start: 1.5em; }
}

@media (forced-colors: active) {
  input.switch { appearance: auto; }
  input.switch::after { display: none; }
}
