/* The window: the app library on the left; the open app's header, its
   work and the set dock on the right. */

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: var(--s1);
  padding: var(--s3) 10px; background: var(--sidebar); border-right: 1px solid var(--line);
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding-bottom: 8px; }
.sidebar-toggle {
  flex: none; width: 30px; height: 26px; display: grid; place-items: center; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--ink-2); cursor: pointer;
}
.sidebar-toggle:hover { background: var(--hover); color: var(--ink); }
/* The sidebar symbol: a window with its left pane marked. */
.sidebar-glyph { position: relative; width: 17px; height: 13px; border: 1.5px solid currentColor; border-radius: 3px; }
.sidebar-glyph::before { content: ''; position: absolute; left: 4px; top: 0; bottom: 0; width: 1.5px; background: currentColor; }
.brand {
  display: flex; align-items: center; gap: var(--s2); padding: 6px 8px; white-space: nowrap;
  color: var(--ink); font: 600 15px/1 var(--font-display); letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
/* A phone screen on a blue tile: the one ornament. */
.brand-mark {
  position: relative; width: 22px; height: 22px; border-radius: 6px; flex: none;
  background: linear-gradient(140deg, #2D8CFF, #0058C7);
}
.brand-mark::after {
  content: ''; position: absolute; left: 7px; top: 4px; width: 8px; height: 14px;
  border-radius: 2px; background: rgba(255, 255, 255, 0.92);
}
.sidebar-label { margin: var(--s2) 8px var(--s1); font-size: 11px; font-weight: 600; color: var(--ink-2); }
.lib-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.lib-item {
  display: flex; align-items: center; gap: var(--s2); height: 32px; padding: 0 8px;
  border-radius: var(--r-sm); color: var(--ink); font-size: 13.5px; white-space: nowrap;
}
.lib-item:hover { background: var(--hover); text-decoration: none; }
.lib-item.is-current { background: var(--select); font-weight: 600; }
.lib-icon { width: 22px; height: 22px; border-radius: 22.37%; flex: none; object-fit: cover; box-shadow: 0 0 0 0.5px var(--line); }
.lib-icon.is-letter { display: grid; place-items: center; background: var(--stage); color: var(--ink-2); font-size: 11px; font-weight: 600; box-shadow: none; }
.lib-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lib-icon.is-glyph { display: grid; place-items: center; box-shadow: none; color: var(--ink-2); font-size: 16px; line-height: 1; }
.sidebar-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: var(--s1); }
.keys { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 4px 8px; font-size: 12px; color: var(--ink-2); }
.key { display: inline-flex; align-items: center; gap: 5px; }
.key::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--bad-dot); }
.key.is-set::before { background: var(--ok-dot); }
.account { margin: 4px 8px 0; font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.lib-item { width: 100%; border: 0; background: none; font: inherit; font-size: 13.5px; text-align: start; cursor: pointer; }

/* Folded: icons only, names as tooltips; nothing moves up or down. */
.app.is-sidebar-collapsed { grid-template-columns: 60px minmax(0, 1fr); }
.is-sidebar-collapsed .sidebar-top { flex-direction: column; }
.is-sidebar-collapsed .brand { padding: 6px 0; }
.is-sidebar-collapsed .brand-name { display: none; }
.is-sidebar-collapsed .lib-name, .is-sidebar-collapsed .sidebar-label, .is-sidebar-collapsed .keys, .is-sidebar-collapsed .account { opacity: 0; pointer-events: none; }

/* ---------------------------------------------------------------- menu */

.menu { position: relative; flex: none; }
.menu-button { width: 30px; height: 28px; font-size: 17px; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: grid; min-width: 230px; padding: 5px;
  background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-2);
}
.menu-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); font: inherit; font-size: 13px; text-align: start; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--accent); color: #fff; outline: none; box-shadow: none; }
.menu-item.is-danger { color: var(--bad); }
.menu-item.is-danger:hover, .menu-item.is-danger:focus-visible { background: var(--bad); color: #fff; }

/* ---------------------------------------------------------------- workspace */

.workspace { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.notice { padding: 10px var(--s6); background: var(--warn-bg); color: var(--warn); font-size: 13px; font-weight: 500; border-bottom: 1px solid var(--line); }

.app-header {
  position: sticky; top: 0; z-index: 5; padding: 14px var(--s6) 0;
  background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.app-header:empty { display: none; }
.app-title { display: flex; align-items: center; gap: var(--s3); padding-bottom: 14px; }
.app-icon { width: 40px; height: 40px; border-radius: 22.37%; flex: none; object-fit: cover; box-shadow: 0 0 0 0.5px var(--line), 0 2px 6px rgba(0, 0, 0, 0.08); }
.app-icon.is-letter { display: grid; place-items: center; background: var(--stage); color: var(--ink-2); font-size: 18px; font-weight: 600; }
.app-name { font: 600 17px/1.2 var(--font-display); letter-spacing: -0.01em; }
.app-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); }
.app-title .segmented { margin-left: auto; }
.app-title .menu { margin-left: var(--s2); }

.segmented { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r); background: var(--select); }
.segmented > a, .segmented > button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 26px; padding: 0 14px;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); font: 500 13px/1 var(--font); cursor: pointer; white-space: nowrap;
}
.segmented > a:hover { text-decoration: none; background: var(--hover); }
.segmented > [aria-selected="true"], .segmented > [aria-pressed="true"] { background: var(--surface); box-shadow: var(--shadow-1); }

.step-bar { overflow-x: auto; scrollbar-width: none; margin: 0 -10px; }
.step-bar ol { list-style: none; margin: 0; padding: 0; display: flex; }
.step-link {
  display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 10px;
  color: var(--ink-2); font-size: 13px; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent;
}
.step-link:hover { color: var(--ink); text-decoration: none; }
.step-link.is-current { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.step-link.is-skip { opacity: 0.45; }
span.step-link.is-skip { cursor: default; }
.step-mark {
  width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 10.5px; font-weight: 600; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.step-mark.is-done { background: var(--ok-dot); color: #fff; box-shadow: none; }
.step-mark.is-attention { background: var(--warn-dot); color: #fff; box-shadow: none; }
.step-link.is-current .step-mark:not(.is-done):not(.is-attention) { color: var(--accent-text); box-shadow: inset 0 0 0 1.5px var(--accent); }

.main { flex: 1; width: 100%; max-width: 1160px; padding: 28px var(--s6) var(--s7); outline: none; }
.step-head { margin-bottom: 20px; }
.lede { color: var(--ink-2); font-size: 14.5px; margin-top: 6px; }
/* Back and Next stay in reach on a long step: stuck to the foot of the window, just above the dock. */
.step-nav {
  position: sticky; bottom: var(--dock-h, 0px); z-index: 3; display: flex; justify-content: space-between; gap: var(--s4);
  margin: 40px calc(-1 * var(--s6)) 0; padding: 10px var(--s6);
  background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}

/* ---------------------------------------------------------------- set dock */

.dock {
  position: sticky; bottom: 0; z-index: 4; padding: var(--s2) var(--s6) 10px;
  background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}
.dock-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) 10px; font-size: 12.5px; }
.dock-label { font-weight: 600; font-size: 13px; }
.dock-bar select { min-height: var(--control-sm); padding-block: 2px; font-size: 12.5px; }
.dock-meta { color: var(--ink-2); }
.dock-actions { margin-left: auto; display: flex; gap: var(--s2); }
.dock-strip { display: flex; gap: var(--s2); overflow-x: auto; padding: 10px 0 2px; }
.dock-strip img { height: 96px; width: auto; flex: none; display: block; border-radius: 6px; box-shadow: var(--shadow-1); }
.dock-strip.is-wide img { height: 56px; }
.dock-empty { margin: 0; padding: 10px 0 2px; color: var(--ink-2); font-size: 12.5px; }
.dock-body .dock-bar { padding-top: var(--s2); }
.dock-ready { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; font-size: 12.5px; }
.ready-store { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ready-name { font-weight: 600; color: var(--ink-2); }
.ready-none { color: var(--ink-2); font-style: italic; }
.ready-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); font: inherit; font-size: 12px; color: var(--ink); cursor: pointer;
}
.ready-chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok-dot); flex: none; }
.ready-chip:hover { background: var(--hover); }
.ready-chip.is-static { cursor: default; }
.ready-chip.is-static:hover { background: var(--surface); }
.ready-chip.is-warn::before { background: var(--warn-dot); }
.ready-chip.is-bad::before { background: var(--bad-dot); }
.ready-chip.is-soft { color: var(--ink-2); border-style: dashed; }
.ready-chip.is-soft::before { background: var(--line-strong); }
.ready-chip.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ready-label { color: var(--ink-2); }
.ready-note { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-2); max-width: none; }

/* ---------------------------------------------------------------- overview */

.overview-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: var(--s4); }
.ov-card { display: grid; grid-template-rows: auto 1fr; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.ov-picture { display: grid; place-items: center; height: 200px; padding: var(--s4); background: var(--stage); }
.ov-picture img.ov-demo { max-height: 168px; width: auto; max-width: 100%; border-radius: 4px; }
.ov-strip { display: flex; gap: 6px; height: 168px; }
.ov-strip img { height: 100%; width: auto; border-radius: 4px; box-shadow: var(--shadow-1); }
.ov-icon { width: 96px; height: 96px; border-radius: 22.37%; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); }
.ov-icon.placeholder { display: grid; place-items: center; background: var(--surface); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.ov-store { display: flex; align-items: center; gap: var(--s3); padding: 14px 18px; background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.ov-store .lib-icon { width: 40px; height: 40px; }
.ov-store > span { display: grid; }
.ov-body { display: grid; grid-template-rows: auto 1fr auto; padding: 14px 18px 16px; }
.ov-body h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; }
.ov-status { margin: 6px 0 0; }
.ov-body .row { margin-bottom: 0; }

/* ---------------------------------------------------------------- welcome */

.welcome-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: var(--s4); margin: var(--s4) 0 var(--s5); }
.welcome-step { margin: 0; display: grid; gap: 10px; }
.welcome-shot { display: grid; place-items: center; height: 220px; padding: var(--s3); background: var(--stage); border-radius: var(--r-lg); }
/* A fixed height: a percentage of a grid cell does not hold the picture in Safari. */
.welcome-shot img { max-height: 196px; width: auto; max-width: 100%; border-radius: 4px; }
.welcome-step figcaption { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.welcome-n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; flex: none; }

/* ---------------------------------------------------------------- home and settings */

.app-grid { list-style: none; margin: 20px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s3); }
.app-card {
  display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: var(--s3); align-items: center; padding: var(--s4);
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); color: var(--ink);
}
.app-card:hover { text-decoration: none; box-shadow: 0 0 0 1.5px var(--accent); }
.app-card.is-button { width: 100%; border: 0; font: inherit; text-align: start; cursor: pointer; }
.app-card .lib-icon { width: 48px; height: 48px; }
.app-card .lib-icon.is-letter { font-size: 20px; }
.app-card strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-card > span > span { font-size: 12px; color: var(--ink-2); }
.app-card.is-new .lib-icon { background: none; box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 22px; font-weight: 400; color: var(--ink-2); }

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px var(--s5); margin: 0; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; min-width: 0; }
.facts dd code { white-space: normal; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- help and feedback */

.feedback { width: min(36rem, 86vw); }
.feedback h2 { margin-top: 0; }
.feedback-kinds { flex-wrap: wrap; margin: 4px 0 2px; }
.feedback textarea { width: 100%; min-height: 8rem; resize: vertical; }
.feedback-error { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--bad-bg); }
.feedback-error p { margin: 0 0 4px; }
.feedback-error code { display: block; margin-bottom: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-shot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.feedback-shot img { max-height: 120px; max-width: 220px; border-radius: 6px; box-shadow: var(--shadow-1); }
.feedback-list { display: grid; gap: var(--s3); margin-top: var(--s4); }
.panel.feedback-item { margin: 0; }
.feedback-item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.feedback-kind.is-problem { color: var(--bad); background: var(--bad-bg); }
.feedback-kind.is-idea { color: var(--paid-text); background: var(--paid-soft); }
.feedback-message { margin: 12px 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }
.feedback-item-shot img { max-height: 220px; max-width: 100%; border-radius: 6px; box-shadow: var(--shadow-1); cursor: zoom-in; }

/* ---------------------------------------------------------------- narrow windows */

@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center; gap: 6px;
    padding: var(--s2) var(--s4); overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0 6px 0 0; }
  .sidebar-top { padding: 0; }
  .sidebar-toggle { display: none; }
  .app.is-sidebar-collapsed { grid-template-columns: minmax(0, 1fr); }
  .is-sidebar-collapsed .lib-name { opacity: 1; pointer-events: auto; }
  .brand-name, .sidebar-label, .keys, .account { display: none; }
  .lib-list { display: flex; gap: 2px; }
  .lib-item { height: 30px; flex: none; }
  .lib-name { max-width: 9em; }
  .sidebar-foot { margin: 0; padding: 0; border: 0; display: flex; }
  .notice { padding: 10px var(--s6); background: var(--warn-bg); color: var(--warn); font-size: 13px; font-weight: 500; border-bottom: 1px solid var(--line); }

.app-header { padding: 10px var(--s4) 0; }
  .app-title { flex-wrap: wrap; }
  .app-title .segmented { margin-left: 0; flex: 1; }
  .segmented > a, .segmented > button { flex: 1; }
  .main { padding: 20px var(--s4) 40px; }
  .step-nav { margin-inline: calc(-1 * var(--s4)); padding: 6px var(--s4); }
  .step-nav .button { min-height: 30px; padding-block: 4px; }
  .dock { padding: var(--s2) var(--s4); }
  .dock-actions { margin-left: 0; }
  .dock-strip img { height: 72px; }
  h1 { font-size: 20px; }
}

/* ---------------------------------------------------------------- sign-in */

/* The window before anyone is signed in, and the page a sign-in link lands on. */
.app.is-signin { display: block; }
.signin {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 420px); justify-content: center; align-content: center;
  gap: var(--s4); padding: var(--s6) var(--s4);
}
.signin-brand { justify-self: center; font-size: 17px; }
/* The phone layout hides the sidebar's brand name; this one stays. */
.signin-brand .brand-name { display: inline; }
.signin-panel { margin: 0; }
.signin-panel h1 { margin: 0 0 var(--s2); font: 600 22px/1.2 var(--font-display); }
.signin-panel form .button { width: 100%; }
.signin-panel > .button { width: 100%; }
.signin-or { text-align: center; margin: var(--s3) 0; }
