:root {
  --bg-app: #f5f4f0;
  --bg-sidebar: #1c1e24;
  --bg-sidebar-hover: #282b34;
  --bg-card: #ffffff;
  --border-subtle: #e4e1d8;
  --text-main: #1f2328;
  --text-muted: #656d76;
  --accent: #2f5d50;
  --accent-hover: #24493f;
  --accent-soft: #eaf2ef;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 6px 18px rgba(16, 24, 40, 0.08);
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 270px;
  background: var(--bg-sidebar);
  color: #e6e8ec;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, #4d8b78, #2f5d50);
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
  letter-spacing: 0.5px;
}

.brand-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.brand-sub {
  font-size: 0.75rem;
  color: #9ba1ae;
}

.active-standard-pill {
  margin: 16px 0;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.pill-label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: #8fd1bc;
  font-weight: 600;
}

.active-standard-pill strong {
  display: block;
  font-size: 0.85rem;
  color: #fff;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-menu {
  flex: 1;
  overflow-y: auto;
}

.nav-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #7c8290;
  margin: 16px 8px 6px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: #cfd4dc;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: #ffffff;
}

.nav-item.active {
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
}

.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.badge-soon {
  margin-left: auto;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  color: #aeb4c0;
}

.sidebar-footer {
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.phase-indicator {
  font-size: 0.75rem;
  color: #9ba1ae;
  text-align: center;
}

/* MAIN AREA */
.main-content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1440px;
}

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

.topbar h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

section.view-section {
  display: none;
}

section.view-section.active {
  display: block;
}

/* CARDS & BUTTONS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.card-header h3,
.card-header h4 {
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 7px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-small {
  padding: 6px 11px;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: #ffffff;
  border-color: var(--border-subtle);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: #f8f7f4;
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #fecdca;
}

.btn-danger:hover {
  background: #fee4e2;
}

.tag {
  font-size: 0.75rem;
  padding: 3px 9px;
  border-radius: 99px;
  background: #f2f1ed;
  color: var(--text-muted);
  font-weight: 500;
}

.tag-success {
  background: var(--accent-soft);
  color: var(--accent);
}

/* DASHBOARD */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  display: block;
  font-size: 1.65rem;
  margin: 6px 0 4px;
  color: var(--text-main);
}

.stat-note {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dashboard-split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}

.blueprint-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.blueprint-item {
  padding: 10px 12px;
  background: #faf9f6;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
}

.blueprint-item span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.blueprint-item strong {
  font-size: 0.9rem;
}

.swatch-strip {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.swatch-chip {
  flex: 1;
  min-width: 72px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 600;
}

.roadmap-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.roadmap-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 7px;
  background: #faf9f6;
  font-size: 0.85rem;
}

.roadmap-list li.done {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* DESIGN STANDARDS STUDIO */
.standards-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  gap: 10px;
  flex: 1;
  min-width: 260px;
  flex-wrap: wrap;
}

.standards-workspace {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}

.standards-list-col {
  display: grid;
  gap: 12px;
}

.standard-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.standard-item-card:hover {
  border-color: #b7b2a4;
}

.standard-item-card.selected {
  border: 2px solid var(--accent);
  box-shadow: var(--shadow-md);
}

.std-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.std-card-top h4 {
  margin: 0;
  font-size: 0.95rem;
}

.std-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 4px 0 10px;
}

.mini-palette {
  display: flex;
  gap: 5px;
}

.mini-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.standards-editor-col {
  display: grid;
  gap: 20px;
}

/* FORM CONTROLS */
.form-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.form-tab {
  background: #f5f4f0;
  border: none;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
}

.form-tab.active {
  background: var(--accent);
  color: #ffffff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.form-row.three-col {
  grid-template-columns: repeat(3, 1fr);
}

.form-group {
  margin-bottom: 14px;
}

.form-group label,
.color-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-main);
}

.input {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  font-size: 0.875rem;
  font-family: inherit;
  background: #ffffff;
  color: var(--text-main);
}

.input:focus {
  outline: 2px solid rgba(47, 93, 80, 0.25);
  border-color: var(--accent);
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-input-wrap input[type="color"] {
  width: 38px;
  height: 36px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 2px;
  background: #fff;
  cursor: pointer;
}

.hex-input {
  font-family: monospace;
  text-transform: uppercase;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 10px;
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

/* LIVE PREVIEW CANVAS */
.live-canvas {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 24px;
  transition: all 0.2s ease;
}

.preview-doc-sheet {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
  padding: 28px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
  overflow: hidden;
}

.preview-header-block {
  padding-bottom: 12px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 0.85rem;
}

.preview-table th,
.preview-table td {
  padding: 8px 10px;
  text-align: left;
}

.preview-footer-note {
  margin-top: 16px;
  padding-top: 10px;
  font-size: 0.75rem;
  display: flex;
  justify-content: space-between;
}

/* THEME LIBRARY & AESTHETIC STUDIO */
.info-banner {
  margin-bottom: 18px;
  background: #faf9f6;
}

.info-banner h3 {
  margin: 0 0 6px;
}

.info-banner p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.theme-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.category-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 7px 14px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  background: #f2f1ed;
}

.filter-pill.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.theme-studio-split {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 20px;
  align-items: start;
}

.themes-grid,
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 14px;
}

.theme-card,
.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.theme-card:hover {
  border-color: #b7b2a4;
}

.theme-card.inspecting {
  border: 2px solid var(--accent);
  box-shadow: var(--shadow-md);
}

.theme-swatches {
  display: flex;
  height: 32px;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.theme-swatches div {
  flex: 1;
}

.theme-tags-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.theme-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inspector-sticky {
  position: sticky;
  top: 20px;
}

.skill-card h4 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.skill-block {
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.skill-block strong {
  color: var(--accent);
}

.empty-phase-card {
  text-align: center;
  padding: 48px 24px;
}

.settings-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: #1c1e24;
  color: #ffffff;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.2s ease;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .theme-studio-split {
    grid-template-columns: 1fr;
  }
  .inspector-sticky {
    position: static;
  }
}

@media (max-width: 1024px) {
  .app-shell {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
  }
  .dashboard-split,
  .standards-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .form-row,
  .form-row.three-col,
  .color-grid,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
}
