/* ============ Le Météor — Design system ============ */
:root {
  --blue: #009ddc;
  --blue-dark: #0084bb;
  --blue-darker: #006d9a;
  --blue-soft: #eaf6fc;
  --gold: #c8aa5a;
  --gold-soft: #f5eed9;

  --ink: #0a1a24;
  --ink-soft: #5a6976;
  --ink-faint: #8a97a2;

  --bg: #f7f8fa;
  --surface: #ffffff;
  --line: #ecf0f3;
  --line-strong: #dee4ea;

  --ok: #1f9d62;
  --ok-soft: #e4f5ec;
  --warn: #c98a1e;
  --warn-soft: #fbf0dc;
  --danger: #c94a4a;
  --danger-soft: #fbeaea;

  --shadow-xs: 0 1px 2px rgba(10, 26, 36, 0.04);
  --shadow-sm: 0 2px 6px rgba(10, 26, 36, 0.05), 0 1px 2px rgba(10, 26, 36, 0.03);
  --shadow-md: 0 12px 28px -8px rgba(10, 26, 36, 0.12), 0 4px 10px -4px rgba(10, 26, 36, 0.06);
  --shadow-lg: 0 24px 60px -12px rgba(10, 26, 36, 0.22);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.55;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; letter-spacing: -0.015em; }

.hidden { display: none !important; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ============ AUTH ============ */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background:
    radial-gradient(900px 500px at 85% -20%, rgba(0, 157, 220, 0.14), transparent 55%),
    radial-gradient(700px 400px at -10% 110%, rgba(200, 170, 90, 0.12), transparent 55%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 40px 36px 36px;
  border: 1px solid var(--line);
  text-align: center;
}
.auth-logo {
  width: 92px;
  height: auto;
  display: block;
  margin: 0 auto 14px;
}
.auth-tagline {
  margin: 0 0 28px;
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
}
.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: 12px;
  padding: 4px;
  margin: 0 0 22px;
  border: 1px solid var(--line);
}
.tab {
  flex: 1;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 500;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.18s ease;
}
.tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

/* ============ Forms ============ */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
input, textarea, select {
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-weight: 400;
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 157, 220, 0.12);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.hint {
  font-size: 12px;
  color: var(--ink-faint);
  margin: 4px 0 0;
}
.auth-error {
  color: var(--danger);
  font-size: 13px;
  margin: 0;
  min-height: 18px;
  font-weight: 500;
}

/* ============ Buttons ============ */
button { font-family: inherit; }
.btn-primary, .btn-ghost, .btn-danger, .btn-small {
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary {
  background: var(--ink);
  color: #fff;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
}
.btn-primary:hover { background: #0e2a3a; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  padding: 10px 16px;
  font-size: 13px;
  border-color: var(--line-strong);
  font-weight: 500;
}
.btn-ghost:hover { background: var(--bg); border-color: var(--ink-faint); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  border-color: transparent;
}
.btn-danger:hover { background: var(--danger-soft); }

.btn-small {
  background: var(--ink);
  color: #fff;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
}
.btn-small:hover { background: #0e2a3a; }

.btn-small.secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-small.secondary:hover { background: var(--bg); border-color: var(--ink-faint); }

/* ============ App header ============ */
.app-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.brand-sub {
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 2px;
  font-weight: 500;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-chip {
  font-size: 13px;
  color: var(--ink);
  padding: 7px 13px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.user-chip::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ok);
}
.user-chip.admin::after {
  content: 'Admin';
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  background: var(--ink);
  color: #fff;
  padding: 2px 7px;
  border-radius: 999px;
}

/* ============ Section nav (top-level sections) ============ */
.section-nav-wrap {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.section-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 8px;
  padding-bottom: 0;
  flex-wrap: wrap;
}
.section-tabs {
  display: flex;
  gap: 4px;
  align-items: flex-end;
}
.section-tab {
  background: transparent;
  border: 0;
  padding: 14px 18px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.section-tab:hover { color: var(--ink-soft); }
.section-tab.active {
  color: var(--ink);
  border-bottom-color: var(--blue);
}

.oei-banner {
  margin: 0;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: linear-gradient(90deg, rgba(0, 157, 220, 0.08), rgba(200, 170, 90, 0.1));
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-xs);
  max-width: 640px;
  line-height: 1.4;
}
.oei-banner:empty { display: none; }

.app-section { display: block; }
.app-section.hidden { display: none !important; }

/* ============ Panel card (generic) ============ */
.panel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  box-shadow: var(--shadow-xs);
  margin-top: 32px;
  margin-bottom: 48px;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 22px;
}
.panel-card h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.panel-sub {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}
.panel-card.placeholder {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.chart-wrap {
  position: relative;
  width: 100%;
  height: 440px;
}
@media (max-width: 640px) {
  .chart-wrap { height: 300px; }
}

/* ============ 4DX sub-tabs ============ */
.subtabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 4px;
  box-shadow: var(--shadow-xs);
  margin: 28px 0 16px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}
.subtab {
  background: transparent;
  border: 0;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: all 0.15s;
}
.subtab:hover { color: var(--ink); background: var(--bg); }
.subtab.active { background: var(--ink); color: #fff; font-weight: 600; }

/* ============ 4DX OEI banner (per team) ============ */
.fourdx-oei-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(90deg, rgba(0, 157, 220, 0.08), rgba(200, 170, 90, 0.1));
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}
.fourdx-oei-text {
  flex: 1;
  font-size: 14.5px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.5;
}
.fourdx-oei-text:empty::before {
  content: 'Aucun OEI défini pour cette équipe.';
  color: var(--ink-faint);
  font-style: italic;
  font-weight: 400;
}
.btn-inline-edit {
  background: transparent;
  border: 1px solid transparent;
  padding: 6px 9px;
  cursor: pointer;
  color: var(--ink-soft);
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.btn-inline-edit:hover {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

/* ============ 4DX layout ============ */
.fourdx-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 64px;
}
.fourdx-grid .panel-card {
  margin: 0;
  padding: 22px 24px;
}
@media (max-width: 960px) {
  .fourdx-grid { grid-template-columns: 1fr; }
}

/* ---- Week nav ---- */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 16px;
}
.week-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  padding: 7px 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  min-width: 130px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.week-nav-btn {
  width: 34px;
  height: 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.15s;
  line-height: 1;
}
.week-nav-btn:hover { background: var(--bg); border-color: var(--ink-faint); }

/* ---- Engagements table ---- */
.engagements-table-wrap { overflow-x: auto; }
.engagements-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.engagements-table thead th {
  text-align: left;
  padding: 10px 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--line);
}
.engagements-table tbody td {
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.engagements-table tbody tr:last-child td { border-bottom: 0; }
.engagements-table .cell-who {
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  padding-top: 14px;
}
.engagement-field {
  width: 100%;
  font-family: inherit;
  font-size: 13.5px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  padding: 7px 9px;
  min-height: 40px;
  resize: vertical;
  background: transparent;
  color: var(--ink);
  line-height: 1.5;
  transition: all 0.15s;
}
.engagement-field:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--line);
}
.engagement-field:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(0, 157, 220, 0.12);
}
.engagement-field:disabled {
  color: var(--ink-soft);
  cursor: default;
}
.engagement-field.saved {
  border-color: var(--ok);
  transition: border-color 0.5s;
}

/* ---- Dashboard metric blocks ---- */
.metric-block { margin-bottom: 22px; }
.metric-block:last-child { margin-bottom: 0; }
.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.metric-head h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  color: var(--ink);
  white-space: nowrap;
}
.metric-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.metric-nature {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
  padding: 3px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metric-nature:empty { display: none; }
.metric-nature:empty + .btn-inline-edit::before {
  content: 'Définir le libellé';
  font-size: 12px;
  color: var(--ink-faint);
  font-style: italic;
  font-weight: 400;
  margin-right: 6px;
}
.metric-chart-wrap {
  position: relative;
  width: 100%;
  height: 220px;
}

/* ---- Metrics edit modal ---- */
.metrics-edit-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 8px;
}
.metrics-edit-table {
  width: 100%;
  border-collapse: collapse;
}
.metrics-edit-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.metrics-edit-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}
.metrics-edit-table tbody tr:last-child td { border-bottom: 0; }
.metrics-edit-table td:first-child {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.metrics-edit-table input {
  width: 100%;
  padding: 7px 10px;
  font-size: 14px;
}

/* ============ Admin OEI editor ============ */
.admin-oei-section {
  padding: 14px 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}
.admin-oei-section label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.admin-oei-section textarea {
  min-height: 70px;
  font-size: 14px;
}
.admin-oei-section .row {
  display: flex;
  justify-content: flex-end;
}

/* ============ Toolbar (tabs + primary action) ============ */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 36px 0 24px;
}

/* ============ Status tabs ============ */
.status-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
  width: fit-content;
  box-shadow: var(--shadow-xs);
}
.status-tab {
  background: transparent;
  border: 0;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}
.status-tab:hover { color: var(--ink); background: var(--bg); }
.status-tab.active {
  color: var(--ink);
  background: var(--bg);
  font-weight: 600;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot.submitted { background: var(--warn); }
.dot.retained { background: var(--blue); }
.dot.closed { background: var(--ok); }
.dot.rejected { background: var(--danger); }
.count {
  background: var(--line);
  color: var(--ink-soft);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.status-tab.active .count { background: var(--ink); color: #fff; }

/* ============ Ideas grid ============ */
.ideas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  padding-bottom: 64px;
}
.idea-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.2s ease;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}
.idea-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.idea-card-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.idea-card h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 19px;
  line-height: 1.3;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.idea-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 500;
}
.idea-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.idea-meta svg { width: 13px; height: 13px; opacity: 0.65; flex-shrink: 0; }
.idea-desc {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}
.idea-impact {
  background: var(--blue-soft);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--blue-darker);
  line-height: 1.5;
}
.idea-impact strong {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
  font-weight: 600;
  color: var(--blue-darker);
  opacity: 0.85;
}
.idea-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* Status pill (inline, not overlapping) */
.idea-status-badge {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.idea-status-badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
}
.idea-status-badge.submitted { background: var(--warn-soft); color: #8a5f10; }
.idea-status-badge.submitted::before { background: var(--warn); }
.idea-status-badge.retained { background: var(--blue-soft); color: var(--blue-darker); }
.idea-status-badge.retained::before { background: var(--blue); }
.idea-status-badge.closed { background: var(--ok-soft); color: #156841; }
.idea-status-badge.closed::before { background: var(--ok); }
.idea-status-badge.rejected { background: var(--danger-soft); color: #8b2c2c; }
.idea-status-badge.rejected::before { background: var(--danger); }

.idea-card.is-rejected { opacity: 0.72; }
.idea-card.is-rejected:hover { opacity: 1; }

.empty-state {
  text-align: center;
  color: var(--ink-faint);
  padding: 80px 20px;
  font-size: 15px;
  font-weight: 500;
}

/* ============ Modal ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 26, 36, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadein 0.18s ease-out;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  animation: popin 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal.modal-large { max-width: 640px; }
@keyframes popin {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 16px;
}
.modal h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.015em;
}
.modal .close {
  background: transparent;
  border: 0;
  font-size: 24px;
  line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: all 0.15s;
}
.modal .close:hover { color: var(--ink); background: var(--bg); }
.modal form {
  padding: 8px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
}
#detail-body {
  padding: 0 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.detail-section { display: flex; flex-direction: column; gap: 6px; }
.detail-section .label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.detail-section .value {
  font-size: 14.5px;
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.6;
}
.detail-section.impact .value {
  background: var(--blue-soft);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  color: var(--blue-darker);
  font-weight: 500;
}
.detail-section.report .value {
  background: var(--ok-soft);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  color: #156841;
  font-weight: 500;
}
.detail-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

/* ============ Segmented control (forms) ============ */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.segmented-option {
  position: relative;
  display: flex;
  margin: 0;
  cursor: pointer;
}
.segmented-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segmented-option span {
  flex: 1;
  text-align: center;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  border-radius: 7px;
  transition: all 0.15s ease;
  user-select: none;
}
.segmented-option input:checked + span {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}

/* ============ Impact display ============ */
.impact-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.impact-title {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--blue-darker);
  opacity: 0.85;
}
.impact-type-pill {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--blue-darker);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.impact-type-pill.cost { color: #8a5f10; background: var(--warn-soft); }
.impact-type-pill.revenue { color: #156841; background: var(--ok-soft); }
.impact-amount {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.impact-amount .unit {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 500;
  margin-left: 4px;
}

/* ============ Deadline badge ============ */
.deadline-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.deadline-badge svg { width: 12px; height: 12px; opacity: 0.7; }
.deadline-badge.is-urgent { background: var(--warn-soft); color: #8a5f10; border-color: transparent; }
.deadline-badge.is-overdue { background: var(--danger-soft); color: #8b2c2c; border-color: transparent; }

/* ============ View switcher (cards / table) ============ */
.view-switcher {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}
.view-toggle {
  display: inline-flex;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
}
.view-toggle button {
  border: 0;
  background: transparent;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.view-toggle button svg { width: 13px; height: 13px; }
.view-toggle button.active { background: var(--ink); color: #fff; font-weight: 600; }

/* ============ Ideas table ============ */
.ideas-table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  margin-bottom: 64px;
}
.ideas-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.ideas-table thead th {
  text-align: left;
  padding: 14px 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  user-select: none;
}
.ideas-table thead th.sortable { cursor: pointer; }
.ideas-table thead th.sortable:hover { color: var(--ink); }
.ideas-table thead th .sort-indicator {
  display: inline-block;
  margin-left: 6px;
  opacity: 0.4;
  font-size: 10px;
}
.ideas-table thead th.sorted .sort-indicator { opacity: 1; color: var(--blue); }
.ideas-table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}
.ideas-table tbody tr:hover { background: var(--bg); }
.ideas-table tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.ideas-table tbody tr:last-child td { border-bottom: 0; }
.ideas-table .cell-title { font-weight: 500; }
.ideas-table .cell-assignee { color: var(--ink-soft); }
.ideas-table .cell-deadline { font-variant-numeric: tabular-nums; }
.ideas-table .cell-impact { font-variant-numeric: tabular-nums; }
.ideas-table .cell-date { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.ideas-table .cell-empty { color: var(--ink-faint); }
.ideas-table .cell-person { white-space: nowrap; }

/* Person cells (author / assignee) share structure, distinct icon colors */
.person-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--ink);
}
.person-cell svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.person-cell.author svg { color: var(--ink-faint); }
.person-cell.assignee svg { color: var(--blue); }

/* Card meta also gets author/assignee tint for consistency */
.idea-meta .meta-item.assignee svg { color: var(--blue); opacity: 1; }
.idea-meta .meta-item.author svg { opacity: 0.55; }
.impact-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.25;
}
.impact-cell-amount {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 14.5px;
  white-space: nowrap;
}
.impact-cell-amount svg { width: 15px; height: 15px; flex-shrink: 0; }
.impact-cell-amount.revenue { color: #157a4c; }
.impact-cell-amount.cost { color: #8a5f10; }
.impact-cell-type {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-faint);
  letter-spacing: 0.01em;
}
.ideas-table .cell-actions,
.ideas-table .cell-actions-head {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

/* ============ Admin panel ============ */
#admin-body {
  padding: 0 28px 28px;
}
.admin-stats {
  display: flex;
  gap: 20px;
  padding: 14px 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--ink-soft);
}
.admin-stats strong { color: var(--ink); font-weight: 600; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.admin-table thead th {
  text-align: left;
  padding: 12px 14px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.admin-table tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table .u-name { font-weight: 500; color: var(--ink); }
.admin-table .u-email { color: var(--ink-soft); font-size: 13px; }
.admin-table .u-role {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
}
.admin-table .u-role.admin { background: var(--ink); color: #fff; }
.admin-table .u-role.member { background: var(--bg); color: var(--ink-soft); border: 1px solid var(--line); }
.admin-table .u-date { color: var(--ink-faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.admin-table .u-actions {
  text-align: right;
  white-space: nowrap;
}
.admin-table .u-actions button { margin-left: 6px; }
.admin-table .u-self {
  font-size: 11px;
  color: var(--ink-faint);
  font-style: italic;
}

.label-optional {
  font-weight: 400;
  color: var(--ink-faint);
  text-transform: none;
  letter-spacing: 0;
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: slideup 0.2s ease-out;
}
.toast.error { background: var(--danger); }
@keyframes slideup {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ============ Responsive ============ */
@media (max-width: 640px) {
  .container { padding: 0 20px; }
  .hero { padding: 32px 0 20px; gap: 18px; }
  .hero h2 { font-size: 28px; }
  .app-header-inner { flex-wrap: wrap; gap: 12px; }
  .brand-sub { display: none; }
  .ideas-grid { grid-template-columns: 1fr; }
  .status-tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .status-tab { flex-shrink: 0; }
  .auth-card { padding: 32px 24px 28px; }
}
