/*
 * shell.css — the Paraclete workspace.
 *
 * A persistent left rail plus one content pane that holds the active app. The
 * design tokens match the apps themselves (accent #ef3d23 on near-black), so
 * the rail and the app inside the pane read as one product rather than a
 * wrapper around someone else's software.
 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --bg:#f6f6f5; --surface:#fff; --border:#e6e4e2; --accent:#ef3d23; --accent-dk:#cf2f17;
  --accent-soft:#fdeceb; --text:#141414; --muted:#6f6f6f; --dark:#0a0a0a;
  --rail:#141414; --rail-hover:#242424; --rail-text:#c7c7c7;
  --radius:12px; --rail-w:236px; --bar-h:46px;
  --ui:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;
  --healthy:#27ae60; --watch:#d4a017; --critical:#b62a14;
}

html, body { height: 100%; }
body {
  font-family: var(--ui); background: var(--bg); color: var(--text);
  line-height: 1.5; display: flex; overflow: hidden;
}
a { color: var(--accent-dk); }

/* ── Left rail ───────────────────────────────────────────────────────────── */
.rail {
  width: var(--rail-w); flex: none; background: var(--rail); color: var(--rail-text);
  display: flex; flex-direction: column; height: 100vh; overflow: hidden;
}
.rail-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; flex: none; }
.rail-head .mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex: none;
}
.rail-head b { color: #fff; font-size: 15.5px; letter-spacing: -.01em; display: block; line-height: 1.15; }
.rail-head span { font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: #7d7d7d; }
.rail-head a { text-decoration: none; display: flex; align-items: center; gap: 10px; }

.rail-nav { flex: 1; overflow-y: auto; padding: 4px 10px 10px; }
.rail-nav::-webkit-scrollbar { width: 8px; }
.rail-nav::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.rail-cat {
  font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: #6d6d6d; padding: 14px 8px 6px;
}
.rail-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: 9px;
  color: var(--rail-text); text-decoration: none; font-size: 13.5px; cursor: pointer;
  border: none; background: none; width: 100%; text-align: left; font-family: inherit;
  transition: background .12s, color .12s;
}
.rail-item:hover { background: var(--rail-hover); color: #fff; }
.rail-item.active { background: var(--accent); color: #fff; }
.rail-item.active .ic { background: rgba(255,255,255,.2); color: #fff; }
.rail-item .ic {
  width: 24px; height: 24px; border-radius: 6px; background: #262626; color: #b9b9b9;
  display: flex; align-items: center; justify-content: center; font-size: 13px; flex: none;
}
.rail-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item .dot { width: 7px; height: 7px; border-radius: 50%; background: #4a4a4a; flex: none; }
.rail-item[data-s="up"] .dot { background: var(--healthy); }
.rail-item[data-s="waking"] .dot { background: var(--watch); animation: pulse 1.4s ease-in-out infinite; }
.rail-item[data-s="error"] .dot { background: var(--critical); }
.rail-item[data-s="n/a"] .dot { background: transparent; }
.rail-item.disabled { opacity: .45; cursor: default; }
.rail-item.disabled:hover { background: none; color: var(--rail-text); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.rail-foot { flex: none; padding: 10px; border-top: 1px solid #262626; font-size: 12px; }
.rail-foot a { color: #8d8d8d; text-decoration: none; padding: 7px 9px; border-radius: 8px; display: block; }
.rail-foot a:hover { background: var(--rail-hover); color: #fff; }
.rail-foot .who { color: #8d8d8d; padding: 4px 9px 6px; line-height: 1.35; overflow-wrap: anywhere; }
.rail-foot .who b { color: var(--rail-text); font-weight: 600; display: block; }

/* ── Main pane ───────────────────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; }

/* Public demo only (DEMO_MODE): a thin strip above the bar. */
.demo-banner { flex: none; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
  justify-content: center; background: var(--dark); color: #e8e8e8; font-size: 13px;
  /* The right padding clears i18n.js's fixed EN/ES toggle, which sits at top right. */
  padding: 10px 104px 10px 16px; min-height: 50px; }
.demo-banner[hidden] { display: none; }
.demo-banner a { color: #fff; font-weight: 600; background: var(--accent); border-radius: 6px;
  padding: 3px 10px; text-decoration: none; }

.bar {
  height: var(--bar-h); flex: none; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.bar .menu { display: none; }
.bar h1 { font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .crumb { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .right { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.iconbtn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 14px; text-decoration: none; font-family: inherit;
}
.iconbtn:hover { border-color: var(--accent); color: var(--accent-dk); }

.pane { flex: 1; position: relative; min-height: 0; background: var(--surface); }
.pane iframe { width: 100%; height: 100%; border: 0; display: block; }

.veil {
  position: absolute; inset: 0; background: var(--bg); display: flex; align-items: center;
  justify-content: center; flex-direction: column; gap: 14px; z-index: 3;
}
.spinner {
  width: 26px; height: 26px; border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.veil p { font-size: 13.5px; color: var(--muted); max-width: 340px; text-align: center; }

/* ── Launcher (shown when no app is open) ────────────────────────────────── */
.launcher { position: absolute; inset: 0; overflow-y: auto; padding: 34px 30px 40px; background: var(--bg); }
.launcher h2 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.launcher .sub { font-size: 13.5px; color: var(--muted); margin: 4px 0 26px; max-width: 72ch; line-height: 1.5; }
.lcat { font-size: 10.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
        color: var(--muted); margin: 24px 0 10px; }
.lgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px; }
.ltile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px; text-align: left; cursor: pointer; font-family: inherit; display: flex;
  gap: 12px; align-items: flex-start; transition: border-color .12s, box-shadow .12s, transform .12s;
}
.ltile:hover { border-color: var(--accent); box-shadow: 0 3px 14px rgba(20,20,20,.07); transform: translateY(-1px); }
.ltile.disabled { opacity: .6; cursor: default; }
.ltile.disabled:hover { border-color: var(--border); box-shadow: none; transform: none; }
.ltile .ic {
  width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-dk);
  display: flex; align-items: center; justify-content: center; font-size: 17px; flex: none;
}
.ltile h3 { font-size: 14px; font-weight: 700; line-height: 1.25; }
.ltile p { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.4; }

/* ── Login ───────────────────────────────────────────────────────────────── */
body.login { display: flex; align-items: center; justify-content: center; background: var(--dark); overflow: auto; }
.login-card { background: var(--surface); border-radius: 16px; padding: 34px; width: 100%; max-width: 380px; margin: 20px; }
.login-card .mark {
  width: 46px; height: 46px; border-radius: 12px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 23px; margin-bottom: 18px;
}
.login-card h1 { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.login-card .sub { font-size: 13.5px; color: var(--muted); margin: 5px 0 22px; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.field input {
  width: 100%; font-size: 14.5px; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--bg); outline: none; font-family: inherit;
}
.field input:focus { border-color: var(--accent); background: var(--surface); }
.btn {
  width: 100%; font-size: 14.5px; font-weight: 600; border: none; border-radius: 9px;
  padding: 12px; cursor: pointer; background: var(--accent); color: #fff; font-family: inherit;
}
.btn:hover { background: var(--accent-dk); }
.err {
  background: #fdeceb; border: 1px solid #f8cfc8; color: var(--accent-dk); font-size: 13px;
  border-radius: 9px; padding: 9px 12px; margin-bottom: 15px;
}
.ok {
  background: #f0faf4; border: 1px solid #bfe6cf; color: #1e7a45; font-size: 13px;
  border-radius: 9px; padding: 9px 12px; margin-bottom: 15px;
}
.login-note { font-size: 11.5px; color: var(--muted); margin-top: 18px; text-align: center; }

/* ── Small screens: the rail collapses to a drawer ───────────────────────── */
@media (max-width: 780px) {
  .rail {
    position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%);
    transition: transform .18s ease; box-shadow: 0 0 40px rgba(0,0,0,.3);
  }
  body.rail-open .rail { transform: translateX(0); }
  .bar .menu { display: flex; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30; }
}
