/* Look and layout ported from the Mokkup frontend (ai-tableau): dark sidebar, light work pane, centred login card. */
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, "Segoe UI", Roboto, sans-serif; color: #14161c; background: #f4f5f7; }
a { color: #4f7cff; }

/* ---------- shell ---------- */
.dashboard { display: flex; height: 100svh; overflow: hidden; background: #f4f5f7; }
.dashboard__content { flex: 1; min-height: 0; overflow-y: auto; padding: 2.25rem 2.5rem 4rem; text-align: left; }
.dashboard__head { margin-bottom: 1.5rem; }
.dashboard__eyebrow { margin: 0 0 .3rem; font-size: .7rem; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; color: #9aa0ad; }
.dashboard__head h1 { margin: 0; font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; max-width: 26ch; overflow-wrap: anywhere; }
.dashboard__main { display: flex; flex-direction: column; gap: 1.25rem; max-width: 900px; min-width: 0; }

.dashboard__gate { background: #fff; border: 1px solid #e2e4ea; border-radius: 12px; padding: 1.5rem; }
.dashboard__gate h2 { margin: 0 0 .5rem; font-size: 1.05rem; }
.dashboard__gate p { margin: 0 0 1rem; color: #5b6070; font-size: .9rem; line-height: 1.5; }
.dashboard__gate ol { margin: 0; padding-left: 1.2rem; color: #5b6070; font-size: .9rem; }
.dashboard__gate label { display: block; margin: .4rem 0; font-size: .92rem; }
.dashboard__gate h2 + small, .dashboard__gate small { color: #8a8f9a; }
.dashboard__gate input[type="number"] { width: 4rem; padding: .25rem .4rem; border: 1px solid #cbd2d8; border-radius: 6px; }
.dashboard__gate button, .btn { background: #4f7cff; color: #fff; border: none; border-radius: 8px; padding: .6rem 1.1rem; font-size: .92rem; cursor: pointer; text-decoration: none; display: inline-block; }
.dashboard__gate button:hover, .btn:hover { background: #3d6af0; }
.dashboard__gate button:disabled { opacity: .6; cursor: not-allowed; }
.dashboard__gate .btn--ghost, button.btn--ghost { background: none; color: #96271b; border: 1px solid #f5c2bd; }
.dashboard__gate .btn--ghost:hover, button.btn--ghost:hover { background: #fdecea; }
.dashboard__gate ul { margin: 0 0 1rem; padding-left: 1.2rem; font-size: .92rem; }
.dashboard__gate img { max-width: 100%; margin-top: 1rem; border: 1px solid #e2e4ea; border-radius: 8px; }
.dashboard__actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.dashboard__actions form { margin: 0; }

.dashboard__summary { white-space: pre-wrap; word-break: break-word; background: #f7f8fa; border: 1px solid #e9ebf0; border-radius: 8px; padding: .75rem; font-size: .82rem; line-height: 1.5; color: #33383f; max-height: 14rem; overflow-y: auto; margin: 0; }
.dashboard__error { background: #fdecea; border: 1px solid #f5c2bd; color: #96271b; border-radius: 8px; padding: .7rem .9rem; font-size: .88rem; white-space: pre-wrap; margin: 0; }
.dashboard__note { background: #f4f5f7; border: 1px solid #dfe1e6; color: #4b5563; border-radius: 8px; padding: .7rem .9rem; font-size: .85rem; margin: 0; }

/* ---------- sidebar ---------- */
.sidebar { width: 300px; min-width: 300px; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; padding: 0 1.15rem 1.25rem; background: #14161c; color: #f1f2f4; text-align: left; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 999px; }

.sidebar__brand { display: flex; align-items: center; gap: .65rem; padding: 1.35rem .25rem 1.1rem; color: inherit; text-decoration: none; }
.sidebar__mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(140deg, #4f7cff, #8a5cf6); display: grid; place-items: center; flex: none; }
.sidebar__brand strong { display: block; font-size: .98rem; letter-spacing: -.01em; }
.sidebar__brand em { display: block; font-style: normal; font-size: .7rem; color: #7b8290; letter-spacing: .04em; }

.sidebar__account { border-top: 1px solid rgba(255,255,255,.08); border-bottom: 1px solid rgba(255,255,255,.08); padding: .55rem 0; }
.sidebar__account > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .6rem; padding: .3rem .25rem; border-radius: 6px; }
.sidebar__account > summary::-webkit-details-marker { display: none; }
.sidebar__account > summary:hover { background: rgba(255,255,255,.05); }
.sidebar__account > summary::after { content: ""; margin-left: auto; border-left: 5px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent; color: #7b8290; transition: transform .15s ease; }
.sidebar__account[open] > summary::after { transform: rotate(90deg); }
.sidebar__avatar { width: 30px; height: 30px; border-radius: 50%; background: #2b3140; display: grid; place-items: center; font-weight: 600; font-size: .75rem; flex: none; overflow: hidden; }
.sidebar__avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar__who { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__details { margin: .6rem 0 .5rem; display: grid; grid-template-columns: 3.1rem 1fr; gap: .25rem .6rem; font-size: .76rem; padding: 0 .25rem; }
.sidebar__details dt { color: #767d8b; }
.sidebar__details dd { margin: 0; color: #c9cdd6; word-break: break-word; }
.sidebar__account form { margin: 0; }
.sidebar__logout { width: 100%; margin-top: .4rem; background: transparent; border: 1px solid #333a49; color: #c9cdd6; border-radius: 6px; padding: .4rem; font-size: .8rem; cursor: pointer; }
.sidebar__logout:hover { background: #1d212b; color: #fff; }

/* ---------- upload form (sidebar) ---------- */
.upload-form { display: flex; flex-direction: column; padding: 1.25rem .25rem; }
.upload-form h2 { font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; color: #9aa3b2; margin: 0 0 1rem; }
.upload-form label { font-size: .8rem; color: #c3c9d4; margin-bottom: .3rem; }
.upload-form input[type="file"] { background: #1c2028; border: 1px solid #333a47; border-radius: 6px; color: #f1f2f4; padding: .4rem; margin-bottom: .9rem; font-size: .875rem; width: 100%; }
.upload-form button { padding: .6rem; border: none; border-radius: 6px; background: #4f7cff; color: #fff; font-weight: 600; cursor: pointer; }
.upload-form button:hover:not(:disabled) { background: #3a63e0; }
.upload-form button:disabled { opacity: .6; cursor: not-allowed; }
.upload-form__error { color: #ff8080; font-size: .8rem; margin: 0 0 .9rem; }

/* ---------- run history (sidebar) ---------- */
.history { border-top: 1px solid rgba(255,255,255,.08); padding: .9rem 0 .3rem; }
.history > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .5rem; font-size: .72rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: #9aa0ad; padding: .35rem 0; }
.history > summary::-webkit-details-marker { display: none; }
.history > summary::before { content: ""; border-left: 5px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .15s ease; }
.history[open] > summary::before { transform: rotate(90deg); }
.history > summary:hover { color: #d6dae2; }
.history__count { margin-left: auto; background: rgba(255,255,255,.1); border-radius: 999px; padding: .05rem .45rem; font-size: .7rem; letter-spacing: 0; }
.history__empty { font-size: .78rem; color: #7b8290; margin: .4rem 0; }
.history__list { list-style: none; margin: .3rem 0 0; padding: 0; }
.history__item a { display: flex; flex-direction: column; gap: .1rem; border-left: 2px solid transparent; padding: .4rem .5rem; color: #c9cdd6; font-size: .8rem; text-decoration: none; border-radius: 0 4px 4px 0; }
.history__item a:hover { background: rgba(255,255,255,.05); }
.history__item[data-active="true"] a { border-left-color: #4f7cff; background: rgba(79,124,255,.12); color: #fff; }
.history__name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.history__meta { font-size: .72rem; color: #838a97; }
.history__when { white-space: nowrap; }
.history__item[data-status="failed"] .history__meta { color: #e29b90; }
.history__item[data-status="succeeded"] .history__meta { color: #6fc39a; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f4f5f7; }
.login-card { background: #fff; padding: 2.5rem; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.08); width: 100%; max-width: 360px; display: flex; flex-direction: column; }
.login-card h1 { margin: 0 0 1.5rem; font-size: 1.5rem; text-align: center; color: #1a1a1a; }
.login-card label { font-size: .875rem; margin-bottom: .375rem; color: #333; }
.login-card input[type="email"], .login-card input[type="text"] { padding: .625rem .75rem; margin-bottom: 1.25rem; border: 1px solid #d0d3d9; border-radius: 8px; font-size: 1rem; }
.login-card input:focus { outline: none; border-color: #4f7cff; box-shadow: 0 0 0 3px rgba(79,124,255,.15); }
.login-card button { padding: .75rem; border: none; border-radius: 8px; background: #4f7cff; color: #fff; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background .15s ease; }
.login-card button:hover:not(:disabled) { background: #3a63e0; }
.login-card button:disabled { opacity: .6; cursor: not-allowed; }
.login-card a.login-secondary { margin-top: .5rem; text-align: center; padding: .7rem; border: 1px solid #d5dced; border-radius: 8px; color: #4f7cff; font-weight: 500; text-decoration: none; }
.login-card a.login-secondary:hover { background: #f4f7ff; }
.login-error { color: #d63333; font-size: .875rem; margin: -.5rem 0 1rem; }
.login-notice { color: #6b5b16; background: #fdf6dd; border: 1px solid #f0e3a8; border-radius: 6px; padding: .5rem .75rem; font-size: .875rem; margin: -.5rem 0 1rem; }

@media (max-width: 800px) {
  .dashboard { flex-direction: column; height: auto; overflow: visible; }
  .sidebar { width: auto; min-width: 0; }
  .dashboard__content { padding: 1.5rem 1rem 3rem; }
}

/* ---------- Mokkup build progress ---------- */
.build__line { font-weight: 600; color: #14161c; }
.build__events { list-style: none; margin: 0 0 1rem; padding: 0; font-size: .85rem; color: #33383f; }
.build__events li { padding: .2rem 0; }
.dashboard__gate select { padding: .4rem .5rem; border: 1px solid #cbd2d8; border-radius: 6px; margin-left: .4rem; }
.dashboard__gate form + form { margin-top: .75rem; }
.build__heading { margin: 1rem 0 .4rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: #8a8f9a; }
.build__calls { width: 100%; border-collapse: collapse; font-size: .8rem; margin-bottom: 1rem; }
.build__calls th { text-align: left; font-weight: 600; color: #8a8f9a; padding: .25rem .4rem; }
.build__calls td { padding: .3rem .4rem; border-top: 1px solid #eceef2; word-break: break-all; }
.build__calls td small { display: block; color: #8a8f9a; }
.build__calls tr.is-error td { color: #96271b; background: #fdecea; }
.build__calls tr.is-live td { color: #1b3a73; background: #eaf2ff; }
.build__plan { margin: 0 0 1rem; padding-left: 1.2rem; font-size: .85rem; color: #5b6070; }

/* ---------- one-click migration stepper ---------- */
.steps { list-style: none; margin: 0 0 1.25rem; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.steps li { display: flex; align-items: flex-start; gap: .65rem; font-size: .95rem; color: #9aa0ad; }
.steps__pip { width: 14px; height: 14px; margin-top: .22rem; border-radius: 50%; border: 2px solid #cfd3dc; flex: none; }
.steps li[data-state="done"] { color: #14161c; }
.steps li[data-state="done"] .steps__pip { background: #2fa84f; border-color: #2fa84f; }
.steps li[data-state="active"] { color: #14161c; font-weight: 600; }
.steps li[data-state="active"] .steps__pip { border-color: #4f7cff; border-top-color: transparent; animation: spin 1s linear infinite; }
.steps li[data-state="failed"] { color: #96271b; font-weight: 600; }
.steps li[data-state="failed"] .steps__pip { background: #d63333; border-color: #d63333; }
@keyframes spin { to { transform: rotate(360deg); } }
.build__note { font-size: .82rem; color: #8a8f9a; margin: .5rem 0 0; }
.dashboard__delete { margin: 1.25rem 0 0; }
.upload-form__note { margin: .6rem 0 0; font-size: .72rem; color: #7b8290; }
.upload-form__text { background: #1c2028; border: 1px solid #333a47; border-radius: 6px; color: #f1f2f4; padding: .5rem .6rem; margin-bottom: .9rem; font-size: .875rem; width: 100%; }
.upload-form__check { display: flex; align-items: center; gap: .4rem; margin-bottom: .6rem; }
.history__item[data-status="running"] .history__meta { color: #8aa9ff; }
.dashboard__gate .steps { margin: 0 0 1.25rem; padding-left: 0; }

/* sub-steps under the active "Build in Mokkup" step */
.steps__body { display: block; }
.steps .steps__sub { list-style: none; margin: .5rem 0 0; padding: 0 0 0 .2rem; display: flex; flex-direction: column; gap: .3rem; }
.steps .steps__sub li { align-items: center; gap: .5rem; font-size: .82rem; font-weight: 400; color: #8a8f9a; }
.steps .steps__sub li::before { content: "✓"; color: #2fa84f; font-size: .75rem; width: .9rem; flex: none; }
.steps .steps__sub li[data-state="active"] { color: #14161c; font-weight: 400; }
.steps .steps__sub li[data-state="active"]::before { content: ""; width: .6rem; height: .6rem; margin: 0 .15rem; border-radius: 50%; border: 2px solid #4f7cff; border-top-color: transparent; animation: spin 1s linear infinite; }

/* page choice for multi-page reports */
.steps li[data-state="waiting"] { color: #14161c; font-weight: 600; }
.steps li[data-state="waiting"] .steps__pip { border-color: #e0a526; background: #fff6e0; }
.page-choice { display: flex; flex-direction: column; gap: .5rem; max-width: 34rem; }
.page-choice label { margin: 0; font-size: .8rem; color: #8a8f9a; }
.page-choice select { margin-left: 0; padding: .55rem .6rem; font-size: .95rem; }
.page-choice button { align-self: flex-start; margin-top: .4rem; }
.history__item[data-status="awaiting_page"] .history__meta { color: #d9a63a; }
