/* Daily Life Doc, round 13 (zone XF): the expert's layout, drawn as the page "Expert Plans" draws "The expert's
   screens" (docs/artifact/expert/index.html, the css of .win, .wnav, .ni, .whead, .emp, .cpb, .ephone).
   At a computer: the left list (#nav: Clients · To review · Calls, a rule, Knowledge base · Settings, with counts),
   then the head row (#top) and the open place (#page); pages opened over a place slide in over the head and the
   place (#stack). At 880 px and narrower: one column: the head row with the round More button, the row Clients ·
   To review · Calls under it, then the place; a client's page hides the row and shows its own back arrow.
   The client page's parts (.cp*) are in css/shell-client.css. js/shell/shell.js draws all of this. */
html, body { margin: 0; height: 100%; }
body { min-height: 100dvh; background: linear-gradient(var(--app), var(--app2)) fixed; color: var(--ink); font-family: var(--font); font-size: var(--t-m);
  line-height: 1.4; -webkit-font-smoothing: antialiased; overflow: hidden; --top: 0px; }

/* ---------- The app: the left list, the head row, the place ---------- */
.app { position: fixed; inset: 0; display: grid; grid-template-columns: 212px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "nav top" "nav page"; }
.nav { grid-area: nav; display: flex; flex-direction: column; gap: 2px; padding: 18px 10px; border-right: 1px solid var(--cardline);
  background: color-mix(in srgb, var(--card) 45%, transparent); overflow-y: auto; scrollbar-width: none; }
.ni { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 12px; font-size: var(--t-s); font-weight: 500; color: var(--ink2);
  white-space: nowrap; text-align: left; transition: background-color var(--m-step) ease, color var(--m-step) ease, box-shadow var(--m-step) ease, transform var(--m-press) var(--ease-out); }
.ni:active { transform: scale(.97); }
.ni.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.ni .cnt { font-style: normal; margin-left: auto; min-width: 20px; padding: 0 7px; border-radius: 999px; background: var(--ink); color: var(--surface); font-size: var(--t-2xs);
  font-weight: 600; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.ni .cnt.sf { background: var(--soft); color: var(--ink2); }
.ni .cnt:empty { display: none; }
.nsep { height: 1px; margin: 10px 12px; background: var(--cardline); }
.ni.more-only { display: none; }

.top { grid-area: top; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 72px; padding: 16px 24px 12px; }
.top:empty { min-height: 0; padding: 0; }
.wt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; margin-right: auto; }
.wt b { font-size: var(--t-l); font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wt span { font-size: var(--t-sm); color: var(--ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* A line under the title with a shorter form for phone width (DD.shell.head's subShort). */
.wt .sub-s { display: none; }
.wsrch { flex: 1 1 180px; max-width: 260px; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--card);
  color: var(--ink3); font-size: var(--t-sm); }
.wsrch svg { width: 15px; height: 15px; flex: none; }
.wsrch input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: var(--t-sm); color: var(--ink); }
/* A round button of the head row (Search, More, Call and Pause AI at phone width). .dk = the dark one (+). */
.rb { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--ink);
  transition: transform var(--m-press) var(--ease-out), background-color var(--m-step) ease; }
.rb:active { transform: scale(.92); }
.rb svg { width: 18px; height: 18px; }
.rb.dk { background: var(--ink); color: var(--surface); }
.top .more, .top .bk { display: none; }

.page { grid-area: page; position: relative; min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 24px 28px; scrollbar-width: thin; }
.tabview { position: relative; min-height: 100%; display: flex; flex-direction: column; }

/* ---------- Empty screens: one icon, one line, one button ---------- */
.emp { flex: 1; min-height: 340px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px 16px 48px; text-align: center; }
.emp .eic { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--sage-d); box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.emp .eic svg { width: 26px; height: 26px; }
.emp b { font-size: var(--t-l); font-weight: 600; }
.emp p { max-width: 300px; font-size: var(--t-sm); color: var(--ink3); }
.emp .pill { margin-top: 4px; }

/* ---------- Pages over a place (DD.router kind "page"): over the head row and the place, never over the list ---------- */
#stack { grid-column: 2; grid-row: 1 / span 2; position: relative; pointer-events: none; z-index: 30; }
#stack > .pg { pointer-events: auto; }
.pg { position: absolute; inset: 0; display: flex; flex-direction: column; background: linear-gradient(var(--app), var(--app2)); transform: translateX(28px); opacity: 0;
  transition: transform var(--m-push) var(--ease-drawer), opacity 240ms ease; }
.pg.on { transform: none; opacity: 1; }
.pg.out { transition-duration: var(--m-pop); }
.pg-head { flex: none; display: flex; align-items: center; gap: 10px; min-height: 72px; padding: 16px 24px 12px; }
.pg-head h2 { flex: 1; min-width: 0; font-size: var(--t-l); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-head .icon-btn { width: 40px; height: 40px; background: var(--card); }
.pg-head .icon-btn svg { width: 18px; height: 18px; }
.pg-act { flex: none; display: flex; align-items: center; gap: 8px; }
.pg-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 24px 28px; }

/* A page whose draw failed. */
.stub { margin: 8px 0; padding: 22px 18px; border-radius: 18px; background: var(--card); color: var(--ink2); font-size: var(--t-m); }
.stub b { display: block; color: var(--ink); font-size: var(--t-l); font-weight: 600; margin-bottom: 4px; }

/* ---------- Whole screens with no list: Sign in, #bare ---------- */
.full { position: fixed; inset: 0; z-index: 38; overflow-y: auto; overflow-x: hidden; background: linear-gradient(var(--app), var(--app2)); padding: 10px 18px 40px; }
.full.bare { z-index: 39; }
.signin > * { max-width: 440px; margin-inline: auto; }

/* ---------- Sheets, the toast and the cover over the whole window (no phone frame since round 13) ----------
   Round 13 (FX-F2): at a computer a sheet is a centred dialog that fits the window (four round corners, no handle,
   a short fade and rise); at 880 px and narrower it is the bottom sheet, its buttons filling the row. */
.scrim, .busy { position: fixed; }
.sheet { position: fixed; left: 50%; width: min(560px, 100%); transform: translate(-50%, 105%); }
.sheet.on { transform: translate(-50%, 0); }
@media (min-width: 881px) {
  .sheet, .sheet.tall { top: 50%; bottom: auto; width: min(520px, calc(100% - 48px)); height: auto; max-height: calc(100dvh - 64px); padding: 20px 22px 22px;
    border-radius: 22px; box-shadow: var(--lift); opacity: 0; visibility: hidden; transform: translate(-50%, calc(-50% + 14px)) scale(.98);
    transition: transform 280ms var(--ease-out), opacity 200ms ease, visibility 0s linear 280ms; }
  .sheet.on { opacity: 1; visibility: visible; transform: translate(-50%, -50%); transition: transform 280ms var(--ease-out), opacity 200ms ease, visibility 0s; }
  /* The dialog is a column: the head and the buttons stay, the body between them scrolls when the window is short. */
  .sheet.on, .sheet { display: flex; flex-direction: column; overflow: hidden; }
  .sheet .grab { display: none; }
  .sheet .sh-head { position: static; flex: none; margin-bottom: 12px; box-shadow: none; }
  .sheet .sh-head h2 { font-size: var(--t-l); }
  .sheet .sh-text { flex: none; }
  .sheet .sh-body { flex: 0 1 auto; min-height: 0; overflow-y: auto; margin: 0 -22px; padding: 2px 22px; scrollbar-width: thin; }
  .sheet .sh-actions { flex: none; margin-top: 16px; }
}
.toast { position: fixed; left: 50%; right: auto; bottom: 28px; width: max-content; max-width: calc(100% - 32px); transform: translate(-50%, 160%); }
.toast.on { transform: translate(-50%, 0); }
.callbar { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60; }

/* ---------- One column at phone width (the page's "On a phone") ---------- */
@media (max-width: 880px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "top" "nav" "page"; }
  .nav { flex-direction: row; gap: 6px; padding: 0 16px 10px; border-right: 0; background: none; overflow-x: auto; overflow-y: hidden; }
  .nav .nsep, .nav .ni.lower { display: none; }
  .ni { flex: none; min-height: 36px; padding: 0 13px; border-radius: 999px; background: color-mix(in srgb, var(--card) 60%, transparent); }
  .ni.on { background: var(--ink); color: var(--surface); box-shadow: none; }
  .ni .cnt { margin-left: 2px; min-width: 20px; }
  .ni.on .cnt { background: var(--surface); color: var(--ink); }
  .top { min-height: 64px; padding: 12px 16px 10px; gap: 8px; flex-wrap: nowrap; }
  .top .more { display: grid; }
  .wt b { font-size: var(--t-xl); }
  .wt .sub-l { display: none; }
  .wt .sub-s { display: inline; }
  .wsrch { display: none; }
  .page { padding: 0 16px 24px; }
  #stack { grid-column: 1; grid-row: 1 / span 3; }
  .pg-head { padding: 12px 16px 10px; min-height: 64px; }
  .pg-body { padding: 0 16px 24px; }
  /* A client's page: no row of places; its own back arrow leads to Clients. */
  body[data-base="client"] .nav { display: none; }
  body[data-base="client"] .top .bk { display: grid; }
}
@media (max-width: 380px) {
  .ni { padding: 0 10px; font-size: var(--t-sm); }
  .rb { width: 36px; height: 36px; }
}
