/* Loft Hub — minimal, dependency-free styling.
   Layout: fixed left sidebar (app switcher) + right content area (iframe). */

:root {
  --rail-w: 220px;
  --topbar-h: 52px;
  --bg: #0f1115;
  --rail-bg: #171a21;
  --rail-border: #262b36;
  --text: #e7e9ee;
  --text-dim: #9aa3b2;
  --accent: #e8a13a;      /* Loft amber */
  --accent-soft: #2a2417;
  --hover: #202531;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

#app { display: flex; height: 100vh; width: 100vw; }

/* ---- Sidebar ---- */
#sidebar {
  width: var(--rail-w);
  flex: 0 0 var(--rail-w);
  background: var(--rail-bg);
  border-right: 1px solid var(--rail-border);
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--rail-border);
}
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent); color: #1a1205;
  font-weight: 800; font-size: 16px;
  display: grid; place-items: center;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .2px; }

#tabs { list-style: none; margin: 0; padding: 8px; flex: 1 1 auto; overflow-y: auto; }
#tabs li { margin: 2px 0; }
#tabs a {
  display: block; padding: 10px 12px; border-radius: 8px;
  color: var(--text-dim); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background .12s, color .12s;
}
#tabs a:hover { background: var(--hover); color: var(--text); }
#tabs a.active { background: var(--accent-soft); color: var(--accent); }

.sidebar-foot {
  padding: 12px 18px; font-size: 11px; color: var(--text-dim);
  border-top: 1px solid var(--rail-border);
}

/* ---- Content ---- */
#content { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
#topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; border-bottom: 1px solid var(--rail-border); background: var(--rail-bg);
}
#app-title { font-size: 15px; font-weight: 600; margin: 0; }
#open-new { font-size: 13px; color: var(--accent); text-decoration: none; }
#open-new:hover { text-decoration: underline; }

#frame-wrap { flex: 1 1 auto; position: relative; background: #fff; }
#frame { border: 0; width: 100%; height: 100%; display: block; background: #fff; }

/* ---- Built-in page container (generic; currently unused — Help is now an iframed app) ---- */
#builtin { height: 100%; overflow-y: auto; background: var(--bg); color: var(--text); }

/* ---- Narrow screens: rail becomes a top strip ---- */
@media (max-width: 640px) {
  #app { flex-direction: column; }
  #sidebar { width: 100%; flex-basis: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .brand { border-bottom: 0; border-right: 1px solid var(--rail-border); }
  #tabs { display: flex; padding: 6px; }
  .sidebar-foot { display: none; }
}
