:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --ink: #1d2433;
  --muted: #6b7280;
  --line: #e3e0da;
  --accent: #2f5bea;
  --ok: #16794c;
  --warn: #a15c07;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171f;
    --panel: #1c212c;
    --ink: #e8e6e1;
    --muted: #9aa1ad;
    --line: #2b3240;
    --accent: #7c9bff;
    --ok: #4cc38a;
    --warn: #e0a24a;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
}
.sidebar {
  border-right: 1px solid var(--line);
  padding: 16px;
  overflow: auto;
  background: var(--panel);
}
.brand { font-weight: 700; font-size: 18px; margin-bottom: 16px; letter-spacing: -0.01em; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 20px 0 8px; }
.accounts { list-style: none; padding: 0; margin: 0 0 8px; }
.accounts li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 8px; cursor: pointer;
}
.accounts li:hover { background: var(--bg); }
.accounts img, .accounts .avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--line); flex: none; object-fit: cover;
}
.accounts .who { flex: 1; min-width: 0; }
.accounts .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.accounts .handle { color: var(--muted); font-size: 12px; }
.accounts button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.inline-form { display: flex; gap: 6px; }
.inline-form input {
  flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--bg); color: var(--ink);
}
button {
  padding: 6px 10px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--accent); color: white; cursor: pointer; font: inherit;
}
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.banner { background: var(--accent); color: white; padding: 10px; border-radius: 8px; font-size: 13px; }
.frames {
  display: grid; gap: 12px; padding: 12px;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  overflow: auto;
}
.frame {
  display: flex; flex-direction: column; min-height: 520px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.frame header {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.frame .app-name { font-weight: 600; }
.frame select {
  margin-left: auto; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); max-width: 180px;
}
.frame .status { font-size: 12px; color: var(--muted); }
.frame .status.ok { color: var(--ok); }
.frame .status.warn { color: var(--warn); }
.frame .close { background: none; border: 0; color: var(--muted); font-size: 18px; padding: 0 4px; }
.badge {
  display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: white; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
}
.accounts .who .badge { margin-left: 4px; vertical-align: 1px; }
.frame .notice {
  margin: 0; padding: 6px 10px; font-size: 12px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.frame.flash { animation: flash 1.2s ease-out; }
@keyframes flash {
  from { box-shadow: 0 0 0 3px var(--accent); }
  to { box-shadow: 0 0 0 3px transparent; }
}
.frame iframe { flex: 1; border: 0; width: 100%; background: white; }
button.secondary { background: var(--bg); color: var(--ink); }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.context-title { font-weight: 600; margin: 0 0 6px; }
.context-items { list-style: none; padding: 0; margin: 0; }
.context-items .context-app {
  font-size: 12px; color: var(--muted); margin: 10px 0 4px; font-weight: 600;
}
.context-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  background: var(--bg); color: var(--ink); text-align: left; margin-bottom: 4px;
}
.context-item:hover { border-color: var(--accent); }
.context-item-text {
  color: var(--muted); font-size: 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.act-sheet {
  border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; width: min(360px, 90vw);
  background: var(--panel); color: var(--ink);
}
.act-sheet::backdrop { background: rgb(0 0 0 / 0.35); }
.act-sheet h2 { margin-top: 0; }
.act-title { font-weight: 600; margin: 0 0 10px; }
.act-text {
  margin: -6px 0 12px; padding-left: 8px; border-left: 3px solid var(--line); color: var(--muted); font-size: 13px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.act-text:empty { display: none; }
.act-options { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.act-options button {
  width: 100%; display: flex; justify-content: space-between; gap: 8px; text-align: left;
}
.act-options .act-app { opacity: 0.8; font-size: 12px; }
@media (max-width: 700px) {
  body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .frames { grid-template-columns: 1fr; }
}
.brand .back { display: block; font-size: 12px; font-weight: 400; color: var(--muted); text-decoration: none; margin-top: 2px; }
.brand .back:hover { color: var(--accent); }
