/* ============================================================================
   Skha Workspace — Base: reset, typography, application shell
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100%;
  /* The page scrolls only when the window is shorter than the design height;
     at 1600x900 there is nothing to scroll. */
  overflow-y: auto;
}

h1, h2, h3, h4, h5 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;              /* [OBSERVED] Skha sets --h1-font-weight: 400 */
  line-height: var(--lh-tight);
  letter-spacing: -0.005em;
  color: var(--text-primary);
  text-transform: none;          /* [OBSERVED] --h1-text-transform: none */
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a {
  color: var(--brand-primary);
  text-decoration: none;
}
a:hover { color: var(--brand-primary-strong); }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}
button { background: none; border: none; padding: 0; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: #d3e4f5; color: var(--text-primary); }

/* Scrollbars — present but quiet, so screenshots stay clean */
.scroll-y { overflow-y: auto; overscroll-behavior: contain; }
.scroll-y::-webkit-scrollbar { width: 9px; }
.scroll-y::-webkit-scrollbar-track { background: transparent; }
.scroll-y::-webkit-scrollbar-thumb {
  background: #d8d8d3;
  border-radius: var(--radius-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}
.scroll-y::-webkit-scrollbar-thumb:hover { background: #c2c2bc; background-clip: content-box; }

/* ----------------------------------------------------------------------------
   Application shell — identical across every screen
   -------------------------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  height: 100vh;
  /* Below the 900px design height the shell keeps its intended proportions
     and the window scrolls, instead of every card compressing to nothing. */
  min-height: 900px;
}

.main {
  display: grid;
  grid-template-rows: var(--topbar-h) var(--stagebar-h) minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  background: var(--bg-app);
}

.screen {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

/* ----------------------------------------------------------------------------
   Left navigation rail
   -------------------------------------------------------------------------- */

.rail {
  display: flex;
  flex-direction: column;
  background: var(--bg-rail);
  color: var(--text-on-navy);
  border-right: 1px solid var(--brand-navy-deep);
  min-height: 0;
}

.rail__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--border-rail);
  flex: none;
}
.rail__logo { height: 19px; width: auto; display: block; }
.rail__product {
  font-family: var(--font-display);
  font-size: var(--fs-label);
  color: var(--text-on-navy-muted);
  letter-spacing: 0.02em;
  padding-left: 10px;
  margin-left: 2px;
  border-left: 1px solid var(--border-rail);
  line-height: 1;
}

.rail__scroll { flex: 1 1 auto; min-height: 0; padding: var(--sp-5) 0 var(--sp-3); }

.rail__group + .rail__group { margin-top: var(--sp-5); }

.rail__grouplabel {
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  padding: 0 var(--sp-5) var(--sp-2);
  font-weight: 600;
}

.rail__divider {
  height: 1px;
  background: var(--border-rail);
  margin: var(--sp-5) var(--sp-5) var(--sp-4);
}

.navitem {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px var(--sp-5);
  color: rgba(255, 255, 255, 0.76);
  font-size: var(--fs-body);
  line-height: 1.3;
  position: relative;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  cursor: pointer;
}
.navitem svg { flex: none; width: 15px; height: 15px; opacity: 0.8; }
.navitem:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.navitem:hover svg { opacity: 1; }

/* Active state: a thin brand-blue marker and a weight shift — restrained,
   deliberately not a filled pill. */
.navitem.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.075);
  font-weight: 600;
}
.navitem.is-active svg { opacity: 1; color: var(--skha-blue-light); }
.navitem.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 5px; bottom: 5px;
  width: 2px;
  background: var(--skha-blue-light);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

.navitem__count {
  margin-left: auto;
  font-size: var(--fs-micro);
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-pill);
  padding: 1px 7px;
  font-weight: 600;
}

.rail__foot {
  flex: none;
  border-top: 1px solid var(--border-rail);
  padding: var(--sp-3) 0 var(--sp-3);
}

.rail__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px var(--sp-5);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.rail__user:hover { background: rgba(255, 255, 255, 0.06); }
.rail__user .avatar { background: rgba(255, 255, 255, 0.15); color: #fff; }
.rail__user-name { font-size: var(--fs-body-sm); color: #fff; line-height: 1.25; }
.rail__user-role { font-size: var(--fs-micro); color: var(--text-on-navy-muted); line-height: 1.25; }

/* ----------------------------------------------------------------------------
   Top project bar
   -------------------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-6);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  min-width: 0;
}

.topbar__project { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.topbar__name {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  color: var(--text-primary);
  white-space: nowrap;
}
.topbar__sub {
  font-size: var(--fs-body-sm);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__sep { width: 1px; height: 20px; background: var(--border-default); flex: none; }
.topbar__spacer { margin-left: auto; }

.topbar__actions { display: flex; align-items: center; gap: var(--sp-2); }

.iconbtn {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  position: relative;
}
.iconbtn:hover { background: var(--bg-sunken); color: var(--text-primary); }
.iconbtn svg { width: 16px; height: 16px; }
.iconbtn__dot {
  position: absolute; top: 5px; right: 5px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--skha-red);
  border: 1.5px solid var(--bg-surface);
}

/* Review pill — human control is reachable from every screen */
.reviewpill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.reviewpill:hover { border-color: var(--border-strong); background: var(--bg-subtle); color: var(--text-primary); }
.reviewpill svg { width: 14px; height: 14px; color: var(--text-muted); }
.reviewpill__count {
  font-weight: 700;
  font-size: var(--fs-micro);
  font-variant-numeric: tabular-nums;
  background: var(--status-warning-bg);
  color: var(--status-warning);
  border-radius: var(--radius-pill);
  padding: 1px 6px;
  line-height: 1.5;
}
.reviewpill.is-active { border-color: var(--brand-primary); background: var(--brand-primary-soft); color: var(--brand-primary); }

/* ----------------------------------------------------------------------------
   Project stage indicator — the Skha process, always visible, never loud
   -------------------------------------------------------------------------- */

.stagebar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-6);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-default);
  min-width: 0;
}

.stagebar__label {
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
  flex: none;
}

.stageflow { display: flex; align-items: center; gap: 2px; min-width: 0; }

.stagestep {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-body-sm);
  color: var(--text-faint);
  padding: 2px 9px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.stagestep__mark {
  width: 13px; height: 13px;
  display: grid; place-items: center;
  flex: none;
}
.stagestep__mark svg { width: 11px; height: 11px; }
.stagestep__dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: 0.4;
}

.stagestep.is-done { color: var(--status-success); }
.stagestep.is-done .stagestep__dot { display: none; }

.stagestep.is-current {
  color: var(--brand-primary);
  background: var(--brand-primary-soft);
  font-weight: 600;
}
.stagestep.is-current .stagestep__dot { opacity: 1; }

.stagechevron { color: var(--border-strong); flex: none; display: grid; place-items: center; }
.stagechevron svg { width: 12px; height: 12px; }

.stagebar__meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  font-size: var(--fs-body-sm);
  color: var(--text-muted);
  white-space: nowrap;
  flex: none;
}
.stagebar__meta strong { color: var(--text-secondary); font-weight: 600; font-variant-numeric: tabular-nums; }
