/* css/app-shell.css
   The frame every app page shares: design settings, and the top bar drawn by
   js/app-shell.js. Colours and fonts are Rubricator's own (navy, orange, teal;
   DM Serif Display and Outfit). The Rubricator chat (companion.html) does not
   load this file: it is a research instrument and keeps its own page. */

/* ── Design settings ─────────────────────────────────────── */
:root {
  --navy: #1F3864; --orange: #C55A11; --teal: #1E7278;

  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem;
  --space-5: 1.5rem; --space-6: 2rem;  --space-7: 3rem;

  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 14px; --radius-full: 999px;

  --text-xs: .75rem; --text-sm: .85rem; --text-md: .95rem; --text-lg: 1.15rem;
  --text-xl: 1.6rem; --text-2xl: 2rem;

  --bar-h: 56px;
  --ease: .15s ease;
}
html[data-theme="dark"], html:not([data-theme]) {
  --bg: #0A1220; --surface: #111D33; --surface-2: #16284A; --line: rgba(255,255,255,.12);
  --ink: #F4F6FA; --mute: rgba(244,246,250,.62); --accent: #4FB3BA; --accent-ink: #fff;
  --bar-bg: rgba(10,18,32,.86); --menu-bg: #16284A;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.3); --shadow-md: 0 10px 30px rgba(0,0,0,.45);
}
html[data-theme="light"] {
  --bg: #F0F1F4; --surface: #FFFFFF; --surface-2: #F6F7F9; --line: rgba(31,56,100,.14);
  --ink: rgb(28,27,24); --mute: rgba(28,27,24,.6); --accent: #1E7278; --accent-ink: #fff;
  --bar-bg: rgba(255,255,255,.9); --menu-bg: #FFFFFF;
  --shadow-sm: 0 2px 8px rgba(31,56,100,.08); --shadow-md: 0 12px 32px rgba(31,56,100,.16);
}

body.app-shell { background: var(--bg); color: var(--ink); padding-top: var(--bar-h); min-height: 100vh; }

/* The page headers no longer sit under the website's tall nav. */
body.app-shell .al-header, body.app-shell .sk-header, body.app-shell .ap-header { padding-top: var(--space-6); }
body.app-shell .mr-header { padding-top: var(--space-6); }

/* Controls the bar now carries, hidden where a page still has its own copy. */
body.app-shell .page-dup { display: none !important; }

/* ── Shared buttons ─────────────────────────────────────── */
.sh-btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: none; color: var(--ink);
  border-radius: var(--radius-md); padding: .45rem .8rem; font: 600 var(--text-sm) var(--sans); cursor: pointer; text-decoration: none; transition: border-color var(--ease), background var(--ease); }
.sh-btn:hover { border-color: var(--accent); }
.sh-btn--primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.sh-btn--primary:hover { background: #166a6e; }
.sh-icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--radius-md); border: 1px solid transparent;
  background: none; color: var(--ink); cursor: pointer; font-size: 1rem; transition: background var(--ease), border-color var(--ease); }
.sh-icon-btn:hover { background: var(--surface-2); border-color: var(--line); }
.sh-icon-btn:focus-visible, .sh-btn:focus-visible, .shell-bar .lang-btn:focus-visible, .shell-avatar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.shell-ask input:focus, .shell-ask input:focus-visible { outline: none; }
.shell-ask form:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

/* ── The bar ─────────────────────────────────────────────── */
.shell-bar { position: fixed; top: 0; left: 0; right: 0; height: var(--bar-h); z-index: 200; display: flex; align-items: center; gap: var(--space-2);
  padding: 0 var(--space-4); background: var(--bar-bg); backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line); font-family: var(--sans); color: var(--ink); }
.shell-grid svg { width: 18px; height: 18px; }
.shell-app { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); min-width: 0; margin-right: var(--space-2); }
.shell-app img { width: 26px; height: 26px; flex-shrink: 0; }
.shell-app span { font-weight: 700; font-size: var(--text-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell-spacer { flex: 1; }

.shell-ask { position: relative; flex: 0 1 380px; }
.shell-ask form { display: flex; align-items: center; gap: .4rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-full); padding: 0 .35rem 0 .85rem; height: 36px; }
.shell-ask form:focus-within { border-color: var(--accent); }
.shell-ask input { flex: 1; min-width: 0; border: none; background: none; outline: none; color: var(--ink); font: var(--text-sm) var(--sans); }
.shell-ask input::placeholder { color: var(--mute); }
.shell-ask-glyph { color: var(--mute); font-size: .9rem; }

.shell-credits { font-size: var(--text-xs); color: var(--mute); white-space: nowrap; padding: 0 var(--space-2); }
.shell-bar .lang-toggle { display: inline-flex; gap: 2px; margin: 0; background: transparent; border: 1px solid var(--line); border-radius: var(--radius-full); padding: 2px; }
.shell-bar .lang-btn { border: none; background: none; color: var(--mute); font: 700 .7rem var(--sans); padding: .3rem .55rem; border-radius: var(--radius-full); cursor: pointer; }
.shell-bar .lang-btn.active { background: var(--navy); color: #fff; }
html[data-theme="dark"] .shell-bar .lang-btn.active { background: var(--teal); color: #fff; }
.shell-theme .t-light, html[data-theme="light"] .shell-theme .t-dark { display: inline; }
.shell-theme .t-dark, html[data-theme="light"] .shell-theme .t-light { display: none; }
.shell-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--orange); color: #fff; font: 700 .8rem var(--sans); display: grid; place-items: center; border: none; cursor: pointer; }

/* ── Menus and the suggestion list ───────────────────────── */
.shell-pop { position: absolute; top: calc(100% + 8px); right: 0; min-width: 220px; background: var(--menu-bg); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: var(--space-2); z-index: 210; }
.shell-pop[hidden] { display: none; }
.shell-menu-who { padding: .5rem .6rem .6rem; font-size: var(--text-sm); color: var(--mute); border-bottom: 1px solid var(--line); margin-bottom: var(--space-1); }
.shell-menu-who b { display: block; color: var(--ink); }
.shell-menu a, .shell-menu button { display: block; width: 100%; text-align: left; padding: .55rem .6rem; border-radius: var(--radius-sm); border: none; background: none;
  color: var(--ink); font: var(--text-sm) var(--sans); text-decoration: none; cursor: pointer; }
.shell-menu a:hover, .shell-menu button:hover { background: var(--surface-2); }
.shell-ask .shell-pop { left: 0; right: auto; width: min(440px, calc(100vw - 2rem)); }
.shell-sug { display: flex; gap: .7rem; align-items: flex-start; padding: .6rem; border-radius: var(--radius-md); text-decoration: none; color: var(--ink); }
.shell-sug:hover { background: var(--surface-2); }
.shell-sug img { width: 30px; height: 30px; flex-shrink: 0; }
.shell-sug b { display: block; font-size: var(--text-sm); }
.shell-sug span { display: block; font-size: var(--text-xs); color: var(--mute); line-height: 1.4; margin-top: .1rem; }
.shell-sug em { display: block; font-size: .7rem; color: var(--mute); margin-top: .25rem; }
.shell-pop-msg { padding: .6rem; font-size: var(--text-sm); color: var(--mute); }

/* ── The docked assistant's place (filled in a later step) ── */
.shell-dock { position: fixed; top: var(--bar-h); right: 0; bottom: 0; width: 360px; background: var(--surface); border-left: 1px solid var(--line); z-index: 150; }
.shell-dock[hidden] { display: none; }
body.app-shell.dock-open { padding-right: 360px; }

/* ── Narrow screens ─────────────────────────────────────── */
.shell-ask-toggle { display: none; }
@media (max-width: 760px) {
  .shell-bar { padding: 0 var(--space-2); gap: .2rem; }
  .shell-credits { display: none; }
  .shell-ask { display: none; position: fixed; top: var(--bar-h); left: 0; right: 0; padding: var(--space-2); background: var(--bar-bg); border-bottom: 1px solid var(--line); }
  .shell-ask.open { display: block; }
  .shell-ask .shell-pop { width: auto; left: var(--space-2); right: var(--space-2); }
  .shell-ask-toggle { display: inline-grid; }
  .shell-dock { width: 100%; }
  body.app-shell.dock-open { padding-right: 0; }
}
.shell-menu-lang { display: none !important; }
@media (max-width: 420px) {
  .shell-app span { max-width: 32vw; }
  .shell-bar > .lang-toggle { display: none; }
  .shell-menu-lang { display: inline-flex !important; margin: .2rem .6rem .5rem; }
}

/* ── Pass 2: slimmer page headers under the bar ─────────── */
body.app-shell .al-header h1, body.app-shell .sk-header h1, body.app-shell .ap-header h1, body.app-shell .mr-header h1 {
  font-size: var(--text-xl); line-height: 1.2; margin: 0 0 .2rem; }
body.app-shell .al-header p, body.app-shell .sk-header p, body.app-shell .ap-header p, body.app-shell .mr-header p {
  font-size: var(--text-sm); line-height: 1.5; }
body.app-shell .sk-header, body.app-shell .ap-header, body.app-shell .mr-header { padding-top: var(--space-5); padding-bottom: var(--space-4); }
body.app-shell .mr-header { background: transparent; border-bottom-color: var(--line); }

/* ── Item 13: a larger bar, and the assistant in the dock ── */
:root { --bar-h: 64px; }
.shell-bar { padding: 0 var(--space-5); gap: var(--space-3); }
.shell-app img { width: 30px; height: 30px; }
.shell-app span { font-size: 1.05rem; }
.shell-grid svg { width: 20px; height: 20px; }
.sh-icon-btn { width: 40px; height: 40px; }
.shell-avatar { width: 36px; height: 36px; font-size: .9rem; }
.shell-ask { flex: 0 1 480px; }
.shell-ask form { height: 42px; padding-left: 1rem; }
.shell-ask input { font-size: var(--text-md); }
.shell-credits { font-size: var(--text-sm); }
.shell-bar .lang-btn { font-size: .75rem; padding: .35rem .65rem; }

.shell-dock { display: flex; flex-direction: column; width: 400px; box-shadow: var(--shadow-md); }
body.app-shell.dock-open { padding-right: 400px; }
.dock-head { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.dock-head b { font-family: var(--serif); font-weight: 400; font-size: 1.15rem; }
.dock-msgs { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .75rem; }
.dock-hello { color: var(--mute); font-size: var(--text-md); line-height: 1.6; }
.dock-hello p + p { margin-top: .6rem; }
.dock-msg { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px; padding: .7rem .85rem; font-size: var(--text-md); line-height: 1.55; color: var(--ink); max-width: 95%; }
.dock-msg p + p { margin-top: .5rem; }
.dock-msg--me { align-self: flex-end; background: var(--teal); border-color: var(--teal); color: #fff; border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg); }
.dock-typing { color: var(--mute); font-style: italic; }
.dock-app { display: flex; gap: .65rem; align-items: center; margin-top: .6rem; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color var(--ease); }
.dock-app:hover { border-color: var(--accent); }
.dock-app img { width: 32px; height: 32px; flex-shrink: 0; }
.dock-app b { display: block; font-size: var(--text-sm); }
.dock-app em { display: block; font-style: normal; font-size: var(--text-xs); color: var(--mute); }
.dock-app.is-locked img { opacity: .5; filter: grayscale(1); }
.dock-form { display: flex; gap: .5rem; align-items: flex-end; padding: .75rem; border-top: 1px solid var(--line); }
.dock-form textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); color: var(--ink);
  padding: .6rem .75rem; font: var(--text-md) var(--sans); outline: none; }
.dock-form textarea:focus { border-color: var(--accent); }
@media (max-width: 760px) {
  .shell-bar { padding: 0 var(--space-2); gap: .2rem; }
  .shell-dock { width: 100%; }
  body.app-shell.dock-open { padding-right: 0; }
  .sh-icon-btn { width: 38px; height: 38px; }
}

/* ── Item 14: calmer spacing, Odoo-like (more air, quieter lines) ── */
body.app-shell { font-size: 15.5px; }
body.app-shell .al-inner, body.app-shell .ap-inner, body.app-shell .mr-wrap, body.app-shell .mr-header-inner { max-width: 1120px; }
body.app-shell .al-header, body.app-shell .sk-header, body.app-shell .ap-header, body.app-shell .mr-header { padding-top: var(--space-6); padding-bottom: var(--space-5); border-bottom-color: transparent; }
body.app-shell .al-header h1, body.app-shell .sk-header h1, body.app-shell .ap-header h1, body.app-shell .mr-header h1 { font-size: 1.85rem; margin-bottom: .35rem; }
body.app-shell .al-header p, body.app-shell .sk-header p, body.app-shell .ap-header p, body.app-shell .mr-header p { font-size: var(--text-md); }
/* Launcher: bigger gaps between tiles and groups */
body.app-shell .al-ask { margin-top: var(--space-6); }
body.app-shell .al-group { margin-top: var(--space-7); }
body.app-shell .al-grid { gap: 2.2rem 1.5rem; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
body.app-shell .al-icon { border-color: transparent; }
body.app-shell .al-bridge { margin-top: var(--space-7); border-color: transparent; background: var(--surface-2); }
/* Chat apps and Sketch: soft cards instead of outlined boxes */
body.app-shell .ap-limits, body.app-shell .sk-panel { border-color: transparent; }
body.app-shell .ap-wrap { padding-top: var(--space-5); }
body.app-shell .sk-wrap { padding-top: var(--space-5); }
body.app-shell .sk-toolbar, body.app-shell .sk-actions { gap: .6rem; }

/* The website's paragraph colour must not reach the assistant's bubbles. */
.dock-msg p, .dock-hello p { color: inherit; margin: 0; }
.dock-msg--me, .dock-msg--me p { color: #fff; }

/* Item 4: the grid button says Apps; item 2: a way back to the website */
.shell-grid { display: inline-flex; align-items: center; gap: .5rem; height: 40px; padding: 0 .75rem 0 .6rem; border-radius: var(--radius-md); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font: 600 var(--text-sm) var(--sans); }
.shell-grid:hover { border-color: var(--accent); background: var(--surface-2); }
.shell-grid svg { width: 18px; height: 18px; }
.shell-site { color: var(--mute); text-decoration: none; font-size: var(--text-sm); white-space: nowrap; padding: .4rem .5rem; border-radius: var(--radius-sm); }
.shell-site:hover { color: var(--ink); background: var(--surface-2); }
.shell-menu-sep { height: 1px; background: var(--line); margin: .3rem .2rem; }
@media (max-width: 760px) {
  .shell-grid span, .shell-site span:last-child { display: none; }
  .shell-grid { padding: 0 .55rem; }
}
