:root {
  --desktop-bg: linear-gradient(150deg, #12588c 0%, #2480bd 34%, #55b4df 68%, #9be0d6 100%);
  --glass-top: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.62) 0%,
    rgba(218, 240, 255, 0.42) 48%,
    rgba(162, 212, 246, 0.46) 50%,
    rgba(196, 232, 253, 0.56) 100%
  );
  --glass-border-outer: rgba(24, 78, 126, 0.62);
  --glass-border-inner: rgba(255, 255, 255, 0.78);
  --window-shadow: 0 12px 34px rgba(8, 42, 74, 0.36), 0 2px 6px rgba(8, 42, 74, 0.2);

  --panel: #f4f8fc;
  --surface: #ffffff;
  --border: #b8cde2;
  --border-strong: #8aa7c4;

  --text: #13283d;
  --text-secondary: #395570;
  --text-muted: #5d7892;

  --focus-glow: rgba(60, 164, 236, 0.48);

  --radius-sm: 3px;
  --font: "Segoe UI", Frutiger, "Frutiger Linotype", Calibri, -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: Consolas, "Cascadia Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background-color: #1a6da8;
  background-image:
    url("/static/wallpaper.jpg"),
    var(--desktop-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: #164873;
  background: rgba(206, 229, 248, 0.55);
  border: 1px solid rgba(140, 180, 214, 0.55);
  border-radius: var(--radius-sm);
  padding: 0 4px;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 18px;
  background: var(--glass-top);
  backdrop-filter: blur(14px) saturate(145%);
  -webkit-backdrop-filter: blur(14px) saturate(145%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 0 var(--glass-border-inner);
}

.brand-crumb {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin-right: 6px;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.brand {
  font-size: 14.5px;
  font-weight: 600;
  color: #0b2540;
}

.brand-sep {
  color: #2f567a;
}

.channel-name {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: #0f3659;
}

.channel-name.is-empty {
  font-family: var(--font);
  font-weight: 500;
  color: #2b4d6d;
}

.irc-state {
  font-size: 11.5px;
  font-weight: 600;
  color: #274c6e;
  margin-left: 2px;
}

.irc-state.is-warn {
  color: #7c4706;
}

.irc-state.is-err {
  color: #9e1c1c;
}

.obs-box {
  flex: 1 1 280px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 240px;
  max-width: 540px;
}

.obs-label {
  font-size: 12px;
  font-weight: 600;
  color: #0f2f4d;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.obs-box input {
  flex: 1;
  font-family: var(--mono);
  font-size: 12px;
  color: #183b5c;
  background: rgba(255, 255, 255, 0.88);
  padding: 5px 8px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.save-status {
  font-size: 12px;
  font-weight: 600;
  color: #163b5e;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.95);
}

.save-status.ok {
  color: #0e6f2d;
}

.save-status.err {
  color: #9e1c1c;
}

.workbench {
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 16px 16px;
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 416px;
  gap: 14px;
  align-items: stretch;
}

@media (max-width: 1020px) {
  .workbench {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 10px;
  }
}

.stage-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: start;
  position: sticky;
  top: 62px;
}

@media (max-width: 1020px) {
  .stage-pane {
    position: static;
  }
}

.monitor {
  border-radius: 7px;
  background: var(--glass-top);
  backdrop-filter: blur(14px) saturate(145%);
  -webkit-backdrop-filter: blur(14px) saturate(145%);
  border: 1px solid var(--glass-border-outer);
  box-shadow:
    inset 0 1px 0 var(--glass-border-inner),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    var(--window-shadow);
  padding: 7px;
}

.monitor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 4px 8px 6px;
}

.monitor-title-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.monitor-title {
  font-size: 13px;
  font-weight: 600;
  color: #0b2540;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

.poll-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  white-space: nowrap;
  border: 1px solid #7d9ab6;
  background: linear-gradient(180deg, #f8fbfe 0%, #e4eff9 49%, #d1e2f2 50%, #e4eff9 100%);
  color: #2b4a68;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.poll-pill.is-open {
  border-color: #1a66a3;
  background: linear-gradient(180deg, #74c4f7 0%, #3ba0e4 49%, #1a7ec9 50%, #2a97e4 100%);
  color: #ffffff;
  text-shadow: 0 -1px 0 rgba(10, 48, 86, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    0 1px 2px rgba(10, 44, 78, 0.2);
}

.poll-pill.is-rolling {
  border-color: #a86414;
  background: linear-gradient(180deg, #ffe89c 0%, #f7be4a 49%, #df951b 50%, #f3b53b 100%);
  color: #422100;
  text-shadow: 0 1px 0 rgba(255, 246, 214, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 1px 2px rgba(108, 66, 8, 0.2);
}

.poll-pill.is-closed {
  border-color: #167234;
  background: linear-gradient(180deg, #6de28e 0%, #31ba5a 49%, #1a9740 50%, #33c15d 100%);
  color: #ffffff;
  text-shadow: 0 -1px 0 rgba(10, 62, 28, 0.48);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    0 1px 2px rgba(12, 66, 30, 0.22);
}

.monitor-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.window-body {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.segmented {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(36, 94, 145, 0.42);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

.seg-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: #163a5c;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 2px;
  cursor: pointer;
}

.seg-btn:hover {
  color: #0b2540;
  background: rgba(255, 255, 255, 0.62);
}

.seg-btn.is-active {
  background: linear-gradient(180deg, #ffffff 0%, #e8f3fc 49%, #d4e9fa 50%, #e7f3fc 100%);
  border-color: #6b9bc7;
  color: #0e3254;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.monitor-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 210px);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.22);
}

.monitor-viewport[data-backdrop="dark"] {
  background: #0d131a;
}

.monitor-viewport[data-backdrop="alpha"] {
  background-color: #d8e2ec;
  background-image:
    linear-gradient(45deg, #c2d1e0 25%, transparent 25%),
    linear-gradient(-45deg, #c2d1e0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #c2d1e0 75%),
    linear-gradient(-45deg, transparent 75%, #c2d1e0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.monitor-viewport[data-backdrop="light"] {
  background: #eef4fa;
}

#preview-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  background: linear-gradient(180deg, #f3f8fd 0%, #e3eef9 100%);
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.action-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 2px;
}

.inspector-pane {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 78px);
  position: sticky;
  top: 62px;
  border-radius: 7px;
  background: var(--glass-top);
  backdrop-filter: blur(14px) saturate(145%);
  -webkit-backdrop-filter: blur(14px) saturate(145%);
  border: 1px solid var(--glass-border-outer);
  box-shadow:
    inset 0 1px 0 var(--glass-border-inner),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    var(--window-shadow);
  padding: 7px;
}

@media (max-width: 1020px) {
  .inspector-pane {
    position: static;
    height: auto;
  }
}

.tab-bar {
  display: flex;
  align-items: flex-end;
  padding: 1px 0 0;
  gap: 4px;
  flex-shrink: 0;
}

.tab-btn {
  appearance: none;
  border: 1px solid rgba(36, 94, 145, 0.35);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.52) 0%, rgba(212, 234, 252, 0.45) 100%);
  color: #143757;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 14px 7px;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.tab-btn:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85) 0%, rgba(224, 242, 255, 0.78) 100%);
  border-color: rgba(45, 118, 178, 0.65);
  color: #0b2540;
}

.tab-btn.is-active {
  background: var(--surface);
  border-color: var(--border-strong);
  color: #0e355b;
  font-weight: 600;
  z-index: 3;
  text-shadow: none;
  box-shadow: inset 0 2px 0 #4db2f0;
}

.inspector-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 0 4px 4px 4px;
  position: relative;
  z-index: 2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.section {
  padding: 14px 16px;
  border-bottom: 1px solid #dce8f4;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.section:last-child {
  border-bottom: 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #164875;
}

.field,
.slider-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text);
}

.field-value {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #164875;
  font-weight: 600;
}

.field-hint {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.inline-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inline-row input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  background: #ffffff;
  color: var(--text);
  border: 1px solid #96b0ca;
  border-top-color: #7c99b8;
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.45;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(24, 66, 108, 0.09);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input[type="text"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
select:hover {
  border-color: #5b93c9;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: #3c8ed6;
  box-shadow:
    inset 0 1px 2px rgba(24, 66, 108, 0.08),
    0 0 0 2px var(--focus-glow);
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.option-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.option-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #ffffff 0%, #e8f3fc 48%, #cfe4f7 50%, #e5f2fc 100%);
  border: 1px solid #7395b8;
  color: #103559;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 1px 2px rgba(15, 52, 88, 0.12);
}

.option-row input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
}

.option-remove-btn {
  width: 28px;
  padding: 0;
  flex-shrink: 0;
  font-weight: 600;
}

.options-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 2px;
}

.duration-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
  gap: 5px;
}

.pill-btn {
  appearance: none;
  border: 1px solid #8ea9c4;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #f8fbfe 0%, #e8f1fa 49%, #d8e7f6 50%, #e9f3fc 100%);
  color: #163a5c;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 4px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.pill-btn:hover:not(:disabled) {
  border-color: #3c7fb1;
  background: linear-gradient(180deg, #eaf6fd 0%, #d9f0fc 49%, #bee6fd 50%, #a7d9f5 100%);
}

.pill-btn:active:not(:disabled) {
  border-color: #2c628b;
  background: linear-gradient(180deg, #d7edf9 0%, #c0e4f8 49%, #98d1f2 50%, #b4e0f7 100%);
  box-shadow: inset 0 1px 2px rgba(20, 62, 98, 0.28);
}

.pill-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pill-btn.is-active {
  border-color: #1a5c94;
  background: linear-gradient(180deg, #74c4f7 0%, #3ba0e4 49%, #1a7ec9 50%, #2a97e4 100%);
  color: #ffffff;
  font-weight: 600;
  text-shadow: 0 -1px 0 rgba(10, 52, 92, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.pill-btn.is-active:hover:not(:disabled) {
  border-color: #125086;
  background: linear-gradient(180deg, #8bd1fa 0%, #4cb0ef 49%, #238cd8 50%, #3ca7ef 100%);
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 0 5px rgba(60, 175, 248, 0.5);
}

.pill-btn.is-active:active:not(:disabled) {
  border-color: #0e4270;
  background: linear-gradient(180deg, #2b89cd 0%, #1d75b9 49%, #1463a2 50%, #217ec4 100%);
  color: #ffffff;
  box-shadow: inset 0 1px 3px rgba(6, 34, 62, 0.4);
}

.poll-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

.poll-actions .btn-primary {
  flex: 1 1 auto;
}

.preset-save-box {
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.presets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preset-card {
  border: 1px solid #bfd2e6;
  border-radius: 4px;
  background: linear-gradient(180deg, #ffffff 0%, #f3f8fd 100%);
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.preset-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.preset-name {
  font-size: 13px;
  font-weight: 600;
  color: #10375c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.preset-preview {
  font-size: 11.5px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.preset-actions .btn-danger {
  margin-left: auto;
}

.presets-empty {
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 8px 2px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: linear-gradient(180deg, #c6d7e8 0%, #e7f0f8 100%);
  border: 1px solid #9db4ca;
  border-radius: 2px;
  box-shadow: inset 0 1px 1px rgba(15, 50, 88, 0.18);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #ffffff 0%, #e6f2fc 48%, #cde4f7 50%, #e4f2fc 100%);
  border: 1px solid #6b91b6;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 1px 2px rgba(12, 46, 82, 0.25);
  margin-top: -7px;
  transition: border-color 0.1s ease, background 0.1s ease;
}

input[type="range"]:hover::-webkit-slider-thumb {
  border-color: #2f7ec2;
  background: linear-gradient(180deg, #f3fbff 0%, #d4effd 48%, #a9dcfb 50%, #cfecfd 100%);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  background: linear-gradient(180deg, #c6d7e8 0%, #e7f0f8 100%);
  border: 1px solid #9db4ca;
  border-radius: 2px;
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #ffffff 0%, #e6f2fc 48%, #cde4f7 50%, #e4f2fc 100%);
  border: 1px solid #6b91b6;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.switch-label {
  font-size: 12.5px;
  color: var(--text);
}

.switch {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 9px;
  background: linear-gradient(180deg, #c8d6e4 0%, #e4edf6 100%);
  border: 1px solid #8ea7c0;
  box-shadow: inset 0 1px 2px rgba(16, 48, 82, 0.22);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff 0%, #e4eef7 100%);
  border: 1px solid #7f9bb8;
  box-shadow: 0 1px 2px rgba(12, 44, 78, 0.28);
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.switch:checked {
  background: linear-gradient(180deg, #43c86f 0%, #24a84f 49%, #1c9642 50%, #37be63 100%);
  border-color: #1a7a38;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 0 3px rgba(45, 190, 95, 0.35);
}

.switch:checked::after {
  transform: translateX(16px);
  border-color: #1a7a38;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #7f9db9;
  background: linear-gradient(180deg, #f8fbfe 0%, #e8f1fa 49%, #d5e4f3 50%, #e7f2fc 100%);
  color: #132c45;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:hover:not(:disabled) {
  border-color: #3c7fb1;
  background: linear-gradient(180deg, #eaf6fd 0%, #d9f0fc 49%, #bee6fd 50%, #a7d9f5 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 4px rgba(60, 165, 235, 0.45);
}

.btn:active:not(:disabled) {
  border-color: #2c628b;
  background: linear-gradient(180deg, #d7edf9 0%, #c0e4f8 49%, #98d1f2 50%, #b4e0f7 100%);
  box-shadow: inset 0 1px 2px rgba(20, 62, 98, 0.28);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  border-color: #1a5c94;
  background: linear-gradient(180deg, #74c4f7 0%, #3ba0e4 49%, #1a7ec9 50%, #2a97e4 100%);
  color: #ffffff;
  font-weight: 600;
  text-shadow: 0 -1px 0 rgba(10, 52, 92, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 1px 2px rgba(15, 65, 112, 0.25);
}

.btn-primary:hover:not(:disabled) {
  border-color: #125086;
  background: linear-gradient(180deg, #8bd1fa 0%, #4cb0ef 49%, #238cd8 50%, #3ca7ef 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 0 6px rgba(60, 175, 248, 0.55);
}

.btn-primary:active:not(:disabled) {
  border-color: #0e4270;
  background: linear-gradient(180deg, #2b89cd 0%, #1d75b9 49%, #1463a2 50%, #217ec4 100%);
  box-shadow: inset 0 1px 3px rgba(6, 34, 62, 0.4);
}

.btn-danger {
  border-color: #b86666;
  background: linear-gradient(180deg, #fef5f5 0%, #f8dada 49%, #f1c0c0 50%, #f7dada 100%);
  color: #7d1e1e;
}

.btn-danger:hover:not(:disabled) {
  border-color: #9e3d3d;
  background: linear-gradient(180deg, #fff0f0 0%, #f9c8c8 49%, #efa6a6 50%, #f7c7c7 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 4px rgba(215, 80, 80, 0.35);
}

.btn-danger:active:not(:disabled) {
  border-color: #822b2b;
  background: linear-gradient(180deg, #f3c6c6 0%, #eba8a8 49%, #e08e8e 50%, #ebb0b0 100%);
  box-shadow: inset 0 1px 2px rgba(96, 20, 20, 0.3);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.45);
  color: #0f2d4a;
  box-shadow: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.btn-ghost:hover:not(:disabled) {
  border-color: rgba(60, 127, 177, 0.72);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(218, 240, 255, 0.72) 49%, rgba(186, 226, 252, 0.74) 50%, rgba(212, 238, 254, 0.8) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.btn-ghost:active:not(:disabled) {
  border-color: rgba(44, 98, 139, 0.78);
  background: linear-gradient(180deg, rgba(212, 234, 250, 0.78) 0%, rgba(186, 222, 246, 0.76) 49%, rgba(154, 205, 240, 0.78) 50%, rgba(184, 220, 246, 0.82) 100%);
  box-shadow: inset 0 1px 2px rgba(16, 52, 86, 0.28);
}

.btn:focus-visible,
.pill-btn:focus-visible,
.seg-btn:focus-visible,
.tab-btn:focus-visible,
.switch:focus-visible,
input[type="range"]:focus-visible {
  outline: 2px solid var(--focus-glow);
  outline-offset: 1px;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(9, 34, 60, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.login-shell {
  width: 100%;
  max-width: 380px;
  border-radius: 7px;
  background: var(--glass-top);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--glass-border-outer);
  box-shadow:
    inset 0 1px 0 var(--glass-border-inner),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    var(--window-shadow);
  padding: 7px;
}

.login-titlebar {
  padding: 4px 8px 9px;
  font-size: 13px;
  font-weight: 600;
  color: #0b2540;
  text-shadow: 0 0 9px rgba(255, 255, 255, 0.95), 0 1px 1px rgba(255, 255, 255, 0.9);
}

.login-body {
  background: linear-gradient(180deg, #ffffff 0%, #f3f8fd 100%);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.login-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #103a63;
}

.login-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.login-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

.error-banner {
  display: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fff5f5 0%, #fce3e3 100%);
  border: 1px solid #d17c7c;
  color: #821d1d;
  font-size: 12.5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.error-banner.visible {
  display: block;
}
