/* Imago v2 theme.
   Loaded after styles.css. It keeps the original variable contract and adds
   only brand-level chrome for the login, app shell, terminal and dialogs. */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Noto+Sans+SC:wght@400;500;700&family=Noto+Serif+SC:wght@400;500;600&display=swap');

:root {
  color-scheme: dark;
  --bg: #0b1113;
  --surface: #121b1e;
  --surface-2: #172327;
  --surface-3: #202e32;
  --line: #28383b;
  --line-strong: #3c5356;
  --text: #eef4ee;
  --muted: #aab8b2;
  --muted-2: #74837f;
  --accent: #9adfd0;
  --accent-strong: #d9f4e8;
  --warn: #f0bd82;
  --danger: #ed7d78;
  --terminal: #071012;
  --radius: 7px;

  --font-brand: "Fraunces", "Noto Serif SC", Georgia, serif;
  --font-ui: "Inter", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --dawn: #f0b98e;
  --dawn-soft: rgba(240, 185, 142, 0.18);
  --aqua-soft: rgba(154, 223, 208, 0.18);
  --iris-soft: rgba(182, 174, 218, 0.14);
  --glass: rgba(18, 27, 30, 0.78);
  --shadow-deep: 0 24px 80px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 14px 42px rgba(0, 0, 0, 0.24);
  --ring: 0 0 0 3px rgba(154, 223, 208, 0.18);
}

* {
  scrollbar-color: var(--line-strong) transparent;
}

html,
body {
  background:
    linear-gradient(180deg, #090d10 0%, var(--bg) 46%, #111915 100%);
  color: var(--text);
}

body,
button,
input,
select,
textarea {
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button,
input,
select,
textarea {
  border-color: var(--line);
  box-shadow: none;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

button {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.005)), var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

button:hover:not(:disabled),
button:focus-visible {
  border-color: rgba(154, 223, 208, 0.78);
  box-shadow: var(--ring);
  outline: none;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

input,
select,
textarea {
  background: rgba(7, 16, 18, 0.74);
  color: var(--text);
  caret-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
  color: rgba(170, 184, 178, 0.52);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(154, 223, 208, 0.82);
  box-shadow: var(--ring);
}

label {
  color: var(--muted);
  font-weight: 500;
}

::selection {
  background: rgba(240, 185, 142, 0.34);
  color: #fbfff8;
}

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

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

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(154, 223, 208, 0.62), rgba(240, 185, 142, 0.58)) border-box;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
  background-clip: padding-box;
}

#terminal,
.xterm,
.xterm-rows {
  font-family: var(--font-mono) !important;
}

.message {
  border-color: rgba(154, 223, 208, 0.2);
  background: rgba(154, 223, 208, 0.075);
  color: var(--text);
}

.message.error {
  border-color: rgba(237, 125, 120, 0.58);
  background: rgba(237, 125, 120, 0.12);
  color: #ffe1de;
}

.message.info {
  border-color: rgba(154, 223, 208, 0.55);
  background: rgba(154, 223, 208, 0.12);
}

.login-panel button[type="submit"],
.stack-form button[type="submit"],
.modal-actions button[type="submit"] {
  border-color: transparent;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.34), transparent 42%),
    linear-gradient(135deg, var(--accent), var(--dawn));
  color: #081012;
  font-weight: 700;
}

.login-panel button[type="submit"]:hover,
.stack-form button[type="submit"]:hover,
.modal-actions button[type="submit"]:hover {
  box-shadow: 0 12px 30px rgba(154, 223, 208, 0.18), 0 0 0 3px rgba(240, 185, 142, 0.16);
}

/* Login */

.login-view {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 32px;
  background:
    linear-gradient(180deg, rgba(8, 12, 15, 0.98) 0%, rgba(11, 17, 19, 0.94) 46%, rgba(19, 27, 22, 0.98) 100%),
    var(--bg);
}

.login-view::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, transparent 0%, rgba(154, 223, 208, 0.08) 26%, rgba(240, 185, 142, 0.12) 55%, rgba(182, 174, 218, 0.08) 76%, transparent 100%),
    linear-gradient(180deg, transparent 0%, transparent 52%, rgba(154, 223, 208, 0.08) 63%, rgba(240, 185, 142, 0.12) 76%, transparent 100%);
}

.login-view::after {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: 24%;
  z-index: -1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(217, 244, 232, 0.24), rgba(240, 185, 142, 0.22), transparent);
  box-shadow: 0 0 54px rgba(154, 223, 208, 0.18), 0 16px 84px rgba(240, 185, 142, 0.12);
}

.login-shell {
  width: min(940px, 100%);
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.login-panel,
.saved-panel,
.modal {
  border-color: rgba(154, 223, 208, 0.17);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    var(--glass);
  box-shadow: var(--shadow-deep);
  backdrop-filter: blur(22px);
}

.login-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(238px, 0.9fr) minmax(300px, 1fr);
  gap: 16px 30px;
  overflow: hidden;
  padding: 28px;
}

.login-panel::before {
  content: "";
  position: absolute;
  top: 28px;
  bottom: 28px;
  left: calc(47% - 15px);
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(154, 223, 208, 0.22), rgba(240, 185, 142, 0.18), transparent);
}

.login-panel > *:not(.brand-block) {
  grid-column: 2;
}

.brand-block {
  grid-column: 1;
  grid-row: 1 / span 7;
  display: grid;
  align-content: center;
  justify-items: start;
  min-height: 420px;
  padding: 20px 18px 20px 4px;
}

.brand-mark {
  display: block;
  width: 92px;
  height: 92px;
  margin: 0 0 30px;
  filter: drop-shadow(0 18px 36px rgba(154, 223, 208, 0.18));
}

.brand-block h1 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-brand);
  font-size: 64px;
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: 0.015em;
}

.brand-block p {
  margin: 0;
}

.brand-tagline {
  margin-top: 18px !important;
  color: var(--accent-strong) !important;
  font-family: var(--font-brand);
  font-size: 18px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.045em;
}

.brand-tagline-zh {
  margin-top: 9px !important;
  color: rgba(240, 185, 142, 0.86) !important;
  font-family: "Noto Serif SC", var(--font-brand);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.36em;
  text-indent: 0.36em;
}

.login-panel label {
  gap: 7px;
}

.login-panel label > span,
.modal label > span,
.stack-form label > span {
  color: rgba(170, 184, 178, 0.78);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-panel input {
  min-height: 46px;
  border-color: rgba(154, 223, 208, 0.18);
  background: rgba(7, 16, 18, 0.62);
}

#login-submit {
  min-height: 48px;
  margin-top: 2px;
  letter-spacing: 0.04em;
}

.saved-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.section-title {
  color: rgba(170, 184, 178, 0.78);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.saved-panel .section-title,
.panel-section .section-title,
.meeting-rail .section-title {
  color: rgba(217, 244, 232, 0.68);
}

/* App shell */

.app {
  background: var(--terminal);
}

.topbar {
  min-height: 58px;
  border-bottom-color: rgba(154, 223, 208, 0.16);
  background:
    linear-gradient(90deg, rgba(154, 223, 208, 0.06), rgba(240, 185, 142, 0.045), transparent 62%),
    rgba(12, 18, 20, 0.94);
  backdrop-filter: blur(18px);
}

.icon-button {
  border-color: transparent;
  background: rgba(154, 223, 208, 0.06);
}

.icon-button span {
  height: 1px;
  background: var(--accent-strong);
}

.title-block {
  position: relative;
  padding-left: 38px;
  min-height: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.title-block::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  background: url("/icons/imago-mark.svg") no-repeat center / contain;
  filter: drop-shadow(0 0 8px rgba(154, 223, 208, 0.28));
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.title-block strong,
.meeting-title-block strong,
.modal-header strong {
  color: var(--text);
  font-family: var(--font-brand);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.title-block small,
.meeting-title-block span,
.modal-header span {
  color: var(--muted-2);
}

.top-actions,
.meeting-actions {
  scrollbar-width: none;
}

.compact-button,
.meeting-actions button,
.section-actions button,
.mini-button,
.send-bar button {
  border-color: rgba(154, 223, 208, 0.14);
  background: rgba(255, 255, 255, 0.026);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.compact-button:hover,
.meeting-actions button:hover,
.section-actions button:hover,
.mini-button:hover,
.send-bar button:hover {
  color: var(--accent-strong);
}

.danger,
.compact-button.danger {
  color: #ffd0cd;
}

.compact-button.danger:hover,
.danger:hover {
  border-color: rgba(237, 125, 120, 0.7);
  color: #ffc3c0;
}

.layout {
  background:
    linear-gradient(180deg, rgba(154, 223, 208, 0.04), transparent 120px),
    var(--terminal);
}

.sidebar,
.meeting-rail {
  border-right-color: rgba(154, 223, 208, 0.13);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.026), rgba(255, 255, 255, 0.006)),
    #0f1719;
}

.sidebar-scroll {
  gap: 14px;
  padding: 14px;
}

.panel-section {
  gap: 10px;
  border: 1px solid rgba(154, 223, 208, 0.11);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.018);
}

.panel-section.grow-section {
  min-height: 0;
}

.section-actions {
  gap: 7px;
}

.list-row,
.participant-item,
.candidate-row,
.chat-message {
  border-color: rgba(154, 223, 208, 0.13);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0.01)),
    rgba(10, 17, 19, 0.82);
}

.list-row.is-active {
  border-color: rgba(154, 223, 208, 0.72);
  background:
    linear-gradient(90deg, rgba(154, 223, 208, 0.14), rgba(240, 185, 142, 0.075)),
    rgba(10, 17, 19, 0.9);
  box-shadow: inset 3px 0 0 rgba(154, 223, 208, 0.78);
}

.row-main strong,
.participant-item strong,
.candidate-details strong {
  color: var(--text);
  font-weight: 600;
}

.row-main span,
.participant-item span,
.candidate-details span {
  color: var(--muted-2);
}

.status-dot,
.participant-dot {
  background: var(--muted-2);
  box-shadow: 0 0 0 3px rgba(116, 131, 127, 0.11);
}

.status-dot.running,
.participant-dot.ready {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(154, 223, 208, 0.16), 0 0 20px rgba(154, 223, 208, 0.2);
}

.status-dot.exited,
.participant-dot.thinking,
.participant-dot.queued,
.participant-dot.connecting,
.participant-dot.executing {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(240, 185, 142, 0.14);
}

.empty-list-item {
  border-color: rgba(154, 223, 208, 0.16);
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.012);
}

.segmented {
  border: 1px solid rgba(154, 223, 208, 0.12);
  border-radius: var(--radius);
  padding: 3px;
  background: rgba(7, 16, 18, 0.52);
}

.segmented button {
  border-color: transparent;
  background: transparent;
}

.segmented button.is-active {
  border-color: rgba(154, 223, 208, 0.22);
  background: linear-gradient(135deg, rgba(154, 223, 208, 0.16), rgba(240, 185, 142, 0.08));
  color: var(--accent-strong);
}

/* Terminal */

.terminal-area {
  position: relative;
  border-left: 1px solid rgba(217, 244, 232, 0.06);
  background:
    linear-gradient(180deg, rgba(154, 223, 208, 0.035), transparent 96px),
    var(--terminal);
}

.terminal-area::before {
  /* removed: top 1px gradient stripe could interfere with xterm canvas. */
  display: none;
}

#terminal {
  padding: 10px 12px 10px 10px;
  background: var(--terminal);
}

#terminal .xterm {
  letter-spacing: 0;
}

.empty-state {
  color: var(--muted-2);
}

.empty-state strong {
  color: rgba(238, 244, 238, 0.92);
  font-family: var(--font-brand);
  font-size: 22px;
  font-weight: 500;
}

.send-bar {
  border-top-color: rgba(154, 223, 208, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.024), rgba(255, 255, 255, 0.006)),
    rgba(10, 17, 19, 0.96);
}

.send-bar input {
  border-color: rgba(154, 223, 208, 0.14);
  background: rgba(7, 16, 18, 0.82);
  font-family: var(--font-mono);
}

.send-bar button[type="submit"] {
  border-color: transparent;
  background: linear-gradient(135deg, var(--warn), var(--accent));
  color: #081012;
}

/* Meeting and dialogs */

.meeting-room {
  background:
    linear-gradient(180deg, rgba(154, 223, 208, 0.04), transparent 180px),
    var(--bg);
}

.meeting-header {
  border-bottom-color: rgba(154, 223, 208, 0.14);
  background: rgba(15, 23, 25, 0.94);
}

.meeting-chat-log {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.014), transparent 160px),
    var(--terminal);
}

.chat-message.host {
  border-color: rgba(154, 223, 208, 0.42);
  background: rgba(17, 38, 38, 0.86);
}

.chat-message.host .chat-message-header strong {
  color: var(--accent-strong);
}

.chat-message.task,
.chat-message.memo {
  border-color: rgba(240, 185, 142, 0.42);
  background: rgba(45, 32, 20, 0.72);
}

.chat-message.task .chat-message-header strong {
  color: var(--warn);
}

.chat-message.system {
  border-color: rgba(182, 174, 218, 0.28);
  background: rgba(18, 20, 29, 0.7);
}

.meeting-composer {
  border-top-color: rgba(154, 223, 208, 0.14);
  background: rgba(15, 23, 25, 0.94);
}

.mention-menu {
  border-color: rgba(154, 223, 208, 0.25);
  background: rgba(10, 17, 19, 0.96);
  box-shadow: var(--shadow-soft);
}

.mention-menu button.is-active,
.mention-menu button:hover {
  border-color: rgba(154, 223, 208, 0.44);
  background: rgba(154, 223, 208, 0.1);
}

.modal {
  box-shadow: var(--shadow-deep);
}

.modal::backdrop {
  background: rgba(5, 9, 10, 0.68);
  backdrop-filter: blur(4px);
}

.modal-panel {
  gap: 15px;
}

.icon-close {
  border-color: rgba(154, 223, 208, 0.12);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
}

@media (max-width: 860px) {
  .login-view {
    padding: 20px;
  }

  .login-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 22px;
  }

  .login-panel::before {
    display: none;
  }

  .login-panel > *:not(.brand-block),
  .brand-block {
    grid-column: 1;
  }

  .brand-block {
    grid-row: auto;
    justify-items: center;
    min-height: auto;
    padding: 4px 0 12px;
    text-align: center;
  }

  .brand-mark {
    width: 74px;
    height: 74px;
    margin: 0 0 18px;
  }

  .brand-block h1 {
    font-size: 48px;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 40px minmax(0, 1fr) minmax(0, 56vw);
  }

  .sidebar {
    top: 58px;
    background: rgba(13, 20, 22, 0.98);
  }

  .sidebar-backdrop.is-visible {
    inset: 58px 0 0 0;
    background: rgba(5, 9, 10, 0.58);
  }

  .panel-section {
    padding: 9px;
  }

  .send-bar {
    gap: 6px;
  }
}
