:root {
  /* fabrincando brand palette (#19) */
  --brand-black: #101820;
  --brand-teal: #00D4BE;
  --brand-orange: #FF8000;
  --brand-white: #F8F9FA;
  --brand-graphite: #1E293B;
  --brand-slate: #64748B;
  --brand-silver: #CBD5E1;
  --brand-teal-dark: #008F83;
  --brand-teal-light: #99F6E4;
  --brand-orange-light: #FFB866;

  /* UI roles. Teal and orange are too light for text on white, so text uses darker shades of them. */
  --bg: var(--brand-white);
  --panel: #ffffff;
  --text: var(--brand-graphite);
  --muted: var(--brand-slate);
  --border: #E2E8F0;
  --accent: var(--brand-teal);
  --on-accent: var(--brand-black);
  --accent-text: #007A70;
  --accent-soft: #E6FBF8;
  --ok: #2b8a3e;
  --warn: #B35900;
  --warn-soft: #FFF4E6;
  --err: #c92a2a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent-text); }
:root { accent-color: var(--brand-teal-dark); }
:focus-visible { outline: 2px solid var(--brand-teal-dark); outline-offset: 2px; }
.topbar :focus-visible { outline-color: var(--brand-teal); }
.modal input:focus, .modal textarea:focus { outline: 2px solid var(--brand-teal-light); border-color: var(--brand-teal-dark); }
.hidden { display: none !important; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 20px; background: var(--brand-black); color: var(--brand-white); border-bottom: 3px solid var(--brand-teal); }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 17px; min-width: 0; }
.brand-logo { display: flex; flex: none; }
.brand-logo img { height: 44px; width: auto; display: block; }
.brand-page { padding-left: 12px; border-left: 1px solid var(--brand-graphite); color: var(--brand-white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-tagline { font-weight: 500; font-size: 13px; color: var(--brand-silver); }
.brand-tagline b { color: var(--brand-teal); font-weight: 600; }
@media (max-width: 700px) { .brand-tagline { display: none; } }
.topbar-actions { display: flex; gap: 8px; }
select { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: #fff; max-width: 280px; }

.btn { border: 1px solid var(--border); background: #fff; color: var(--text); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.btn:hover { background: #f0f2f5; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--brand-teal-light); border-color: var(--brand-teal-light); }
.btn.danger { color: var(--err); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.wide { width: 100%; margin-top: 12px; padding: 11px; font-weight: 600; }

.layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 16px; padding: 16px; min-height: 0; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.chat { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 80%; padding: 11px 15px; border-radius: 14px; line-height: 1.5; font-size: 15px; }
.msg.consultant { background: var(--accent-soft); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.customer { background: var(--brand-graphite); color: var(--brand-white); align-self: flex-end; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.error { background: #fff5f5; color: var(--err); align-self: center; font-size: 13px; }
.msg .who { font-size: 11px; color: var(--muted); margin-bottom: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.typing::after { content: "▍"; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.composer textarea, .change textarea { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 15px; }
.composer textarea:focus, .change textarea:focus { outline: 2px solid var(--brand-teal-light); border-color: var(--brand-teal-dark); }

.side { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; min-height: 0; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.card h2, .card h3 { margin: 0; font-size: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
details.card summary { cursor: pointer; font-weight: 600; }
.badge { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: #eef0f4; color: var(--muted); font-weight: 600; white-space: nowrap; }
.badge.awaiting_confirmation { background: var(--warn-soft); color: var(--warn); }
.badge.accepted { background: #e6fcf5; color: #087f5b; }
.badge.building, .badge.starting { background: var(--accent-soft); color: var(--accent-text); }
.badge.running { background: #ebfbee; color: var(--ok); }
.badge.failed { background: #fff5f5; color: var(--err); }

.topics { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; font-size: 13.5px; }
.topics li { color: var(--muted); }
.topics li::before { content: "○ "; }
.topics li.done { color: var(--text); }
.topics li.done::before { content: "● "; color: var(--ok); }

.md { font-size: 14px; line-height: 1.5; }
.md h1 { font-size: 18px; } .md h2 { font-size: 15px; margin: 14px 0 4px; } .md h3 { font-size: 14px; margin: 12px 0 4px; }
.md ul { padding-left: 20px; margin: 4px 0; }
.md p { margin: 6px 0; }
.md code { background: #f1f3f5; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.msg .md p:first-child { margin-top: 0; } .msg .md p:last-child { margin-bottom: 0; }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; text-align: center; }

.applink { background: var(--accent-soft); border: 1px solid var(--brand-teal-light); border-radius: 10px; padding: 12px; margin-bottom: 10px; font-size: 14px; }
.applink a { font-weight: 700; color: var(--accent-text); font-size: 16px; }
.error { background: #fff5f5; color: var(--err); border-radius: 8px; padding: 10px; font-size: 13px; margin-bottom: 10px; }
.buildlog { background: var(--brand-black); color: var(--brand-silver); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; border-radius: 8px; padding: 10px; max-height: 420px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; }
.buildlog:empty::before { content: "Waiting for build…"; color: var(--brand-slate); }
.log-status { color: var(--brand-teal); }
.log-tool { color: var(--brand-orange-light); }
.log-result { color: #ff8787; }
.log-error { color: #ff6b6b; font-weight: 700; }
.log-text { color: var(--brand-white); }
.change { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

/* GitHub delivery */
.delivery { margin: 8px 0; padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); font-size: 13px; line-height: 1.5; }
.delivery .error { margin-bottom: 6px; }
.delivery .hint { margin-top: 4px; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* identity dialog (shared with the factory floor) */
.modal-overlay { position: fixed; inset: 0; background: rgba(16, 24, 32, .6); display: grid; place-items: center; z-index: 100; }
.modal { background: #fff; color: var(--brand-graphite); border-radius: 12px; padding: 22px 24px; width: min(440px, 92vw); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; }
.modal h2 { margin: 0; font-size: 18px; }
.modal label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.modal input[type=text], .modal input:not([type]), .modal textarea { padding: 8px 10px; border: 1px solid #e2e5eb; border-radius: 8px; font: inherit; font-weight: 400; }
.modal fieldset { border: 1px solid #e2e5eb; border-radius: 8px; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; }
.modal legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.modal label.radio { flex-direction: row; align-items: flex-start; font-weight: 400; gap: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.delivery .pipeline { margin-top: 6px; }

/* welcome pop-up: the full logo on a brand-black banner */
.welcome-banner { margin: -22px -24px 0; padding: 22px 28px; background: var(--brand-black); border-radius: 12px 12px 0 0; border-bottom: 3px solid var(--brand-teal); }
.welcome-banner img { display: block; width: 100%; height: auto; }

/* Signed-in person menu (#2) */
.modal select { padding: 8px 10px; border: 1px solid #e2e5eb; border-radius: 8px; font: inherit; font-weight: 400; }
.me-menu { position: fixed; z-index: 90; background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; min-width: 220px; box-shadow: 0 12px 32px rgba(16, 24, 32, .18); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
body .me-menu .muted, body .me-menu .me-label { color: var(--brand-slate); }
.me-menu .me-label { margin-top: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.me-menu ul { margin: 0; padding-left: 18px; }
.me-menu button { margin-top: 8px; align-self: flex-start; }
.me-menu a { color: var(--accent-text); }
.me-menu .me-link { display: block; margin-top: 6px; font-weight: 600; text-decoration: none; }
.me-menu .small { font-size: 12px; }
.ws-switcher { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--brand-graphite); font: inherit; font-size: 14px; max-width: 220px; }

/* Sign-in page (#2) */
.signin-page { min-height: 100vh; display: grid; place-items: center; background: var(--brand-black); padding: 24px; }
.signin-card { background: #fff; border-radius: 16px; padding: 32px 30px; width: 100%; box-sizing: border-box; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 24px 80px rgba(0, 0, 0, .4); }
.signin-wrap { display: flex; flex-direction: column; align-items: center; gap: 22px; width: min(420px, 100%); }
.signin-logo { width: 240px; }
.signin-card h1 { margin: 0; font-size: 20px; }
.signin-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.signin-card form { display: flex; flex-direction: column; gap: 12px; }
.signin-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.signin-card input { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-weight: 400; }
.signin-card input:focus { outline: 2px solid var(--brand-teal-light); border-color: var(--brand-teal-dark); }
.signin-card .btn { justify-content: center; padding: 10px 14px; }
.signin-card .btn.microsoft { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; box-sizing: border-box; background: #fff; color: #1b1b1b; border: 1px solid #8c8c8c; font-weight: 600; text-decoration: none; }
.signin-card .btn.microsoft:hover { background: #f3f3f3; }
#microsoftSignIn { display: flex; flex-direction: column; gap: 14px; }
#microsoftSignIn.hidden { display: none; }
.signin-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.signin-divider::before, .signin-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.signin-card .error { color: var(--err); font-size: 14px; }
.signin-card .notice { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--text); word-break: break-all; }
.signin-card section { display: flex; flex-direction: column; gap: 14px; }
.signin-card .hidden { display: none; }

/* Workspace and People pages (#2) */
body.page { height: auto; min-height: 100vh; }
.page-main { width: 100%; box-sizing: border-box; max-width: 1000px; margin: 24px auto; padding: 0 20px; display: flex; flex-direction: column; gap: 16px; }
.page-main .card { padding: 18px 20px; }
.page-main h1 { margin: 0; font-size: 24px; }
.page-main h2 { margin: 0 0 10px; font-size: 18px; }
.page-main p { margin: 6px 0; line-height: 1.5; font-size: 14px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head .row { display: flex; gap: 8px; flex-wrap: wrap; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-slate); font-weight: 700; padding: 6px 8px; border-bottom: 2px solid var(--border); }
.table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table td.actions { text-align: right; white-space: nowrap; }
.table .muted, .page-main .muted { color: var(--brand-slate); }
.table select, .inline-form select, .inline-form input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-weight: 400; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-top: 8px; }
.inline-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; }
.inline-form input[type=email], .inline-form input[type=text] { min-width: 240px; }
.notice { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; font-size: 13px; word-break: break-all; }
.tabs-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs-nav button[aria-selected=true] { background: var(--brand-black); color: #fff; border-color: var(--brand-black); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); }
.tag.manager { background: #FFF4E6; color: #8a4500; }
.table-wrap { overflow-x: auto; }
.page-main .warn { color: var(--warn); font-weight: 600; }
.table td.nowrap { white-space: nowrap; }

/* Next steps after the POC (#35) */
#plan h4 { margin: 10px 0 4px; font-size: 13px; }
ul.plan { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 13.5px; }
ul.plan li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
ul.plan li .hint { display: inline; margin: 0 0 0 4px; }
ul.plan .tag { white-space: nowrap; }
.tag.done { background: #e6f6ec; color: #1d6b3a; }

/* Local demo people on the sign-in page (#41) */
.dev-users #devUserList { display: flex; flex-direction: column; gap: 8px; }
.btn.dev-user { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 8px 12px; }
.btn.dev-user span { font-size: 12px; color: var(--muted); font-weight: 400; }
