:root {
  --bg: #eef2ef;
  --surface: #ffffff;
  --surface-2: #f7f8f6;
  --ink: #17211f;
  --muted: #66736e;
  --line: #d9e0dc;
  --green: #1f7a55;
  --green-soft: #dcefe5;
  --blue: #2c6f91;
  --blue-soft: #dcecf3;
  --amber: #a86514;
  --amber-soft: #f6ead8;
  --red: #9f3a33;
  --shadow: 0 14px 30px rgba(20, 35, 31, 0.08);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
select,
input,
textarea {
  font: inherit;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 100vh;
  padding: 22px;
  background: #112b27;
  color: #f7faf8;
}

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

.brand img {
  flex: 0 0 auto;
  border-radius: 8px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
  line-height: 1.2;
}

.brand span {
  margin-top: 3px;
  color: #b9ccc5;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.2);
}

.nav-mark,
.module-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #dcefe5;
  color: #12312b;
  font-weight: 800;
}

.nav-item strong,
.nav-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item strong {
  font-size: 14px;
}

.nav-item small {
  margin-top: 2px;
  color: #b9ccc5;
  font-size: 12px;
}

.side-panel {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.side-panel label {
  color: #b9ccc5;
  font-size: 12px;
}

.side-panel select {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 0 10px;
  background: #f7faf8;
  color: #17211f;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.topbar p,
.topbar h1 {
  margin: 0;
}

.topbar p {
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.topbar h1 {
  margin-top: 4px;
  font-size: 30px;
  line-height: 1.1;
}

.top-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.pill,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-ready {
  background: var(--green-soft);
  border-color: #b8dec8;
  color: var(--green);
}

.status-pending {
  background: var(--amber-soft);
  border-color: #e7cfad;
  color: var(--amber);
}

.status-reserved {
  background: var(--blue-soft);
  border-color: #b8d7e3;
  color: var(--blue);
}

.content {
  min-width: 0;
}

.overview-grid,
.detail-grid {
  display: grid;
  gap: 16px;
}

.metric-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.metric-band article {
  min-height: 112px;
  padding: 18px;
  background: var(--surface);
}

.metric-band span,
.module-meta,
.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-band strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
  line-height: 1;
}

.work-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-head,
.module-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2,
.module-card h3 {
  margin: 0;
}

.section-head h2 {
  font-size: 18px;
}

.section-head > span:not(.status) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.module-card {
  display: grid;
  gap: 11px;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-2);
}

.suite-launch-panel {
  max-width: 1080px;
}

.module-grid-clean {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.module-card-clean {
  min-height: 188px;
}

.module-card-clean p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.module-card p,
.module-detail p,
.priority-list p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.module-meta {
  display: grid;
  gap: 5px;
  margin-top: auto;
}

.module-card button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.module-card button:hover {
  background: #165c41;
}

.access-grid {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

.access-form {
  display: grid;
  gap: 12px;
}

.access-form label,
.module-checks {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.access-form input,
.access-form select,
.access-form textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  color: var(--ink);
}

.access-form textarea {
  min-height: 78px;
  resize: vertical;
}

.module-checks {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.module-checks legend {
  padding: 0 6px;
  color: var(--ink);
}

.module-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.module-checks input {
  width: 16px;
  min-height: 16px;
}

.module-access-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}

.module-access-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.module-access-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.module-access-header small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.module-scope-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  padding-left: 24px;
}

.module-scope-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.access-form button,
.access-table button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #ffffff;
  padding: 0 12px;
  font-weight: 800;
  cursor: pointer;
}

.access-form button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.form-note,
.muted-text {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.access-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.access-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.access-table th,
.access-table td {
  border-top: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.access-table th {
  color: var(--muted);
  font-size: 12px;
}

.access-table strong,
.access-table span {
  display: block;
}

.access-table span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.empty-cell {
  color: var(--muted);
}

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

.priority-list article {
  border-left: 4px solid var(--green);
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
}

.priority-list strong {
  display: block;
  margin-bottom: 3px;
}

.detail-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
}

.module-detail {
  grid-row: span 2;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.steps li {
  color: var(--muted);
  line-height: 1.45;
}

.loading,
.error-panel {
  color: var(--muted);
}

.error-panel {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.error-panel h2,
.error-panel p {
  margin: 0;
}

.error-panel h2 {
  color: var(--ink);
  font-size: 18px;
}

.error-panel button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #ffffff;
  padding: 0 12px;
  font-weight: 800;
  cursor: pointer;
}

.install-app-prompt {
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: min(520px, calc(100vw - 28px));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 12px;
  background: #112b27;
  color: #f7faf8;
  box-shadow: 0 18px 38px rgba(17, 43, 39, 0.24);
}

.install-app-prompt strong,
.install-app-prompt span {
  display: block;
}

.install-app-prompt strong {
  font-size: 13px;
  line-height: 1.25;
}

.install-app-prompt span {
  margin-top: 2px;
  color: #c9d8d2;
  font-size: 12px;
  line-height: 1.35;
}

.install-app-action,
.install-app-dismiss {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.install-app-action {
  min-height: 38px;
  padding: 0 12px;
  background: #dcefe5;
  color: #12312b;
  white-space: nowrap;
}

.install-app-action:disabled {
  opacity: 0.72;
  cursor: wait;
}

.install-app-dismiss {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.08);
  color: #f7faf8;
}

@media (max-width: 880px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

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

  .side-panel {
    margin-top: 0;
  }

  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-meta {
    justify-content: flex-start;
  }

  .metric-band,
  .detail-grid,
  .access-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .install-app-prompt {
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    grid-template-columns: minmax(0, 1fr) auto;
    width: auto;
  }

  .install-app-action {
    grid-column: 1 / -1;
    width: 100%;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .detail-list div {
    grid-template-columns: 1fr;
  }
}
