:root {
  --ink: #242938;
  --muted: #7a8191;
  --purple: #7058dc;
  --purple-light: #f0edff;
  --border: #e8eaf0;
  --bg: #f7f8fc;
  --green: #208966;
  --red: #c65360;
  --sidebar: #222238;
  --shadow: 0 12px 40px #27234212;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea {
  outline-offset: 4px;
}

button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 14px;
  transition: background .15s, border-color .15s, box-shadow .15s;
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

button:hover:not(:disabled) {
  background: #f6f5fc;
  border-color: #d4cee8;
}

button.primary {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
  box-shadow: 0 3px 7px #7058dc20;
}

button.primary:hover:not(:disabled) {
  background: #6047cd;
  border-color: #6047cd;
}

button.danger {
  color: var(--red);
}

button.danger:hover:not(:disabled) {
  background: #fff4f5;
  border-color: #ecc4c9;
}

button.compact-btn {
  padding: 6px 12px;
  font-size: 12px;
}

button.icon-button {
  padding: 6px 9px;
  line-height: 1.3;
}

button.link-button {
  border: 0;
  padding: 3px;
  color: var(--purple);
  background: transparent;
}

button.link-button:hover:not(:disabled) {
  background: transparent;
  text-decoration: underline;
}

input,
select,
textarea {
  border: 1px solid #dfe2eb;
  border-radius: 7px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 36px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%236c7284' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
  cursor: pointer;
}

select::picker-icon {
  display: none;
}

select::-ms-expand {
  display: none;
}

select:disabled {
  opacity: .6;
  cursor: not-allowed;
  background-color: #f7f8fc;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--purple);
  outline: 2px solid #7058dc22;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--purple);
  cursor: pointer;
}

textarea {
  resize: vertical;
  line-height: 1.65;
}

label {
  font-size: 13px;
  font-weight: 500;
}

small {
  font-size: 12px;
}

/* Sidebar */
.sidebar {
  width: 242px;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--sidebar);
  color: #bab9cc;
  padding: 33px 20px 16px;
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.brand {
  display: flex;
  gap: 9px;
  align-items: center;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.6px;
}

.brand-light {
  font-weight: 400;
  color: #dbd8f3;
}

.brand-icon {
  background: #7860e3;
  color: #fff;
  border-radius: 10px;
  width: 35px;
  height: 37px;
  display: grid;
  place-items: center;
  font-size: 29px;
}

.brand small {
  display: block;
  font-size: 10px;
  letter-spacing: 2px;
  color: #9190a8;
  margin-top: 5px;
  font-weight: 400;
}

.workspace {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #ffffff12;
  background: #ffffff04;
  border-radius: 9px;
  padding: 13px 10px;
  margin: 36px 0 28px;
  color: #eeedf6;
  font-size: 12px;
}

.workspace small {
  display: block;
  color: #9594a9;
  margin-top: 5px;
  font-size: 10px;
}

.avatar {
  background: #eee9ff;
  color: #7964c5;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 600;
}

.workspace .avatar {
  background: #46405d;
  color: #e9dffa;
}

.online-dot {
  height: 6px;
  width: 6px;
  border-radius: 50%;
  background: #60bc9e;
  margin-left: auto;
}

.nav-label {
  font-size: 10px;
  color: #75748e;
  letter-spacing: 1.5px;
  padding: 0 13px;
  margin: 0 0 12px;
}

.sidebar nav {
  display: grid;
  gap: 6px;
  margin-bottom: 32px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 13px;
  border-radius: 7px;
  font-size: 13px;
}

.sidebar nav a > span {
  font-size: 19px;
  width: 20px;
  text-align: center;
  color: #9995b5;
}

.sidebar nav a.active {
  background: #7560d5;
  color: #fff;
  box-shadow: 0 5px 15px #1512271a;
}

.sidebar nav a.active > span {
  color: #fff;
}

.sidebar nav a:hover:not(.active) {
  background: #ffffff09;
}

.sidebar nav b {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  background: #ffffff18;
  border-radius: 4px;
  margin-left: auto;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 18px 14px;
  border: 1px solid #ffffff10;
  border-radius: 10px;
  background: linear-gradient(125deg, #333149, #29283e);
}

.adapter-dot {
  width: 22px;
  height: 4px;
  background: #9e8de5;
  border-radius: 8px;
  margin-bottom: 14px;
}

.sidebar-bottom strong {
  font-size: 12px;
  color: #e1deef;
  font-weight: 500;
}

.sidebar-bottom p {
  font-size: 11px;
  line-height: 1.8;
  color: #9491ac;
  margin: 9px 0 15px;
}

.sidebar-bottom a {
  font-size: 11px;
  color: #b9a9fb;
  display: flex;
  justify-content: space-between;
}

.sidebar-footer {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  letter-spacing: 1px;
  color: #77728e;
  margin-top: 20px;
}

/* Main layout & topbar */
.layout {
  margin-left: 242px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 76px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  font-size: 12px;
}

.breadcrumb {
  color: #8f95a3;
}

.slash {
  color: #c6cad3;
  margin: 0 16px;
}

.top-right {
  display: flex;
  gap: 20px;
  align-items: center;
}

.top-right a:hover {
  color: var(--purple);
}

.small.avatar {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.connection {
  font-size: 11px;
  color: var(--green);
}

.connection:before {
  content: ' ';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  margin-right: 7px;
}

.connection.offline {
  color: var(--red);
}

main {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 36px 40px 28px;
  flex: 1;
}

h1 {
  font-size: 27px;
  font-weight: 650;
  letter-spacing: -.7px;
  margin: 0 0 10px;
}

h2 {
  font-size: 17px;
  margin: 0 0 10px;
  font-weight: 600;
}

h3 {
  font-size: 14px;
  margin: 0 0 8px;
}

p {
  line-height: 1.7;
}

.muted,
.subtitle {
  color: var(--muted);
}

.subtitle {
  font-size: 12px;
  margin: 0;
  line-height: 1.8;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 29px;
}

.button-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button-group button {
  font-size: 12px;
}

/* Dashboard stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 20px 22px;
  position: relative;
}

.stat-title {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 16px;
}

.stat-number {
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -1px;
}

.stat-caption {
  font-size: 10px;
  color: #9298a7;
  margin-top: 9px;
}

.stat-icon {
  position: absolute;
  right: 20px;
  top: 20px;
  height: 31px;
  width: 31px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--purple);
  background: #f1eeff;
  font-size: 18px;
}

.stat:nth-child(2) .stat-icon {
  color: #b28b35;
  background: #fff6e3;
}

.stat:nth-child(3) .stat-icon {
  color: #369678;
  background: #eaf7f1;
}

.stat:nth-child(4) .stat-icon {
  color: #cc6471;
  background: #fceef0;
}

/* Panels & toolbar */
.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 11px;
  overflow: hidden;
}

.panel + .panel {
  margin-top: 22px;
}

.panel-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  margin: 0;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  padding: 0 21px;
  min-height: 58px;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.filter-tabs {
  display: flex;
  gap: 22px;
  align-items: stretch;
  align-self: stretch;
}

.filter-tab {
  border: 0;
  border-radius: 0;
  padding: 10px 0;
  font-size: 12px;
  color: var(--muted);
  background: none;
  position: relative;
  display: inline-flex;
  align-items: center;
}

.filter-tab:hover:not(:disabled) {
  background: none;
  border-color: transparent;
  color: var(--ink);
}

.filter-tab.active {
  color: var(--purple);
  font-weight: 600;
}

.filter-tab.active:after {
  content: '';
  height: 2px;
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  background: var(--purple);
}

.tools {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
}

.tools input {
  width: 220px;
  height: 36px;
  font-size: 12px;
  line-height: 1.4;
  padding: 7px 12px;
}

.tools select {
  height: 36px;
  max-width: 175px;
  font-size: 12px;
  line-height: 1.4;
  padding: 7px 34px 7px 12px;
  background-position: right 11px center;
}

.bulk {
  padding: 11px 21px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f7f5ff;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.bulk span {
  margin-right: auto;
}

.bulk button {
  font-size: 11px;
  padding: 6px 10px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  white-space: nowrap;
}

th {
  background: #fcfcfe;
  font-size: 10px;
  color: #8b91a0;
  font-weight: 500;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
}

td {
  font-size: 12px;
  padding: 18px 12px;
  border-bottom: 1px solid #f0f1f5;
  vertical-align: middle;
}

th:first-child,
td:first-child {
  padding-left: 22px;
}

th:last-child,
td:last-child {
  padding-right: 22px;
}

tbody tr:hover {
  background: #fdfcfe;
}

.watch-title {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 230px;
}

.site-icon {
  height: 35px;
  width: 35px;
  border-radius: 9px;
  background: #f1eff9;
  color: #8d79bd;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

.watch-name {
  font-size: 12px;
  font-weight: 600;
  color: #38394e;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.watch-url {
  display: block;
  color: #a0a4b1;
  margin-top: 6px;
  font-size: 10px;
  max-width: 285px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unread-dot {
  width: 5px;
  height: 5px;
  display: inline-block;
  background: var(--purple);
  border-radius: 50%;
  margin-left: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 5px;
  font-size: 10px;
  color: #8b829e;
  background: #f3f1f8;
}

.badge.status-ok {
  color: #278767;
  background: #edf8f2;
}

.badge.status-changed {
  color: #98742c;
  background: #fff6e1;
}

.badge.status-error {
  color: #c55763;
  background: #ffedf0;
}

.badge.status-queued,
.badge.status-checking {
  color: #7c68c7;
  background: #f1edff;
}

.tag-chip {
  display: inline-block;
  background: #f2effb;
  color: #9482b7;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 9px;
  margin: 2px;
}

.row-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  min-width: 0;
  max-width: none;
}

.row-actions button {
  font-size: 11px;
  padding: 5px 7px;
  border-color: transparent;
  color: #888698;
  background: transparent;
}

.row-actions button:hover {
  background: #eeebf8;
  color: var(--purple);
}

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 22px;
  color: #969bab;
  font-size: 10px;
}

.table-footer button {
  font-size: 10px;
  padding: 5px 9px;
}

/* Empty state & helper cards */
.empty {
  padding: 60px 25px 64px;
  text-align: center;
}

.empty-symbol {
  width: 68px;
  height: 68px;
  background: #f1edff;
  color: #9985df;
  font-size: 32px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  margin: 0 auto 23px;
  box-shadow: 0 0 0 10px #faf9ff;
}

.empty h2 {
  font-size: 17px;
  margin-bottom: 12px;
}

.empty p {
  font-size: 12px;
  color: var(--muted);
  max-width: 470px;
  margin: 0 auto 23px;
  line-height: 1.9;
}

.empty button {
  font-size: 12px;
}

.helper-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 22px;
}

.helper-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 19px 21px;
  background: #ffffff75;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.helper-card > span {
  color: #9c90c6;
  font-size: 20px;
}

.helper-card h3 {
  font-size: 11px;
  font-weight: 500;
  color: #606277;
  margin-bottom: 7px;
}

.helper-card p {
  font-size: 10px;
  line-height: 1.8;
  color: #989eab;
  margin: 0;
}

.page-footer {
  padding: 18px 40px 23px;
  color: #a0a6b3;
  font-size: 9px;
  display: flex;
  justify-content: space-between;
  letter-spacing: .2px;
}

.notice {
  background: #f5f2ff;
  border: 1px solid #e8e0ff;
  color: #5b4d82;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 12px;
  line-height: 1.7;
  margin-bottom: 20px;
}

.notice.warning {
  background: #fff9ed;
  color: #977637;
  border-color: #f3e8ca;
}

/* Forms & Settings */
.form-panel {
  padding: 28px;
  max-width: 920px;
}

.settings-stack {
  display: grid;
  gap: 24px;
  max-width: 960px;
}

.settings-stack .form-panel {
  max-width: none;
  margin-top: 0;
}

.settings-form {
  overflow: visible;
}

.settings-section + .settings-section {
  margin-top: 28px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}

.settings-section > h2,
#api-keys-panel > h2 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 650;
}

.section-desc {
  margin: 0 0 18px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
}

.section-desc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  background: #f3f1f8;
  color: #4f3da8;
  padding: 1px 5px;
  border-radius: 4px;
}

.section-desc a {
  color: var(--purple);
  font-weight: 500;
}

.section-desc a:hover {
  text-decoration: underline;
}

.section-actions {
  margin-top: 4px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 18px;
}

.field small {
  color: #8c92a2;
  font-size: 11px;
  line-height: 1.6;
}

.field input,
.field select,
.field textarea {
  width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
  margin-bottom: 18px;
}

.form-grid > .field {
  margin-bottom: 0;
}

.full {
  grid-column: 1 / -1;
}

.checkbox-field {
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 16px;
  cursor: pointer;
}

.checkbox-field:last-child {
  margin-bottom: 0;
}

.checkbox-field input {
  flex-shrink: 0;
  margin: 0;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

.form-actions .primary {
  margin-left: auto;
}

.settings-save-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 28px -28px -28px;
  padding: 16px 28px;
  background: rgba(251, 251, 253, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  border-radius: 0 0 11px 11px;
  justify-content: space-between;
}

.settings-save-hint {
  font-size: 12px;
  color: var(--muted);
}

/* Telegram & Notification blocks */
.telegram-box {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.telegram-box p {
  margin: 0;
}

.telegram-error {
  color: var(--red);
  font-size: 12px;
}

.telegram-error:empty {
  display: none;
}

.notification-actions {
  margin: 6px 0 10px;
}

.notification-hint {
  margin: 0 0 12px;
}

/* Public API keys card */
.api-key-quick-actions {
  margin: 0 0 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.api-key-banner {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.api-key-banner .mini-caption,
.api-key-banner .field {
  margin: 0;
}

.api-key-curl {
  margin: 2px 0 0;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e2daf8;
  border-radius: 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: #463a6e;
  overflow-x: auto;
  white-space: pre;
}

.api-key-form {
  margin-bottom: 22px;
}

.scope-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 0 0 18px;
}

.scope-checkboxes .checkbox-field {
  margin: 0;
}

.scope-checkboxes code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.api-key-submit {
  display: flex;
  align-items: center;
  gap: 10px;
}

.api-keys-table-wrap {
  border: 1px solid var(--border);
  border-radius: 9px;
}

.api-keys-table th,
.api-keys-table td {
  padding: 13px 12px;
}

.api-keys-table th:first-child,
.api-keys-table td:first-child {
  padding-left: 16px;
}

.api-keys-table th:last-child,
.api-keys-table td:last-child {
  padding-right: 16px;
}

.api-keys-table tbody tr:last-child td {
  border-bottom: 0;
}

.api-key-name-cell {
  white-space: normal;
  min-width: 150px;
}

.api-key-name-cell .mini-caption {
  margin: 3px 0 0;
  font-size: 11px;
}

.api-key-prefix {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.scope-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 240px;
}

.api-key-action-cell {
  text-align: right;
  white-space: nowrap;
}

.api-keys-empty {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.inline-form {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
}

.inline-form input {
  flex: 1;
}

/* Tags & Timeline */
.tag-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.tag-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 21px;
}

.tag-card h3 {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.tag-card .button-group {
  margin-top: 20px;
}

.tag-card .muted {
  font-size: 11px;
}

.timeline {
  padding: 0 24px;
}

.timeline-row {
  display: flex;
  gap: 18px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.timeline-row:last-child {
  border-bottom: 0;
}

.timeline-row > div {
  flex: 1;
}

.timeline-row h3 {
  font-size: 13px;
}

.timeline-row p {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}

.timeline-row time {
  font-size: 10px;
  color: #a0a3b0;
}

.timeline-row .site-icon {
  flex: none;
}

.delivery-panel {
  margin-top: 22px;
}

.delivery-empty {
  padding: 20px 22px;
}

/* Watch detail & diff */
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.detail-heading a {
  color: var(--purple);
  font-size: 12px;
}

.detail-meta {
  font-size: 12px;
  margin: 0 0 18px;
}

.detail-meta a {
  color: var(--purple);
  font-weight: 500;
}

.detail-meta a:hover {
  text-decoration: underline;
}

.history-toolbar {
  display: flex;
  gap: 14px;
  align-items: end;
  flex-wrap: wrap;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.history-toolbar .field {
  margin: 0;
  min-width: 180px;
  flex: 1;
}

.history-toolbar > button {
  min-height: 40px;
}

.diff-summary {
  padding: 15px 22px;
  font-size: 11px;
  display: flex;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.green {
  color: var(--green);
}

.red {
  color: var(--red);
}

.diff-view {
  max-height: 650px;
  overflow: auto;
  padding: 15px 0;
  background: #fdfdfe;
}

.diff-line {
  display: flex;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.9;
  min-height: 23px;
}

.diff-line > span {
  width: 48px;
  flex-shrink: 0;
  text-align: right;
  padding-right: 15px;
  color: #b3b6c3;
  user-select: none;
}

.diff-line > code {
  font: inherit;
  padding-right: 20px;
}

.diff-line.added {
  background: #eaf8ee;
  color: #267343;
}

.diff-line.removed {
  background: #fff0f1;
  color: #ac424f;
}

.diff-line.added > span {
  color: #70ab7e;
}

.diff-line.removed > span {
  color: #cf8991;
}

.snapshot {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 22px;
  line-height: 1.8;
  font-size: 12px;
  margin: 0;
}

.loading {
  padding: 80px;
  text-align: center;
  color: var(--muted);
}

/* Dialogs */
dialog {
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 25px 100px #18133440;
  padding: 0;
  width: min(830px, calc(100vw - 32px));
  max-height: 90vh;
  color: var(--ink);
}

dialog::backdrop {
  background: #1a173d60;
  backdrop-filter: blur(3px);
}

dialog.compact {
  max-width: 440px;
}

.dialog-head {
  padding: 23px 28px 19px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.dialog-head h2 {
  margin: 0;
  font-size: 19px;
}

.dialog-head small {
  display: block;
  color: var(--muted);
  margin-top: 7px;
  font-size: 11px;
}

.dialog-tabs {
  display: flex;
  gap: 20px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.dialog-tabs button {
  background: none;
  border: 0;
  padding: 17px 0;
  border-radius: 0;
  font-size: 12px;
  white-space: nowrap;
  color: var(--muted);
}

.dialog-tabs button.active {
  border-bottom: 2px solid var(--purple);
  color: var(--purple);
}

.dialog-body {
  padding: 25px 28px;
  max-height: 57vh;
  overflow: auto;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 17px 28px;
  background: #fbfbfd;
  border-top: 1px solid var(--border);
}

.tab-pane[hidden] {
  display: none;
}

.error-message {
  color: #ba4155;
  font-size: 12px;
  padding: 0 28px 12px;
  white-space: pre-wrap;
}

.step-row {
  display: grid;
  grid-template-columns: 30px 105px 1fr 1fr 30px 30px;
  gap: 7px;
  align-items: center;
  margin-bottom: 10px;
}

.step-row input,
.step-row select {
  width: 100%;
  padding: 9px 10px;
  font-size: 11px;
}

.step-row select {
  padding-right: 30px;
  background-position: right 9px center;
}

.step-number {
  font-size: 12px;
  color: var(--muted);
}

.compact .dialog-body p {
  font-size: 13px;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.compact .dialog-body .field {
  margin-top: 14px;
  margin-bottom: 0;
}

.toast {
  background: #302b45;
  color: #fff;
  padding: 14px 20px;
  border-radius: 9px;
  box-shadow: var(--shadow);
  font-size: 12px;
  max-width: 460px;
  line-height: 1.6;
}

.toast.error {
  background: #9e4250;
}

#toasts {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 100;
  display: grid;
  gap: 10px;
}

.skip {
  position: fixed;
  left: -500px;
  top: 10px;
  z-index: 200;
  background: #fff;
  padding: 15px;
}

.skip:focus {
  left: 10px;
}

.hidden {
  display: none !important;
}

.overview-hint {
  font-size: 10px;
  color: #a2a6b5;
  padding: 17px 0;
}

.error-detail {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #c76b77;
  font-size: 10px;
  margin-top: 5px;
}

.content-stack {
  display: grid;
  gap: 22px;
}

.transfer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 22px;
  align-items: start;
}

.transfer-grid .form-panel {
  max-width: none;
  margin-top: 0;
}

.transfer-grid .subtitle + .subtitle {
  margin-top: 10px;
}

.file-input {
  margin: 4px 0 0;
  width: 100%;
  font-size: 12px;
}

.history-list {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.history-list button {
  font-size: 11px;
}

.mini-caption {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 14px;
  line-height: 1.6;
}

.verdict-chip {
  display: inline-block;
  margin-left: 5px;
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 500;
  color: #8a5a2b;
  background: #fdf1e3;
  border: 1px solid #f2e0c8;
}

.verdict-detail {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  color: #8b7b5c;
}

#language {
  font: inherit;
  border: 1px solid var(--border, #e3e8e6);
  border-radius: 8px;
  padding: 7px 30px 7px 10px;
  background-color: #fff;
  color: inherit;
  max-width: 140px;
}

.processor-label {
  display: block;
  margin-bottom: 6px;
  color: #63776d;
  font-size: 11px;
}

.snapshot-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  padding: 24px;
}

.snapshot-pair figure {
  margin: 0;
  min-width: 0;
}

.snapshot-pair figcaption {
  font-weight: 600;
  margin-bottom: 12px;
}

.snapshot-image {
  display: block;
  max-width: 100%;
  max-height: 600px;
  object-fit: contain;
  background: repeating-conic-gradient(#e8ecea 0% 25%, #fff 0% 50%) 50% / 20px 20px;
  border: 1px solid #dbe3de;
}

.product-snapshot {
  border: 1px solid #e0e7e2;
  border-radius: 12px;
  padding: 20px;
}

.product-price {
  font-size: 34px;
  font-weight: 600;
  margin: 24px 0;
}

.product-price small {
  font-size: 16px;
}

[data-processor][hidden] {
  display: none;
}

/* Watch editor */
#editor {
  width: min(1420px, 96vw);
  max-width: 96vw;
  height: min(960px, 94vh);
  max-height: 94vh;
  border-radius: 14px;
}

#watch-form {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#editor .dialog-head {
  padding: 20px 28px;
  background: #faf9ff;
}

#editor .dialog-head > button[data-close] {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

#editor .dialog-head > button[data-close]:hover {
  background: #eeebf8;
  color: var(--ink);
}

.editor-eyebrow {
  margin: 0 0 5px;
  font-size: 10px;
  letter-spacing: 1.7px;
  color: #817394;
  font-weight: 700;
}

#editor .dialog-tabs {
  flex-shrink: 0;
  padding: 0 24px;
  gap: 4px;
  background: #faf9ff;
  overflow-x: auto;
}

#editor .dialog-tabs button {
  white-space: nowrap;
  padding: 17px 14px;
  font-size: 13px;
}

#editor .dialog-tabs [hidden] {
  display: none;
}

#editor .dialog-body {
  padding: 28px 34px;
  flex: 1;
  max-height: none;
  overflow: auto;
  min-height: 0;
}

#editor .tab-pane {
  max-width: 1100px;
  margin: 0 auto;
}

#editor .field {
  margin-bottom: 18px;
  font-weight: 600;
  gap: 7px;
}

#editor .form-grid > .field {
  margin-bottom: 0;
}

#editor .field small,
#editor small {
  font-weight: 400;
  line-height: 1.6;
  color: #8a8798;
}

#editor input:not([type="checkbox"]):not([type="radio"]),
#editor select,
#editor textarea {
  font-weight: 400;
}

#editor .notice {
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 22px;
}

#editor fieldset {
  border: 1px solid #e4e1ec;
  border-radius: 8px;
  margin: 18px 0;
  padding: 20px;
  min-width: 0;
}

#editor fieldset legend {
  font-weight: 650;
  font-size: 14px;
  padding: 0 6px;
}

#editor fieldset.processor-choices {
  border: 0;
  padding: 0;
  margin: 24px 0;
}

#editor .checkbox-field {
  font-size: 14px;
  margin: 12px 0;
  align-items: center;
  line-height: 1.5;
}

#editor .schedule-row .checkbox-field {
  margin: 0;
}

#editor input[type="radio"],
#editor input[type="checkbox"] {
  accent-color: #7a5ae3;
  flex-shrink: 0;
}

#editor #custom-schedule {
  border: 0;
  padding: 12px 0 0;
  margin-bottom: 0;
}

#editor fieldset:disabled {
  opacity: .45;
}

.interval-fields {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

#editor .interval-fields .field {
  margin-bottom: 10px;
}

.editor-details {
  margin: 6px 0 18px;
}

.editor-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: #7958d5;
  padding: 6px 0;
}

.editor-details[open] > summary {
  margin-bottom: 14px;
}

.schedule-table {
  border: 1px solid #ece9f2;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 12px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr;
  align-items: center;
  gap: 22px;
  padding: 10px 16px;
  border-top: 1px solid #eeeaf3;
}

.schedule-row .field {
  margin: 0 !important;
  font-size: 11px;
}

.schedule-row .checkbox-field {
  margin: 0;
}

.schedule-labels {
  font-size: 12px;
  color: #827c91;
  background: #faf9fc;
  border: 0;
}

.duration-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.schedule-fields {
  margin: 6px 0 18px;
}

.schedule-fields > small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}

.check-grid {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.condition-row {
  display: grid;
  grid-template-columns: 1.2fr 1.1fr 1fr auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
}

.condition-row .field {
  margin-bottom: 0 !important;
}

.condition-row > button {
  margin-top: 0;
  height: 40px;
  width: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.condition-row > [data-condition-result] {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
  margin-bottom: 6px;
}

.editor-preview {
  max-height: 400px;
  overflow: auto;
  background: #faf9fd;
  border: 1px solid #e5e1ee;
  border-radius: 8px;
  padding: 16px 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.editor-stats {
  margin: 0;
}

.editor-stats > div {
  display: grid;
  grid-template-columns: 1fr 2fr;
  padding: 18px 0;
  border-bottom: 1px solid #eeebf2;
}

.editor-stats dt {
  color: #868093;
}

.editor-stats dd {
  margin: 0;
  overflow-wrap: anywhere;
}

#editor .dialog-footer {
  flex-shrink: 0;
  border-top: 1px solid #e9e5f1;
  padding: 18px 28px;
  display: flex;
  gap: 10px;
  align-items: center;
  background: #fff;
}

.editor-secondary {
  margin-right: auto;
  display: flex;
  gap: 10px;
}

#editor .error-message:empty {
  display: none;
}

#visual-canvas {
  display: block;
  max-width: 100%;
  border: 1px solid #e3dfec;
  cursor: crosshair;
}

/* Product summaries & price history */
.product-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-width: 160px;
  max-width: 220px;
}

.stock-badge,
.price-badge {
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.stock-badge.in-stock {
  background: #e4f4ed;
  color: #16754d;
}

.stock-badge.out-of-stock {
  background: #fff0ed;
  color: #b54435;
}

.stock-badge.unknown-stock {
  background: #efedf4;
  color: #777085;
}

.price-badge {
  background: #f3f1f8;
  color: #403850;
}

.price-change {
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.price-down {
  color: #168351;
}

.price-up {
  color: #c45148;
}

.history-link {
  font-size: 12px;
  padding: 7px 5px;
}

.row-actions [data-action="price-history"] {
  color: #7658ce;
  font-weight: 600;
}

.price-history-row > td {
  padding: 0 !important;
  white-space: normal;
  background: linear-gradient(110deg, #effbf5, #f2f4fe);
}

.price-history {
  padding: 24px 28px;
  min-width: 0;
}

.price-history h3 {
  margin: 0 0 20px;
  font-size: 16px;
  color: #454056;
}

.price-chart-summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
  color: #757080;
  margin-bottom: 4px;
}

.price-chart-summary strong {
  color: #4b445b;
  margin-right: auto;
}

.price-chart-scroll {
  overflow-x: auto;
}

.price-chart {
  display: block;
  width: 100%;
  min-width: 500px;
  max-height: 320px;
  overflow: visible;
}

.price-chart text {
  font-size: 12px;
  fill: #777888;
  font-family: inherit;
}

.price-grid {
  stroke: #dce7e6;
  stroke-width: 1;
}

.price-line {
  fill: none;
  stroke: #869d9b;
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.in-stock {
  color: #209c69;
}

.out-of-stock {
  color: #db6b58;
}

.unknown-stock {
  color: #898292;
}

.price-point.in-stock circle {
  fill: #209c69;
}

.price-point.out-of-stock circle {
  fill: #db6b58;
}

.price-point.unknown-stock circle {
  fill: #898292;
}

.price-point circle {
  stroke: #fff;
  stroke-width: 2;
}

.price-point {
  outline: none;
  cursor: default;
}

.price-point:hover circle,
.price-point:focus circle {
  r: 7;
  stroke: #44345e;
  stroke-width: 2;
}

.price-tooltip {
  display: none;
  fill: #44345e !important;
  font-weight: 600;
}

.price-point:hover .price-tooltip,
.price-point:focus .price-tooltip {
  display: block;
}

.price-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 12px;
  margin: 6px 0 20px;
}

.price-history .mini-caption {
  line-height: 1.6;
  white-space: normal;
  max-width: 900px;
}

.price-data {
  font-size: 12px;
  margin: 15px 0;
}

.price-data summary {
  cursor: pointer;
  color: #716386;
}

.price-data table {
  margin-top: 12px;
  min-width: 0 !important;
  width: 100%;
}

.price-data th,
.price-data td {
  padding: 10px !important;
  white-space: normal;
}

.full-history-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  margin-top: 10px;
}

/* Watch list table layout */
.watch-list {
  table-layout: fixed;
  min-width: 940px;
}

.watch-list th,
.watch-list td {
  padding-left: 10px;
  padding-right: 10px;
}

.watch-list th:first-child,
.watch-list td:first-child {
  padding-left: 18px;
}

.watch-list th:last-child,
.watch-list td:last-child {
  padding-right: 16px;
}

.watch-list .select-col {
  width: 42px;
}

.watch-list .name-col {
  width: auto;
}

.watch-list .status-col {
  width: 118px;
}

.watch-list .product-col {
  width: 174px;
}

.watch-list .tags-col {
  width: 88px;
}

.watch-list .checked-col {
  width: 126px;
}

.watch-list .actions-col {
  width: 260px;
}

.watch-list > tbody > tr > td {
  white-space: normal;
}

.watch-list .watch-title {
  min-width: 0;
  gap: 10px;
}

.watch-list .watch-title > div:last-child {
  min-width: 0;
}

.watch-list .watch-name {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.watch-list .watch-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-list .row-actions {
  min-width: 0;
  max-width: none;
}

.watch-list .product-summary {
  min-width: 0;
}

.watch-list .tag-chip {
  margin: 2px 0;
}

.watch-list .site-icon {
  width: 30px;
  height: 30px;
}

/* Browser Steps */
#editor:has(#tab-steps[aria-selected="true"]) {
  width: min(1520px, 96vw);
  max-width: 96vw;
}

.browser-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

.browser-preview {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fafafe;
}

.browser-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  font-size: 11px;
}

.browser-toolbar [data-browser-url] {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  flex: 1;
}

.browser-toolbar button {
  padding: 6px 9px;
  font-size: 11px;
  flex-shrink: 0;
}

.browser-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a5a7b3;
  flex-shrink: 0;
}

.browser-indicator.connected {
  background: #32a17c;
}

.browser-stage {
  min-height: 350px;
  display: grid;
  align-items: center;
  background: #eeeef3;
  position: relative;
}

.browser-placeholder {
  text-align: center;
  padding: 70px 24px;
  color: var(--muted);
}

.browser-placeholder h3 {
  font-size: 19px;
  margin-top: 20px;
}

.browser-placeholder p {
  font-size: 12px;
}

.browser-play {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--purple);
  border: 0;
  color: #fff;
  font-size: 30px;
  padding-left: 18px;
  box-shadow: 0 6px 20px #7958df30;
}

[data-browser-canvas] {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

[data-browser-canvas].picking {
  cursor: crosshair;
}

.browser-preview [data-browser-status] {
  padding: 0 16px;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.browser-preview > .mini-caption {
  padding: 0 16px 10px;
  font-size: 11px;
}

.browser-error {
  color: var(--red);
}

.browser-picker {
  display: flex;
  padding: 12px;
  gap: 8px;
  align-items: end;
  background: #f2eeff;
}

.browser-picker .field {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.browser-picker select {
  width: 100%;
  font-size: 11px;
}

.browser-picker button {
  font-size: 11px;
  padding: 8px;
}

.browser-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 18px;
}

.browser-controls button {
  font-size: 11px;
  padding: 8px 10px;
}

.browser-step-panel h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.browser-step-panel h3 span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

.browser-step-fields {
  padding: 0;
  border: 0;
  margin: 0;
  min-width: 0;
}

.browser-step-fields #steps-list {
  max-height: 580px;
  overflow: auto;
  padding: 2px 4px 2px 0;
  scrollbar-width: thin;
}

.browser-step-panel .step-row {
  display: block;
  padding: 12px;
  margin: 0 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
}

.step-heading {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.step-heading select {
  width: 100%;
  min-width: 0;
  font-size: 12px;
}

.step-number {
  font-size: 12px;
  min-width: 18px;
  color: var(--muted);
}

.step-row .field {
  margin-bottom: 8px;
  font-size: 11px;
}

.step-row input,
.step-row textarea {
  font-size: 12px;
  width: 100%;
  min-width: 0;
}

.step-row textarea {
  resize: vertical;
  min-height: 55px;
}

.step-target-input {
  display: flex;
  gap: 5px;
}

.step-target-input input {
  flex: 1;
}

.step-target-input button {
  padding: 6px 10px;
  font-size: 18px;
}

.step-tools {
  display: flex;
  gap: 5px;
  align-items: center;
}

.step-tools button {
  font-size: 11px;
  padding: 5px 8px;
}

.step-tools button:first-child {
  margin-right: auto;
}

.step-result {
  margin: 7px 0 0;
  font-size: 11px;
  overflow-wrap: anywhere;
  max-height: 100px;
  overflow: auto;
}

.step-result:empty {
  display: none;
}

.step-row[data-result="running"] {
  border-color: var(--purple);
  background: #f8f6ff;
}

.step-row[data-result="success"] {
  border-color: #86c9ae;
}

.step-row[data-result="success"] .step-result {
  color: var(--green);
}

.step-row[data-result="error"] {
  border-color: #e09ca2;
}

.step-row[data-result="error"] .step-result {
  color: var(--red);
}

[data-steps-empty] {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.browser-workspace [hidden] {
  display: none !important;
}

#editor:has(#tab-steps[aria-selected="true"]) .dialog-body {
  max-height: none;
}

#editor #pane-steps {
  max-width: none;
}

#editor .browser-step-fields {
  border: 0;
  padding: 0;
  margin: 0;
}

#editor .step-row .field {
  margin-bottom: 10px;
  font-size: 11px;
}

/* Auth pages */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg, #f5f7fb);
}

.login-card {
  width: min(100%, 460px);
  padding: 40px;
  background: #fff;
  border: 1px solid #e2e7ef;
  border-radius: 16px;
  box-shadow: 0 12px 40px #24334d0a;
}

.login-card .brand {
  padding: 0;
  margin-bottom: 36px;
  color: var(--ink);
}

.login-card h1 {
  font-size: 27px;
  line-height: 1.25;
}

.login-card p {
  line-height: 1.65;
  margin: 18px 0;
}

.login-card label {
  display: block;
  margin-bottom: 8px;
}

.google-signin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #24334d;
  background: #fff;
  font-weight: 600;
  text-decoration: none;
  margin: 26px 0;
}

.google-signin:hover {
  background: #f8fafc;
}

.google-signin:focus-visible {
  outline: 3px solid #607bf5;
  outline-offset: 3px;
}

.google-signin span {
  font-size: 20px;
}

.login-card [role="alert"] {
  color: #b42318;
}

.account-identity {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-owner {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-card form {
  display: grid;
  gap: 12px;
  margin: 20px 0;
}

.login-card input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
}

.login-card button {
  padding: 12px;
}

.login-card [hidden] {
  display: none !important;
}

.login-card #login-status {
  color: var(--text-muted, #526174);
}

.login-card #code {
  font-size: 20px;
  letter-spacing: .2em;
}

/* Billing */
.billing-page {
  background: #f6f8fb;
  color: #172b3a;
  min-height: 100vh;
}

.billing-header {
  max-width: 1160px;
  margin: auto;
  padding: 28px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.billing-header > div {
  display: flex;
  gap: 20px;
  align-items: center;
}

.billing-main {
  max-width: 1160px;
  margin: 30px auto;
  padding: 0 32px;
}

.billing-eyebrow {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: #667b8d;
  font-weight: 700;
}

.billing-sandbox {
  background: #fff0cb;
  color: #75510b;
  padding: 9px 14px;
  border-radius: 20px;
  font-size: 12px;
  white-space: nowrap;
}

.billing-current {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.billing-current h2 {
  font-size: 30px;
  margin: 0;
}

.billing-details {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin: 20px 0;
}

.billing-details dt {
  font-size: 12px;
  color: #63788b;
}

.billing-details dd {
  margin: 5px 0 0;
  font-weight: 600;
}

.billing-plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 26px 0;
}

.billing-plan {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.billing-plan.is-current {
  border: 2px solid #1f8278;
}

.billing-plan h2 {
  font-size: 27px;
  margin: 8px 0;
}

.billing-price {
  font-size: 23px;
  font-weight: 650;
  min-height: 55px;
}

.billing-price small {
  font-size: 12px;
  font-weight: 400;
  color: #607587;
}

.billing-plan ul {
  padding-left: 0;
  list-style: none;
  line-height: 2.3;
  font-size: 13px;
  flex: 1;
}

.billing-plan button {
  width: 100%;
  margin-top: 15px;
}

.billing-warning,
#billing-error {
  padding: 12px 16px;
  background: #fff1db;
  border-radius: 8px;
  color: #7f440e;
}

.billing-footer {
  margin: 45px 0;
  color: #728497;
  font-size: 12px;
}

.status-plan_limited {
  background: #fff1db;
  color: #7f440e;
}

#billing-message:empty {
  display: none;
}

#change-dialog {
  padding: 28px;
  width: min(520px, calc(100vw - 32px));
  max-width: 520px;
}

#change-dialog h2 {
  font-size: 20px;
  margin: 0 0 20px;
}

#change-dialog .billing-details {
  gap: 16px 28px;
  margin: 0 0 20px;
}

#change-policy {
  line-height: 1.7;
  margin: 0 0 22px;
  color: #63788b;
}

#change-dialog .button-group {
  justify-content: flex-end;
}

.billing-page .panel {
  padding: 24px;
}

.billing-header .brand {
  padding: 0;
}

.billing-header a {
  color: inherit;
}

/* Unified row actions */
.row-actions .text-action,
.row-actions .icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #6f6c85;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.row-actions .text-action {
  padding: 0 7px;
}

.row-actions .icon-action {
  width: 30px;
  padding: 0;
}

.row-actions .icon-action svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.row-actions .primary-text {
  color: var(--purple);
  font-weight: 600;
}

.row-actions .text-action:hover,
.row-actions .icon-action:hover:not(:disabled) {
  background: #eeebf8;
  color: var(--purple);
}

.row-actions .danger-action:hover:not(:disabled) {
  background: #fdeaec;
  color: var(--red);
}

.row-actions .icon-action:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.row-actions .action-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 5px;
  flex: none;
}

/* Quick templates & visual options */
.template-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 14px;
  margin-bottom: 20px;
  border: 1px solid #e5e0f8;
  border-radius: 10px;
  background: #faf9ff;
}

.template-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6f5ec9;
}

.template-bar button {
  font-size: 12px;
  padding: 6px 11px;
}

.visual-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}

/* Watch status stack & error details dialog */
.status-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  min-width: 0;
}

.status-stack .processor-label {
  margin-bottom: 0;
}

.status-stack .badge {
  white-space: nowrap;
}

.status-stack .verdict-chip,
.verdict-detail .verdict-chip,
.error-dialog .verdict-chip {
  margin-left: 0;
  white-space: nowrap;
}

.status-error-btn {
  border: 1px solid #f2c2c8;
  background: #ffedf0;
  color: #b94452;
  padding: 4px 7px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}

.status-error-btn:hover {
  background: #fde0e4;
  border-color: #e6a3ac;
  color: #9d3240;
}

.status-error-btn:focus-visible {
  outline: 2px solid #c5576355;
  outline-offset: 2px;
}

.status-btn-icon {
  width: 12px;
  height: 12px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status-btn-chevron {
  width: 11px;
  height: 11px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .75;
}

.error-peek-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border: 1px solid #f2c2c8;
  border-radius: 5px;
  background: #fff6f7;
  color: #b94452;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
}

.error-peek-btn:hover {
  background: #ffedf0;
  border-color: #e6a3ac;
  color: #9d3240;
}

.verdict-chip-btn {
  cursor: pointer;
  line-height: 1.25;
  transition: background .15s, border-color .15s, color .15s;
}

.verdict-chip-btn:hover {
  background: #fbe6ce;
  border-color: #e6c69c;
  color: #75491f;
}

.error-dialog {
  max-width: 580px;
}

.error-dialog-shell {
  display: flex;
  flex-direction: column;
}

.error-dialog .dialog-head {
  align-items: flex-start;
  gap: 14px;
  background: #faf9ff;
}

.error-dialog-head-meta {
  min-width: 0;
  flex: 1;
}

.error-dialog-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.error-dialog-watch-title {
  overflow-wrap: anywhere;
}

.error-dialog-url {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--purple);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.error-dialog-url:hover {
  text-decoration: underline;
}

.error-dialog-close {
  flex: none;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.error-dialog-close svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}

.error-dialog-close:hover {
  background: #eeebf8;
  border-color: transparent;
  color: var(--ink);
}

.error-dialog-hint {
  margin-bottom: 16px;
}

.error-message-wrap {
  border: 1px solid #f2d7db;
  border-radius: 10px;
  overflow: hidden;
  background: #fffafb;
  margin-bottom: 18px;
}

.error-message-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #fff0f2;
  border-bottom: 1px solid #f2d7db;
  font-size: 11px;
  font-weight: 600;
  color: #9c3b47;
}

.error-copy-btn {
  padding: 3px 9px;
  font-size: 11px;
  border-radius: 6px;
  border-color: #e8c0c6;
  color: #9c3b47;
  background: #fff;
}

.error-copy-btn:hover {
  background: #fff5f6;
  border-color: #d99ba4;
}

.error-message-box {
  margin: 0;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.65;
  color: #5f2730;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 200px;
  overflow: auto;
}

.error-meta-grid {
  margin: 0;
  border-top: 1px solid var(--border);
}

.error-meta-row {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f1f5;
  font-size: 12px;
  align-items: start;
}

.error-meta-row dt {
  color: var(--muted);
  font-weight: 500;
}

.error-meta-row dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.evidence-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.evidence-chip {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f3f1f8;
  color: #5c5373;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.error-dialog .dialog-footer {
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.error-dialog .editor-secondary {
  align-items: center;
  flex-wrap: wrap;
}

.error-detail-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--purple);
  padding: 6px 4px;
}

.error-detail-link:hover {
  text-decoration: underline;
}

/* Responsive */
@media (min-width: 1500px) {
  main {
    padding-top: 45px;
  }
  .stats {
    gap: 22px;
  }
  .stat {
    padding: 24px;
  }
}

@media (max-width: 1150px) {
  .sidebar {
    width: 210px;
    padding-left: 14px;
    padding-right: 14px;
  }
  .layout {
    margin-left: 210px;
  }
  main {
    padding: 28px 24px;
  }
  .topbar {
    padding: 0 24px;
  }
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
    gap: 12px;
    min-height: 0;
  }
  .filter-tabs {
    width: 100%;
    border-bottom: 1px solid var(--border);
  }
  .filter-tab {
    padding: 6px 0 11px;
  }
  .tools {
    width: 100%;
    padding: 0;
    flex-wrap: wrap;
  }
  .tools input {
    flex: 1;
    min-width: 180px;
  }
  .stat {
    padding: 17px;
  }
  .stat-icon {
    right: 13px;
    top: 14px;
  }
  .tag-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .brand {
    font-size: 16px;
  }
}

@media (max-width: 900px) {
  .browser-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .browser-stage {
    min-height: 260px;
  }
  .browser-step-fields #steps-list {
    max-height: none;
  }
  .browser-picker {
    flex-wrap: wrap;
  }
  .browser-picker .field {
    flex-basis: 100%;
  }
}

@media (max-width: 760px) {
  .sidebar {
    position: relative;
    width: 100%;
    padding: 16px;
    display: block;
  }
  .brand {
    margin-bottom: 18px;
  }
  .brand small,
  .workspace,
  .nav-label,
  .sidebar-bottom,
  .sidebar-footer {
    display: none;
  }
  .sidebar nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 0;
  }
  .sidebar nav a {
    font-size: 11px;
    padding: 8px 10px;
  }
  .sidebar nav a > span {
    font-size: 15px;
    width: 15px;
  }
  .sidebar nav + nav {
    margin-top: 6px;
  }
  .sidebar nav b {
    display: none;
  }
  .layout {
    margin-left: 0;
  }
  .topbar {
    height: 56px;
    padding: 0 20px;
  }
  .top-right {
    gap: 12px;
  }
  main {
    padding: 24px 16px;
  }
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }
  h1 {
    font-size: 24px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 18px;
  }
  .stat-number {
    font-size: 26px;
  }
  .stat-title {
    margin-bottom: 12px;
  }
  .helper-cards,
  .transfer-grid {
    grid-template-columns: 1fr;
  }
  .helper-cards {
    gap: 10px;
  }
  .helper-card {
    padding: 15px;
  }
  .page-footer {
    padding: 15px 16px;
    gap: 10px;
    font-size: 8px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .tag-grid {
    grid-template-columns: 1fr;
  }
  .dialog-head,
  .dialog-body {
    padding: 20px;
  }
  .dialog-tabs {
    gap: 18px;
    padding: 0 20px;
  }
  .dialog-footer {
    padding: 15px 20px;
  }
  .step-row {
    grid-template-columns: 20px 90px 1fr 30px;
  }
  .step-row input {
    grid-column: auto;
  }
  .step-row input:nth-of-type(2) {
    grid-column: 2 / 4;
  }
  .step-row button:last-child {
    grid-column: 4;
  }
  .form-panel {
    padding: 20px;
  }
  .settings-save-bar {
    margin: 22px -20px -20px;
    padding: 14px 20px;
    flex-wrap: wrap;
  }
  .bulk {
    flex-wrap: wrap;
  }
  .bulk span {
    width: 100%;
  }
  .tools select {
    max-width: 150px;
  }
  .tools input {
    width: 140px;
  }
  .topbar .breadcrumb,
  .slash {
    display: none;
  }
  .timeline-row {
    flex-wrap: wrap;
  }
  .timeline-row time {
    display: block;
  }
  .filter-tabs {
    gap: 17px;
  }
  .history-toolbar .field {
    min-width: 140px;
  }
  .empty {
    padding: 45px 16px;
  }
  .empty p {
    font-size: 11px;
  }
  .billing-header {
    padding: 20px;
    align-items: flex-start;
  }
  .billing-header > div {
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
  }
  .billing-main {
    padding: 0 20px;
    margin: 15px auto;
  }
  .billing-plans {
    grid-template-columns: 1fr;
  }
  .billing-current {
    align-items: flex-start;
    flex-direction: column;
  }
  .billing-page .page-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .billing-details {
    flex-direction: column;
    gap: 12px;
  }
  .billing-page .button-group {
    flex-wrap: wrap;
  }
  #change-dialog {
    padding: 22px;
  }
  #change-dialog .billing-details {
    flex-direction: row;
  }
  #change-dialog .button-group {
    justify-content: stretch;
  }
  #change-dialog .button-group button {
    flex: 1;
  }
}

@media (max-width: 700px) {
  #editor {
    height: 98vh;
    max-height: 98vh;
    width: 98vw;
    max-width: 98vw;
  }
  #editor .dialog-body {
    padding: 20px;
  }
  #editor .dialog-tabs {
    padding: 0 12px;
  }
  .interval-fields {
    gap: 8px;
  }
  .condition-row {
    grid-template-columns: 1fr 1fr;
  }
  .condition-row .field:nth-child(3) {
    grid-column: 1 / 2;
  }
  .schedule-row {
    gap: 10px;
    padding: 8px;
    grid-template-columns: 1fr 1fr 1.3fr;
  }
  .editor-secondary {
    flex-wrap: wrap;
  }
  #editor .dialog-footer {
    flex-wrap: wrap;
    padding: 12px;
  }
  .editor-secondary button {
    font-size: 11px;
    padding: 8px;
  }
  #editor .field {
    font-size: 13px;
  }
  .price-history {
    padding: 18px;
  }
  .price-chart-summary {
    gap: 10px;
  }
  .price-legend {
    justify-content: flex-start;
    gap: 12px;
  }
  .error-meta-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 600px) {
  .login-card {
    padding: 26px;
  }
  .account-identity {
    display: none;
  }
}
