:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #17202a;
  --muted: #5d6875;
  --line: #d9e0e8;
  --green: #18724b;
  --blue: #245f92;
  --amber: #94620f;
  --amber-soft: #fff7e6;
  --green-soft: #edf8f2;
  --sidebar: #152238;
  --sidebar-muted: #b8c5d4;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  width: 100%;
  min-height: 100vh;
}

.sidebar {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  width: 300px;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid #0f1a2d;
  color: #ffffff;
  background: var(--sidebar);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 86px;
  margin-bottom: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.brand-logo {
  display: block;
  width: min(100%, 264px);
  max-width: 264px;
  aspect-ratio: 306 / 86;
  height: auto;
  flex: 0 0 auto;
  object-fit: contain;
  object-position: center;
}

.sidebar-brand > div,
.sidebar-brand span {
  display: none;
}

.sidebar-brand:hover,
.sidebar-brand:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.32);
  outline-offset: 6px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-version {
  margin: auto 0 0;
  padding: 14px 12px 0;
  color: var(--sidebar-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.sidebar-link {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  color: #eef4fb;
  background: transparent;
  text-decoration: none;
  text-align: left;
  font-weight: 750;
  font: inherit;
  cursor: pointer;
}

.sidebar-link:hover,
.sidebar-link:focus,
.sidebar-link[aria-current="page"],
.sidebar-link.is-active {
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

.app-main {
  grid-column: 2;
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.header-actions,
.badge-row,
.section-heading,
.workflow-strip,
.action-grid,
.item-meta,
.item-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.header-actions {
  justify-content: flex-end;
  align-items: center;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 1.8rem;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.15rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.lede,
.current-section-label,
.small,
.empty-state,
.read-item p,
.summary-panel p,
.future-card p,
.boundary-list {
  color: var(--muted);
}

.current-section-label {
  margin-bottom: 8px;
  font-weight: 800;
}

.section-panel,
.summary-panel,
.future-card,
.read-item,
.status-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.section-panel {
  display: none;
  margin-bottom: 18px;
  padding: 18px;
}

.section-panel[hidden] {
  display: none !important;
}

.section-panel.is-active {
  display: block !important;
}

.section-heading {
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-heading.compact {
  align-items: center;
}

.status-panel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--green);
  font-weight: 850;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 0.78rem;
  font-weight: 850;
}

.badge-safe {
  color: var(--green);
  background: var(--green-soft);
  border-color: #b9dcca;
}

.badge-warning {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #efd7a6;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 850;
}

.primary-action,
.secondary-action {
  padding: 0 14px;
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

.secondary-action {
  background: var(--green);
  border-color: var(--green);
}

button:disabled {
  color: var(--muted);
  background: #eef2f6;
}

.overview-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(0, 1.25fr);
  gap: 14px;
}

.summary-panel,
.future-card,
.read-item {
  padding: 14px;
}

.summary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 0;
}

.summary-list div {
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.summary-list dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.summary-list dd {
  margin: 0;
  font-weight: 850;
}

.workflow-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #b9dcca;
  border-radius: 8px;
  background: #fbfdfb;
}

.workflow-strip {
  margin-bottom: 12px;
}

.workflow-strip span {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #b9dcca;
  border-radius: 8px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 0.82rem;
  font-weight: 850;
}

.item-list {
  display: grid;
  gap: 10px;
}

.profile-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  padding: 12px;
  color: inherit;
  background: #fbfcfd;
  text-align: left;
}

.profile-card:hover,
.profile-card:focus-visible,
.profile-card.is-selected {
  border-color: #7da7c9;
  background: #f5f9fc;
}

.person-photo,
.avatar-fallback {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  font-weight: 900;
}

.profile-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.profile-card-body {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.profile-card-body p {
  margin-bottom: 0;
}

.profile-list-view {
  display: grid;
  gap: 14px;
}

.profile-view {
  margin-top: 14px;
}

.profile-view[hidden],
.profile-list-view[hidden] {
  display: none !important;
}

.profile-view.is-active-profile {
  outline: 2px solid #7da7c9;
  outline-offset: 4px;
}

.profile-screen {
  display: grid;
  gap: 16px;
}

.profile-header {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.profile-header-body {
  display: grid;
  gap: 10px;
}

.profile-photo {
  width: 88px;
  height: 88px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.profile-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.profile-back-action {
  min-height: 34px;
}

.profile-breadcrumb {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.profile-section-stack {
  display: grid;
  gap: 12px;
}

.profile-section {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.profile-columns h4,
.profile-section h4 {
  margin: 0 0 8px;
}

.profile-columns ul,
.profile-section ul {
  margin: 0;
  padding-left: 18px;
}

.profile-definition-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.profile-definition-list div {
  display: grid;
  grid-template-columns: minmax(120px, 0.32fr) minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.profile-definition-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.profile-definition-list dt {
  color: var(--muted);
  font-weight: 850;
}

.profile-definition-list dd {
  margin: 0;
}

.belongings-list {
  display: grid;
  gap: 10px;
}

.belonging-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.belonging-icon {
  display: inline-flex;
  width: 58px;
  height: 58px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 0.78rem;
  font-weight: 850;
}

.belonging-item h5 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.planning-board,
.kitchen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.shift-column,
.meal-plan {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.deployment-card,
.kitchen-alert {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.deployment-card + .deployment-card,
.kitchen-alert + .kitchen-alert {
  margin-top: 10px;
}

.meal-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.read-item {
  background: #fbfcfd;
}

.read-item h3 {
  margin-bottom: 0;
}

.item-title-row {
  align-items: flex-start;
  justify-content: space-between;
}

.item-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.review-item {
  border-color: #efd7a6;
  background: var(--amber-soft);
}

.review-note,
.offline-message,
.next-step {
  color: var(--amber);
  font-weight: 800;
}

.offline-message {
  padding: 10px 12px;
  border: 1px solid #efd7a6;
  border-radius: 8px;
  background: var(--amber-soft);
}

.synthetic-actions {
  border-color: #b9dcca;
}

.action-copy {
  margin-bottom: 12px;
  font-weight: 800;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.action-grid button {
  width: 100%;
}

.action-summary {
  margin: 12px 0;
}

.future-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.future-card button {
  width: 100%;
}

.boundary-list {
  margin: 0;
  padding-left: 20px;
}

.boundary-list li + li {
  margin-top: 8px;
}

.empty-state {
  margin: 0;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

@media print {
  .app-shell {
    display: grid !important;
    grid-template-columns: 300px minmax(0, 1fr) !important;
    width: 100% !important;
    min-height: 100vh !important;
  }

  .sidebar {
    grid-column: 1 !important;
    width: 300px !important;
    position: relative !important;
    top: auto !important;
    height: auto !important;
    min-height: 100vh !important;
    border-right: 1px solid #0f1a2d !important;
    background: var(--sidebar) !important;
  }

  .sidebar-nav {
    display: flex !important;
    flex-direction: column !important;
  }

  .sidebar-link {
    display: block !important;
    color: #eef4fb !important;
    text-decoration: none !important;
  }

  .app-main {
    grid-column: 2 !important;
    min-width: 0 !important;
  }

  .section-panel {
    display: none !important;
  }

  .section-panel.is-active {
    display: block !important;
  }
}

@media (max-width: 560px) {
  .app-shell {
    display: block;
    grid-template-columns: none;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
  }

  .overview-layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .header-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .app-main {
    padding: 16px;
  }

  .section-heading {
    display: grid;
  }

  .primary-action,
  .secondary-action,
  .status-panel {
    width: 100%;
  }
}
