/* Satur AI Dashboard — clean light theme. */

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e4e8ee;
  --text: #1f2633;
  --muted: #6b7480;
  --accent: #2563eb;
  --accent-weak: #eaf1ff;
  --admin: #0e9f6e;
  --admin-weak: #e3f6ee;
  --danger: #d83a52;
  --danger-weak: #fdecef;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

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

/* --- Top bar --- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); font-size: 18px; }
.brand-text { font-size: 15px; }
.brand-text strong { font-weight: 700; }

.nav { display: flex; gap: 4px; flex: 1; }
.nav-link {
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 500;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { color: var(--accent); background: var(--accent-weak); }

.user-chip { display: flex; align-items: center; gap: 12px; }
.user-name { color: var(--text); font-weight: 600; }
.link-muted { color: var(--muted); font-size: 13px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 20px;
}
.badge-admin { background: var(--admin-weak); color: var(--admin); }
.badge-locked { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge-locked:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.badge-admin-sm { background: var(--admin-weak); color: var(--admin); font-size: 11px; padding: 2px 7px; border-radius: 12px; }

/* --- Layout --- */
.app-main { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 64px 20px; min-height: calc(100vh - 120px); }

.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 700; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.placeholder { text-align: center; padding: 56px 24px; color: var(--muted); }
.placeholder-icon { font-size: 32px; margin-bottom: 12px; }
.muted { color: var(--muted); }

/* --- Auth cards --- */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px;
  width: 100%;
  max-width: 380px;
}
.auth-card-wide { max-width: 560px; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-size: 18px; margin-bottom: 6px; }
.auth-brand .brand-mark { font-size: 22px; }
.auth-sub { color: var(--muted); margin: 4px 0 20px; }

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
input[type="password"], input[type="text"], input[type="number"] {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 15px;
  font-family: inherit;
  background: var(--surface-2);
}
input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-weak); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px; border-radius: 9px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4fd0; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; }
.inline { display: inline; margin: 0; }
.center-mt { display: block; text-align: center; margin-top: 16px; }

/* --- Name picker --- */
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 8px; }
.name-option { position: relative; cursor: pointer; }
.name-option input { position: absolute; opacity: 0; }
.name-option-body {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2);
}
.name-option:hover .name-option-body { border-color: var(--accent); }
.name-option input:checked + .name-option-body { border-color: var(--accent); background: var(--accent-weak); box-shadow: 0 0 0 1px var(--accent); }
.name-option-name { font-weight: 600; }

/* --- Alerts --- */
.alert { padding: 11px 14px; border-radius: 9px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: var(--danger-weak); color: var(--danger); }
.alert-success { background: var(--admin-weak); color: var(--admin); }
.calc-display { padding: 11px 13px; border: 1px dashed var(--border); border-radius: 9px; background: var(--surface-2); font-weight: 600; color: var(--accent); }
.dash-footnote { margin: -8px 0 20px; font-size: 13px; }

.page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }

/* --- KPI cards --- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kpi-value { font-size: 30px; font-weight: 700; margin: 6px 0 4px; letter-spacing: -.02em; }
.kpi-sub { color: var(--muted); font-size: 13px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 2px; }
.dot-done { background: var(--admin); } .dot-prog { background: #e0a82e; } .dot-plan { background: #94a3b8; }

/* --- Charts --- */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card { padding: 20px; }
.chart-card-wide { grid-column: 1 / -1; }
.chart-title { font-size: 15px; font-weight: 600; margin: 0 0 14px; }

/* --- Data table --- */
.table-card { padding: 0; overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead th {
  text-align: left; padding: 12px 16px; color: var(--muted); font-weight: 600;
  font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table .num { text-align: right; white-space: nowrap; }
.cell-name { font-weight: 600; display: block; }
.cell-desc { color: var(--muted); font-size: 12.5px; display: block; margin-top: 2px; max-width: 380px; }
.tag-example { font-size: 10.5px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 10px; margin-left: 6px; }
.actions-col { text-align: right; white-space: nowrap; }
.link-action { font-size: 13px; font-weight: 600; color: var(--accent); background: none; border: none; cursor: pointer; padding: 0 0 0 12px; font-family: inherit; }
.link-action:hover { text-decoration: underline; }
.link-danger { color: var(--danger); }

.status-pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.status-done { background: var(--admin-weak); color: var(--admin); }
.status-in_progress { background: #fdf3dc; color: #9a6b00; }
.status-planned { background: #eef1f5; color: #5b6675; }

/* --- Forms (project create/edit) --- */
.form-card { max-width: 760px; display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-row:has(.span-2) { grid-template-columns: 2fr 1fr; }
.span-2 { grid-column: span 1; }
.form-card .field { display: flex; flex-direction: column; gap: 6px; }
textarea, select {
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 9px;
  font-size: 15px; font-family: inherit; background: var(--surface-2); width: 100%;
}
textarea:focus, select:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-weak); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* --- Tasks --- */
.filter-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-bar select { width: auto; min-width: 180px; }

.task-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.task-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.task-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.task-title { font-weight: 600; font-size: 15.5px; }
.task-desc { color: var(--muted); font-size: 13.5px; margin: 0; }

.progress { height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 20px; transition: width .2s; }
.progress-label { font-size: 12px; color: var(--muted); margin-top: -4px; }

.task-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; color: var(--muted); }
.meta-item { display: inline-flex; align-items: center; gap: 4px; }
.assignees { gap: 6px; }
.assignee-chip { background: var(--accent-weak); color: var(--accent); font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 12px; }

.task-actions { display: flex; justify-content: flex-end; gap: 4px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 2px; }

.task-status-open { background: #eef1f5; color: #5b6675; }
.task-status-in_progress { background: #fdf3dc; color: #9a6b00; }
.task-status-done { background: var(--admin-weak); color: var(--admin); }

/* assignee checkboxes */
.assignee-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.assignee-option { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); cursor: pointer; font-size: 14px; }
.assignee-option input { width: auto; }
.assignee-option:has(input:checked) { border-color: var(--accent); background: var(--accent-weak); }
.assignee-option:has(input:disabled) { opacity: .5; cursor: not-allowed; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

@media (max-width: 800px) {
  .chart-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .task-list { grid-template-columns: 1fr; }
}

/* --- Architecture map --- */
.arch-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.tab { border: none; background: transparent; padding: 7px 16px; border-radius: 8px; font-weight: 600; color: var(--muted); cursor: pointer; font-family: inherit; font-size: 14px; }
.tab.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.arch-tools { display: flex; align-items: center; gap: 8px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-ghost.active { border-color: var(--accent); color: var(--accent); background: var(--accent-weak); }
.arch-hint { color: var(--muted); font-size: 13px; }

.arch-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.arch-canvas { height: 560px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.arch-detail { min-height: 560px; padding: 18px; }
.detail-title { font-size: 16px; margin: 0 0 12px; }
.detail-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.detail-row span { color: var(--muted); }
.detail-desc { font-size: 13.5px; margin: 8px 0; }
.detail-empty { padding-top: 20px; }
.detail-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }
.arch-detail .field { margin-bottom: 10px; }
.arch-detail textarea { font-size: 13px; }

.arch-scopes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.scope-tab { border: 1px solid var(--border); background: var(--surface); color: var(--muted); padding: 6px 13px; border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }
.scope-tab:hover { border-color: var(--accent); color: var(--accent); }
.scope-tab.active { background: var(--accent-weak); color: var(--accent); border-color: var(--accent); }
.scope-add { border-style: dashed; }

.caps { margin: 6px 0 10px; padding-left: 18px; font-size: 13px; }
.caps li { margin: 2px 0; }
.detail-caps-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-top: 10px; }

@media (max-width: 800px) {
  .arch-layout { grid-template-columns: 1fr; }
  .arch-canvas { height: 420px; }
  .arch-detail { min-height: 0; }
}

/* --- Footer --- */
.footer { max-width: 1200px; margin: 0 auto; padding: 24px; color: var(--muted); font-size: 13px; text-align: center; }
