/* Panda Cloner — shared cloner page styles (MEGA, MediaFire, …). Themes override the tokens below. */
/* ==========================================================================
 * Panda Mega Cloner — cloud-storage dark theme
 * Charcoal canvas, red accent, ring spinner loaders, slim red progress bars.
 * Light theme available via html.light.
 * ========================================================================== */
:root {
  --red: #e0181f;
  --red-hover: #f0373a;
  --red-deep: #b5060c;
  --red-soft: rgba(224, 24, 31, 0.14);
  --red-ring: rgba(224, 24, 31, 0.28);
  --bg: #181818;
  --canvas: #1e1e1e;
  --surface: #262626;
  --surface-2: #2f2f2f;
  --rail: #1b1b1b;
  --line: #333333;
  --line-strong: #444444;
  --text: #f2f2f2;
  --text-2: #c9c9c9;
  --muted: #8f8f8f;
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --amber: #f5a524;
  --amber-soft: rgba(245, 165, 36, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.28);
  --radius: 14px;
  color-scheme: dark;
}
html.light {
  --bg: #f4f4f5;
  --canvas: #fafafa;
  --surface: #ffffff;
  --surface-2: #f3f3f3;
  --rail: #f7f7f7;
  --line: #e4e4e4;
  --line-strong: #cfcfcf;
  --text: #1b1b1b;
  --text-2: #4a4a4a;
  --muted: #8a8a8a;
  --red: #d90007;
  --red-hover: #b80006;
  --red-soft: #fdeceb;
  --red-ring: rgba(217, 0, 7, 0.18);
  --green: #16a34a;
  --green-soft: #e8f6ee;
  --amber: #b45309;
  --amber-soft: #fff4e5;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.05);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
html.booting body { overflow: hidden; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'JetBrains Mono', monospace; font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px !important; }
.red { color: var(--red); }
.ok { color: var(--green); }

/* ---------------------------------------------------------------- spinner */
.spinner {
  width: 92px; height: 92px; border-radius: 50%; background: #262626;
  display: flex; align-items: center; justify-content: center; position: relative;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.spinner::before {
  content: ''; position: absolute; inset: 10px; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.85); border-right-color: transparent;
  animation: spin 1s linear infinite;
}
.spinner span { width: 44px; height: 44px; border-radius: 50%; background: #262626; box-shadow: 0 0 0 4px #1b1b1b; }
.spinner.sm { width: 56px; height: 56px; flex-shrink: 0; }
.spinner.sm::before { inset: 6px; border-width: 3px; }
.spinner.sm span { width: 24px; height: 24px; }
html.light .spinner { background: #ececec; }
html.light .spinner::before { border-color: #555; border-right-color: transparent; }
html.light .spinner span { background: #ececec; box-shadow: 0 0 0 4px #f6f6f6; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- boot */
.boot {
  position: fixed; inset: 0; z-index: 3000; background: var(--boot-bg, #333333);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 70px;
  transition: opacity .45s ease, visibility .45s ease;
}
.boot.gone { opacity: 0; visibility: hidden; }
.boot-steps { position: relative; height: 120px; width: 420px; max-width: 90vw; text-align: center; }
.boot-step {
  position: absolute; left: 0; right: 0; font-size: 22px; color: var(--boot-text, #f2f2f2);
  opacity: 0; transform: translateY(70px); transition: transform .5s ease, opacity .5s ease;
}
.boot-step.now { opacity: 1; transform: translateY(0); }
.boot-step.past { opacity: .55; transform: translateY(54px); font-size: 22px; color: var(--boot-text-2, #bdbdbd); }
.boot-step.past2 { opacity: .3; transform: translateY(110px); color: var(--boot-text-3, #9a9a9a); }
.boot-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 12px; background: var(--boot-track, #1b1b1b); }
.boot-bar span { display: block; height: 100%; width: 0; background: var(--boot-bar, #c1272d); transition: width .5s ease; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 40; height: 64px; display: flex; align-items: center; gap: 14px;
  padding: 0 20px; background: var(--canvas); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; flex-shrink: 0; }
.brand-name { font-size: 18px; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap; }
.brand-name b { font-weight: 800; color: var(--red); }
.top-search {
  flex: 1; max-width: 560px; margin: 0 auto; height: 44px; display: flex; align-items: center; gap: 10px;
  padding: 0 6px 0 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
}
.top-search:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-ring); }
.top-search i { color: var(--muted); }
.top-search input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font: 500 14px 'Inter', sans-serif; min-width: 0; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 15px; flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.pill-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px;
  font-weight: 600; font-size: 13px; border: 1px solid var(--line); color: var(--text); background: var(--surface);
  text-decoration: none !important; white-space: nowrap;
}
.pill-btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.pill-btn.bot { background: #229ed9; border-color: #229ed9; color: #fff; }
.pill-btn.bot:hover { background: #1b8bc0; }
.account-chip { display: flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; position: relative; }
.account-chip > img, .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: var(--on-red, #fff); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; object-fit: cover; }
.account-menu { position: absolute; right: 0; top: 44px; min-width: 250px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; z-index: 50; cursor: default; }
.account-menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.account-menu .who b { display: block; }
.account-menu .who span { color: var(--muted); font-size: 12px; }
.account-menu button, .account-menu a { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 10px; border: 0; background: none; color: var(--text); border-radius: 8px; cursor: pointer; font: inherit; text-decoration: none !important; }
.account-menu button:hover, .account-menu a:hover { background: var(--surface-2); }

/* ---------------------------------------------------------------- layout */
.layout { display: flex; min-height: calc(100vh - 64px); }
.side {
  width: 260px; flex-shrink: 0; background: var(--rail); border-right: 1px solid var(--line);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 14px;
  position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto;
}
.new-btn {
  display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; height: 46px; padding: 0 20px;
  border-radius: 12px; border: 0; cursor: pointer; background: var(--red); color: var(--on-red, #fff);
  font: 600 14px 'Inter', sans-serif; box-shadow: 0 6px 18px var(--red-ring); transition: background .15s, transform .15s;
}
.new-btn:hover { background: var(--red-hover); transform: translateY(-1px); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-item {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 14px; border-radius: 10px; border: 0;
  background: none; color: var(--text-2); font: 500 14px 'Inter', sans-serif; cursor: pointer; text-align: left;
  text-decoration: none !important;
}
.side-item i { width: 18px; text-align: center; color: var(--muted); }
.side-item:hover { background: var(--surface); color: var(--text); }
.side-item.active { background: var(--red-soft); color: var(--red); font-weight: 600; }
.side-item.active i { color: var(--red); }
.side-sep { height: 1px; background: var(--line); margin: 8px 4px; }
.side-card { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.side-card-row { display: flex; align-items: center; gap: 8px; }
.side-card-sub { color: var(--muted); font-size: 12px; }
.plan-chip { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); }
.plan-chip.pro { background: rgba(99, 102, 241, .18); color: #a5b4fc; }
.plan-chip.ultra { background: rgba(245, 165, 36, .18); color: #fbbf24; }
html.light .plan-chip.pro { color: #4f46e5; }
html.light .plan-chip.ultra { color: #b45309; }
.quota-track { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.quota-track span { display: block; height: 100%; width: 0; background: var(--red); border-radius: 99px; transition: width .6s ease; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); flex-shrink: 0; }
.dot.on { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); animation: breathe 2s infinite; }
.dot.wait { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
@keyframes breathe { 50% { box-shadow: 0 0 0 7px transparent; } }
.side-foot { margin-top: auto; color: var(--muted); font-size: 12px; padding: 0 6px; }

.main { flex: 1; min-width: 0; padding: 26px 30px 60px; background: var(--bg); }
.page-head h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.page-head p { margin: 4px 0 20px; color: var(--muted); }
.page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.section-title { font-weight: 700; margin: 20px 0 10px; font-size: 14px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 18px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: 10px; border: 1px solid transparent; font: 600 14px 'Inter', sans-serif; cursor: pointer;
  text-decoration: none !important; white-space: nowrap; transition: background .15s, box-shadow .15s, opacity .15s, transform .15s;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-red { background: var(--red); color: var(--on-red, #fff); }
.btn-red:hover:not(:disabled) { background: var(--red-hover); box-shadow: 0 6px 18px var(--red-ring); }
.btn-light { background: var(--text); color: var(--canvas); }
.btn-soft { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-soft:hover { border-color: var(--line-strong); }
.btn-ghost { background: none; color: var(--text-2); border-color: var(--line); }
.btn-ghost:hover { color: var(--red); border-color: var(--red); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 50px; padding: 0 26px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.link-btn { border: 0; background: none; color: var(--red); font: 600 12px 'Inter', sans-serif; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }

/* ---------------------------------------------------------------- banner & toast */
.banner { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; background: var(--amber-soft); color: var(--amber); font-weight: 500; border: 1px solid rgba(245,165,36,.25); }
.banner.error { background: var(--red-soft); color: var(--red); border-color: var(--red-ring); }
.toast-host { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #111; color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.35); animation: up .2s ease; max-width: 90vw; border: 1px solid #333; }
.toast.error { background: var(--red); border-color: var(--red); }
.toast.ok { background: #15803d; border-color: #15803d; }
@keyframes up { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- hero */
.hero { text-align: center; padding: 40px 20px 20px; max-width: 740px; margin: 0 auto; }
.hero-orbit { width: 140px; height: 140px; margin: 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; }
.hero-orbit::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--red); border-right-color: transparent; border-bottom-color: transparent; animation: spin 2.4s linear infinite; opacity: .7; }
.hero-orbit img { filter: drop-shadow(0 12px 30px var(--red-ring)); }
.hero h1 { font-size: clamp(28px, 4vw, 44px); letter-spacing: -0.03em; line-height: 1.12; margin: 18px 0 12px; }
.hero p { color: var(--text-2); font-size: 16px; margin: 0 auto 26px; max-width: 560px; }
.hero-note { color: var(--muted); font-size: 13px; margin-top: 10px; }
.hero-points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 40px; text-align: left; }
.hero-points div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.hero-points i { color: var(--red); font-size: 18px; margin-bottom: 6px; }
.hero-points span { color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- engine card */
.engine-card { padding: 18px 20px; }
.engine-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.engine-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--red-soft); color: var(--red); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.engine-card.ok { border-color: rgba(34, 197, 94, .4); }
.engine-card.ok .engine-icon { background: var(--green-soft); color: var(--green); }
.engine-card.wait .engine-icon { background: var(--amber-soft); color: var(--amber); }
.engine-meta { flex: 1; min-width: 180px; }
.engine-title { font-weight: 700; font-size: 16px; }
.engine-sub { color: var(--muted); font-size: 13px; }
.engine-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pair { display: grid; grid-template-columns: 210px 1fr; gap: 20px; margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--line); }
.pair-code-box { background: var(--canvas); border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pair-label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.pair-code { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 26px; letter-spacing: .08em; color: var(--red); }
.pair-exp { font-size: 12px; color: var(--muted); }
.pair-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; font-size: 13px; }
.pair-steps li::marker { color: var(--red); font-weight: 700; }
.pair-steps li > b:first-child { display: block; margin-bottom: 2px; font-size: 14px; }
.pair-btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.engine-progress { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.stage { padding: 7px 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12.5px; font-weight: 500; display: inline-flex; gap: 8px; align-items: center; }
.stage.now { background: var(--amber-soft); color: var(--amber); }
.stage.now i { animation: pulse 1.2s infinite; }
.stage.done { background: var(--green-soft); color: var(--green); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------------------------------------------------------------- form */
.transfer-form { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.form-head { display: flex; align-items: center; justify-content: space-between; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.field-label { font-weight: 600; font-size: 13px; }
.field-hint { font-size: 12px; color: var(--muted); }
.field-hint.bad { color: var(--red); }
.field-hint.good { color: var(--green); }
.input-wrap { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 6px 0 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--canvas); transition: border-color .15s, box-shadow .15s; }
.input-wrap:focus-within, .batch-box:focus { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-ring); }
.input-wrap > i { color: var(--muted); }
.input-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: 500 14px 'Inter', sans-serif; height: 100%; }
.batch-box { width: 100%; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--canvas); color: var(--text); padding: 12px 14px; font: 500 13px 'JetBrains Mono', monospace; resize: vertical; outline: 0; }
.prefix { color: var(--muted); font-weight: 500; white-space: nowrap; }
.form-note { text-align: center; color: var(--muted); font-size: 12px; }
.wm-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--amber-soft); border: 1px solid rgba(245,165,36,.25); margin-top: 6px; }
.wm-icon { width: 34px; height: 34px; border-radius: 10px; background: rgba(245,165,36,.2); color: var(--amber); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wm-text { flex: 1; display: flex; flex-direction: column; font-size: 12px; color: var(--text-2); }
.wm-text b { color: var(--text); font-size: 13px; }

/* ---------------------------------------------------------------- queue */
.jobs { display: flex; flex-direction: column; gap: 8px; }
.job { padding: 12px 14px; display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; cursor: pointer; transition: border-color .15s; }
.job:hover, .job.focus { border-color: var(--red); }
.job-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--red-soft); color: var(--red); display: flex; align-items: center; justify-content: center; }
.job.completed .job-icon { background: var(--green-soft); color: var(--green); }
.job-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-sub { color: var(--muted); font-size: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.mini-bar { height: 3px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.mini-bar span { display: block; height: 100%; background: var(--red); transition: width .6s ease; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.running { background: var(--red-soft); color: var(--red); }
.badge.queued { background: var(--amber-soft); color: var(--amber); }
.badge.completed { background: var(--green-soft); color: var(--green); }
.badge.failed { background: var(--red-soft); color: var(--red); }

/* ---------------------------------------------------------------- live monitor */
.monitor { min-height: 520px; overflow: hidden; position: sticky; top: 84px; }
.mon-empty { padding: 56px 28px; text-align: center; }
.mon-empty h3 { margin: 22px 0 6px; font-size: 17px; }
.mon-empty p { color: var(--muted); margin: 0 auto; max-width: 360px; font-size: 13px; }
.me-art { display: flex; align-items: center; justify-content: center; gap: 18px; }
.me-cloud, .me-drive { width: 66px; height: 66px; border-radius: 18px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 30px; border: 1px solid var(--line); }
.me-drive { color: #4285f4; }
.me-cloud { animation: bob 2.4s ease-in-out infinite; }
.me-drive { animation: bob 2.4s ease-in-out infinite .6s; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.me-dots { display: flex; gap: 7px; }
.me-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: hop 1.2s infinite ease-in-out; }
.me-dots span:nth-child(2) { animation-delay: .15s; }
.me-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes hop { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1.15); } }
.me-legend { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-top: 22px; font-size: 12px; color: var(--text-2); }

.mon-live { display: flex; flex-direction: column; }
.tw-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.tw-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--red-soft); color: var(--red); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.tw-title { flex: 1; min-width: 0; }
.tw-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-dest { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phase-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 99px; background: var(--red-soft); color: var(--red); font-size: 12px; font-weight: 700; white-space: nowrap; }
.phase-pill .pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1s infinite; }
.phase-pill.done { background: var(--green-soft); color: var(--green); }
.phase-pill.done .pulse, .phase-pill.failed .pulse, .phase-pill.queued .pulse { animation: none; }
.phase-pill.queued { background: var(--amber-soft); color: var(--amber); }
.phase-pill.failed { background: var(--red-soft); color: var(--red); }

.phase-loader { display: flex; align-items: center; gap: 18px; padding: 22px 20px; background: #2a2a2a; border-bottom: 1px solid var(--line); }
html.light .phase-loader { background: #f1f1f1; }
.phase-steps { position: relative; flex: 1; height: 64px; overflow: hidden; }
.phase-step { position: absolute; left: 0; right: 0; font-size: 15px; color: var(--text); opacity: 0; transform: translateY(40px); transition: transform .45s ease, opacity .45s ease; }
.phase-step.now { opacity: 1; transform: translateY(0); font-weight: 600; }
.phase-step.past { opacity: .5; transform: translateY(24px); font-size: 13px; }
.phase-step.past2 { opacity: .25; transform: translateY(44px); font-size: 13px; }

.tw-progress { padding: 16px 18px 6px; }
.tw-row { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; }
.tw-row.small { font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 8px; }
.track { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 10px; position: relative; }
.fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--red-deep), var(--red), #ff5a5f); position: relative; transition: width .8s cubic-bezier(.22,.8,.32,1); overflow: hidden; }
.fill.active::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); transform: translateX(-100%); animation: shimmer 1.4s infinite; }
.fill.indeterminate { width: 35% !important; animation: indet 1.3s infinite ease-in-out; }
.fill.complete { background: linear-gradient(90deg, #15803d, var(--green)); }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes indet { 0% { transform: translateX(-110%); } 100% { transform: translateX(300%); } }

.tw-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px 18px; }
.tw-stats div { background: var(--canvas); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.tw-stats b { font-size: 17px; font-variant-numeric: tabular-nums; }
.tw-stats span { font-size: 11px; color: var(--muted); }
.tw-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 18px 10px; }
.tw-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tw-tab { border: 1px solid var(--line); background: none; color: var(--text-2); border-radius: 99px; padding: 5px 12px; font: 600 12px 'Inter', sans-serif; cursor: pointer; }
.tw-tab i { font-style: normal; color: var(--muted); margin-left: 2px; }
.tw-tab.active { background: var(--red); border-color: var(--red); color: var(--on-red, #fff); }
.tw-tab.active i { color: var(--on-red, #fff); opacity: .8; }
.tw-list { max-height: 300px; overflow-y: auto; border-top: 1px solid var(--line); }
.tw-item { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 9px 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
.tw-item.fresh { animation: slideIn .4s ease; }
.tw-item.fresh.done { animation: slideIn .4s ease, flashOk 1.2s ease; }
@keyframes flashOk { 0% { background: var(--green-soft); } 100% { background: transparent; } }
.tw-item .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-item .p { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-item .s { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tw-item .fa-circle-check { color: var(--green); }
.tw-item .fa-circle-notch { color: var(--red); }
.tw-list[data-f="copying"] .tw-item:not(.copying), .tw-list[data-f="done"] .tw-item:not(.done) { display: none; }
.tw-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 13px; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } }

.tw-done { position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: center; padding: 18px; margin: 12px 18px; border-radius: 14px; background: var(--green-soft); border: 1px solid rgba(34,197,94,.3); overflow: hidden; }
.tw-done.failed { background: var(--red-soft); border-color: var(--red-ring); }
.done-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; animation: pop .55s cubic-bezier(.2,1.6,.4,1); box-shadow: 0 0 0 8px rgba(34,197,94,.15); }
.tw-done.failed .done-icon { background: var(--red); box-shadow: 0 0 0 8px var(--red-ring); }
.done-text { display: flex; flex-direction: column; }
.done-text b { font-size: 15px; }
.done-text span { color: var(--text-2); font-size: 12.5px; }
.done-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
@keyframes pop { from { transform: scale(0); } }
.done-burst { position: absolute; inset: 0; pointer-events: none; }
.done-burst i { position: absolute; width: 7px; height: 12px; border-radius: 2px; top: 30px; left: 46px; opacity: 0; animation: burst 1.1s ease-out forwards; }
@keyframes burst { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--r)); } }

.tw-log { border-top: 1px solid var(--line); }
.tw-log summary { cursor: pointer; padding: 12px 18px; font-weight: 600; font-size: 13px; color: var(--text-2); list-style: none; }
.tw-log summary i { margin-right: 6px; color: var(--muted); }
.console { max-height: 220px; overflow-y: auto; background: #111; color: #d4d4d4; font: 500 12px/1.6 'JetBrains Mono', monospace; padding: 10px 18px; }
html.light .console { background: #1e1e1e; }
.console .l { white-space: pre-wrap; word-break: break-word; }
.console .t { color: #6b6b6b; margin-right: 8px; }
.console .success { color: #4ade80; }
.console .error { color: #f87171; }
.console .warn { color: #fbbf24; }
.console .muted { color: #8f8f8f; }

/* ---------------------------------------------------------------- history */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 12px; }
.table-card { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface-2); }
.table .empty { text-align: center; color: var(--muted); padding: 40px; }
.cell-name { font-weight: 600; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- guide */
.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.guide { padding: 18px; }
.guide h3 { margin: 10px 0 6px; font-size: 15px; }
.guide p { margin: 0; color: var(--text-2); font-size: 13px; }
.g-num { width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: var(--on-red, #fff); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.plans-mini { padding: 18px; margin-bottom: 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.plans-mini .pm { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--canvas); }
.plans-mini .pm.current { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-ring); }
.plans-mini .pm b { display: block; font-size: 15px; }
.plans-mini .pm ul { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); font-size: 12.5px; }
.faq { padding: 6px 20px; }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
.faq summary::after { content: '+'; color: var(--red); font-weight: 700; }
.faq details[open] summary::after { content: '−'; }
.faq p { color: var(--text-2); margin: 8px 0 0; }

/* ---------------------------------------------------------------- responsive */
.only-mobile { display: none; }
.scrim { display: none; }
@media (max-width: 1180px) {
  .grid-2 { grid-template-columns: 1fr; }
  .monitor { position: static; min-height: 0; }
}
@media (max-width: 1000px) { .hide-md { display: none !important; } }
@media (max-width: 900px) {
  .only-mobile { display: inline-flex; }
  .topbar { padding: 0 12px; gap: 6px; }
  .pill-btn .btn-text { display: none; }
  .side { position: fixed; left: 0; top: 64px; z-index: 45; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  body.side-open .side { transform: none; }
  body.side-open .scrim { display: block; position: fixed; inset: 64px 0 0; background: rgba(0,0,0,.45); z-index: 44; }
  .main { padding: 20px 14px 60px; }
  .pair { grid-template-columns: 1fr; }
  .guide-grid, .hero-points, .plans-mini { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .brand-name { font-size: 15px; }
  .tw-stats { grid-template-columns: repeat(2, 1fr); }
  .prefix { display: none; }
  .boot-step { font-size: 18px !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------------- modals */
.modal { position: fixed; inset: 0; z-index: 1500; background: rgba(0, 0, 0, .62); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.modal-box { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 24px 60px rgba(0,0,0,.5); animation: rise .3s cubic-bezier(.2,.9,.3,1.2); }
@keyframes rise { from { transform: translateY(18px) scale(.97); opacity: 0; } }
.modal-accent { height: 5px; background: linear-gradient(90deg, var(--red-deep), var(--red), #ff6b6f); border-radius: 20px 20px 0 0; }
.modal-body { padding: 22px 24px 20px; }
.modal-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--red-soft); color: var(--red); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.center { text-align: center; }
.notice-list { display: flex; flex-direction: column; gap: 10px; }
.notice-item { display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 12px; border-radius: 12px; background: var(--canvas); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.notice-item b { color: var(--text); }
.notice-item > div > b:first-child { display: block; font-size: 14px; margin-bottom: 2px; }
.notice-item.warn { background: var(--amber-soft); border-color: rgba(245,165,36,.35); }
.notice-item.warn .n-num { background: var(--amber); color: #1b1b1b; }
.n-num { width: 28px; height: 28px; border-radius: 50%; background: var(--red); color: var(--on-red, #fff); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.consent-check { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--line-strong); font-weight: 600; font-size: 13px; cursor: pointer; }
.consent-check input { width: 18px; height: 18px; accent-color: var(--red); }

.drive-hero { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 4px 0 14px; }
.dh-ring { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 30px; color: #4285f4; background: var(--canvas); position: relative; }
.dh-ring::before { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 3px solid var(--red); border-right-color: transparent; animation: spin 1.1s linear infinite; }
.dh-arrow { display: flex; gap: 5px; transform: scaleX(-1); }
.dh-arrow span { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: hop 1.1s infinite ease-in-out; }
.dh-arrow span:nth-child(2) { animation-delay: .15s; }
.dh-arrow span:nth-child(3) { animation-delay: .3s; }
.dh-colab { padding: 10px 16px; border-radius: 12px; background: #f9ab00; color: #1b1b1b; font-weight: 800; letter-spacing: .02em; }
#drive-modal h3 { margin: 6px 0 4px; font-size: 19px; }
.drive-steps { margin: 16px 0 12px; padding-left: 22px; display: flex; flex-direction: column; gap: 9px; font-size: 13.5px; color: var(--text-2); }
.drive-steps li::marker { color: var(--red); font-weight: 800; }
.drive-steps b { color: var(--text); }
.warn-box { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--amber-soft); border: 1px solid rgba(245,165,36,.35); font-size: 13px; color: var(--text-2); }
.warn-box i { color: var(--amber); font-size: 18px; margin-top: 2px; }
.warn-box b { color: var(--text); }
.drive-fail { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--red-soft); border: 1px solid var(--red-ring); font-size: 13px; color: var(--text-2); margin-top: 10px; }
.drive-fail i { color: var(--red); font-size: 18px; margin-top: 2px; }
.drive-fail b { color: var(--text); }
.waiting-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.spinner.xs { width: 22px; height: 22px; background: transparent; box-shadow: none; }
.spinner.xs::before { inset: 0; border-width: 2.5px; border-color: var(--red); border-right-color: transparent; }
.spinner.xs span { display: none; }

/* ---------------------------------------------------------------- guided tour */
.tour-item { color: var(--red) !important; }
.tour-item i { color: var(--red) !important; }
.tour-blocker { position: fixed; inset: 0; z-index: 1600; }
.tour-spot { position: fixed; z-index: 1601; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .66), 0 0 0 3px var(--red); transition: all .35s cubic-bezier(.2,.8,.3,1); pointer-events: none; }
.tour-spot.center { width: 0 !important; height: 0 !important; left: 50% !important; top: 40% !important; box-shadow: 0 0 0 9999px rgba(0,0,0,.66); }
.tour-pop { position: fixed; z-index: 1602; width: 380px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.5); padding: 18px; animation: rise .25s ease; transition: left .35s ease, top .35s ease; }
.tour-pop h4 { margin: 4px 0 8px; font-size: 16px; }
.tour-pop p { margin: 0 0 8px; color: var(--text-2); font-size: 13.5px; }
.tour-pop ul { margin: 0 0 8px; padding-left: 18px; color: var(--text-2); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.tour-pop b { color: var(--text); }
.tour-pop .tip { display: flex; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--amber-soft); color: var(--text-2); font-size: 12.5px; margin-top: 6px; }
.tour-pop .tip i { color: var(--amber); margin-top: 2px; }
.tour-count { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.tour-dots { display: flex; gap: 5px; margin: 10px 0 12px; flex-wrap: wrap; }
.tour-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); transition: all .2s; }
.tour-dots span.on { background: var(--red); width: 20px; border-radius: 99px; }
.tour-actions { display: flex; align-items: center; gap: 8px; }
.tour-actions .link-btn { margin-right: auto; color: var(--muted); }

/* ==========================================================================
 * MOBILE APP SHELL (≤ 768px) — same native-app feel as the G Drive Cloner:
 * compact translucent top bar · bottom tab bar · edge-to-edge screens ·
 * More drawer · bottom-sheet dialogs · thumb-sized controls
 * ========================================================================== */
html, body { overflow-x: clip; }
.bottom-nav { display: none; }
.grid-2 > *, .col > *, .tw-title, .engine-meta { min-width: 0; }

@media (max-width: 768px) {
  :root { --topbar-h: 56px; --bottom-nav-h: 64px; }
  body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }

  /* Top app bar */
  .topbar {
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 10px 0;
    gap: 6px;
    background: color-mix(in srgb, var(--canvas) 86%, transparent);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    backdrop-filter: saturate(1.6) blur(14px);
  }
  .topbar .only-mobile { display: none; }            /* "More" in the bottom bar opens the drawer */
  .brand img { width: 30px; height: 30px; }
  .brand-name { font-size: 16px; }
  .top-actions { gap: 2px; }
  .top-actions .pill-btn.ghost { display: none; }    /* Switch cloner lives in the More drawer */
  .pill-btn.bot { width: 38px; padding: 0; justify-content: center; }
  .account-chip { padding: 2px; }
  .account-chip > .fa-chevron-down { display: none; }
  .account-menu { position: fixed; right: 10px; left: 10px; top: calc(var(--topbar-h) + env(safe-area-inset-top) + 6px); min-width: 0; }

  /* Edge-to-edge screens */
  .layout { min-height: calc(100dvh - var(--topbar-h)); }
  .main { padding: 16px 12px calc(var(--bottom-nav-h) + 24px + env(safe-area-inset-bottom)); }
  .page-head h2 { font-size: 22px; }
  .page-head p { margin-bottom: 14px; font-size: 13.5px; }
  .page-head-row { flex-direction: column; align-items: stretch; }
  .card { border-radius: 18px; }
  .grid-2 { gap: 14px; }
  .col { gap: 14px; }

  /* Bottom tab bar */
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1300;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
    padding: 6px 4px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: saturate(1.6) blur(16px);
    backdrop-filter: saturate(1.6) blur(16px);
    border-top: 1px solid var(--line);
  }
  .bn-item {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px;
    background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none !important;
    color: var(--text-2); font: 500 11.5px/1.2 'Inter', sans-serif;
  }
  .bn-item i { width: 58px; height: 30px; border-radius: 15px; display: grid; place-items: center; font-size: 17px; transition: background .2s, color .2s, transform .1s; }
  .bn-item.active { color: var(--text); font-weight: 700; }
  .bn-item.active i { background: var(--red-soft); color: var(--red); }
  .bn-item:active i { transform: scale(.94); }

  /* Sidebar becomes the "More" drawer, above the bottom bar */
  .side {
    position: fixed; top: 0; left: 0; bottom: 0; height: auto; z-index: 1400;
    width: min(86vw, 320px); transform: translateX(-102%); transition: transform .25s cubic-bezier(.2,.8,.3,1);
    padding: calc(16px + env(safe-area-inset-top)) 14px calc(16px + env(safe-area-inset-bottom));
    border-radius: 0 20px 20px 0; box-shadow: none; overflow-y: auto;
  }
  body.side-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.5); }
  body.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1390; }
  .side-switch { display: flex !important; }

  /* Dialogs slide up as bottom sheets */
  .modal { align-items: flex-end; padding: 0; }
  .modal-box { max-width: none; width: 100%; border-radius: 24px 24px 0 0; max-height: calc(100dvh - 24px); padding-bottom: env(safe-area-inset-bottom); animation: sheetUp .28s cubic-bezier(.2,.8,.3,1); }
  .modal-accent { display: none; }
  .modal-box::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 10px auto 0; }
  .modal-body { padding: 14px 16px 18px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }

  /* Thumb-friendly controls; 16px inputs stop iOS zooming in */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  input, textarea, select { font-size: 16px !important; }
  .input-wrap { height: 52px; }

  /* Engine card */
  .engine-top { gap: 12px; }
  .engine-actions { width: 100%; }
  .engine-actions .btn { width: 100%; }
  .pair { gap: 14px; }
  .pair-code { font-size: 30px; }
  .pair-btns .btn { flex: 1; }

  /* Live window */
  .monitor { min-height: 0; }
  .tw-head { padding: 14px; }
  .phase-loader { padding: 16px 14px; }
  .tw-progress, .tw-stats, .tw-toolbar { padding-left: 14px; padding-right: 14px; }
  .tw-stats { grid-template-columns: repeat(2, 1fr); }
  .tw-item { padding: 9px 14px; }
  .tw-list { max-height: 50vh; }
  .tw-done { margin: 12px 14px; grid-template-columns: 48px 1fr; }
  .done-icon { width: 48px; height: 48px; font-size: 20px; }
  .done-actions .btn { flex: 1; }
  .job { grid-template-columns: 34px 1fr; }
  .job .badge { grid-column: 2; justify-self: start; }

  /* Hero & history */
  .hero { padding-top: 16px; }
  .hero h1 { font-size: 30px; }
  .hero p { font-size: 15px; }
  .hero .btn-lg { width: 100%; }
  .hero-points { margin-top: 24px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat b { font-size: 19px; }

  /* Toasts float above the tab bar */
  .toast-host { left: 12px; right: 12px; transform: none; bottom: calc(var(--bottom-nav-h) + 12px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }

  /* Tour stays on screen, above the tab bar */
  .tour-pop { max-height: calc(100dvh - var(--bottom-nav-h) - 40px); overflow-y: auto; }

  /* Boot loader */
  .boot { gap: 48px; }
  .boot-step { font-size: 18px; }
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@media (min-width: 769px) { .side-switch { display: none !important; } }

/* Installed app (opened from the home screen) */
@media (display-mode: standalone) {
  .pill-btn.bot { display: none; }
}

/* Sidebar items keep their size; the rail scrolls when the window is short. */
.side > * { flex-shrink: 0; }
.new-btn { min-height: 46px; width: 100%; justify-content: center; }
@media (max-height: 760px) and (min-width: 769px) {
  .side { gap: 10px; padding-top: 14px; }
  .side-item { height: 36px; }
  .side-card { padding: 10px; }
}

/* ==========================================================================
 * Phone polish (all cloners): roomy top bar, readable names, stacked rows,
 * history as cards instead of a sideways-scrolling table.
 * ========================================================================== */
@media (max-width: 768px) {
  .topbar .brand { flex: 1 1 auto; min-width: 0; flex-shrink: 1; }
  .topbar .brand-name { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .top-actions { flex: none; margin-left: 0; }

  .job { grid-template-columns: 36px minmax(0, 1fr); row-gap: 8px; }
  .job > .badge { grid-column: 2; justify-self: start; }
  .job-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }

  .tw-head { flex-wrap: wrap; }
  .tw-title { flex-basis: calc(100% - 60px); }
  .tw-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
  .tw-head .phase-pill { margin-left: 56px; }

  .wm-row { flex-wrap: wrap; align-items: flex-start; }
  .wm-text { flex: 1 1 calc(100% - 50px); min-width: 0; }
  .wm-row > .btn, .wm-row > button, .wm-row > a { margin-left: 46px; }

  .table-card { overflow: visible; background: transparent; border: 0; box-shadow: none; }
  .table { min-width: 0; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
  .table tr:hover td { background: transparent; }
  .table td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
  .table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; flex: none; }
  .table td.cell-name { font-weight: 700; font-size: 14px; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); justify-content: flex-start; overflow-wrap: anywhere; }
  .table td.empty { display: block; text-align: center; padding: 28px 10px; }
  .table tr:has(td.empty) { box-shadow: none; }
}
@media (max-width: 400px) {
  .pill-btn.bot { display: none; }       /* the bot is also in the More drawer */
  .brand { gap: 8px; }
  .brand img { width: 28px; height: 28px; }
  .topbar .brand-name { font-size: 15px; }
  .stat-row { gap: 8px; }
}
