:root {
  --bg: #0e0f10;
  --bg-2: #16181a;
  --ink: #ece6dc;
  --muted: #8b8680;
  --line: rgba(236, 230, 220, 0.1);
  --copper: #c4a574;
  --copper-dim: rgba(196, 165, 116, 0.18);
  --danger: #d4726a;
  --ok: #7eb8a2;
  --warn: #d4a574;
  --font-display: "Syne", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 15% -10%, rgba(196, 165, 116, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(90, 110, 100, 0.12), transparent 50%),
    linear-gradient(165deg, #121314 0%, #0e0f10 45%, #0c0d0e 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.gate,
.shell {
  position: relative;
  z-index: 1;
}

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.gate-panel {
  width: min(420px, 100%);
  animation: rise 0.7s var(--ease) both;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.85rem, 4vw, 2.65rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0.15rem 0 0.6rem;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--copper);
}

.lede {
  margin: 0 0 1.4rem;
  color: var(--muted);
  max-width: 36rem;
}

.lede.tight {
  margin-bottom: 1rem;
}

.lede a {
  color: var(--copper);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.field span {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field input,
.field textarea {
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0.75rem 0.85rem;
  outline: none;
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(196, 165, 116, 0.55);
}

.btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 0.7rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.btn:hover {
  border-color: rgba(236, 230, 220, 0.28);
}

.btn.primary {
  background: var(--copper);
  border-color: var(--copper);
  color: #141210;
}

.btn.primary:hover {
  filter: brightness(1.06);
}

.btn.ghost {
  border-color: transparent;
  color: var(--muted);
}

.btn.ghost:hover {
  color: var(--ink);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hint {
  min-height: 1.2em;
  margin: 0.75rem 0 0;
  color: var(--warn);
  font-size: 0.88rem;
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  animation: rise 0.65s var(--ease) both;
}

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2rem;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.75rem;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.tabs {
  display: flex;
  gap: 0.15rem;
  border-bottom: 1px solid transparent;
  flex-wrap: wrap;
}

.tab {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tab:hover {
  color: var(--ink);
}

.tab.active {
  color: var(--copper);
  border-bottom-color: var(--copper);
}

.view[hidden] {
  display: none !important;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.9rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  margin-bottom: 2rem;
}

.metric {
  background: var(--bg-2);
  padding: 1.1rem 1.15rem;
}

.metric-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.metric strong {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.due-strip {
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--copper);
  background: var(--copper-dim);
  animation: slideIn 0.55s var(--ease) both;
}

.due-strip.danger {
  border-left-color: var(--danger);
  background: rgba(212, 114, 106, 0.12);
}

.due-strip strong {
  color: var(--ink);
}

.due-strip-head {
  margin-bottom: 0.65rem;
}

.due-strip-cards {
  display: grid;
  gap: 0.55rem;
}

.due-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
}

.due-card strong {
  display: block;
  font-size: 0.98rem;
}

.due-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.pay-modal {
  max-width: 640px;
  width: calc(100% - 2rem);
}

.pay-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.1rem;
  margin: 1rem 0 0.5rem;
}

.pay-qr-wrap {
  text-align: center;
}

.pay-qr {
  width: 220px;
  height: 220px;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  display: block;
  margin: 0 auto;
}

.pay-net {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.pay-amount-box {
  border: 1px solid var(--line);
  background: rgba(126, 184, 162, 0.08);
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.85rem;
}

.pay-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pay-amount-box strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.55rem;
  margin: 0.2rem 0;
  letter-spacing: -0.02em;
}

.pay-hint {
  font-size: 0.78rem;
  color: var(--copper);
}

.pay-addr-row {
  display: flex;
  gap: 0.45rem;
  align-items: stretch;
}

.pay-address {
  flex: 1;
  word-break: break-all;
  font-size: 0.78rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  background: #0b0c0d;
}

.pay-status {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.85rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  font-size: 0.88rem;
}

.pay-status[data-state="listening"] {
  border-color: rgba(126, 184, 162, 0.45);
}

.pay-status[data-state="paid"] {
  border-color: rgba(126, 184, 162, 0.9);
  background: rgba(126, 184, 162, 0.12);
  color: #9fd9c0;
}

.pay-status[data-state="expired"] {
  border-color: rgba(212, 114, 106, 0.7);
  color: #e8a39d;
}

.pay-pulse {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--copper);
  animation: pulse 1.6s ease infinite;
}

.pay-status[data-state="paid"] .pay-pulse {
  background: #7eb8a2;
  animation: none;
}

.attention {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.muted {
  color: var(--muted);
}

.plist {
  display: flex;
  flex-direction: column;
}

.prow {
  display: grid;
  grid-template-columns: 4px 1fr auto;
  gap: 0 1rem;
  align-items: center;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--line);
  animation: rise 0.45s var(--ease) both;
}

.prow-bar {
  align-self: stretch;
  background: var(--accent, var(--copper));
  opacity: 0.85;
}

.prow-main h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
  letter-spacing: -0.02em;
}

.prow-main p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.prow-meta {
  margin-top: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.9rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.prow-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status .pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.status.on .pip {
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(126, 184, 162, 0.55);
  animation: pulse 2.2s ease-out infinite;
}

.status.off .pip {
  background: var(--danger);
}

.status.unk .pip {
  background: var(--warn);
}

.tag {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--copper);
}

.due-badge {
  font-size: 0.8rem;
  font-weight: 600;
}

.due-badge.ok {
  color: var(--ok);
}
.due-badge.warn {
  color: var(--warn);
}
.due-badge.danger {
  color: var(--danger);
}
.due-badge.muted {
  color: var(--muted);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.row-actions.stack {
  flex-direction: column;
  align-items: stretch;
}

.prow a.open {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.prow a.open:hover {
  border-bottom-color: var(--copper);
  color: var(--copper);
}

.settings-block {
  max-width: 520px;
}

.section-head {
  margin-bottom: 0.75rem;
}

.vault-upload {
  max-width: 560px;
  margin-bottom: 1.5rem;
  padding: 1rem 1.1rem 1.15rem;
  border: 1px solid var(--line);
  background: rgba(22, 24, 26, 0.65);
}

.vault-upload code {
  font-size: 0.85em;
  color: var(--copper);
}

.vault-row .prow-side a.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* —— Coder studio (Cursor-like IDE) —— */
body.mode-coder {
  overflow: hidden;
  height: 100dvh;
  --ide-bg: #1e1e1e;
  --ide-panel: #252526;
  --ide-panel-2: #2d2d2d;
  --ide-border: #3c3c3c;
  --ide-text: #cccccc;
  --ide-muted: #858585;
  --ide-accent: #3794ff;
  --ide-active: #094771;
  --ide-tab: #2d2d2d;
  --ide-editor: #1e1e1e;
}
body.mode-coder .atmosphere { opacity: 0.2; }
body.mode-coder .shell {
  max-width: none;
  margin: 0;
  padding: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  animation: none;
  background: var(--ide-bg);
}
body.mode-coder .top {
  flex: 0 0 auto;
  padding: 0 0.5rem;
  min-height: 34px;
  border-bottom: 1px solid var(--ide-border);
  margin-bottom: 0;
  align-items: center;
  gap: 0.5rem;
  background: var(--ide-panel);
}
body.mode-coder .top-brand { display: none; }
body.mode-coder .top-actions {
  width: 100%;
  justify-content: space-between;
}
body.mode-coder .tabs {
  gap: 0;
  border: none;
}
body.mode-coder .tab {
  font-size: 0.78rem;
  padding: 0.35rem 0.55rem;
  color: var(--ide-muted);
  border-bottom: none;
}
body.mode-coder .tab.active {
  color: var(--ide-text);
  background: transparent;
  box-shadow: inset 0 -2px 0 var(--ide-accent);
}
body.mode-coder .btn.ghost { color: var(--ide-muted); padding: 0.3rem 0.55rem; font-size: 0.78rem; }
body.mode-coder .foot { display: none; }
body.mode-coder .view:not(.coder-view) { display: none !important; }

.coder-view {
  margin: 0;
  flex: 1;
  min-height: 0;
  display: none;
  color: var(--ide-text);
}
.coder-view.active {
  display: flex;
  flex-direction: column;
}

.coder-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 48px 260px minmax(0, 1fr) 360px;
  background: var(--ide-bg);
  overflow: hidden;
  height: 100%;
  border: none;
}

.coder-activity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem 0;
  border-right: 1px solid var(--ide-border);
  background: var(--ide-panel);
}
.coder-act-spacer { flex: 1; }
.coder-act {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--ide-muted);
  cursor: pointer;
  border-radius: 0;
  font: inherit;
  font-size: 1rem;
  position: relative;
}
.coder-act:hover { color: var(--ide-text); }
.coder-act.active {
  color: var(--ide-text);
  background: transparent;
}
.coder-act.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--ide-text);
}

.coder-side {
  border-right: 1px solid var(--ide-border);
  background: var(--ide-panel);
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
.coder-rail-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.coder-rail-panel[hidden] { display: none !important; }
.coder-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem 0.35rem;
  flex: 0 0 auto;
}
.coder-side-title {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--ide-text);
}
.coder-side-actions { display: flex; gap: 0.1rem; }
.coder-side-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.coder-section {
  border: none;
  margin: 0;
}
.coder-section > summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--ide-text);
  padding: 0.35rem 0.75rem;
  user-select: none;
}
.coder-section > summary::-webkit-details-marker { display: none; }
.coder-section > summary::before {
  content: "▾ ";
  color: var(--ide-muted);
}
.coder-section:not([open]) > summary::before { content: "▸ "; }
.coder-dim { color: var(--ide-muted); font-size: 0.78rem; }
.coder-dim.pad { padding: 0.5rem 0.75rem; }

.coder-icon-btn,
.coder-text-btn {
  border: none;
  background: transparent;
  color: var(--ide-muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
}
.coder-icon-btn:hover,
.coder-text-btn:hover {
  color: var(--ide-text);
  background: rgba(255,255,255,0.06);
}
.coder-icon-btn:disabled,
.coder-text-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.coder-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 0 0.35rem;
}
.coder-item {
  text-align: left;
  border: none;
  background: transparent;
  color: var(--ide-text);
  padding: 0.28rem 0.75rem 0.28rem 1.1rem;
  border-radius: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
}
.coder-item:hover { background: rgba(255,255,255,0.05); }
.coder-item.active { background: var(--ide-active); color: #fff; }
.coder-item small {
  display: block;
  color: var(--ide-muted);
  font-size: 0.68rem;
  margin-top: 0.05rem;
}
.coder-tree {
  font-size: 0.78rem;
  line-height: 1.35;
  padding: 0 0 0.5rem;
}
.coder-tree button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--ide-text);
  font: inherit;
  padding: 0.15rem 0.75rem 0.15rem 1.1rem;
  cursor: pointer;
}
.coder-tree button:hover { background: rgba(255,255,255,0.05); }
.coder-tree button.active-file { background: var(--ide-active); color: #fff; }
.coder-tree .dir {
  color: var(--ide-muted);
  padding: 0.15rem 0.75rem 0.15rem 0.9rem;
  cursor: default;
}

.coder-search-form {
  padding: 0.35rem 0.75rem 0.5rem;
}
.coder-search-form input {
  width: 100%;
  background: #3c3c3c;
  border: 1px solid transparent;
  color: var(--ide-text);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  border-radius: 2px;
  outline: none;
}
.coder-search-form input:focus { border-color: var(--ide-accent); }
.coder-search-hits {
  flex: 1;
  overflow: auto;
  font-size: 0.78rem;
  padding: 0 0.25rem 0.5rem;
}
.coder-search-hits button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--ide-text);
  font: inherit;
  padding: 0.4rem 0.55rem;
  cursor: pointer;
}
.coder-search-hits button:hover { background: rgba(255,255,255,0.05); }
.coder-search-hits small { display: block; color: var(--ide-muted); font-size: 0.7rem; }

.coder-agent-cards {
  flex: 1;
  overflow: auto;
  padding: 0.25rem 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.coder-agent-card {
  text-align: left;
  border: 1px solid var(--ide-border);
  background: var(--ide-panel-2);
  color: var(--ide-text);
  padding: 0.5rem 0.55rem;
  cursor: pointer;
  font: inherit;
  border-radius: 4px;
}
.coder-agent-card.active {
  border-color: var(--ide-accent);
  background: var(--ide-active);
}
.coder-agent-card strong { display: block; font-size: 0.82rem; }
.coder-agent-card span { display: block; color: var(--ide-muted); font-size: 0.7rem; margin-top: 0.15rem; }

.coder-center-col {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--ide-editor);
}
.coder-mid {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.coder-menubar {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.2rem 0.55rem;
  background: var(--ide-panel);
  border-bottom: 1px solid var(--ide-border);
  min-height: 30px;
}
.coder-menubar-left,
.coder-menubar-right { display: flex; align-items: center; gap: 0.45rem; }
.coder-ws-chip {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ide-text);
}

.coder-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 0;
  overflow-x: auto;
  background: var(--ide-panel);
  border-bottom: 1px solid var(--ide-border);
}
.coder-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  border-right: 1px solid var(--ide-border);
  background: var(--ide-tab);
  color: var(--ide-muted);
  font: inherit;
  font-size: 0.78rem;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  white-space: nowrap;
}
.coder-tab.active {
  color: var(--ide-text);
  background: var(--ide-editor);
}
.coder-tab .x {
  opacity: 0.55;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0 0.1rem;
}
.coder-tab .x:hover { opacity: 1; color: #f48771; }
.coder-tab.dirty::before {
  content: "●";
  color: var(--ide-text);
  font-size: 0.55rem;
}

.coder-editor-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
}
.coder-editor {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: none;
  resize: none;
  background: var(--ide-editor);
  color: #d4d4d4;
  font-family: Consolas, "Cascadia Code", "Courier New", monospace;
  font-size: 0.84rem;
  line-height: 1.55;
  padding: 0.75rem 1rem;
  outline: none;
  tab-size: 2;
}

.coder-bottom {
  flex: 0 0 auto;
  border-top: 1px solid var(--ide-border);
  background: var(--ide-panel);
  max-height: 32%;
  min-height: 120px;
  display: flex;
  flex-direction: column;
}
.coder-bottom.collapsed {
  max-height: none;
  min-height: 28px;
}
.coder-bottom.collapsed .coder-bottom-body,
.coder-bottom.collapsed .coder-term-form { display: none !important; }
.coder-bottom-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 0.25rem;
  border-bottom: 1px solid var(--ide-border);
  min-height: 28px;
}
.coder-bottom-grow { flex: 1; }
.coder-btab {
  border: none;
  background: none;
  color: var(--ide-muted);
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}
.coder-btab.active {
  color: var(--ide-text);
  box-shadow: inset 0 -1px 0 var(--ide-accent);
}
.coder-bottom-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.coder-bottom-body[hidden] { display: none !important; }
.coder-term-out {
  flex: 1;
  margin: 0;
  overflow: auto;
  padding: 0.45rem 0.7rem;
  font-family: Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #cccccc;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 48px;
  background: #1e1e1e;
}
.coder-term-form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.5rem;
  border-top: 1px solid var(--ide-border);
  background: var(--ide-panel);
}
.coder-prompt-mark { color: var(--ide-accent); font-family: Consolas, monospace; }
.coder-term-form input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--ide-text);
  font-family: Consolas, monospace;
  font-size: 0.8rem;
  padding: 0.25rem 0.2rem;
  outline: none;
}

.coder-statusbar {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.15rem 0.7rem;
  border-top: 1px solid var(--ide-border);
  background: #007acc;
  font-size: 0.7rem;
  color: #fff;
  min-height: 22px;
  align-items: center;
}

.coder-chat {
  border-left: 1px solid var(--ide-border);
  background: var(--ide-panel);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.coder-chat-head {
  flex: 0 0 auto;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--ide-border);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.coder-agent-select {
  width: 100%;
  background: #3c3c3c;
  border: 1px solid var(--ide-border);
  color: var(--ide-text);
  font: inherit;
  font-size: 0.82rem;
  padding: 0.35rem 0.45rem;
  border-radius: 3px;
  outline: none;
}
.coder-agent-select:focus { border-color: var(--ide-accent); }
.coder-key-banner {
  flex: 0 0 auto;
  margin: 0.5rem 0.65rem 0;
  padding: 0.55rem;
  border: 1px solid var(--ide-border);
  background: var(--ide-panel-2);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
}
.coder-key-banner[hidden] { display: none !important; }
.coder-key-banner p { margin: 0; color: var(--ide-muted); }
.coder-key-banner input {
  width: 100%;
  background: #1e1e1e;
  border: 1px solid var(--ide-border);
  color: var(--ide-text);
  font: inherit;
  font-size: 0.78rem;
  padding: 0.35rem 0.45rem;
  border-radius: 3px;
}
.coder-messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.65rem;
}
.coder-empty {
  color: var(--ide-muted);
  font-size: 0.82rem;
  line-height: 1.45;
  padding: 0.5rem 0.15rem;
}
.coder-empty p { margin: 0; }
.coder-bubble { margin-bottom: 0.75rem; }
.coder-bubble .who {
  font-size: 0.68rem;
  color: var(--ide-muted);
  margin-bottom: 0.2rem;
  font-weight: 600;
}
.coder-bubble .body {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--ide-border);
  background: #1e1e1e;
  border-radius: 6px;
  white-space: pre-wrap;
  font-size: 0.84rem;
  color: var(--ide-text);
}
.coder-bubble.user .body {
  background: var(--ide-active);
  border-color: transparent;
}
.coder-bubble .tools {
  margin-top: 0.25rem;
  font-size: 0.7rem;
  color: #89d185;
}
.coder-prompt {
  flex: 0 0 auto;
  border-top: 1px solid var(--ide-border);
  padding: 0.55rem 0.65rem 0.7rem;
  background: var(--ide-panel);
}
.coder-prompt textarea {
  width: 100%;
  resize: none;
  min-height: 3.2rem;
  max-height: 8rem;
  background: #1e1e1e;
  border: 1px solid var(--ide-border);
  color: var(--ide-text);
  font: inherit;
  font-size: 0.84rem;
  padding: 0.55rem 0.6rem;
  border-radius: 6px;
  outline: none;
}
.coder-prompt textarea:focus { border-color: var(--ide-accent); }
.coder-prompt-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.4rem;
}
.coder-prompt-bar .hint,
.coder-prompt-bar .coder-dim { margin: 0; font-size: 0.72rem; min-height: 0; }
body.mode-coder .btn.primary {
  background: var(--ide-accent);
  border-color: var(--ide-accent);
  color: #fff;
}
body.mode-coder .btn.mini { padding: 0.3rem 0.65rem; }

@media (max-width: 1100px) {
  .coder-shell {
    grid-template-columns: 44px 220px minmax(0, 1fr) 300px;
  }
}
@media (max-width: 900px) {
  body.mode-coder { overflow: auto; height: auto; }
  body.mode-coder .shell { height: auto; min-height: 100dvh; }
  .coder-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(360px, 55vh) minmax(280px, 40vh);
    height: auto;
  }
  .coder-activity {
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--ide-border);
  }
  .coder-act-spacer { display: none; }
  .coder-side { border-right: none; border-bottom: 1px solid var(--ide-border); max-height: 220px; }
  .coder-chat { border-left: none; border-top: 1px solid var(--ide-border); }
}

/* —— Secure notes —— */
.secure-lock {
  min-height: 50vh;
  display: grid;
  place-items: center;
}

.secure-lock-panel {
  width: min(420px, 100%);
  padding: 1.4rem 1.35rem;
  border: 1px solid var(--line);
  background: rgba(18, 19, 20, 0.92);
}

.secure-app .secure-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.secure-grid {
  display: grid;
  grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
  gap: 1rem;
  min-height: 520px;
}

.secure-list-pane {
  border: 1px solid var(--line);
  background: #121314;
  padding: 0.7rem;
  overflow: auto;
}

.secure-search {
  width: 100%;
  margin-bottom: 0.6rem;
  background: #0e0f10;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.5rem 0.6rem;
  font: inherit;
}

.secure-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.secure-item {
  text-align: left;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  padding: 0.55rem 0.5rem;
  cursor: pointer;
  font: inherit;
  border-radius: 4px;
}

.secure-item:hover,
.secure-item.active {
  background: var(--copper-dim);
  border-color: var(--line);
}

.secure-item small {
  display: block;
  color: var(--muted);
  margin-top: 0.15rem;
  font-size: 0.72rem;
}

.secure-editor {
  border: 1px solid var(--line);
  padding: 1rem 1.1rem;
  background: rgba(16, 17, 18, 0.85);
}

.secure-editor select {
  background: #121314;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.55rem 0.65rem;
  font: inherit;
}

@media (max-width: 820px) {
  .secure-grid {
    grid-template-columns: 1fr;
  }
  .shell {
    padding: 1.25rem 1rem 3rem;
  }
  .top {
    align-items: flex-start;
    gap: 1rem;
  }
  .top-actions {
    width: 100%;
  }
  .tabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.15rem;
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }
  .tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 0.55rem 0.75rem;
  }
  .gate {
    padding: 1.25rem 1rem;
    min-height: 100dvh;
  }
  .prow {
    flex-direction: column;
    align-items: stretch;
  }
  .prow-side {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
  }
}

@media (max-width: 520px) {
  .metrics {
    grid-template-columns: 1fr;
  }
  .top-actions {
    width: 100%;
  }
  .brand {
    font-size: clamp(1.55rem, 8vw, 2rem);
  }
  .lede {
    font-size: 0.95rem;
  }
}

.kv {
  margin: 0 0 1rem;
}

.kv > div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.kv dt {
  margin: 0;
  color: var(--muted);
}

.kv dd {
  margin: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.75rem 0 1rem;
  font-size: 0.92rem;
}

.foot {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.dot {
  opacity: 0.5;
}

.modal {
  border: 1px solid var(--line);
  background: #141516;
  color: var(--ink);
  padding: 0;
  max-width: 400px;
  width: calc(100% - 2rem);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.modal-card {
  padding: 1.4rem 1.35rem 1.5rem;
}

.modal-card h3 {
  font-family: var(--font-display);
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
}

.modal-card .lede.tight {
  margin: 0 0 1rem;
  font-size: 0.92rem;
}

.row-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.row-actions.stack {
  flex-direction: column;
}

.row-actions.stack .btn {
  width: 100%;
}

body.locked .shell {
  display: none;
}

body.unlocked .gate {
  display: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(126, 184, 162, 0.5);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(126, 184, 162, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(126, 184, 162, 0);
  }
}

@media (max-width: 820px) {
  .metrics {
    grid-template-columns: 1fr 1fr;
  }
  .prow {
    grid-template-columns: 3px 1fr;
  }
  .prow-side {
    grid-column: 2;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    margin-top: 0.65rem;
  }
  .pay-layout {
    grid-template-columns: 1fr;
  }
  .due-card {
    flex-direction: column;
    align-items: stretch;
  }
}

