/* Colours follow DVM Advisory's palette (ink / brand) so the portal feels like the same product. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #d5d9e2;
  --border-strong: #b0b8c8;
  --text: #1f2430;
  --muted: #65718c;
  --faint: #8590a8;
  --brand: #1f52e8;
  --brand-soft: #d9e8ff;
  --dark: #1f2430;
  --dark-hover: #383e4d;
  --dark-text: #ffffff;
  --error-bg: #fff1f2;
  --error-border: #ffe4e6;
  --error-text: #be123c;
  --info-bg: #eef5ff;
  --info-border: #d9e8ff;
  --info-text: #1740d4;
  --shadow: 0 1px 2px rgba(19, 22, 31, .04), 0 8px 24px rgba(19, 22, 31, .06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #13161f;
    --surface: #1f2430;
    --border: #383e4d;
    --border-strong: #505a72;
    --text: #eceef2;
    --muted: #b0b8c8;
    --faint: #8590a8;
    --brand: #8ebcff;
    --brand-soft: #1a3385;
    --dark: #eceef2;
    --dark-hover: #d5d9e2;
    --dark-text: #13161f;
    --error-bg: #3b0d18;
    --error-border: #5c1426;
    --error-text: #fda4af;
    --info-bg: #142054;
    --info-border: #1935a9;
    --info-text: #bcd6ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

.shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.view { width: 100%; max-width: 420px; }
.view[hidden] { display: none; }
.view.wide { max-width: 960px; align-self: flex-start; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

h1 { font-size: 24px; line-height: 1.25; margin: 0 0 6px; letter-spacing: -.01em; text-wrap: balance; }
.muted { color: var(--muted); margin: 0 0 24px; }
.center { text-align: center; }
.hint { color: var(--faint); font-size: 13px; margin: 8px 0 0; text-align: center; }
.foot { font-size: 13px; text-align: center; margin: 28px 0 0; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .01em; margin-bottom: 24px; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--brand); color: var(--surface); font-size: 15px;
}

.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 48px; padding: 12px 16px;
  border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.btn:focus-visible, .link:focus-visible, .back:focus-visible, .app-card:focus-visible, input:focus-visible {
  outline: 3px solid var(--brand-soft); outline-offset: 2px;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-dark { background: var(--dark); color: var(--dark-text); }
.btn-dark:hover:not(:disabled) { background: var(--dark-hover); }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-outline:hover:not(:disabled) { border-color: var(--border-strong); background: var(--bg); }
.btn-small { width: auto; min-height: 36px; padding: 6px 14px; font-size: 14px; }
.ms-logo { width: 18px; height: 18px; flex: none; }

.divider { display: flex; align-items: center; gap: 14px; margin: 22px 0; color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
input {
  width: 100%; min-height: 48px; padding: 10px 14px; margin-bottom: 16px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); font: inherit;
}
input:focus { border-color: var(--brand); }
.code-input { font-family: Consolas, "SFMono-Regular", monospace; font-size: 26px; letter-spacing: .5em; text-align: center; padding-left: calc(14px + .5em); }

.back, .link {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--muted);
}
.back { font-size: 14px; margin-bottom: 20px; }
.back:hover, .link:hover:not(:disabled) { color: var(--text); }
.link { display: block; margin: 16px auto 0; font-size: 14px; color: var(--brand); }
.link:disabled { color: var(--faint); cursor: default; }

.message { margin: 18px 0 0; padding: 10px 14px; border-radius: 12px; font-size: 14px; border: 1px solid; }
.message.error { background: var(--error-bg); border-color: var(--error-border); color: var(--error-text); }
.message.info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }

.spinner {
  width: 28px; height: 28px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Launcher */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 40px; }
.topbar .brand { margin: 0; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who .muted { margin: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 8px; }
.app-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 24px; min-height: 210px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  color: var(--text); text-decoration: none; box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
a.app-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.app-card.disabled { opacity: .6; box-shadow: none; }
.app-icon {
  display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 8px;
  border-radius: 12px; font-weight: 700; font-size: 19px; color: #fff;
}
.app-advisory { background: #1f52e8; }
.app-teamworks { background: #059669; }
.app-compilot { background: #65718c; }
.app-name { font-size: 18px; font-weight: 700; }
.app-desc { color: var(--muted); font-size: 14px; flex: 1; }
.app-action { font-weight: 600; font-size: 14px; color: var(--brand); }
.app-card.disabled .app-action { color: var(--faint); }

@media (max-width: 480px) {
  .card { padding: 26px 20px; }
  .shell { padding: 24px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 0s !important; }
}
