:root {
  --bg-0: #f3efe3;
  --bg-1: #efe9d8;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --ink: #1b1f24;
  --muted: #526171;
  --line: rgba(30, 44, 60, 0.16);
  --brand: #1369b3;
  --brand-strong: #0e4f86;
  --danger: #c8253a;
  --shadow-soft: 0 14px 36px rgba(35, 49, 66, 0.09);
  --shadow-card: 0 10px 24px rgba(35, 49, 66, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 8% -8%, #fff8dc 20%, transparent 66%),
    radial-gradient(900px 520px at 110% 10%, #d7ecff 18%, transparent 62%),
    linear-gradient(160deg, var(--bg-0) 0%, var(--bg-1) 100%);
}

.app-shell {
  padding: 20px clamp(14px, 2.6vw, 34px) 28px;
}

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

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  line-height: 1.08;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero {
  border: 1px solid var(--line);
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.82), rgba(245, 253, 255, 0.75));
  box-shadow: var(--shadow-soft);
  border-radius: 18px;
  padding: clamp(22px, 4vw, 36px) 18px;
  margin: 10px 0 16px;
  text-align: center;
}

.hero-kicker {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 600;
}

.consult-subline {
  margin: 10px 0 0;
  color: #36414c;
  font-size: 0.92rem;
}

.button {
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.button:hover {
  background: var(--brand-strong);
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.button.ghost:hover {
  background: rgba(255, 255, 255, 0.58);
}

.button.small {
  padding: 8px 12px;
  font-size: 0.88rem;
}

.button.consult-main {
  min-width: 260px;
  font-size: 1.02rem;
  padding: 12px 16px;
  box-shadow: 0 10px 22px rgba(19, 105, 179, 0.3);
}

.tabs-wrap {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 12px;
  backdrop-filter: blur(3px);
}

.tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.tab-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-solid);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 8px 14px;
}

.tab-button.is-active {
  background: #123e66;
  border-color: #123e66;
  color: #fff;
}

.board-controls {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: end;
}

.board-controls label {
  font-size: 0.79rem;
  font-weight: 700;
  color: #2a3442;
  display: grid;
  gap: 5px;
}

.board-controls input,
.board-controls select,
.board-controls textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.board-controls input:focus,
.board-controls select:focus,
.board-controls textarea:focus {
  outline: 2px solid #9bc8f0;
  outline-offset: 1px;
}

.checkbox-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 700;
}

.filter-summary {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.layout {
  margin-top: 16px;
}

.board {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.column {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  min-height: 300px;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
}

.column-header h3 {
  margin: 0;
  font-size: 0.9rem;
}

.column-count {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(24, 58, 93, 0.12);
}

.column-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 12px;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.opportunity-card {
  border: 1px solid rgba(13, 49, 81, 0.15);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-card);
  padding: 10px;
  display: grid;
  gap: 8px;
  cursor: grab;
}

.opportunity-card:active {
  cursor: grabbing;
}

.opportunity-card.is-stale {
  box-shadow:
    var(--shadow-card),
    0 0 0 2px rgba(200, 37, 58, 0.5);
}

.opportunity-card h4 {
  margin: 0;
  font-size: 0.97rem;
}

.card-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.card-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.76rem;
  font-weight: 700;
}

.pill.prio-high {
  background: rgba(200, 37, 58, 0.16);
  color: #7d1827;
}

.pill.prio-med {
  background: rgba(198, 122, 12, 0.2);
  color: #86500a;
}

.pill.prio-low {
  background: rgba(20, 115, 79, 0.16);
  color: #0f6341;
}

.pill.age {
  background: rgba(24, 58, 93, 0.12);
  color: #133a5c;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 29, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 40;
}

.modal.is-open {
  display: flex;
}

.modal-card {
  width: min(560px, 100%);
  border-radius: 16px;
  border: 1px solid rgba(17, 38, 58, 0.17);
  background: #fff;
  padding: 18px;
  box-shadow: 0 20px 42px rgba(15, 20, 29, 0.24);
}

.modal-card h2 {
  margin: 0 0 14px;
}

.form {
  display: grid;
  gap: 10px;
}

.form label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #2d3847;
  display: grid;
  gap: 6px;
}

.form input,
.form textarea {
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 9px 10px;
  font: inherit;
}

.error-text {
  min-height: 1.1em;
  margin: 0;
  color: var(--danger);
  font-size: 0.86rem;
}

.consultation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast-container {
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 8px;
  z-index: 50;
}

.toast {
  border-radius: 10px;
  background: #11263a;
  color: #fff;
  padding: 10px 12px;
  font-size: 0.85rem;
  box-shadow: 0 8px 18px rgba(12, 24, 35, 0.32);
}

.toast.is-error {
  background: #8c1b2d;
}

.reporting-shell {
  padding: 20px clamp(14px, 2.6vw, 34px) 28px;
}

.sync-stamp {
  margin-top: 8px;
  font-size: 0.84rem;
  color: var(--muted);
}

.metric-grid {
  margin-top: 14px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 14px;
}

.metric-card h2 {
  font-size: 0.95rem;
  color: var(--muted);
}

.metric-value {
  margin-top: 10px;
  font-size: 1.2rem;
  font-weight: 800;
}

.panel.full {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 12px;
}

.panel.full h2 {
  font-size: 1.06rem;
}

.visual-grid {
  margin-top: 10px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.visual-card {
  border: 1px solid rgba(15, 36, 58, 0.12);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.visual-card h3 {
  font-size: 0.96rem;
  margin-bottom: 10px;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  align-items: center;
}

.donut-chart {
  width: 130px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 1px solid var(--line);
  position: relative;
}

.donut-chart::after {
  content: "";
  position: absolute;
  inset: 26%;
  background: #fff;
  border-radius: 50%;
  border: 1px solid #e6eff2;
}

.donut-legend {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.donut-legend li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.legend-label {
  flex: 1;
}

.legend-value {
  color: var(--ink);
  font-weight: 700;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
}

.bar-label {
  color: var(--muted);
}

.bar-value {
  color: var(--ink);
  font-weight: 700;
}

.bar-track {
  width: 100%;
  height: 10px;
  background: #edf3f6;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(120deg, #0f7f8d, #31b3a9);
}

.bar-fill.is-danger {
  background: linear-gradient(120deg, #c44848, #df6a6a);
}

.chart-empty {
  font-size: 0.8rem;
  color: var(--muted);
}

.table-wrap {
  margin-top: 10px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

th,
td {
  border-bottom: 1px solid #d8e5e9;
  text-align: left;
  padding: 0.52rem 0.4rem;
  font-size: 0.84rem;
}

th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.department-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
}

.department-card {
  border: 1px solid rgba(15, 36, 58, 0.12);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.department-card h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.department-card p {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--muted);
}

@media (max-width: 760px) {
  .app-shell,
  .reporting-shell {
    padding: 12px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .button.consult-main {
    width: 100%;
    min-width: 0;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}
