:root {
  --bg: #070b14;
  --bg-elevated: #0c1424;
  --panel: rgba(17, 26, 44, 0.66);
  --panel-solid: #101a2c;
  --panel-soft: rgba(23, 35, 58, 0.56);
  --line: rgba(168, 194, 255, 0.11);
  --line-strong: rgba(168, 194, 255, 0.26);
  --text: #eef2fb;
  --muted: #9aa6c2;
  --dim: #677593;
  --amber: #ffce6a;
  --blue: #8fb0ff;
  --green: #84dc8a;
  --red: #ff7f92;
  --purple: #c9a7ff;
  --teal: #6ad4d4;
  --coral: #ff9f7f;
  --olive: #b8c48a;
  --slate: #9aa7c7;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 12px 34px rgba(0, 0, 0, 0.22);
  --radius: 20px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
  --spring-soft: cubic-bezier(0.25, 0.9, 0.3, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --mono: "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI Variable",
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color-scheme: dark;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: contain;
}

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

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

::selection {
  color: #fff8e6;
  background: rgba(255, 206, 106, 0.3);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(143, 176, 255, 0.24) transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(143, 176, 255, 0.24);
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(143, 176, 255, 0.4);
  background-clip: padding-box;
}

code,
pre {
  font-family: var(--mono);
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 48% at 8% -6%, rgba(143, 176, 255, 0.18), transparent 62%),
    radial-gradient(ellipse 56% 42% at 96% 4%, rgba(255, 206, 106, 0.1), transparent 64%),
    radial-gradient(ellipse 60% 50% at 50% 108%, rgba(106, 212, 212, 0.07), transparent 60%),
    linear-gradient(180deg, #070b14 0%, #070b14 45%, #060911 100%);
}

.backdrop::before {
  content: "";
  position: absolute;
  top: -26vw;
  left: -14vw;
  width: 68vw;
  height: 68vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(143, 176, 255, 0.16), transparent 64%);
  filter: blur(30px);
  animation: aurora-drift 26s ease-in-out infinite alternate;
  pointer-events: none;
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(143, 176, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 176, 255, 0.045) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(180deg, black, transparent 72%);
  pointer-events: none;
}

@keyframes aurora-drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(10vw, 6vw, 0) scale(1.08);
  }
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: calc(14px + env(safe-area-inset-top)) 30px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(7, 11, 20, 0.72);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  transition: background 320ms var(--ease-out), box-shadow 320ms var(--ease-out),
    border-color 320ms var(--ease-out);
}

.topbar.is-scrolled {
  border-bottom-color: rgba(255, 255, 255, 0.08);
  background: rgba(6, 10, 18, 0.86);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(13, 21, 38, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.22),
    0 0 26px rgba(143, 176, 255, 0.08);
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.brand-copy p {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.service-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.opencode-status.off {
  color: var(--dim);
}

.opencode-status.off .status-dot {
  background: var(--dim);
  box-shadow: none;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(132, 220, 138, 0.12), 0 0 16px rgba(132, 220, 138, 0.55);
  animation: status-pulse 3.2s ease-in-out infinite;
}

@keyframes status-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(132, 220, 138, 0.1), 0 0 14px rgba(132, 220, 138, 0.42);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(132, 220, 138, 0.14), 0 0 22px rgba(132, 220, 138, 0.62);
  }
}

.opencode-status.off .status-dot {
  animation: none;
}

.path-chip {
  max-width: 370px;
  overflow: hidden;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.035);
  font-family: var(--mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 240ms var(--ease-out), background 240ms var(--ease-out);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  transition:
    transform 340ms var(--spring),
    border-color 240ms var(--ease-out),
    background 240ms var(--ease-out),
    color 240ms var(--ease-out),
    box-shadow 240ms var(--ease-out),
    filter 240ms var(--ease-out);
  white-space: nowrap;
}

@media (hover: hover) {
  .btn:hover {
    filter: brightness(1.06);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
  }
}

.btn:active {
  transform: scale(0.96);
  filter: brightness(0.98);
  box-shadow: none;
  transition-duration: 90ms;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: none;
  box-shadow: none;
}

.btn:disabled:hover {
  box-shadow: none;
}

.btn.primary {
  color: #1b1405;
  background: linear-gradient(180deg, #ffd982, #ffc94f);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 10px 26px rgba(255, 206, 106, 0.18);
}

.btn.primary:hover {
  background: linear-gradient(180deg, #ffe19a, #ffd160);
}

.btn.ghost {
  border-color: rgba(255, 255, 255, 0.11);
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.btn.ghost:hover {
  border-color: rgba(143, 176, 255, 0.34);
  background: rgba(255, 255, 255, 0.075);
}

.btn.danger {
  border-color: rgba(255, 127, 146, 0.32);
  color: var(--red);
  background: rgba(255, 127, 146, 0.08);
}

.btn.danger-solid {
  border-color: rgba(255, 127, 146, 0.5);
  color: #22070c;
  background: linear-gradient(180deg, #ff93a3, #ff7187);
  box-shadow: 0 10px 26px rgba(255, 127, 146, 0.18);
}

.btn.danger-solid:hover {
  background: linear-gradient(180deg, #ffa5b2, #ff8296);
}

.btn[hidden] {
  display: none;
}

.btn.small {
  min-height: 30px;
  padding: 6px 11px;
  border-radius: 10px;
  font-size: 12px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: color 220ms var(--ease-out), background 220ms var(--ease-out),
    transform 300ms var(--spring);
}

@media (hover: hover) {
  .icon-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
  }
}

.icon-btn:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.1);
  transition-duration: 90ms;
}

:where(button, summary, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(255, 206, 106, 0.48);
  outline-offset: 2px;
}

/* ---------- tabs ---------- */

.tabs {
  position: relative;
  display: flex;
  gap: 2px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 14px 16px 12px;
  border: 0;
  border-radius: 12px 12px 0 0;
  color: var(--dim);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 240ms var(--ease-out), background 240ms var(--ease-out);
}

@media (hover: hover) {
  .tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.035);
  }
}

.tab:active {
  color: var(--amber);
  background: rgba(255, 255, 255, 0.05);
}

.tab.active {
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0));
}

.tabs-line {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--amber));
  box-shadow: 0 0 16px rgba(255, 206, 106, 0.42);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 480ms var(--spring),
    width 480ms var(--spring),
    opacity 220ms var(--ease-out);
}

.tabs-line.is-ready {
  opacity: 1;
}

.tab-index {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  transition: color 240ms var(--ease-out);
}

.tab.active .tab-index {
  color: var(--amber);
}

/* ---------- layout ---------- */

.view {
  max-width: 1440px;
  min-height: calc(100vh - 200px);
  min-height: calc(100dvh - 200px);
  margin: 0 auto;
  padding: 30px 30px 60px;
  padding-bottom: calc(60px + env(safe-area-inset-bottom));
}

.view.is-entering {
  animation: view-enter 420ms var(--spring) both;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translate3d(0, 10px, 0) scale(0.996);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 30px 28px;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
  color: var(--dim);
  font-size: 11px;
}

.page-footer code {
  color: var(--muted);
}

.loading-panel,
.error-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  gap: 16px;
  color: var(--muted);
}

.loading-ring {
  width: 26px;
  height: 26px;
  border: 2px solid rgba(143, 176, 255, 0.16);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.error-panel {
  gap: 10px;
  text-align: center;
}

.error-panel h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.error-panel p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-word;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.02em;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 42%),
    var(--panel);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  backdrop-filter: blur(22px) saturate(140%);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 19px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 {
  margin: 0;
  font-size: 14px;
}

.panel-head span {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

/* ---------- overview ---------- */

.overview {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 8px 2px 0;
}

.hero-copy h2 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(26px, 3.2vw, 42px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.12;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 660px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.quick-hero {
  align-items: flex-start;
}

.quick-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 760px;
  margin-top: 18px;
}

.quick-form input {
  flex: 1 1 320px;
  min-width: 0;
  height: 52px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  outline: none;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 15px;
  transition:
    border-color 280ms var(--ease-out),
    background 280ms var(--ease-out),
    box-shadow 280ms var(--ease-out);
}

.quick-form input::placeholder {
  color: var(--dim);
}

.quick-form input:focus {
  border-color: rgba(255, 206, 106, 0.7);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 0 0 4px rgba(255, 206, 106, 0.12);
}

.quick-form .btn {
  height: 52px;
  padding: 0 24px;
  border-radius: 16px;
}

.quick-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.quick-note {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--dim);
  font-size: 11px;
}

.quick-examples {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
  color: var(--dim);
  font-size: 11px;
}

.quick-examples button {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition:
    border-color 240ms var(--ease-out),
    color 240ms var(--ease-out),
    background 240ms var(--ease-out),
    transform 300ms var(--spring);
}

@media (hover: hover) {
  .quick-examples button:hover {
    border-color: var(--line-strong);
    color: var(--text);
  }
}

.quick-examples button:active {
  transform: scale(0.95);
  background: rgba(255, 206, 106, 0.08);
}

.quick-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 760px;
  margin-top: 14px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid var(--accent, var(--green));
  border-radius: 16px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 46%),
    rgba(17, 26, 44, 0.72);
  box-shadow: var(--shadow-soft);
  animation: soft-rise 420ms var(--spring) both;
  transition: border-color 280ms var(--ease-out), background 280ms var(--ease-out);
}

@keyframes soft-rise {
  from {
    opacity: 0;
    transform: translate3d(0, 8px, 0) scale(0.994);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.quick-result-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.quick-result.is-direct {
  border-color: rgba(132, 220, 138, 0.34);
  background: linear-gradient(90deg, rgba(132, 220, 138, 0.08), rgba(16, 25, 43, 0.78));
}

.quick-result-copy strong {
  color: var(--accent, var(--green));
  font-size: 12px;
}

.quick-result-copy span {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-result-copy small {
  color: var(--muted);
  font-size: 11px;
}

.quick-result-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  flex: 0 0 auto;
}

.quick-reassign {
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 13, 24, 0.6);
  color: var(--muted);
  font-size: 11px;
}

.quick-options {
  max-width: 760px;
  margin-top: 10px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(17, 26, 44, 0.66);
  box-shadow: var(--shadow-soft);
  animation: soft-rise 380ms var(--spring) both;
}

.quick-options.waiting {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.quick-options.sent {
  border-color: rgba(132, 220, 138, 0.3);
  color: var(--green);
  font-size: 12px;
}

.quick-options.error {
  border-color: rgba(255, 127, 146, 0.35);
  color: var(--red);
  font-size: 12px;
}

.quick-options-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.quick-options-head strong {
  font-size: 13px;
}

.quick-options-head span {
  color: var(--dim);
  font-size: 11px;
}

.quick-option-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.quick-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  background: rgba(8, 13, 24, 0.38);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 240ms var(--ease-out),
    background 240ms var(--ease-out),
    transform 300ms var(--spring);
}

@media (hover: hover) {
  .quick-option:hover {
    border-color: rgba(255, 206, 106, 0.45);
    background: rgba(255, 206, 106, 0.06);
  }
}

.quick-option:active {
  transform: scale(0.985);
  background: rgba(255, 206, 106, 0.1);
}

.quick-option b {
  flex: 0 0 20px;
  color: var(--amber);
  font-family: var(--mono);
}

.quick-option span {
  font-size: 12px;
  line-height: 1.45;
}

.quick-options-details {
  margin-top: 9px;
  color: var(--dim);
  font-size: 11px;
}

.quick-options-details summary {
  cursor: pointer;
}

.quick-options-raw {
  max-height: 180px;
  overflow: auto;
  margin: 7px 0 0;
  padding: 10px;
  border-radius: 10px;
  background: rgba(8, 13, 24, 0.7);
  color: var(--muted);
  font-size: 11px;
  white-space: pre-wrap;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.quick-custom {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 10px;
}

.quick-custom textarea {
  flex: 1;
  min-width: 0;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: rgba(8, 13, 24, 0.52);
  color: var(--text);
  font-size: 12px;
  resize: vertical;
  transition:
    border-color 240ms var(--ease-out),
    background 240ms var(--ease-out),
    box-shadow 240ms var(--ease-out);
}

.quick-custom textarea:focus {
  border-color: rgba(255, 206, 106, 0.7);
  background: rgba(8, 13, 24, 0.68);
  box-shadow: 0 0 0 3px rgba(255, 206, 106, 0.1);
}

.quick-custom .btn {
  flex: 0 0 auto;
}

.loading-ring.small {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

.task-flash {
  animation: task-flash 1.8s ease;
}

@keyframes task-flash {
  0%,
  100% {
    border-color: var(--line);
    box-shadow: none;
  }
  18% {
    border-color: var(--amber);
    box-shadow: 0 0 0 3px rgba(255, 206, 106, 0.16);
  }
}

.hero-completion {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(13, 21, 38, 0.62);
}

.completion-ring {
  --value: 0%;
  position: relative;
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: conic-gradient(var(--amber) var(--value), rgba(143, 176, 255, 0.12) 0);
}

.completion-ring::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #0b1220;
}

.completion-ring strong {
  position: relative;
  z-index: 1;
  font-family: var(--mono);
  font-size: 14px;
}

.hero-completion p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.hero-completion strong {
  color: var(--text);
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 16px 17px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 18px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 48%),
    linear-gradient(145deg, rgba(20, 31, 52, 0.84), rgba(11, 18, 32, 0.72));
  box-shadow: var(--shadow-soft);
  transition:
    transform 360ms var(--spring),
    border-color 260ms var(--ease-out),
    box-shadow 260ms var(--ease-out);
}

@media (hover: hover) {
  .stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.14);
  }
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 36px;
  height: 2px;
  background: var(--tone, var(--blue));
}

.stat-card strong {
  display: block;
  color: var(--tone, var(--text));
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.stat-card span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.stat-card small {
  display: block;
  margin-top: 8px;
  color: var(--dim);
  font-size: 10px;
}

.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 13px;
}

.dept-card {
  --accent: var(--blue);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 176px;
  padding: 17px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 46%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 45%),
    linear-gradient(150deg, rgba(20, 31, 52, 0.88), rgba(10, 17, 30, 0.82));
  box-shadow: var(--shadow-soft);
  transition:
    transform 380ms var(--spring),
    border-color 260ms var(--ease-out),
    box-shadow 260ms var(--ease-out);
}

@media (hover: hover) {
  .dept-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--accent) 38%, rgba(255, 255, 255, 0.1));
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
  }
}

.dept-card:active {
  transform: scale(0.994);
}

.dept-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  width: 42px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 55%, transparent);
}

.dept-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
}

.dept-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.dept-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 28px;
  padding: 0 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-radius: 7px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
}

.dept-top h3 {
  margin: 1px 0 0;
  font-size: 14px;
  line-height: 1.2;
}

.dept-top p {
  margin: 3px 0 0;
  color: var(--dim);
  font-size: 11px;
}

.dept-total {
  margin-left: auto;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
}

.dept-counts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(9, 15, 27, 0.52);
  font-size: 10px;
}

.count-pill b {
  color: var(--text);
  font-family: var(--mono);
  font-weight: 600;
}

.progress {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(143, 176, 255, 0.1);
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, white));
  transition: width 400ms ease;
}

.dept-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 2px;
}

.dept-actions .btn {
  flex: 0 0 auto;
}

.dept-actions .btn:first-child {
  margin-right: auto;
  border-color: transparent;
  color: var(--accent);
  background: transparent;
  padding-left: 0;
}

.dept-actions .btn:first-child:hover {
  color: var(--text);
  background: transparent;
  transform: none;
}

.recent-panel {
  overflow: hidden;
}

.recent-list {
  display: flex;
  flex-direction: column;
}

.recent-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(143, 176, 255, 0.08);
  cursor: pointer;
  transition: background 240ms var(--ease-out);
}

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

@media (hover: hover) {
  .recent-row:hover {
    background: rgba(143, 176, 255, 0.055);
  }
}

.recent-row:active {
  background: rgba(143, 176, 255, 0.08);
}

.recent-row .status-dot {
  width: 6px;
  height: 6px;
  box-shadow: none;
}

.recent-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-dept {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.recent-time {
  color: var(--dim);
  font-size: 10px;
  white-space: nowrap;
}

.empty-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 180px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.empty-block strong {
  color: var(--text);
  font-size: 14px;
}

.empty-block p {
  margin: 0;
  font-size: 12px;
}

/* ---------- tasks ---------- */

.task-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 16px;
  background: rgba(17, 26, 44, 0.6);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
}

.search-box {
  position: relative;
  flex: 1 1 260px;
  min-width: 200px;
}

.search-box span {
  position: absolute;
  top: 50%;
  left: 13px;
  color: var(--dim);
  font-size: 15px;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 40px;
  padding: 0 13px 0 35px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: rgba(8, 13, 24, 0.5);
  font-size: 12px;
  transition:
    border-color 240ms var(--ease-out),
    background 240ms var(--ease-out),
    box-shadow 240ms var(--ease-out);
}

.search-box input::placeholder {
  color: var(--dim);
}

.search-box input:focus {
  outline: none;
  border-color: rgba(255, 206, 106, 0.62);
  background: rgba(8, 13, 24, 0.68);
  box-shadow: 0 0 0 3px rgba(255, 206, 106, 0.1);
}

.select {
  height: 40px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background-color: rgba(8, 13, 24, 0.5);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23a9b6d4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 12px 8px;
  font-size: 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition:
    border-color 240ms var(--ease-out),
    background-color 240ms var(--ease-out),
    box-shadow 240ms var(--ease-out);
}

.select:focus {
  outline: none;
  border-color: rgba(255, 206, 106, 0.62);
  box-shadow: 0 0 0 3px rgba(255, 206, 106, 0.1);
}

.model-select {
  width: 280px;
  min-width: 160px;
  max-width: 46vw;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.kanban-col {
  display: flex;
  flex-direction: column;
  min-height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
  background: rgba(11, 18, 32, 0.5);
  transition:
    border-color 260ms var(--ease-out),
    background 260ms var(--ease-out),
    transform 320ms var(--spring);
}

.kanban-col.drag-over {
  border-color: color-mix(in srgb, var(--col-tone, var(--blue)) 55%, transparent);
  background: color-mix(in srgb, var(--col-tone, var(--blue)) 6%, rgba(11, 18, 32, 0.8));
  transform: translateY(-2px);
}

.kanban-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.kanban-head .status-dot {
  width: 7px;
  height: 7px;
  background: var(--col-tone, var(--blue));
  box-shadow: 0 0 12px color-mix(in srgb, var(--col-tone, var(--blue)) 60%, transparent);
}

.kanban-head h3 {
  margin: 0;
  font-size: 13px;
}

.kanban-head span {
  margin-left: auto;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
}

.kanban-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 9px;
  min-height: 130px;
  padding: 10px;
}

.task-card {
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 14px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 44%),
    linear-gradient(160deg, rgba(24, 37, 62, 0.9), rgba(15, 24, 42, 0.92));
  cursor: grab;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
  transition:
    border-color 240ms var(--ease-out),
    transform 340ms var(--spring),
    box-shadow 240ms var(--ease-out);
}

@media (hover: hover) {
  .task-card:hover {
    transform: translateY(-2px);
    border-color: rgba(143, 176, 255, 0.3);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.26);
  }
}

.task-card:active {
  transform: scale(0.992);
  cursor: grabbing;
}

.task-card.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.task-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
}

.task-dept {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.task-top .icon-btn {
  width: 22px;
  height: 22px;
  margin-left: auto;
  font-size: 12px;
}

.task-card h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
}

.task-note {
  display: -webkit-box;
  overflow: hidden;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  white-space: pre-wrap;
}

.task-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  row-gap: 7px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(143, 176, 255, 0.08);
}

.task-foot time {
  color: var(--dim);
  font-size: 9px;
  white-space: nowrap;
}

.task-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
  margin-left: auto;
}

.task-actions .icon-btn {
  width: 23px;
  height: 23px;
  font-size: 12px;
}

.task-actions .icon-btn:hover {
  background: rgba(143, 176, 255, 0.14);
}

.task-actions .delete:hover {
  color: var(--red);
  background: rgba(255, 127, 146, 0.12);
}

.empty-col {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  padding: 16px;
  border: 1px dashed rgba(143, 176, 255, 0.13);
  border-radius: 9px;
  color: var(--dim);
  font-size: 11px;
  text-align: center;
}

/* ---------- project ---------- */

.project-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.project-meta {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  padding: 17px 18px;
}

.project-meta .field {
  flex: 1 1 260px;
}

.project-meta .field.path-field {
  flex: 2 1 380px;
}

.project-meta .field input {
  font-family: var(--mono);
  font-size: 11px;
}

.project-meta .field input[readonly] {
  color: var(--muted);
  cursor: default;
}

.project-meta .btn {
  height: 44px;
}

.project-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 14px;
}

.editor-panel,
.preview-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-panel textarea {
  width: 100%;
  min-height: 540px;
  padding: 18px;
  border: 0;
  color: #dbe5fa;
  background: rgba(8, 13, 24, 0.5);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  resize: vertical;
  tab-size: 2;
  overscroll-behavior: contain;
}

.editor-panel textarea:focus {
  outline: none;
  background: rgba(8, 13, 24, 0.7);
}

.preview-panel pre {
  flex: 1;
  max-height: 640px;
  min-height: 540px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  color: #c9d4ea;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.project-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.project-actions .spacer {
  flex: 1;
}

/* ---------- prompts ---------- */

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(295px, 1fr));
  gap: 13px;
}

.prompt-card {
  --accent: var(--blue);
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 42%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 45%),
    linear-gradient(150deg, rgba(20, 31, 52, 0.88), rgba(10, 17, 30, 0.8));
  box-shadow: var(--shadow-soft);
  transition:
    transform 360ms var(--spring),
    border-color 260ms var(--ease-out),
    box-shadow 260ms var(--ease-out);
}

@media (hover: hover) {
  .prompt-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
  }
}

.prompt-card-head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.prompt-card-head .dept-code {
  height: 24px;
  min-width: 32px;
  font-size: 10px;
}

.prompt-card-head h3 {
  margin: 0;
  font-size: 14px;
}

.prompt-card-head span:last-child {
  margin-left: auto;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
}

.prompt-excerpt {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.prompt-card-actions {
  display: flex;
  gap: 7px;
  margin-top: auto;
  padding-top: 2px;
}

.prompt-card-actions .btn:first-child {
  margin-right: auto;
}

/* ---------- modal ---------- */

.modal {
  width: min(680px, 92vw);
  max-width: none;
  max-height: 88vh;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  opacity: 0;
  transform: translate3d(0, 16px, 0) scale(0.97);
  transition:
    opacity 240ms var(--ease-out),
    transform 420ms var(--spring),
    overlay 420ms allow-discrete,
    display 420ms allow-discrete;
}

.modal[open] {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

@starting-style {
  .modal[open] {
    opacity: 0;
    transform: translate3d(0, 16px, 0) scale(0.97);
  }
}

.modal::backdrop {
  background: rgba(3, 6, 12, 0);
  backdrop-filter: blur(0) saturate(100%);
  -webkit-backdrop-filter: blur(0) saturate(100%);
  transition:
    background 300ms var(--ease-out),
    backdrop-filter 300ms var(--ease-out),
    overlay 300ms allow-discrete,
    display 300ms allow-discrete;
}

.modal[open]::backdrop {
  background: rgba(3, 6, 12, 0.72);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
}

@starting-style {
  .modal[open]::backdrop {
    background: rgba(3, 6, 12, 0);
    backdrop-filter: blur(0) saturate(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal,
  .modal::backdrop {
    transition: none;
  }
}

.modal-card {
  max-height: 88vh;
  max-height: min(88dvh, 900px);
  overflow: auto;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 42%),
    linear-gradient(160deg, rgba(23, 35, 59, 0.97), rgba(10, 18, 33, 0.98));
  box-shadow:
    0 40px 120px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(30px) saturate(140%);
  -webkit-backdrop-filter: blur(30px) saturate(140%);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#prompt-dialog {
  width: min(900px, 94vw);
}

.prompt-modal-card {
  width: 100%;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.modal-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.close-btn {
  flex: 0 0 auto;
  font-size: 20px;
}

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

.field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.field > span em {
  color: var(--dim);
  font-style: normal;
  font-weight: 400;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: rgba(8, 13, 24, 0.55);
  font-size: 13px;
  transition:
    border-color 240ms var(--ease-out),
    background 240ms var(--ease-out),
    box-shadow 240ms var(--ease-out);
}

.field input,
.field select {
  height: 44px;
}

.field select {
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23a9b6d4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.field textarea {
  min-height: 110px;
  line-height: 1.65;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--dim);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(255, 206, 106, 0.62);
  outline: none;
  background: rgba(11, 18, 32, 0.82);
  box-shadow: 0 0 0 3px rgba(255, 206, 106, 0.1);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.modal-actions .hint {
  margin-right: auto;
  color: var(--dim);
  font-size: 10px;
}

.confirm-modal {
  width: min(520px, 92vw);
}

.confirm-card {
  position: relative;
}

.confirm-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(90deg, var(--blue), var(--amber));
  opacity: 0.9;
}

.confirm-modal.is-danger .confirm-card::before {
  background: linear-gradient(90deg, var(--red), var(--amber));
}

.confirm-message {
  margin: 0;
  color: #e4ebfa;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.confirm-detail {
  margin-top: 14px;
  padding: 11px 13px;
  border-left: 2px solid rgba(255, 206, 106, 0.7);
  border-radius: 0 9px 9px 0;
  color: var(--muted);
  background: rgba(255, 206, 106, 0.06);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.confirm-modal.is-danger .confirm-detail {
  border-left-color: rgba(255, 127, 146, 0.8);
  background: rgba(255, 127, 146, 0.07);
}

.confirm-modal.is-danger .eyebrow {
  color: var(--red);
}

.confirm-modal .modal-actions {
  margin-top: 18px;
}

.prompt-full {
  max-height: 52vh;
  margin: 0;
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #d5def2;
  background: rgba(8, 13, 24, 0.72);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ---------- toast ---------- */

.toast-root {
  position: fixed;
  right: 22px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 15px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-left: 3px solid var(--green);
  border-radius: 16px;
  color: var(--text);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0) 50%),
    rgba(17, 26, 43, 0.94);
  box-shadow:
    0 16px 44px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  font-size: 12px;
  line-height: 1.5;
  animation: toast-in 260ms var(--spring) both;
  transition:
    opacity 200ms var(--ease-out),
    transform 280ms var(--spring);
}

.toast.leaving {
  opacity: 0;
  transform: translate3d(0, 6px, 0) scale(0.98);
}

.toast.error {
  border-left-color: var(--red);
}

.toast.info {
  border-left-color: var(--blue);
}

.toast strong {
  display: block;
  margin-bottom: 1px;
  font-size: 11px;
  font-weight: 600;
}

.toast p {
  margin: 0;
  color: var(--muted);
  word-break: break-word;
}

/* ---------- scrollbars ---------- */

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(143, 176, 255, 0.22) transparent;
}

*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(143, 176, 255, 0.22);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(143, 176, 255, 0.36);
  background-clip: padding-box;
}

/* ---------- animation ---------- */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- responsive ---------- */

@media (max-width: 1120px) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .preview-panel pre {
    min-height: 260px;
    max-height: 480px;
  }
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: calc(14px + env(safe-area-inset-top)) 20px 14px;
  }

  .topbar-meta {
    justify-content: flex-start;
    width: 100%;
  }

  .path-chip {
    max-width: 100%;
    flex: 1 1 220px;
  }

  .tabs {
    padding: 0 16px;
    -webkit-overflow-scrolling: touch;
  }

  .view {
    padding: 22px 20px calc(50px + env(safe-area-inset-bottom));
  }

  .page-footer {
    padding: 0 20px calc(22px + env(safe-area-inset-bottom));
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .hero-completion {
    width: 100%;
  }

  .kanban {
    grid-auto-columns: minmax(250px, 1fr);
    grid-auto-flow: column;
    grid-template-columns: none;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .kanban-col {
    min-height: 300px;
    scroll-snap-align: start;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .brand-copy h1 {
    font-size: 17px;
  }

  .brand-copy p {
    max-width: 230px;
  }

  .service-status {
    display: none;
  }

  .topbar-meta .btn {
    flex: 1;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card:last-child {
    grid-column: span 2;
  }

  .dept-grid,
  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy h2 {
    font-size: 27px;
  }

  .quick-form input {
    flex-basis: 100%;
  }

  .quick-actions {
    width: 100%;
    flex-direction: column;
  }

  .quick-form .btn {
    width: 100%;
  }

  .quick-result {
    align-items: flex-start;
    flex-direction: column;
  }

  .quick-result-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .quick-custom {
    flex-direction: column;
  }

  .quick-custom .btn {
    width: 100%;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .modal,
  .confirm-modal,
  #prompt-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 92dvh;
    margin: auto 0 0;
  }

  .modal-card {
    max-height: 92dvh;
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    border-bottom: 0;
  }

  .project-meta {
    align-items: stretch;
  }

  .project-meta .field {
    flex-basis: 100%;
  }

  .editor-panel textarea,
  .preview-panel pre {
    min-height: 380px;
  }

  .page-footer {
    flex-direction: column;
    gap: 4px;
  }

  .toast-root {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 12px;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .backdrop::before,
  .status-dot {
    animation: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.toast-action {
  align-self: flex-start;
  margin-top: 10px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.toast-action:hover {
  background: rgba(255, 255, 255, 0.12);
}

#card-save-status.is-dirty {
  color: #ffce6a;
  border-color: rgba(255, 206, 106, 0.45);
}

#card-save-status.is-saving {
  color: #8fb0ff;
}

#card-save-status.is-saved {
  color: #84dc8a;
}
