:root {
  --bg: #fff7ed;
  --surface: rgba(255, 255, 255, 0.66);
  --surface-strong: rgba(255, 255, 255, 0.84);
  --text: #6b7280;
  --text-strong: #4b5563;
  --title-start: #a78bfa;
  --title-end: #f59abd;
  --primary: #a78bfa;
  --primary-soft: #ede9fe;
  --pink: #f59abd;
  --blue: #60a5fa;
  --cream: #fff7ed;
  --line: rgba(167, 139, 250, 0.12);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  font-family: "Pretendard Variable", "Pretendard", "Noto Sans KR", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #fffaf5 0%, var(--cream) 100%);
  color: var(--text);
}

button,
a,
input {
  font: inherit;
}

.sidebar-toggle {
  position: fixed;
  opacity: 0;
  pointer-events: none;
}

.window-shell {
  min-height: 100vh;
  padding: 32px;
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  gap: 0;
  transition: grid-template-columns 220ms ease;
}

.sidebar,
.stat-card,
.panel,
.plan-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar {
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-collapse-button {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(167, 139, 250, 0.12);
  color: #8b7fe7;
  cursor: pointer;
  user-select: none;
  margin-bottom: 4px;
}

.sidebar-brand {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: center;
}

.brand-mark,
.plan-badge {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(237, 233, 254, 0.9), rgba(255, 255, 255, 0.8));
  color: #8b7fe7;
  font-weight: 800;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-copy h1,
.panel-header h3,
.service-card h4 {
  margin: 0;
  color: var(--text-strong);
}

.brand-copy h1 {
  font-size: 1.1rem;
  line-height: 1.1;
}

.brand-copy p,
.plan-card p,
.signal-item p,
.stat-card span {
  margin: 6px 0 0;
  line-height: 1.55;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.nav-item {
  min-height: 68px;
  padding: 0 16px;
  border-radius: 18px;
  text-decoration: none;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 14px;
  background: transparent;
  position: relative;
}

.nav-item.is-active {
  background: rgba(237, 233, 254, 0.82);
  color: #7d6fe7;
}

.nav-icon-image {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex: 0 0 48px;
}

.nav-label {
  white-space: nowrap;
}

.plan-card {
  margin-top: auto;
  padding: 16px;
  border-radius: 22px;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
  background: rgba(255, 244, 247, 0.78);
}

.sidebar-toggle:checked + .window-shell {
  grid-template-columns: 112px minmax(0, 1fr);
}

.sidebar-toggle:checked + .window-shell .sidebar {
  padding-inline: 12px;
}

.sidebar-toggle:checked + .window-shell .sidebar-brand {
  grid-template-columns: 56px;
  justify-content: center;
}

.sidebar-toggle:checked + .window-shell .brand-mark,
.sidebar-toggle:checked + .window-shell .plan-badge {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  font-size: 0.92rem;
}

.sidebar-toggle:checked + .window-shell .brand-copy,
.sidebar-toggle:checked + .window-shell .nav-label,
.sidebar-toggle:checked + .window-shell .plan-card div:last-child {
  display: none;
}

.sidebar-toggle:checked + .window-shell .sidebar-collapse-button {
  transform: rotate(180deg);
}

.sidebar-toggle:checked + .window-shell .nav-item {
  justify-content: center;
  padding-inline: 0;
  min-height: 62px;
}

.sidebar-toggle:checked + .window-shell .nav-icon-image {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
}

.sidebar-toggle:checked + .window-shell .plan-card {
  grid-template-columns: 1fr;
  justify-items: center;
  padding-inline: 8px;
}

.sidebar-toggle:checked + .window-shell .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  min-height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(75, 85, 99, 0.92);
  color: #ffffff;
  font-size: 0.82rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.14);
}

.sidebar-toggle:checked + .window-shell .nav-item:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.workspace {
  border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
  background: rgba(255, 255, 255, 0.36);
  padding: 0 0 0 28px;
  display: grid;
  gap: 16px;
}

[hidden] {
  display: none !important;
}

.eyebrow,
.label,
.service-kind {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.hero-stage {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 247, 237, 0.88));
  border: 1px solid rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  border-radius: var(--radius-xl);
  display: grid;
  align-items: center;
}

.hero-stage-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-stage-overlay {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100% - 120px));
  margin: 0 auto;
  padding: 24px 0;
  text-align: center;
}

.hero-stage-overlay h3 {
  margin: 0;
  font-size: clamp(2.3rem, 5vw, 4.6rem);
  line-height: 1;
  letter-spacing: -0.06em;
  background: linear-gradient(90deg, var(--title-start), var(--title-end));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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

.hero-stage-subtitle {
  margin: 16px 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #e486af;
}

.hero-stage-copy {
  margin: 14px auto 0;
  max-width: 34ch;
  line-height: 1.75;
}

.hero-stage-input-shell {
  margin: 24px auto 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid rgba(245, 154, 189, 0.14);
  box-shadow: 0 14px 28px rgba(167, 139, 250, 0.12);
  max-width: 640px;
}

.hero-stage-input {
  min-height: 58px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  color: #b5b1b7;
}

.hero-stage-send,
.chat-send {
  border-radius: 999px;
  border: 0;
  background: linear-gradient(180deg, #ad92fb 0%, #9f84fa 100%);
  color: #ffffff;
}

.hero-stage-send {
  width: 58px;
  height: 58px;
  box-shadow: 0 10px 22px rgba(167, 139, 250, 0.28);
}

.primary-button,
.secondary-button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
}

.primary-button {
  background: linear-gradient(90deg, var(--title-start), var(--title-end));
  color: white;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.84);
  color: var(--text-strong);
  border: 1px solid var(--line);
}

.hero-stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
  justify-content: center;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  min-height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(167, 139, 250, 0.1);
  color: #7f7f9b;
}

.chip-accent {
  color: #e486af;
}

.chip-button {
  cursor: pointer;
}

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

.stat-card {
  border-radius: var(--radius-lg);
  padding: 18px;
  display: grid;
  gap: 6px;
}

.stat-card strong {
  color: var(--text-strong);
  font-size: 1.5rem;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) 360px;
  gap: 16px;
}

.workspace[data-active-view="overview"] .main-grid {
  display: none;
}

.workspace[data-active-view="services"] .main-grid {
  grid-template-columns: 1fr;
}

.workspace[data-active-view="services"] .stack {
  display: none;
}

.workspace[data-active-view="actions"] .main-grid,
.workspace[data-active-view="logs"] .main-grid,
.workspace[data-active-view="domains"] .main-grid,
.workspace[data-active-view="settings"] .main-grid {
  grid-template-columns: 1fr;
}

.stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

.panel {
  padding: 22px;
  border-radius: var(--radius-lg);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 18px;
}

.pill,
.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.pill {
  background: rgba(237, 233, 254, 0.8);
  color: #836fe6;
}

.service-toolbar {
  margin-bottom: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.service-search-shell {
  min-height: 52px;
  padding: 0 14px;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(167, 139, 250, 0.12);
}

.service-search-input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-strong);
  outline: none;
}

.toolbar-button {
  flex: 0 0 auto;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.service-card {
  padding: 18px;
  display: grid;
  gap: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(167, 139, 250, 0.1);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition:
    border-color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.service-card:hover {
  transform: translateY(-2px);
  border-color: rgba(167, 139, 250, 0.22);
}

.service-card.is-selected {
  border-color: rgba(167, 139, 250, 0.34);
  box-shadow: 0 14px 26px rgba(167, 139, 250, 0.12);
}

.service-card-compact {
  display: grid;
  gap: 10px;
}

.service-card-compact div {
  display: grid;
  gap: 4px;
}

.service-card-hint {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text);
}

.service-card-header,
.selected-service-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.service-card-actions,
.selected-service-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.service-domain-editor {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.service-domain-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
}

.service-domain-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.service-domain-input {
  min-width: 0;
  flex: 1 1 180px;
  height: 46px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-strong);
  font: inherit;
}

.service-domain-suffix {
  color: var(--text-soft);
  font-size: 14px;
  white-space: nowrap;
}

.service-action-button {
  min-width: 88px;
}

.status-running {
  color: #7d6fe7;
  background: rgba(237, 233, 254, 0.86);
}

.status-stopped {
  color: #cc7b6b;
  background: rgba(255, 237, 213, 0.92);
}

.status-manual {
  color: #7d8797;
  background: rgba(241, 245, 249, 0.94);
}

.meta {
  margin: 0;
  display: grid;
  gap: 10px;
}

.meta div {
  display: grid;
  gap: 4px;
}

.meta dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
}

.meta dd {
  margin: 0;
  color: var(--text-strong);
  word-break: break-word;
}

.chat-card,
.selected-service-card,
.signal-list,
.domain-list {
  display: grid;
  gap: 14px;
}

.panel-visual {
  width: 100%;
  max-width: 220px;
  height: auto;
  object-fit: contain;
  border-radius: 18px;
}

.chat-input-shell {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(245, 154, 189, 0.14);
}

.chat-input {
  min-height: 58px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: #a7a1ac;
  line-height: 1.5;
}

.chat-send {
  width: 48px;
  height: 48px;
  align-self: center;
}

.signal-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 12px;
  align-items: start;
}

.signal-item strong,
.domain-item strong {
  color: var(--text-strong);
}

.signal-dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 999px;
}

.signal-dot.is-good {
  background: #7cd67c;
}

.signal-dot.is-warn {
  background: #ffc85c;
}

.domain-item {
  min-height: 48px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.76);
}

.service-action-feedback,
.empty-copy {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

.error {
  margin: 0;
  color: #cc7b6b;
}

.inline-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inline-muted {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
}

.ai-settings-card,
.usage-summary-card,
.chat-session-item,
.chat-thread-header,
.chat-compose-shell,
.chat-message {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(245, 154, 189, 0.12);
  border-radius: 18px;
}

.ai-settings-card,
.usage-summary-card,
.chat-thread-header,
.chat-compose-shell,
.chat-message {
  padding: 16px;
}

.ai-settings-grid,
.chat-workspace {
  display: grid;
  gap: 12px;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.85rem;
  color: var(--text);
}

.field input,
.field textarea,
.chat-composer-input {
  width: 100%;
  border: 1px solid rgba(167, 139, 250, 0.16);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text-strong);
  resize: vertical;
}

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

.ai-settings-actions {
  display: flex;
  justify-content: flex-end;
}

.chat-workspace {
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: start;
}

.chat-sidebar,
.chat-main,
.chat-session-list,
.chat-message-list {
  display: grid;
  gap: 12px;
}

.chat-session-item {
  width: 100%;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 6px;
}

.chat-session-item.is-active {
  border-color: rgba(167, 139, 250, 0.34);
  box-shadow: 0 10px 24px rgba(167, 139, 250, 0.12);
}

.chat-session-item strong,
.usage-summary-card strong,
.chat-thread-header strong,
.chat-message strong {
  color: var(--text-strong);
}

.chat-session-item span,
.usage-summary-item,
.chat-message-head span,
.chat-message-usage {
  font-size: 0.84rem;
  color: var(--text);
  line-height: 1.5;
}

.usage-summary-card {
  display: grid;
  gap: 10px;
}

.usage-summary-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.chat-thread-header,
.chat-compose-actions,
.chat-message-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-message-list {
  max-height: 420px;
  overflow: auto;
}

.chat-message p {
  margin: 10px 0 0;
  line-height: 1.7;
  white-space: pre-wrap;
}

.chat-message-assistant {
  background: rgba(237, 233, 254, 0.42);
}

.chat-message-usage {
  margin: 10px 0 0;
}

.chat-compose-shell {
  display: grid;
  gap: 12px;
}

.chat-compose-actions {
  align-items: flex-end;
}

.chat-compose-actions .quick-actions {
  margin: 0;
}

.context-menu {
  position: fixed;
  z-index: 1000;
  min-width: 180px;
  padding: 8px;
  display: grid;
  gap: 6px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(167, 139, 250, 0.18);
  border-radius: 16px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.12);
}

.context-menu button {
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-strong);
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.context-menu button:hover {
  background: rgba(237, 233, 254, 0.82);
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(75, 85, 99, 0.32);
  backdrop-filter: blur(6px);
}

.service-modal {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 22px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.16);
}

.service-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-close-button {
  min-width: 88px;
}

.service-modal-body {
  display: grid;
  gap: 14px;
}

@media (max-width: 1200px) {
  .window-shell {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .sidebar {
    border-radius: var(--radius-xl);
  }

  .workspace {
    padding-left: 0;
  }

  .stats-grid,
  .main-grid {
    grid-template-columns: 1fr;
  }

  .chat-workspace,
  .ai-settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .window-shell {
    padding: 14px;
  }

  .hero-stage-overlay {
    width: min(100%, calc(100% - 32px));
    padding: 20px;
  }

  .service-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}
