/* ============================================================
   See Play Dream OS — Brand Design System
   ============================================================ */

:root {
  /* Brand colours */
  --color-text:       #111214;
  --color-text-light: #555a64;
  --color-bg:         #F7F8FA;
  --color-card:       #ffffff;
  --color-border:     #e2e4e9;
  --color-blue:       #00acff;
  --color-green:      #1bad5a;
  --color-red:        #ff3c41;
  --color-yellow:     #ffb800;

  /* Pillar accent colours */
  --pillar-0: #00acff;   /* Brand and Vision */
  --pillar-1: #7c5cfc;   /* Compliance */
  --pillar-2: #1bad5a;   /* Finance */
  --pillar-3: #ff8c00;   /* Marketing */
  --pillar-4: #ff3c7e;   /* Clients */
  --pillar-5: #00c9a7;   /* People and Culture */

  /* Spacing */
  --sp-xs: .25rem;
  --sp-sm: .5rem;
  --sp-md: 1rem;
  --sp-lg: 1.5rem;
  --sp-xl: 2.5rem;
  --sp-2xl: 4rem;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
}
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h3 { font-size: clamp(1.05rem, 2.5vw, 1.35rem); }

/* ---- Layout ---- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--sp-lg) var(--sp-lg);
}

/* ---- Nav ---- */
.site-nav {
  background: var(--color-blue);
  padding: var(--sp-sm) var(--sp-lg);
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  flex-wrap: wrap;
}
.site-nav .logo img { height: 96px; width: auto; }
.site-nav .nav-links { display: flex; gap: var(--sp-xs); flex-wrap: wrap; margin-left: auto; }
.site-nav .nav-links a {
  color: #fff;
  font-weight: 500;
  font-size: .875rem;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  transition: background .2s;
}
.site-nav .nav-links a:hover,
.site-nav .nav-links a.active {
  background: rgba(255,255,255,.15);
  text-decoration: none;
}
.site-nav .nav-user {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  color: #fff;
}
.site-nav .nav-user .org-switcher { margin: 0; }
.site-nav .nav-user .org-switcher select {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--radius-md);
  padding: 6px 28px 6px 12px;
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23ffffff' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.site-nav .nav-user .org-switcher select option { color: var(--color-text); background: #fff; }
.site-nav .nav-user .org-label {
  font-size: .85rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.1);
}
.site-nav .nav-user .nav-user-link {
  color: rgba(255,255,255,.85);
  font-size: .8rem;
  padding: 6px 10px;
  border-radius: var(--radius-full);
}
.site-nav .nav-user .nav-user-link:hover { background: rgba(255,255,255,.15); text-decoration: none; color: #fff; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---- Messages / Toasts ---- */
.messages { list-style: none; margin-bottom: var(--sp-lg); }
.messages li {
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: .9rem;
  margin-bottom: var(--sp-xs);
}
.messages .success, .messages .info { background: #e6f9ee; color: #0d7a3a; }
.messages .error   { background: #ffeaea; color: #c9202e; }
.messages .warning { background: #fff7e0; color: #8a6900; }

/* ---- Cards ---- */
.card {
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-lg);
  margin-bottom: var(--sp-lg);
}
.card-header {
  margin-bottom: var(--sp-md);
  padding-bottom: var(--sp-sm);
  border-bottom: 1px solid var(--color-border);
}
.card-header h2, .card-header h3 { margin: 0; }

/* ---- Pillar Cards ---- */
.pillar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-lg);
}
.pillar-card {
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
}
.pillar-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.pillar-card .pillar-accent {
  height: 8px;
  width: 100%;
}
.pillar-card .pillar-body {
  padding: var(--sp-lg);
  flex: 1;
  display: flex;
  flex-direction: column;
}
.pillar-card .pillar-name {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: var(--sp-sm);
}
.pillar-card .pillar-meta {
  font-size: .85rem;
  color: var(--color-text-light);
  margin-bottom: var(--sp-md);
  flex: 1;
}
.pillar-progress-row {
  margin-bottom: var(--sp-sm);
}
.pillar-progress-label {
  font-size: .85rem;
  color: var(--color-text);
  display: block;
  margin-bottom: 4px;
}
.pillar-progress-label strong {
  font-size: 1rem;
}
.pillar-progress-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}
.pillar-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s;
}

/* Pillar accent colours */
.pillar-0 .pillar-accent { background: var(--pillar-0); }
.pillar-1 .pillar-accent { background: var(--pillar-1); }
.pillar-2 .pillar-accent { background: var(--pillar-2); }
.pillar-3 .pillar-accent { background: var(--pillar-3); }
.pillar-4 .pillar-accent { background: var(--pillar-4); }
.pillar-5 .pillar-accent { background: var(--pillar-5); }

.pillar-0 .pillar-progress-fill { background: var(--pillar-0); }
.pillar-1 .pillar-progress-fill { background: var(--pillar-1); }
.pillar-2 .pillar-progress-fill { background: var(--pillar-2); }
.pillar-3 .pillar-progress-fill { background: var(--pillar-3); }
.pillar-4 .pillar-progress-fill { background: var(--pillar-4); }
.pillar-5 .pillar-progress-fill { background: var(--pillar-5); }

.pillar-view-btn {
  display: inline-block;
  margin-top: auto;
  padding-top: var(--sp-md);
  font-weight: 600;
  font-size: .85rem;
  letter-spacing: .02em;
  color: var(--color-text-light);
  transition: color .15s;
}
.pillar-0:hover .pillar-view-btn { color: var(--pillar-0); }
.pillar-1:hover .pillar-view-btn { color: var(--pillar-1); }
.pillar-2:hover .pillar-view-btn { color: var(--pillar-2); }
.pillar-3:hover .pillar-view-btn { color: var(--pillar-3); }
.pillar-4:hover .pillar-view-btn { color: var(--pillar-4); }
.pillar-5:hover .pillar-view-btn { color: var(--pillar-5); }

.pillar-0 .pillar-name { color: var(--pillar-0); }
.pillar-1 .pillar-name { color: var(--pillar-1); }
.pillar-2 .pillar-name { color: var(--pillar-2); }
.pillar-3 .pillar-name { color: var(--pillar-3); }
.pillar-4 .pillar-name { color: var(--pillar-4); }
.pillar-5 .pillar-name { color: var(--pillar-5); }

/* ---- Summary Cards Row ---- */
.summary-row {
  display: flex;
  gap: var(--sp-lg);
  flex-wrap: wrap;
  margin-bottom: var(--sp-lg);
}
.summary-card {
  flex: 1;
  min-width: 180px;
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-lg);
  text-align: center;
}
.summary-card .big-number {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  line-height: 1;
  display: block;
  margin-bottom: var(--sp-xs);
}
.summary-card .label {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-light);
}
.summary-card.blue   { border-top: 4px solid var(--color-blue); }
.summary-card.green  { border-top: 4px solid var(--color-green); }
.summary-card.red    { border-top: 4px solid var(--color-red); }
.summary-card.yellow { border-top: 4px solid var(--color-yellow); }
.summary-card.blue   .big-number { color: var(--color-blue); }
.summary-card.green  .big-number { color: var(--color-green); }
.summary-card.red    .big-number { color: var(--color-red); }
.summary-card.yellow .big-number { color: var(--color-yellow); }

/* ---- Tables ---- */
.table-wrap {
  overflow-x: visible;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
thead th {
  text-align: left;
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-light);
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: 2px solid var(--color-border);
}
tbody td {
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f0f4fb; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  font-family: inherit;
  font-weight: 600;
  font-size: .95rem;
  padding: 10px 28px;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  text-align: center;
  transition: background .2s, transform .1s;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary   { background: var(--color-blue); color: #fff; }
.btn-primary:hover { background: #009ae6; }
.btn-secondary { background: transparent; color: var(--color-blue); border: 2px solid var(--color-blue); }
.btn-secondary:hover { background: rgba(0,172,255,.08); }
.btn-danger    { background: var(--color-red); color: #fff; }
.btn-danger:hover { background: #e0333a; }
.btn-success   { background: var(--color-green); color: #fff; }
.btn-success:hover { background: #169a4f; }
.btn-sm {
  padding: 6px 18px;
  font-size: .8rem;
}

.btn-row {
  display: flex;
  gap: var(--sp-sm);
  flex-wrap: wrap;
  align-items: center;
}

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.6;
}
.badge-red     { background: var(--color-red); color: #fff; }
.badge-green   { background: var(--color-green); color: #fff; }
.badge-blue    { background: var(--color-blue); color: #fff; }
.badge-yellow  { background: var(--color-yellow); color: #111; }

/* ---- Score circle ---- */
.score-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}
.score-circle.good   { background: var(--color-green); }
.score-circle.medium { background: var(--color-yellow); color: #111; }
.score-circle.low    { background: var(--color-red); }

/* ---- Forms ---- */
form p { margin-bottom: var(--sp-md); }
form label {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: var(--sp-xs);
}
input[type="text"],
input[type="url"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  font-family: inherit;
  font-size: .95rem;
  padding: 10px 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color .2s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-blue);
}
textarea { min-height: 160px; resize: vertical; }

/* ---- Hero ---- */
.hero {
  text-align: center;
  padding: var(--sp-2xl) var(--sp-lg);
}
.hero .logo-hero { height: 96px; margin: 0 auto var(--sp-lg); }
.hero h1 { margin-bottom: var(--sp-sm); }
.hero p {
  font-size: 1.15rem;
  color: var(--color-text-light);
  margin-bottom: var(--sp-xl);
}
.hero .btn-row { justify-content: center; }

/* ---- Status bar ---- */
.status-bar {
  display: flex;
  gap: var(--sp-lg);
  flex-wrap: wrap;
  align-items: center;
  padding: var(--sp-md) 0;
  margin-bottom: var(--sp-md);
  border-bottom: 1px solid var(--color-border);
  font-size: .9rem;
}
.status-bar .status-item { display: flex; align-items: center; gap: var(--sp-xs); }

/* ---- Content preview (rendered Markdown) ---- */
.content-preview {
  background: #f4f5f7;
  border-radius: var(--radius-sm);
  padding: var(--sp-lg);
  font-size: .9rem;
  line-height: 1.7;
  max-height: 600px;
  overflow-y: auto;
}
.content-preview h1 { font-size: 1.5rem; margin: 1rem 0 .5rem; }
.content-preview h2 { font-size: 1.25rem; margin: 1rem 0 .5rem; }
.content-preview h3 { font-size: 1.1rem; margin: .75rem 0 .4rem; }
.content-preview p { margin: 0 0 .75rem; }
.content-preview ul, .content-preview ol { margin: 0 0 .75rem; padding-left: 1.5rem; }
.content-preview li { margin-bottom: .25rem; }
.content-preview table { width: 100%; border-collapse: collapse; margin: .75rem 0; }
.content-preview th, .content-preview td { border: 1px solid var(--color-border); padding: .4rem .6rem; text-align: left; }
.content-preview th { background: #ebedf0; font-weight: 600; }
.content-preview code { background: #ebedf0; padding: .15rem .35rem; border-radius: 3px; font-size: .85em; }
.content-preview pre { background: #ebedf0; padding: var(--sp-md); border-radius: var(--radius-sm); overflow-x: auto; margin: .75rem 0; }
.content-preview pre code { background: none; padding: 0; }
.content-preview blockquote { border-left: 3px solid var(--color-blue); margin: .75rem 0; padding: .5rem 1rem; color: #555; }

/* ---- Section accent header ---- */
.accent-header {
  padding: var(--sp-xl) var(--sp-lg);
  border-radius: var(--radius-md);
  color: #fff;
  margin-bottom: var(--sp-lg);
}
.accent-header h1 { color: #fff; }
.accent-header p  { color: rgba(255,255,255,.85); }
.accent-header a  { color: #fff; text-decoration: underline; }

/* ---- Document detail hero ---- */
.doc-hero {
  border-radius: var(--radius-md);
  padding: var(--sp-xl) var(--sp-lg) var(--sp-lg);
  margin-bottom: var(--sp-lg);
  color: #fff;
}
.doc-hero-breadcrumb {
  color: rgba(255,255,255,.8);
  font-size: .85rem;
  font-weight: 500;
  text-decoration: none;
}
.doc-hero-breadcrumb:hover { color: #fff; text-decoration: underline; }
.doc-hero-breadcrumb-sep {
  color: rgba(255,255,255,.5);
  font-size: .85rem;
  margin: 0 .25rem;
}
.doc-hero-title {
  color: #fff;
  margin-top: var(--sp-sm);
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
}
.doc-hero-desc {
  color: rgba(255,255,255,.85);
  margin-top: var(--sp-xs);
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.doc-hero-desc-hint {
  font-style: italic;
  opacity: .7;
}
.doc-hero-desc-hint:hover {
  opacity: 1;
  cursor: pointer;
}
.doc-hero-desc-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.5);
  font-size: .85rem;
  padding: 0 2px;
  opacity: 0;
  transition: opacity .15s;
}
.doc-hero-desc:hover .doc-hero-desc-edit-btn,
.doc-hero-desc-edit-btn-visible {
  opacity: 1;
}
.doc-hero-desc-edit-btn:hover {
  color: #fff;
}
.doc-hero-desc-wrap {
  position: relative;
}
.doc-hero-desc-input {
  width: 100%;
  max-width: 600px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: var(--radius);
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: .95rem;
  font-family: inherit;
  resize: vertical;
}
.doc-hero-desc-input::placeholder {
  color: rgba(255,255,255,.5);
}

/* ---- Document status strip ---- */
.doc-status-strip {
  display: flex;
  gap: var(--sp-md);
  flex-wrap: wrap;
  align-items: center;
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-md) var(--sp-lg);
  margin-bottom: var(--sp-lg);
}
.doc-status-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  font-size: .88rem;
}
.doc-status-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-light);
}
.doc-status-select {
  width: auto;
  padding: .2rem .4rem;
  font-size: .85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

/* ---- Toggle switch (Approved) ---- */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  margin: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: background .25s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .25s;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--color-green);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* ---- Download links (table inline) ---- */
.dl-links {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}
.dl-links a {
  color: var(--color-blue);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background .15s;
}
.dl-links a:hover {
  background: rgba(0,172,255,.1);
  text-decoration: none;
}
.dl-sep {
  color: var(--color-border);
  font-size: .7rem;
}

/* ---- Pillar hero ---- */
.pillar-hero {
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-xl);
  margin-bottom: var(--sp-lg);
  border-top: 5px solid var(--ph-accent, var(--color-blue));
}
.pillar-hero h1 {
  color: var(--ph-accent, var(--color-text));
}

/* ---- Guideline grid cards ---- */
.guideline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-md);
  margin-bottom: var(--sp-lg);
}
.guideline-card {
  display: flex;
  text-decoration: none;
  color: inherit;
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .2s, transform .15s;
}
.guideline-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  transform: translateY(-2px);
}
.guideline-card-accent {
  width: 6px;
  flex-shrink: 0;
  background: var(--gc-accent, var(--color-blue));
}
.guideline-card-body {
  padding: var(--sp-md) var(--sp-lg);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}
.guideline-card-name {
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.4;
  color: var(--color-text);
}
.guideline-card:hover .guideline-card-name {
  color: var(--gc-accent, var(--color-blue));
}
.guideline-card-progress {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}
.guideline-card-stat {
  font-size: .75rem;
  color: var(--color-text-light);
  white-space: nowrap;
}
.guideline-card-badge {
  font-size: .75rem;
  color: var(--color-text-light);
  font-style: italic;
}

/* ---- Inline CRUD (pillar detail) ---- */
.guideline-card-wrap {
  position: relative;
}
.guideline-card-wrap .inline-card-actions {
  position: absolute;
  top: var(--sp-sm);
  right: var(--sp-sm);
  display: none;
  gap: 2px;
  z-index: 2;
}
.guideline-card-wrap:hover .inline-card-actions {
  display: flex;
}
.inline-btn-edit,
.inline-btn-delete {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .85rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-light);
  transition: background .15s, color .15s;
}
.inline-btn-edit:hover {
  background: var(--color-blue);
  color: #fff;
  border-color: var(--color-blue);
}
.inline-btn-delete:hover {
  background: var(--color-red);
  color: #fff;
  border-color: var(--color-red);
}
.inline-rename-input {
  font-size: .95rem;
  font-weight: 600;
  padding: 4px 8px;
  border: 2px solid var(--color-blue);
  border-radius: var(--radius-sm);
  outline: none;
  width: 100%;
  max-width: 280px;
  font-family: inherit;
}
.inline-cadence-select {
  font-size: .85rem;
  padding: 4px 6px;
  border: 2px solid var(--color-blue);
  border-radius: var(--radius-sm);
  outline: none;
  font-family: inherit;
  background: #fff;
  cursor: pointer;
  width: 130px;
  flex-shrink: 0;
}
.inline-row-actions {
  white-space: nowrap;
  text-align: right;
}
.inline-row-actions .inline-btn-edit,
.inline-row-actions .inline-btn-delete {
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
tr:hover .inline-row-actions .inline-btn-edit,
tr:hover .inline-row-actions .inline-btn-delete {
  opacity: 1;
}
.inline-row-actions {
  display: flex;
  gap: 2px;
  justify-content: flex-end;
}
.guideline-card-add {
  display: flex;
  align-items: center;
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-md) var(--sp-lg);
  border: 2px dashed var(--color-border);
}
.guideline-card-add:hover {
  border-color: var(--gc-accent, var(--color-blue));
}
.inline-add-form {
  display: flex;
  gap: var(--sp-sm);
  align-items: center;
  width: 100%;
}
.inline-add-input {
  flex: 1;
  font-size: .88rem;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  font-family: inherit;
}
.inline-add-input:focus {
  border-color: var(--color-blue);
}
.inline-add-form-row {
  padding: var(--sp-xs) 0;
}
.doc-add-row td {
  border-top: 1px dashed var(--color-border);
  padding-top: var(--sp-sm);
}

/* ---- Adequacy feedback card ---- */
.adequacy-feedback-card {
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-blue);
  border-radius: var(--radius);
  background: #f0f8ff;
}
.adequacy-feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .6rem .8rem;
  font-size: .85rem;
  font-weight: 600;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}
.adequacy-feedback-body {
  padding: .6rem .8rem;
  font-size: .82rem;
  line-height: 1.6;
  white-space: pre-line;
  color: var(--color-text);
}

/* ---- Score popover ---- */
.score-popover-wrap {
  position: relative;
  display: inline-block;
}
.score-badge-btn {
  cursor: pointer;
  border: none;
  font: inherit;
}
.score-badge-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 0 2px rgba(0,0,0,.12);
}
.score-popover {
  display: none;
  position: absolute;
  z-index: 100;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
}
.score-popover.visible {
  display: block;
}
.score-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .6rem .8rem;
  border-bottom: 1px solid var(--color-border);
  font-size: .85rem;
}
.score-popover-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--color-muted);
  line-height: 1;
}
.score-popover-close:hover {
  color: var(--color-text);
}
.score-popover-body {
  padding: .6rem .8rem;
  font-size: .8rem;
  line-height: 1.5;
  color: var(--color-text);
  white-space: pre-line;
  max-height: 280px;
  overflow-y: auto;
}

/* ---- Doc description inline ---- */
.doc-desc-line {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 2px;
}
.doc-desc-text {
  font-size: 0.8rem;
  line-height: 1.3;
  min-height: 1em;
}
.doc-desc-text:empty::after {
  content: "No description";
  opacity: 0.4;
  font-style: italic;
}
.doc-desc-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity .15s;
  padding: 0 2px;
  color: var(--color-muted);
}
.doc-desc-line:hover .doc-desc-edit-btn {
  opacity: .7;
}
.doc-desc-edit-btn:hover {
  opacity: 1 !important;
  color: var(--color-blue);
}
.doc-desc-input {
  font-size: 0.8rem;
  padding: 2px 6px;
  width: 100%;
  max-width: 400px;
}

/* ---- Checklist styles ---- */
.checklist-progress-bar {
  height: 10px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.checklist-progress-bar.checklist-progress-sm {
  width: 80px;
  height: 6px;
}
.checklist-progress-fill {
  height: 100%;
  background: var(--color-green);
  border-radius: var(--radius-full);
  transition: width .3s ease;
}
.checklist-category {
  margin-bottom: var(--sp-lg);
}
.checklist-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.checklist-item {
  padding: var(--sp-sm) 0;
  border-bottom: 1px solid var(--color-border);
  transition: opacity .2s;
}
.checklist-item:last-child {
  border-bottom: none;
}
.checklist-label {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
  cursor: pointer;
  font-weight: 400;
  font-size: .92rem;
  margin: 0;
}
.checklist-check {
  width: 20px;
  height: 20px;
  min-width: 20px;
  accent-color: var(--color-green);
  cursor: pointer;
  margin-top: 2px;
}
.checklist-text {
  line-height: 1.5;
}
.checklist-done .checklist-text {
  text-decoration: line-through;
  color: var(--color-text-light);
}
.checklist-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.checklist-actions {
  display: none;
  gap: 2px;
  flex-shrink: 0;
  margin-left: var(--sp-sm);
}
.checklist-item:hover .checklist-actions {
  display: flex;
}
.checklist-btn-edit,
.checklist-btn-delete {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .85rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-light);
  transition: background .15s, color .15s;
}
.checklist-btn-edit:hover {
  background: var(--color-blue);
  color: #fff;
  border-color: var(--color-blue);
}
.checklist-btn-delete:hover {
  background: var(--color-red);
  color: #fff;
  border-color: var(--color-red);
}
.checklist-edit-input {
  flex: 1;
  font-size: .92rem;
  padding: 4px 8px;
  border: 2px solid var(--color-blue);
  border-radius: var(--radius-sm);
  outline: none;
  margin-left: var(--sp-sm);
}
.checklist-add-row {
  padding: var(--sp-sm) 0 0;
  border-top: 1px solid var(--color-border);
  margin-top: var(--sp-xs);
}
.checklist-add-form {
  display: flex;
  gap: var(--sp-sm);
  align-items: center;
}
.checklist-add-input {
  flex: 1;
  font-size: .88rem;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
}
.checklist-add-input:focus {
  border-color: var(--color-blue);
}

/* ---- AI Actions card tint ---- */
.card-ai {
  background: #f0f9ff;
  border-left: 4px solid var(--color-blue);
}

/* ---- Prefill banner ---- */
.prefill-banner {
  background: #e8f7ff;
  border: 1px solid var(--color-blue);
  border-left: 4px solid var(--color-blue);
  border-radius: var(--radius);
  padding: .6rem .8rem;
  font-size: .85rem;
  color: var(--color-text);
}

/* ---- AI loading overlay ---- */
.ai-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.75);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.ai-loading-msg {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-blue);
}
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(0,172,255,.25);
  border-top-color: var(--color-blue);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}
.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Steps indicator ---- */
.steps {
  display: flex;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-lg);
  flex-wrap: wrap;
}
.step {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  background: var(--color-border);
  color: var(--color-text-light);
}
.step.active { background: var(--color-blue); color: #fff; }
.step.done   { background: var(--color-green); color: #fff; }
.step-link { text-decoration: none; color: inherit; }
.step:hover { transform: scale(1.15); transition: transform .15s; cursor: pointer; }

/* ---- AI Credit card ---- */
.ai-credit-card {
  border-left: 4px solid var(--color-blue);
  background: linear-gradient(135deg, #f0f9ff 0%, var(--color-card) 100%);
}
.ai-credit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-md);
}
.ai-credit-header h3 {
  margin: 0;
  font-size: 1.1rem;
}
.ai-credit-body {
  display: flex;
  gap: var(--sp-xl);
  align-items: center;
  flex-wrap: wrap;
}
.ai-credit-meter {
  flex: 1;
  min-width: 200px;
}
.ai-credit-bar {
  height: 10px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.ai-credit-fill {
  height: 100%;
  background: var(--color-blue);
  border-radius: var(--radius-full);
  transition: width .4s ease;
}
.ai-credit-fill.warning {
  background: var(--color-yellow);
}
.ai-credit-fill.depleted {
  background: var(--color-red);
}
.ai-credit-labels {
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  color: var(--color-text-light);
  margin-top: var(--sp-xs);
}
.ai-credit-remaining {
  text-align: center;
  min-width: 120px;
}
.ai-credit-remaining .big-number {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
  display: block;
  margin-bottom: var(--sp-xs);
}
.ai-credit-remaining .label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-light);
}

/* ---- Overdue card ---- */
.overdue-card {
  background: #fff0f0;
  border-left: 4px solid var(--color-red);
}

/* ---- Scope page ---- */
.scope-wrap {
  max-width: 500px;
  margin: var(--sp-xl) auto;
}

/* ---- Footer ---- */
.site-footer {
  text-align: center;
  padding: var(--sp-xl) var(--sp-lg);
  color: var(--color-text-light);
  font-size: .8rem;
}

/* ---- Back link ---- */
.back-link {
  display: inline-block;
  margin-top: var(--sp-md);
  font-size: .9rem;
}

/* ---- Wizard button loading ---- */
.btn-wizard.is-loading {
  pointer-events: none;
  opacity: .7;
  position: relative;
}
.btn-wizard.is-loading::after {
  content: '';
  display: inline-block;
  width: .85em;
  height: .85em;
  margin-left: .45em;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: middle;
  animation: wizard-spin .6s linear infinite;
}
@keyframes wizard-spin {
  to { transform: rotate(360deg); }
}

/* ---- Utility ---- */
.text-muted { color: var(--color-text-light); }
.text-red   { color: var(--color-red); }
.text-green { color: var(--color-green); }
.mt-sm { margin-top: var(--sp-sm); }
.mt-md { margin-top: var(--sp-md); }
.mt-lg { margin-top: var(--sp-lg); }
.mb-md { margin-bottom: var(--sp-md); }
.mb-lg { margin-bottom: var(--sp-lg); }
.gap-sm { gap: var(--sp-sm); }

/* ---- Phase 2: Folders ---- */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-md);
  margin-bottom: var(--sp-md);
}
.folder-card-wrap {
  position: relative;
}
.folder-card {
  position: relative;
  display: flex;
  text-decoration: none;
  color: inherit;
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .2s, transform .15s;
}
.folder-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  transform: translateY(-2px);
  text-decoration: none;
}
.folder-card-accent {
  width: 6px;
  flex-shrink: 0;
  background: var(--gc-accent, var(--color-blue));
}
.folder-card-body {
  padding: var(--sp-md) var(--sp-lg);
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}
.folder-card-icon {
  color: var(--gc-accent, var(--color-blue));
  display: flex;
  align-items: center;
  justify-content: center;
}
.folder-card-text { min-width: 0; }
.folder-card-name {
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.3;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-card:hover .folder-card-name { color: var(--gc-accent, var(--color-blue)); }
.folder-card-count {
  font-size: .75rem;
  color: var(--color-text-light);
  margin-top: 2px;
}
.folder-card-wrap .inline-card-actions {
  position: absolute;
  top: var(--sp-sm);
  right: var(--sp-sm);
  display: none;
  gap: 2px;
  z-index: 2;
}
.folder-card-wrap:hover .inline-card-actions { display: flex; }

.folder-drop-zone {
  position: absolute;
  inset: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  pointer-events: none;
  opacity: 0;
  border-radius: var(--radius-md);
  border: 2px dashed transparent;
  background: transparent;
  transition: opacity .15s, background .15s, border-color .15s;
  z-index: 3;
}
body.dnd-dragging-guideline .folder-drop-zone {
  pointer-events: auto;
  opacity: 1;
  border-color: var(--gc-accent, var(--color-blue));
  background: rgba(0, 172, 255, 0.08);
}
.folder-drop-zone > * { display: none; }

.folder-card-add {
  display: flex;
  align-items: center;
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-md) var(--sp-lg);
  border: 2px dashed var(--color-border);
  grid-column: span 2;
  min-width: 0;
}
.folder-card-add:hover { border-color: var(--gc-accent, var(--color-blue)); }
.folder-card-add .inline-add-input { min-width: 0; }
@media (max-width: 520px) {
  .folder-card-add { grid-column: auto; }
}

/* Folder detail page */
.folder-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: .85rem;
  color: var(--color-text-light);
  margin-bottom: var(--sp-sm);
}
.folder-breadcrumb a { color: var(--color-text-light); }
.folder-breadcrumb .crumb-sep { opacity: .5; }
.folder-breadcrumb .crumb-current { color: var(--color-text); font-weight: 500; }
.folder-title-icon {
  display: inline-flex;
  vertical-align: middle;
  margin-right: var(--sp-sm);
  color: var(--ph-accent, var(--color-blue));
}
.folder-header-actions { gap: var(--sp-sm); }
.root-drop-zone {
  list-style: none;
  margin: 0 0 var(--sp-lg);
  padding: var(--sp-xl) var(--sp-md);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  min-height: 80px;
  text-align: center;
  color: var(--color-text-light);
  transition: border-color .15s, background .15s;
}
.root-drop-zone::before {
  content: 'Drop a to-do here to move it to the pillar root';
  font-size: .85rem;
}
body.dnd-dragging-guideline .root-drop-zone {
  border-color: var(--color-blue);
  background: rgba(0, 172, 255, 0.04);
}
.root-drop-zone > * { display: none; }

/* ---- Phase 2: Collapsible sections ---- */
.sections-list { display: flex; flex-direction: column; }
.section-card { position: relative; }
.section-toggle {
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  color: var(--color-text);
  text-align: left;
}
.section-toggle:focus-visible { outline: 2px solid var(--color-blue); outline-offset: 2px; }
.section-chevron {
  display: inline-block;
  font-size: 1rem;
  line-height: 1;
  transition: transform .15s;
  color: var(--color-text-light);
}
.section-card.is-collapsed .section-chevron { transform: rotate(-90deg); }
.section-name { font-weight: 700; font-size: 1.15rem; }
.section-header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}
.section-header-actions .inline-btn-edit,
.section-header-actions .inline-btn-delete {
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.section-card:hover .section-header-actions .inline-btn-edit,
.section-card:hover .section-header-actions .inline-btn-delete {
  opacity: 1;
}
.section-body {
  transition: max-height .2s ease, opacity .15s ease;
  overflow: hidden;
}
.section-card.is-collapsed .section-body {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  padding-top: 0;
}
.section-add-card {
  border: 2px dashed var(--color-border);
  box-shadow: none;
  padding: var(--sp-md) var(--sp-lg);
}
.section-add-card:hover { border-color: var(--gc-accent, var(--color-blue)); }
.section-add-card .inline-add-form { width: 100%; }

/* ---- Phase 2: DnD chrome ---- */
.dnd-ghost {
  opacity: .4;
  background: rgba(0, 172, 255, 0.12) !important;
}
.folder-card-wrap.sortable-chosen,
.guideline-card-wrap.sortable-chosen,
.section-card.sortable-chosen {
  cursor: grabbing;
}
.dnd-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--color-text);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: .85rem;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 9999;
}
.dnd-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 640px) {
  .container { padding: var(--sp-md); }
  .site-nav { padding: var(--sp-sm); }
  .site-nav .nav-links a { padding: 4px 10px; font-size: .8rem; }
  .summary-row { flex-direction: column; }
  .pillar-grid { grid-template-columns: 1fr; }
}

/* ── Phase 3: inline AI refinement box ── */
.ai-inline-box {
  background: rgba(0,0,0,.03);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: var(--sp-md);
}
.ai-inline-box label {
  display: block;
  font-weight: 600;
  margin-bottom: .35rem;
}
.ai-inline-box textarea {
  width: 100%;
  padding: .5rem .65rem;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
  font: inherit;
  resize: vertical;
}
.ai-inline-help strong { font-weight: 600; color: var(--text, #111); }

/* ── Phase 3: pillar scaffold review list ── */
.scaffold-list { display: flex; flex-direction: column; gap: var(--sp-sm); }
.scaffold-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .6rem;
  background: rgba(0,0,0,.02);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
}
.scaffold-row-stack { flex-direction: column; align-items: stretch; }
.scaffold-row-main {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.scaffold-check { display: inline-flex; align-items: center; }
.scaffold-name-input { flex: 2; min-width: 180px; }
.scaffold-meta-input { flex: 1; min-width: 120px; }
.scaffold-desc-input {
  margin-top: .4rem;
  width: 100%;
  resize: vertical;
}

/* ------- Phase 4: AI summary + config ------- */
.ai-summary-box { border: 1px solid #e2e8f0; border-radius: 6px; background: #fafbfc; margin-bottom: 1rem; }
.ai-summary-box > summary { padding: .5rem .75rem; cursor: pointer; user-select: none; }
.ai-summary-box[open] > summary { border-bottom: 1px solid #e2e8f0; }
.ai-summary-body { padding: .75rem; }
.ai-summary-content { white-space: pre-wrap; font-family: 'SF Mono', Consolas, monospace; font-size: .85em; background: #fff; border: 1px solid #eee; border-radius: 4px; padding: .6rem .75rem; margin: 0 0 .6rem 0; line-height: 1.35; }
.ai-summary-actions { display: flex; align-items: center; gap: .5rem; }

.breakdown-table { width: 100%; border-collapse: collapse; }
.breakdown-table td { padding: .4rem .6rem; border-bottom: 1px solid #eef1f4; vertical-align: top; }
.breakdown-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.breakdown-table tr.totals-row td { border-top: 2px solid #cbd5e0; border-bottom: none; padding-top: .6rem; }
.full-read-table { width: 100%; border-collapse: collapse; font-size: .92em; }
.full-read-table th, .full-read-table td { padding: .4rem .5rem; border-bottom: 1px solid #eef1f4; text-align: left; }
.full-read-table th.num, .full-read-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.full-read-table tr.row-flagged { background: #f3f7ff; }
.alert-warning { background: #fff4e5; border: 1px solid #f4b000; color: #7a4b00; padding: .75rem 1rem; border-radius: 6px; }
.text-warning { color: #b34600; }
