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

:root {
  --bg:        #1d2125;
  --surface:   #282e33;
  --surface2:  #2c333a;
  --border:    #374048;
  --text:      #b6c2cf;
  --text-dim:  #738496;
  --accent:    #579dff;
  --accent-h:  #85b8ff;
  --green:     #1f845a;
  --green-bg:  #164b35;
  --green-text:#4bce97;
  --red:       #c9372c;
  --red-bg:    #42221f;
  --red-text:  #f87168;
  --yellow-bg: #533f04;
  --yellow-text:#e2b203;
  --radius:    6px;
  --shadow:    0 2px 8px rgba(0,0,0,.4);
}

html { font-size: 14px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

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

/* ── Layout ──────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}

header .logo {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

header nav { display: flex; gap: 4px; flex: 1; }

header nav a {
  color: var(--text-dim);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  transition: color .15s, background .15s;
}
header nav a:hover { color: var(--text); background: var(--surface2); text-decoration: none; }
header nav a.active { color: var(--text); background: var(--surface2); }

.header-actions { display: flex; gap: 8px; margin-left: auto; }

main {
  flex: 1;
  padding: 32px 24px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* ── Typography ──────────────────────────────────────── */
h1 { font-size: 20px; font-weight: 600; color: #c7d1db; margin-bottom: 4px; }
h2 { font-size: 16px; font-weight: 600; color: #c7d1db; margin-bottom: 16px; }
.page-subtitle { color: var(--text-dim); font-size: 13px; margin-bottom: 28px; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary  { background: var(--accent); color: #1d2125; }
.btn-primary:hover:not(:disabled) { background: var(--accent-h); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface2); color: var(--text); }

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Form elements ───────────────────────────────────── */
.form-group { margin-bottom: 18px; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
label .hint { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 11px; color: var(--text-dim); margin-left: 6px; }

input[type="text"],
input[type="date"],
textarea,
select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color .15s;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text-dim); }
textarea { resize: vertical; min-height: 80px; }

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

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ── Progress bar ────────────────────────────────────── */
.progress-wrap { margin-top: 4px; }
.progress-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-bar .fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; }

/* ── Status badges ───────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green  { background: var(--green-bg);  color: var(--green-text); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow-text); }
.badge-gray   { background: var(--surface2);  color: var(--text-dim); }
.badge-red    { background: var(--red-bg);    color: var(--red-text); }

/* ── Status / toast ──────────────────────────────────── */
.status-msg {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-top: 16px;
  display: none;
}
.status-msg.show { display: block; }
.status-msg.info    { background: #1c3251; border: 1px solid #2c5282; color: #90cdf4; }
.status-msg.success { background: var(--green-bg); border: 1px solid var(--green); color: var(--green-text); }
.status-msg.error   { background: var(--red-bg); border: 1px solid var(--red); color: var(--red-text); }

/* ── Section dividers ────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* ── Step indicator ──────────────────────────────────── */
.steps {
  display: flex;
  gap: 0;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  padding: 4px 16px 4px 0;
  position: relative;
}
.step.active { color: var(--accent); }
.step.done   { color: var(--green-text); }
.step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.step.active .step-num { background: var(--accent); border-color: var(--accent); color: #1d2125; }
.step.done .step-num   { background: var(--green); border-color: var(--green); color: white; }
.step-arrow { color: var(--border); margin-left: 8px; }

/* ── Loading spinner ─────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}

/* ── Empty state ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty-state h3 { font-size: 16px; margin-bottom: 8px; color: var(--text); }
.empty-state p  { font-size: 13px; margin-bottom: 20px; }

/* ── Checklist accordion ─────────────────────────────── */
.checklist-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.checklist-item { font-size: 12px; }
.checklist-item .cl-name {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  margin-bottom: 3px;
}
.checklist-item .cl-name .due { font-size: 11px; opacity: .8; }

/* ── Project grid ────────────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color .15s;
}
.project-card:hover { border-color: var(--accent); }

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

.project-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #c7d1db;
  line-height: 1.3;
}

.project-card-meta {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  gap: 12px;
  align-items: center;
}

.project-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

/* ── Analysis output ─────────────────────────────────── */
.analysis-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 13px;
  display: none;
}
.analysis-box.show { display: block; }
.analysis-section { margin-bottom: 16px; }
.analysis-section h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin-bottom: 8px; }
.analysis-section ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.analysis-section li { padding-left: 16px; position: relative; }
.analysis-section li::before { content: "·"; position: absolute; left: 4px; color: var(--accent); }
