/*
 * Native Stack chrome on top of vendor/ui tokens and bundle.css.
 */

html, body { min-height: 100%; }
html { background: var(--tracing); }

.ns-shell { min-height: 100vh; }

.turbo-progress-bar { background: var(--clay); height: 2px; }

.ns-shell a:not([class]) { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.ns-shell a.ns-btn, .ns-shell a.ns-tile, .ns-shell a.ns-family-btn { text-decoration: none; }
.ns-shell a.ns-btn-primary { color: var(--on-clay); }
.ns-table .ns-cell-primary a { color: var(--ink); font-weight: 600; text-decoration: none; }
.ns-table .ns-cell-primary a:hover { text-decoration: underline; }

.ns-page {
  width: min(72rem, 100%);
  margin-inline: auto;
  padding: var(--space-8) var(--space-6) var(--space-12);
}

.ns-family-home .ns-display {
  font-size: 40px;
  line-height: 40px;
  margin: 0 0 var(--space-2);
}

.ns-family-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-8);
}

.ns-sign-in-page {
  min-height: calc(100vh - var(--space-12));
  display: flex;
  align-items: center;
  justify-content: center;
}

.ns-sign-in-card {
  width: 100%;
  max-width: 22rem;
  padding: var(--space-8);
  background: var(--paper);
  border: 1px solid var(--dust);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.ns-sign-in-mark {
  width: 40px;
  height: 40px;
  display: block;
  margin-bottom: var(--space-4);
}

.ns-sign-in-card .ns-display {
  margin: 0 0 var(--space-6);
}

.ns-sign-in-card .ns-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.ns-sign-in-password-row {
  justify-content: space-between;
  align-items: baseline;
}

.ns-sign-in-submit {
  margin-top: var(--space-2);
  width: 100%;
}

.ns-sign-in-alert,
.ns-sign-in-notice {
  margin: 0 0 var(--space-4);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 18px;
}

.ns-sign-in-alert {
  background: var(--clay-tint);
  color: var(--clay-deep);
}

.ns-sign-in-notice {
  background: var(--tracing);
  color: var(--ink-soft);
}

.ns-bar-tools {
  margin-left: auto;
}

.ns-table td.ns-num, .ns-table td .ns-unknown { white-space: nowrap; }

@media (max-width: 720px) {
  .ns-pagehead-actions { margin-left: 0; flex-wrap: wrap; width: 100%; }
  .ns-record-fields { grid-template-columns: 1fr 1fr; }
  .ns-record-field:nth-child(2n) { border-right: 0; }
  .ns-bar-tools .ns-actor { gap: 0; padding-right: 0; }
  .ns-bar-actor-email { display: none; }
  .ns-table-phone td[data-label="Project"]::before { display: none; }
  /* Mobile schedule rendering is a later issue (#66 scope: desktop only). */
  .ns-schedule-wrap { display: none; }
}

.ns-jobs-filters {
  margin: var(--space-4) 0 var(--space-4);
  flex-wrap: wrap;
}

.ns-jobs-filters a.ns-filter {
  text-decoration: none;
}

.ns-money-input { position: relative; display: block; }
.ns-money-prefix { position: absolute; left: var(--space-3); top: 0; height: 38px; display: flex; align-items: center; color: var(--ink-mute); pointer-events: none; }
.ns-money-input .ns-input { padding-left: var(--space-6); width: 100%; }

.ns-project-form { max-width: 40rem; display: flex; flex-direction: column; gap: var(--space-6); margin-top: var(--space-4); }
.ns-form-section { padding: var(--space-5); border: 1px solid var(--dust); background: var(--paper); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.ns-form-section .ns-title-sm { margin-bottom: var(--space-4); }
.ns-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) var(--space-5); }
.ns-form-grid .ns-span-2 { grid-column: span 2; }
.ns-form-actions { display: flex; gap: var(--space-3); align-items: center; }
.ns-form-errors { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--clay-tint); color: var(--clay-deep); font-size: 13px; line-height: 18px; }
.ns-form-errors p { margin: 0; }
.ns-input-invalid { border-color: var(--clay-deep); }
.ns-field-error { color: var(--clay-deep); font-size: 13px; line-height: 18px; }
@media (max-width: 720px) {
  .ns-form-grid { grid-template-columns: 1fr; }
  .ns-form-grid .ns-span-2 { grid-column: auto; }
}

.ns-empty {
  padding: var(--space-8) var(--space-6);
  border: 1px dashed var(--dust-deep);
  border-radius: var(--radius-lg);
  text-align: center;
}

.ns-empty .ns-title-sm {
  margin-bottom: var(--space-1);
}

.ns-title-sm {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  line-height: 22px;
  margin: 0 0 var(--space-2);
}

/*
 * Standins for primitives the kit (vendor/ui) doesn't have yet. Tokens only,
 * no invented colour/radius/shadow -- this is composition, not a second
 * design language. Move into vendor/ui and delete from here once it exists
 * there; flagged on the PR, no write/issue access to Native-Stack-LLC/ui to
 * file it directly.
 */
.ns-chrome-float {
  position: fixed;
  top: var(--space-3);
  right: var(--space-4);
  display: flex;
  gap: var(--space-2);
  z-index: var(--z-chrome, 10);
}

.ns-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--dust);
  background: var(--paper);
  box-shadow: var(--shadow-card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  padding: 0;
}
.ns-icon-btn:hover { background: var(--tracing); }
.ns-icon-btn .ns-actor-avatar { width: 20px; height: 20px; font-size: 10px; }

.ns-chrome-float .ns-family-menu { top: 44px; right: 0; left: auto; }

.ns-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  border: 1px solid var(--dust);
  background: var(--paper);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.ns-chip-btn:hover { background: var(--tracing); }
.ns-chip-btn-empty { border-style: dashed; color: var(--ink-mute); }

.ns-card-centered .ns-record-head { justify-content: center; text-align: center; }
.ns-card-centered .ns-record-field { text-align: center; }

.ns-disclosure { position: relative; display: inline-block; }
.ns-disclosure > summary { list-style: none; cursor: pointer; }
.ns-disclosure > summary::-webkit-details-marker { display: none; }
.ns-disclosure-panel {
  position: absolute;
  top: 44px;
  left: 0;
  z-index: var(--z-sheet, 20);
  background: var(--paper);
  border: 1px solid var(--dust);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-toast);
  padding: var(--space-3);
  min-width: 220px;
}

/* Inside a card (ns-record clips with overflow: hidden, so a floating
   popover gets cut off) the panel grows the card instead of floating. */
.ns-disclosure-inline .ns-disclosure-panel {
  position: static;
  box-shadow: none;
  margin-top: var(--space-3);
  min-width: 0;
  width: 100%;
}

.ns-projects-index { width: min(40rem, 100%); margin-inline: auto; }
.ns-projects-actions { display: flex; justify-content: center; gap: var(--space-2); margin: var(--space-3) 0 var(--space-8); }
.ns-projects-feed { display: flex; flex-direction: column; gap: var(--space-4); }

/* The schedule chart (#66): a Gantt of the same list as the feed below it.
   No vendor/ui primitive for this (flagged, same as .ns-record-* companions
   above) -- tokens only. Wider than the feed's own column on purpose: the
   chart is the overview, the feed is the detail, and the column width below
   is picked so a desktop viewport shows roughly three months of it. */
.ns-schedule-wrap { width: min(90rem, 100%); margin: 0 auto var(--space-8); }
.ns-schedule {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--dust);
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.ns-schedule-labels {
  flex: 0 0 200px;
  display: grid;
  border-right: 1px solid var(--dust-deep);
  background: var(--paper);
  z-index: 1;
}
.ns-schedule-scroll { flex: 1 1 auto; overflow-x: auto; min-width: 0; }
.ns-schedule-grid { display: grid; position: relative; min-width: max-content; }
.ns-schedule-corner { border-bottom: 1px solid var(--dust); }
.ns-schedule-dow, .ns-schedule-date {
  text-align: center; font-size: 9px; line-height: 16px; color: var(--ink-mute);
  border-bottom: 1px solid var(--dust); overflow: hidden;
}
.ns-schedule-date { font-weight: 600; color: var(--ink-soft); border-bottom: 1px solid var(--dust-deep); }
.ns-schedule-today-col { background: var(--clay-tint); }
.ns-schedule-today-marker { grid-row: 1 / -1; background: var(--clay-tint); z-index: 0; pointer-events: none; }
.ns-schedule-label {
  border-bottom: 1px solid var(--dust);
  padding: var(--space-2) var(--space-3);
  display: flex; flex-direction: column; justify-content: center;
}
.ns-schedule-track { border-bottom: 1px solid var(--dust); z-index: 1; }
.ns-schedule-bar { align-self: center; height: 22px; margin: 0 2px; border-radius: var(--radius-sm); z-index: 1; }
.ns-schedule-bar.ns-status-prospective { background: var(--paper); border: 1px solid var(--dust-deep); }
.ns-schedule-bar.ns-status-current { background: var(--aggregate-tint); border: 1px solid var(--sand-deep); }
.ns-schedule-bar.ns-status-complete { background: var(--status-complete); }
.ns-schedule-month {
  text-align: center; font-size: 11px; font-weight: 600; color: var(--ink-soft);
  border-top: 1px solid var(--dust-deep); padding-top: var(--space-2);
}
.ns-schedule-link { text-decoration: none; color: inherit; display: block; }
.ns-schedule-label .ns-schedule-link { display: flex; flex-direction: column; }
.ns-schedule-bar .ns-schedule-link { width: 100%; height: 100%; }
.ns-schedule-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.ns-schedule-address { font-size: 11px; color: var(--ink-mute); margin-top: 2px; }

.ns-companies-cards, .ns-related-cards {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-4);
  margin-top: var(--space-6);
}
