:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #5d6b7a;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --line: rgba(28, 52, 77, 0.14);
  --blue: #175ddc;
  --teal: #087f8c;
  --coral: #c8553d;
  --amber: #b7791f;
  --canvas: #eef3f6;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas) url("/static/assets/wave-background_floodwaive-dark.png") center / cover fixed no-repeat;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(238, 243, 246, 0.74);
  pointer-events: none;
}

a {
  color: var(--blue);
  text-decoration: none;
}

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 20;
  width: max-content;
  max-width: min(300px, calc(100vw - 32px));
  padding: 8px 10px;
  border-radius: 7px;
  background: #17202a;
  color: white;
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  box-shadow: 0 12px 32px rgba(23, 32, 42, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

button,
a {
  font: inherit;
}

main,
.shell-header {
  position: relative;
  z-index: 1;
}

.shell-header {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 750;
}

.brand img {
  width: 38px;
  height: 38px;
}

.main-nav {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.main-nav a,
.identity a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 7px;
  color: var(--muted);
}

.main-nav a:hover,
.identity a:hover {
  background: rgba(23, 93, 220, 0.08);
  color: var(--blue);
}

.identity {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 72px;
}

.hero-dashboard,
.login-layout,
.page-title,
.section-block,
.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(26, 39, 52, 0.14);
  backdrop-filter: blur(18px);
}

.hero-dashboard {
  min-height: 280px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: clamp(28px, 5vw, 56px);
}

.hero-dashboard h1,
.page-title h1,
.login-copy h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 1;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 760;
  text-transform: uppercase;
}

.hero-actions,
.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-action,
.secondary-action,
.tool-card a,
.project-row a,
.card-actions a,
.toolbar a,
.toolbar button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 7px;
  border: 1px solid var(--line);
  cursor: pointer;
}

.primary-action {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.secondary-action,
.toolbar a,
.toolbar button {
  background: white;
  color: var(--ink);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.metrics-grid article,
.project-card,
.tool-card,
.project-row {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metrics-grid article {
  padding: 24px;
}

.metrics-grid span {
  display: block;
  color: var(--blue);
  font-size: 2.2rem;
  font-weight: 780;
}

.metrics-grid p,
.project-card p,
.tool-card p,
.project-row p,
.page-title p,
.login-copy p,
.small-note {
  color: var(--muted);
}

.section-block,
.page-title,
.toolbar {
  padding: 24px;
  margin-top: 18px;
}

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

.section-heading h2,
.project-card h2,
.tool-card h2,
.project-row h3,
.login-panel h2 {
  margin: 0;
}

.project-list {
  display: grid;
  gap: 10px;
}

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

.tool-button {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
}

.tool-button:hover,
.tool-button:focus-visible {
  border-color: rgba(23, 93, 220, 0.42);
  box-shadow: 0 14px 36px rgba(23, 93, 220, 0.12);
  outline: 0;
}

.tool-button span {
  font-weight: 760;
}

.tool-button small {
  color: var(--muted);
  text-transform: uppercase;
}

.dashboard-project-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.project-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px;
}

.compact-row {
  padding: 12px 14px;
}

.project-grid,
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.project-card,
.tool-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}

.tool-card a,
.card-actions {
  margin-top: auto;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
}

.status-dot.active {
  background: var(--teal);
}

.status-dot.complete {
  background: var(--coral);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.login-layout {
  min-height: calc(100vh - 150px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 28px;
  align-items: center;
  padding: clamp(28px, 6vw, 64px);
}

.login-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}

.login-logo {
  width: 72px;
  height: auto;
  margin-bottom: 20px;
}

.notice {
  padding: 14px;
  border-radius: 7px;
  background: rgba(200, 85, 61, 0.1);
  color: #7a2f20;
}

.people-title {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: end;
}

.people-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px;
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.search-control,
.admin-form input,
.admin-form textarea,
.admin-inline-form input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 11px;
  background: white;
  color: var(--ink);
}

.search-control {
  width: min(360px, 100%);
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.segmented-control button,
.icon-button,
.danger-action {
  min-height: 36px;
  border-radius: 7px;
  border: 0;
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.segmented-control button.active,
.icon-button:hover {
  background: var(--ink);
  color: white;
}

.people-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 18px;
  margin-top: 18px;
}

.graph-panel,
.detail-panel,
.admin-panel,
.email-preview {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(26, 39, 52, 0.1);
  backdrop-filter: blur(18px);
}

#people-graph {
  width: 100%;
  height: 660px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(rgba(23, 32, 42, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 42, 0.045) 1px, transparent 1px),
    rgba(255, 255, 255, 0.72);
  background-size: 36px 36px, 36px 36px, auto;
}

#people-graph svg {
  display: block;
  width: 100%;
  height: 100%;
}

.detail-panel {
  padding: 22px;
  min-height: 340px;
}

.detail-person-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.detail-avatar {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  background: #dce8ef;
}

.detail-avatar.placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: var(--teal);
  font-weight: 780;
}

.detail-email {
  color: var(--accent-blue);
  font-weight: 680;
  text-decoration: none;
}

.detail-email:hover {
  text-decoration: underline;
}

.detail-section {
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.detail-label {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 760;
  text-transform: uppercase;
}

.pill-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(8, 127, 140, 0.12);
  color: var(--teal);
  font-size: 0.82rem;
}

.status-pill {
  background: rgba(183, 121, 31, 0.14);
  color: var(--amber);
}

.status-pill.active {
  background: rgba(8, 127, 140, 0.14);
  color: var(--teal);
}

.people-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-panel {
  padding: 24px;
  margin-top: 18px;
}

.admin-inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.admin-inline-form input {
  flex: 1 1 260px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 18px;
  margin-top: 18px;
}

.admin-form {
  display: grid;
  gap: 10px;
  padding: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-form h3 {
  margin: 0 0 4px;
}

.admin-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.84rem;
}

.admin-form button,
.admin-form .secondary-action,
.admin-form .danger-action {
  width: 100%;
}

.danger-action {
  border: 1px solid rgba(200, 85, 61, 0.3);
  background: rgba(200, 85, 61, 0.12);
  color: #7a2f20;
}

.admin-form button:disabled,
.admin-form input:disabled,
.admin-form textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.email-preview {
  margin-top: 18px;
  overflow: hidden;
}

.email-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.email-preview iframe {
  width: 100%;
  height: 520px;
  border: 0;
  background: white;
}

.error {
  color: #7a2f20;
}

@media (max-width: 840px) {
  .shell-header,
  .identity,
  .main-nav,
  .hero-dashboard,
  .login-layout,
  .people-title,
  .section-heading,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .shell-header,
  .main-nav,
  .identity,
  .section-heading,
  .toolbar {
    display: flex;
  }

  .hero-dashboard,
  .login-layout {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .people-layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  #people-graph {
    height: 560px;
  }
}
