:root {
  --sb-dark: #15171c;
  --sb-darker: #0f1115;
  --sb-side: #181b22;
  --sb-side-hover: #21252e;
  --sb-accent: #00b894;
  --sb-accent-d: #00997b;
  --sb-muted: #8a909a;
  --sb-line: #eef0f3;
  --sb-sidebar-w: 256px;
}

* { box-sizing: border-box; }
body { background: #f4f6f9; color: #23262d; }
a { color: var(--sb-accent-d); }

.btn-sb { background: var(--sb-accent); border-color: var(--sb-accent); color: #fff; }
.btn-sb:hover { background: var(--sb-accent-d); border-color: var(--sb-accent-d); color: #fff; }

.sb-has-sidebar { min-height: 100vh; }
.sb-shell {
  margin-left: var(--sb-sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .2s ease;
}

.sb-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sb-sidebar-w);
  background: var(--sb-side);
  color: #cfd3da;
  display: flex;
  flex-direction: column;
  z-index: 1045;
  border-right: 1px solid rgba(255,255,255,.05);
  transition: transform .2s ease;
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sb-brand-mark {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--sb-accent), var(--sb-accent-d));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  flex: 0 0 auto;
}
.sb-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.sb-brand-name { color: #fff; font-weight: 800; letter-spacing: .02em; }
.sb-brand-sub { color: var(--sb-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }

.sb-nav-menu { padding: .8rem .7rem; flex: 1 1 auto; overflow-y: auto; }
.sb-nav-label {
  color: #5b626e;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  padding: .9rem .8rem .35rem;
}
.sb-nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .8rem;
  margin-bottom: 2px;
  border-radius: 8px;
  color: #c2c7d0;
  text-decoration: none;
  font-size: .92rem;
  font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
.sb-nav-link i { font-size: 1.1rem; width: 1.3rem; text-align: center; color: #8a909a; transition: color .12s ease; }
.sb-nav-link:hover { background: var(--sb-side-hover); color: #fff; }
.sb-nav-link:hover i { color: #cfd3da; }
.sb-nav-link.active { background: rgba(0,184,148,.14); color: #fff; box-shadow: inset 3px 0 0 var(--sb-accent); }
.sb-nav-link.active i { color: var(--sb-accent); }

.sb-sidebar-foot { padding: .9rem 1.1rem; border-top: 1px solid rgba(255,255,255,.06); }
.sb-tender-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: rgba(255,255,255,.05);
  color: #aeb4bf;
  border-radius: 6px;
  padding: .3rem .6rem;
  font-size: .76rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.sb-topbar {
  position: sticky; top: 0;
  z-index: 1030;
  background: #fff;
  border-bottom: 1px solid var(--sb-line);
  height: 62px;
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: 0 1.4rem;
}
.sb-burger {
  display: none;
  background: none; border: none;
  font-size: 1.4rem; color: #23262d;
  padding: 0; line-height: 1;
}
.sb-topbar-title { font-weight: 700; color: var(--sb-dark); font-size: 1.05rem; }
.sb-topbar-right { margin-left: auto; }
.sb-user-btn {
  display: flex; align-items: center; gap: .6rem;
  text-decoration: none; color: #23262d;
  padding: .25rem .35rem; border-radius: 8px;
}
.sb-user-btn:hover { background: #f4f6f9; color: #23262d; }
.sb-user-btn::after { display: none; }
.sb-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--sb-accent), var(--sb-accent-d));
  color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.sb-user-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.sb-user-name { font-weight: 600; font-size: .9rem; }
.sb-user-role { font-size: .72rem; color: var(--sb-muted); }

.sb-content { flex: 1 1 auto; padding: 1.6rem 1.6rem 0; }
.sb-footer { text-align: center; padding: 2rem 0 1.2rem; }

.sb-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1040;
  opacity: 0; visibility: hidden;
  transition: opacity .2s ease;
}

@media (max-width: 991.98px) {
  .sb-shell { margin-left: 0; }
  .sb-sidebar { transform: translateX(-100%); }
  .sb-burger { display: inline-flex; align-items: center; }
  .sb-open .sb-sidebar { transform: translateX(0); }
  .sb-open .sb-backdrop { opacity: 1; visibility: visible; }
  .sb-user-meta { display: none; }
  .sb-content { padding: 1.1rem 1rem 0; }
}

.card { border: none; box-shadow: 0 1px 3px rgba(0,0,0,.08); border-radius: .6rem; }
.card-header { background: #fff; border-bottom: 1px solid var(--sb-line); font-weight: 600; }
.stat { border-radius: .6rem; padding: 1rem 1.2rem; color: #fff; }
.stat .n { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat .l { font-size: .8rem; opacity: .9; text-transform: uppercase; letter-spacing: .04em; }
.stat.blocker { background: #c0392b; }
.stat.high { background: #e67e22; }
.stat.medium { background: #f1c40f; color: #3b3b00; }
.stat.done { background: var(--sb-accent); }
.sev-blocker { color: #c0392b; }
.sev-high { color: #e67e22; }
.sev-medium { color: #b7950b; }
.sev-mechanics { color: #2980b9; }
.badge-blocker { background: #c0392b; }
.badge-high { background: #e67e22; }
.badge-medium { background: #f1c40f; color:#3b3b00; }
.badge-mechanics { background: #2980b9; }

.sb-auth { background: linear-gradient(135deg, #15171c 0%, #1b2a28 100%); min-height: 100vh; }
.login-wrap { max-width: 380px; margin: 8vh auto; }
.login-brand { color: #fff; font-weight: 800; }
.sb-auth .text-muted { color: #aeb4bf !important; }

.file-row { transition: background .12s ease; }
.file-row:hover { background: #f8fafb; }
.comment { background:#fff; border:1px solid var(--sb-line); border-radius:.5rem; padding:.6rem .8rem; margin-bottom:.5rem; }
.comment .meta { font-size:.78rem; color: var(--sb-muted); }
.detail-pre { white-space: pre-wrap; }
.progress { height: 1.2rem; }
.section-title { font-weight: 700; color: var(--sb-dark); }

.sub-file-icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: #eef7f4; color: var(--sb-accent-d);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.05rem; flex: 0 0 auto;
}
.sub-preview {
  background: #f4f6f9;
  border: 1px solid var(--sb-line);
  border-radius: .5rem;
  min-height: 60vh;
  height: 60vh;
  display: flex; align-items: center; justify-content: center;
  overflow: auto;
}
.sub-preview iframe { width: 100%; height: 100%; border: 0; border-radius: .5rem; }
.sub-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sub-preview pre {
  width: 100%; height: 100%; margin: 0; padding: 1rem;
  text-align: left; overflow: auto; white-space: pre-wrap;
  font-size: .85rem; background: #fff; border-radius: .5rem;
}
.sub-comments { max-height: 60vh; overflow-y: auto; }
.sub-empty { color: var(--sb-muted); font-size: .9rem; padding: 1.2rem 0; text-align: center; }
.comment-count {
  display: inline-flex; align-items: center; gap: .25rem;
  background: #eef7f4; color: var(--sb-accent-d);
  border-radius: 20px; padding: .1rem .5rem; font-size: .74rem; font-weight: 600;
}

/* ------------------------------------------------ Readiness tags */
.status-badge {
  display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap;
  font-size: .72rem; font-weight: 600; line-height: 1;
  padding: .2rem .55rem; border-radius: 999px; border: 1px solid transparent;
}
.status-badge i { font-size: .8rem; }
.status-count {
  background: rgba(0, 0, 0, .12); border-radius: 999px;
  padding: 0 .4rem; margin-left: .2rem; font-size: .7rem; font-weight: 700;
}
.status-select {
  width: auto; min-width: 9.75rem; font-size: .74rem; font-weight: 600;
  padding: .2rem 1.6rem .2rem .55rem; border-radius: 999px; border-width: 1px;
  background-position: right .45rem center;
}
.status-select:focus { box-shadow: 0 0 0 .2rem rgba(19, 102, 214, .18); }
.status-ready,      select.status-select.status-ready      { background-color: #e3f5ec; color: #1a7f4b; border-color: #bfe6d2; }
.status-review,     select.status-select.status-review     { background-color: #e7f0fd; color: #1366d6; border-color: #c5dcfb; }
.status-draft,      select.status-select.status-draft      { background-color: #eef0f3; color: #5b6470; border-color: #d8dde3; }
.status-incomplete, select.status-select.status-incomplete { background-color: #fdecec; color: #c0392b; border-color: #f6cfcf; }
.status-legend .status-badge { font-size: .73rem; }

/* ---------------------------------------------------- Rendered markdown */
.sub-preview .md-body { width: 100%; height: 100%; overflow: auto; background: #fff; border-radius: .5rem; text-align: left; }
.md-body { font-size: .92rem; color: #23262d; line-height: 1.55; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { font-weight: 700; color: var(--sb-dark); margin-top: 1.1rem; }
.md-body h1 { font-size: 1.4rem; } .md-body h2 { font-size: 1.2rem; } .md-body h3 { font-size: 1.05rem; }
.md-body h1, .md-body h2 { border-bottom: 1px solid var(--sb-line); padding-bottom: .3rem; }
.md-body table { width: 100%; border-collapse: collapse; margin: .8rem 0; font-size: .85rem; }
.md-body th, .md-body td { border: 1px solid #e2e6ea; padding: .4rem .55rem; vertical-align: top; }
.md-body th { background: #f4f6f9; text-align: left; }
.md-body tr:nth-child(even) td { background: #fafbfc; }
.md-body code { background: #f4f6f9; padding: .1rem .35rem; border-radius: 4px; font-size: .85em; color: #b1004b; }
.md-body pre { background: #15171c; color: #e6e8ec; padding: .8rem 1rem; border-radius: .5rem; overflow: auto; }
.md-body pre code { background: none; color: inherit; padding: 0; }
.md-body blockquote { border-left: 3px solid var(--sb-accent); margin: .6rem 0; padding: .2rem .9rem; color: #555; background: #f8fafb; }
.md-body ul, .md-body ol { padding-left: 1.4rem; }
.md-body img { max-width: 100%; }
