/* App shell (tabs + iframes) */
html, body.shell { height: 100%; }
body.shell {
  display: grid; grid-template-rows: auto 1fr; overflow: hidden;
  background: var(--bg);
}

.dl-banner {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 8px max(var(--sp-4), env(safe-area-inset-right)) 8px max(var(--sp-4), env(safe-area-inset-left));
  background: linear-gradient(90deg, rgba(255, 80, 80, 0.18), rgba(122, 162, 255, 0.12));
  border-bottom: 1px solid rgba(255, 80, 80, 0.35);
  font-size: var(--fs-sm);
}
.dl-banner[hidden] { display: none; }
.dl-short { display: none; }

.shell-bar {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 56px;
  padding: max(6px, env(safe-area-inset-top)) max(var(--sp-3), env(safe-area-inset-right)) 6px max(var(--sp-3), env(safe-area-inset-left));
  background: var(--brand-navy);
  border-bottom: 1px solid var(--border);
}
.shell-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: 0.01em; }
.shell-brand img { display: block; }
.shell-tabs { display: flex; gap: 4px; flex: 1 1 auto; justify-content: center; overflow-x: auto; scrollbar-width: none; }
.shell-tabs::-webkit-scrollbar { display: none; }
.shell-tabs button {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 6px 14px;
  border: 1px solid transparent; border-radius: var(--r-md);
  background: transparent; color: var(--text-muted);
  font: inherit; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.shell-tabs button:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.shell-tabs button[aria-selected="true"] {
  color: var(--text); background: rgba(255, 255, 255, 0.08); border-color: var(--border-strong);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.tab-ico { font-size: 1.1rem; line-height: 1; }
.shell-actions { display: flex; align-items: center; gap: var(--sp-2); }
.shell-gh { color: var(--text-muted); }

.shell-top { position: relative; z-index: 5; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); }

/* tab extras */
.shell-tabs button { position: relative; }
.tab-sep { flex: 0 0 1px; align-self: stretch; margin: 8px 6px; background: var(--border-strong); }
.tab-badge {
  min-width: 20px; height: 18px; padding: 0 6px; border-radius: var(--r-pill);
  font-size: 0.68rem; line-height: 18px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums;
  color: #fff; background: rgba(255, 80, 80, 0.85);
}
.shell-tabs button[aria-selected="true"] .tab-badge { background: var(--accent); }

/* ---------------- workspace / file bar ---------------- */
.ws-bar {
  position: relative;
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 52px;
  padding: 6px max(var(--sp-3), env(safe-area-inset-right)) 6px max(var(--sp-3), env(safe-area-inset-left));
  background: linear-gradient(180deg, #0b1236, #08102c);
  border-bottom: 1px solid var(--border);
}
.ws-info { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.ws-icon { font-size: 1.35rem; line-height: 1; flex: 0 0 auto; }
.ws-text { display: grid; min-width: 0; line-height: 1.25; }
.ws-text strong { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-meta { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-bar.is-empty .ws-meta { white-space: normal; }
.ws-colors { display: inline-flex; gap: 2px; }
.ws-dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4); }

.ws-jump {
  display: flex; align-items: center; gap: 4px; flex: 0 0 auto;
  padding: 3px; border-radius: var(--r-md); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border);
}
.ws-bar.is-empty .ws-jump { display: none; }
.ws-label { padding: 0 6px 0 8px; font-size: var(--fs-xs); color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.ws-jump-btn {
  display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 4px 10px;
  border: 0; border-radius: 9px; background: transparent; color: var(--text-muted);
  font: inherit; font-size: var(--fs-xs); font-weight: 650; cursor: pointer; white-space: nowrap;
}
.ws-jump-btn:hover { background: var(--surface-3); color: var(--text); }
.ws-jump-btn[aria-current="true"] { background: var(--accent); color: #fff; }
.ws-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.ws-drop-hint {
  position: absolute; inset: 4px; display: none; place-items: center;
  border: 2px dashed var(--accent); border-radius: var(--r-md); background: rgba(5, 8, 22, 0.92);
  font-weight: 700; color: var(--text);
}
.shell-top.is-drop .ws-drop-hint { display: grid; }

.shell-stage { position: relative; min-height: 0; }
.shell-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); }
.shell-frame[hidden] { display: none; }

@media (max-width: 1180px) {
  .ws-label { display: none; }
}
@media (max-width: 1080px) {
  .shell-brand-text { display: none; }
  .tab-label { display: none; }
  .shell-tabs button { padding: 6px 12px; }
  .tab-ico { font-size: 1.25rem; }
}
@media (max-width: 560px) {
  .shell-bar { flex-wrap: wrap; row-gap: 6px; }
  .shell-tabs { order: 3; flex-basis: 100%; justify-content: space-between; }
  .shell-tabs button { flex: 1 1 0; justify-content: center; padding: 6px 4px; }
  .shell-actions { margin-left: auto; }
  .dl-banner { font-size: var(--fs-xs); gap: var(--sp-2); padding-top: 6px; padding-bottom: 6px; }
  .dl-banner > span[aria-hidden], .dl-long { display: none; }
  .dl-short { display: inline; }
  .tab-sep { display: none; }
  .tab-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 15px; line-height: 15px; padding: 0 4px; font-size: 0.6rem; }
}
@media (max-width: 860px) {
  .ws-bar { flex-wrap: wrap; row-gap: 6px; }
  .ws-info { flex-basis: calc(100% - 150px); }
  .ws-jump { order: 3; flex: 1 1 100%; justify-content: space-between; }
  .ws-jump-btn { flex: 1 1 0; justify-content: center; }
  .ws-bar.is-empty .ws-meta { display: none; }
  .ws-actions .btn span[data-i18n] { display: none; }
}
