:root {
  --bg: #f5f1ea;
  --panel: #fffdf9;
  --panel-alt: #f0e8dc;
  --border: #ddd2c1;
  --text: #2f241c;
  --muted: #7a6b5d;
  --accent: #7b4f2d;
  --accent-soft: #efe2d3;
  --success: #2d6a4f;
  --danger: #9b2c2c;
  --shadow: 0 16px 40px rgba(47, 36, 28, 0.08);
  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%; background: var(--bg); color: var(--text); }
body { font-family: inherit; }
button, input, select { font: inherit; }
.hidden { display: none !important; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
}

.sidebar {
  background: #f7efe3;
  border-right: 1px solid var(--border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-header { display: flex; flex-direction: column; gap: 10px; }

.sidebar-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
}

.lang-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 700;
  min-width: 42px;
}

.lang-button.active {
  background: var(--accent);
  color: #fff;
}
.sidebar-header h1,
.project-header h2,
.section-heading h3,
.dialog-header h3,
.simple-card h1,
.empty-state h2 { margin: 0; }
.sidebar-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.project-list { display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.sidebar-empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,0.55);
  color: var(--muted);
}

.project-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.project-item.active {
  border-color: var(--accent);
  background: #fff7ef;
}
.project-item span,
.project-item small,
.muted,
.kpi-label,
.milestone-item small,
label span,
.dialog label span {
  color: var(--muted);
}

.main-content {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.empty-state,
.milestones-card,
.card,
.dialog-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.empty-state {
  padding: 40px;
  max-width: 760px;
}

.project-view {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.project-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

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

.kpi {
  min-width: 140px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
}

.section-heading,
.phase-group-header,
.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.milestones-card { padding: 24px; }
.milestone-groups { display: flex; flex-direction: column; gap: 18px; margin-top: 18px; }
.phase-group {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  background: #fffaf3;
}
.milestone-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.milestone-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
}
.milestone-index {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.primary-button,
.ghost-button,
.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  padding: 12px 16px;
  text-decoration: none;
  cursor: pointer;
}
.primary-button,
.primary-link {
  border: 0;
  background: var(--accent);
  color: white;
}
.ghost-button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  font-weight: 700;
}

.dialog {
  border: 0;
  padding: 0;
  background: transparent;
}
.dialog::backdrop { background: rgba(28, 23, 18, 0.45); }
.dialog-card {
  width: min(560px, calc(100vw - 24px));
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dialog label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dialog input,
.dialog select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.form-error {
  margin: 0;
  color: var(--danger);
  font-weight: 600;
}

.centered-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.simple-card { max-width: 520px; padding: 32px; }
.card { padding: 24px; }

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .project-header { flex-direction: column; }
  .project-kpis { grid-template-columns: 1fr; width: 100%; }
}
