:root {
  --bg: #0c1117;
  --panel: #131b24;
  --panel2: #18232f;
  --line: #293746;
  --text: #edf3f8;
  --muted: #91a0ae;
  --accent: #dfb451;
  --accent2: #f0cc72;
  --red: #f07878;
  --green: #65d59b;
  --blue: #70b7ed;
  --radius: 12px;
  --tap: 44px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
h1 { margin: .25rem 0 1rem; font-size: clamp(1.75rem, 9vw, 2.6rem); line-height: 1.08; letter-spacing: -.03em; }
h2 { margin: 0 0 1rem; font-size: 1.1rem; }
h3 { margin: 1.5rem 0 .5rem; font-size: .92rem; }
.muted, small { color: var(--muted); }
.negative { color: var(--red) !important; }
.eyebrow { color: var(--accent); font-size: .7rem; font-weight: 800; letter-spacing: .16em; }

.topbar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: max(.65rem, env(safe-area-inset-top)) 1rem .65rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; background: rgba(12, 17, 23, .96); backdrop-filter: blur(12px); }
.brand { color: var(--text); font-size: .9rem; font-weight: 900; letter-spacing: .1em; white-space: nowrap; }
.brand span { color: var(--accent); }
.topbar nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; gap: .2rem; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding: .45rem max(.55rem, env(safe-area-inset-left)) calc(.45rem + env(safe-area-inset-bottom)) max(.55rem, env(safe-area-inset-right)); border-top: 1px solid var(--line); background: rgba(12, 17, 23, .98); box-shadow: 0 -10px 30px #0006; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a { flex: 0 0 auto; min-width: 72px; min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; padding: .55rem .7rem; border-radius: 9px; color: #bdc8d1; font-size: .74rem; font-weight: 750; text-align: center; }
.topbar nav a:hover { background: var(--panel2); color: var(--text); text-decoration: none; }
.identity { display: flex; align-items: center; justify-content: flex-end; gap: .3rem; min-width: 0; font-size: .78rem; }
.identity > span { display: none; }
.identity form { display: inline; }
.identity a, .identity button { min-height: var(--tap); padding-inline: .55rem; }

.shell { width: 100%; max-width: 1480px; margin: 0 auto; padding: 1.35rem 1rem 2rem; }
.auth-shell { min-height: 100svh; display: grid; place-items: center; padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom)); }
.auth-card { width: min(440px, 100%); padding: 1.35rem; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px #0007; }
.wide-card { width: min(720px, 100%); }

label { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; font-size: .82rem; font-weight: 700; }
input, select, textarea { width: 100%; min-height: var(--tap); border: 1px solid var(--line); border-radius: 9px; background: #0d141c; color: var(--text); padding: .72rem .8rem; font: inherit; font-size: 16px; }
textarea { min-height: 104px; resize: vertical; }
.button, button { min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; border: 1px solid #4a5a68; border-radius: 9px; background: #243240; color: var(--text); padding: .67rem 1rem; font: inherit; font-weight: 750; cursor: pointer; touch-action: manipulation; }
.button:hover, button:hover { filter: brightness(1.1); text-decoration: none; }
.button:active, button:active { transform: translateY(1px); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #19130a; }
.button.secondary { background: transparent; }
.button.danger { background: #452329; border-color: #87414c; color: #ffd4d8; }
.button.wide, .wide { width: 100%; }
.button.small { min-height: 40px; padding: .43rem .7rem; font-size: .82rem; }
.link { border: 0; background: none; color: var(--accent2); padding: .45rem; font-weight: 650; }
.divider { display: flex; align-items: center; gap: 1rem; margin: 1.25rem 0; color: var(--muted); font-size: .75rem; text-transform: uppercase; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

.notice, .warning, .error { border-radius: 10px; padding: 1rem; margin: 0 0 1.25rem; overflow-wrap: anywhere; }
.notice { background: #183042; border: 1px solid #28506b; }
.warning { background: #342b17; border: 1px solid #735d27; }
.error { background: #3a1e22; border: 1px solid #743640; color: #ffc4c4; }
.page-head, .section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.page-head { flex-direction: column; margin-bottom: 1.4rem; }
.page-head > .button { width: 100%; }
.section-head { align-items: center; margin-bottom: .8rem; }
.section-head h2 { margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; margin-bottom: 1.5rem; }
.stat-grid article { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .95rem; }
.stat-grid strong { display: block; font-size: clamp(1.35rem, 7vw, 1.8rem); overflow-wrap: anywhere; }
.stat-grid span { color: var(--muted); font-size: .76rem; }
.split, .detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; margin: 1.4rem 0; }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; min-height: var(--tap); padding: .85rem; border-bottom: 1px solid var(--line); color: var(--text); overflow-wrap: anywhere; }
.list-row:last-child { border-bottom: 0; }
.list-row > span:first-child { min-width: 0; display: flex; flex-direction: column; }
.list-row small { display: block; }
.team-list { display: grid; gap: .8rem; }
.team-member { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.team-member.disabled { opacity: .72; }
.team-member-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.team-member-head > span:first-child { min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.team-member-head > span:last-child { flex: 0 0 auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; }
.team-actions { display: grid; gap: .75rem; align-items: end; padding-top: 1rem; }
.team-actions form { margin: 0; }
.team-actions label { margin: 0 0 .5rem; }
.passkey-row { padding: .85rem 0; border-bottom: 1px solid var(--line); }
.passkey-row > span { display: flex; flex-direction: column; overflow-wrap: anywhere; }
.passkey-row details { margin-top: .45rem; }
.passkey-row details label { margin-top: .7rem; }
.metric-stack { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.metric-stack > div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .9rem; border-bottom: 1px solid var(--line); }
.metric-stack > div:last-child { border: 0; }
.metric-stack strong { text-align: right; overflow-wrap: anywhere; }
.empty { padding: 1.5rem 1rem; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.empty.small { padding: 1rem; font-size: .8rem; }

.badge { display: inline-block; flex: 0 0 auto; border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: .2rem .55rem; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.badge.active, .badge.growing, .badge.ready, .badge.completed { border-color: #286446; color: var(--green); }
.badge.building, .badge.beta, .badge.shipped { border-color: #315d7e; color: var(--blue); }
.badge.killed, .badge.cancelled { color: var(--red); }
.badge.paused, .badge.blocked, .badge.attention { color: var(--accent); }

.board { display: flex; gap: .8rem; overflow-x: auto; scroll-snap-type: x proximity; overscroll-behavior-x: contain; padding: 0 1rem 1.5rem; margin-inline: -1rem; scroll-padding-inline: 1rem; }
.board-column { flex: 0 0 min(84vw, 310px); scroll-snap-align: start; }
.board-column h2 { display: flex; justify-content: space-between; color: #c9d2da; text-transform: uppercase; font-size: .72rem; letter-spacing: .1em; }
.app-card { min-height: var(--tap); display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin-bottom: .7rem; color: var(--text); }
.app-card:hover { text-decoration: none; border-color: #596b7c; }
.app-card small { display: block; margin-top: .15rem; }
.app-card p { margin: .8rem 0 0; font-size: .84rem; }
.blocker { display: block; margin-top: .6rem; color: var(--red); font-size: .75rem; }

.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.form-grid .full { grid-column: auto; }
dl { display: grid; grid-template-columns: minmax(84px, 105px) minmax(0, 1fr); gap: .7rem; }
dt { color: var(--muted); font-size: .75rem; font-weight: 700; text-transform: uppercase; }
dd { margin: 0; overflow-wrap: anywhere; }
.milestone { display: flex; justify-content: space-between; gap: .75rem; border-bottom: 1px solid var(--line); padding: .75rem 0; }
.milestone span { min-width: 0; display: flex; flex-direction: column; }
.milestone.done { text-decoration: line-through; color: var(--muted); }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; margin-top: 1rem; }
.inline-form input { margin: 0; }

.table-wrap { width: 100%; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1.5rem; background: var(--panel); }
table { width: 100%; min-width: 660px; border-collapse: collapse; }
th, td { text-align: left; padding: .78rem .85rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
tr:last-child td { border: 0; }
.filter { display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; margin-bottom: 1.2rem; }
.filter label { margin: 0; }
.report { font-size: 1rem; line-height: 1.7; }
.codes { max-width: 100%; overflow-x: auto; columns: 1; font-size: 1rem; line-height: 1.8; background: #080d12; border: 1px solid var(--line); padding: 1rem; border-radius: 8px; }
.qr-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: center; }
.qr-wrap img { width: min(200px, 100%); justify-self: center; border-radius: 8px; }
.security-choice { border-top: 1px solid var(--line); padding: 1.35rem 0; }
.security-choice:last-child { padding-bottom: 0; }
.copy { margin-top: .7rem; }

.agent-grid, .tool-grid, .integration-grid, .partner-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; margin-bottom: 1.5rem; }
.narrow { max-width: 700px; margin: auto; }
.tool-card { min-height: var(--tap); display: flex; flex-direction: column; gap: .35rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; color: var(--text); }
.tool-card:hover { text-decoration: none; border-color: var(--accent); }
.tool-card span { color: var(--muted); font-size: .84rem; }
.timeline article { border-left: 2px solid var(--line); padding: 0 0 1.3rem 1rem; }
.timeline p { margin: .5rem 0; }
.agreement { border-top: 1px solid var(--line); padding: 1rem 0; }
.warning.small { padding: .7rem; font-size: .8rem; }
.token-secret { max-width: 100%; overflow-wrap: anywhere; white-space: pre-wrap; background: #080d12; border: 1px solid var(--line); padding: 1rem; border-radius: 8px; }
.list-row select, .list-row input { width: auto; min-width: min(160px, 100%); margin: 0; }
.partner-grid details { margin-top: 1rem; }
.partner-grid summary, details > summary { min-height: var(--tap); display: flex; align-items: center; color: var(--accent2); cursor: pointer; }
.check { min-height: var(--tap); flex-direction: row; align-items: center; }
.check input { width: auto; min-height: auto; }
.doc-source { white-space: pre-wrap; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; line-height: 1.65; overflow: auto; }

@media (max-width: 719px) {
  .list-row:has(select), .list-row:has(input:not([type="hidden"])) { align-items: stretch; flex-direction: column; }
  .list-row:has(select) select, .list-row:has(input:not([type="hidden"])) input, .list-row:has(select) button { width: 100%; }
}

@media (min-width: 720px) {
  h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
  .topbar { padding-inline: 2rem; }
  .shell { padding: 2rem 2rem 4rem; }
  .auth-card { padding: 2.25rem; }
  .page-head { flex-direction: row; align-items: flex-start; margin-bottom: 2rem; }
  .page-head > .button { width: auto; }
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 2.25rem; }
  .split, .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; margin: 2rem 0; }
  .panel { padding: 1.35rem; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.3rem; }
  .form-grid .full { grid-column: 1 / -1; }
  .inline-form { grid-template-columns: minmax(0, 1fr) 150px auto; }
  .filter { display: flex; align-items: end; }
  .filter input { padding: .55rem; }
  .qr-wrap { grid-template-columns: 170px minmax(0, 1fr); }
  .qr-wrap img { width: 170px; }
  .codes { columns: 2; font-size: 1.1rem; }
  .team-actions { grid-template-columns: minmax(0, 1fr) auto; }
  .agent-grid, .tool-grid, .integration-grid, .partner-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
}

@media (min-width: 1000px) {
  body { padding-bottom: 0; }
  .topbar nav { position: static; flex: 1; overflow: visible; padding: 0; border: 0; background: transparent; box-shadow: none; }
  .topbar nav a { min-width: auto; padding-inline: .58rem; font-size: .76rem; }
  .identity > span { display: inline; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .board { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: start; overflow: visible; margin-inline: 0; padding: 0 0 2rem; scroll-snap-type: none; }
  .board-column { min-width: 0; }
}

@media (min-width: 1200px) {
  .topbar { gap: 2rem; padding-inline: 3vw; }
  .topbar nav { gap: .35rem; }
  .topbar nav a { padding-inline: .8rem; }
  .shell { padding-inline: 3vw; }
}

@media (hover: hover) and (pointer: fine) {
  .app-card:hover, .tool-card:hover, .list-row:hover { background-color: var(--panel2); }
  .button:hover, button:hover { box-shadow: 0 0 0 1px #ffffff12; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media print {
  body { padding: 0; background: white; color: black; }
  .topbar, .button, button, .filter { display: none !important; }
  .shell { padding: 0; }
  .panel, .stat-grid article { break-inside: avoid; border-color: #999; }
  .muted, small { color: #555; }
}
