/* Combined dashboards: shared responsive system with three visual themes. */

* {
  box-sizing: border-box;
}

:root {
  font-size: 16px;
}

body {
  --page: #f4f5f8;
  --surface: #ffffff;
  --surface-alt: #eef0f6;
  --ink: #202235;
  --muted: #65697a;
  --line: #d9dce7;
  --brand: #5b4ad1;
  --brand-dark: #4030a8;
  --accent: #e6a52e;
  --success: #218568;
  --danger: #b64343;
  --sidebar: #27243f;
  --sidebar-ink: #f8f7ff;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

body.project-theme {
  --page: #eef1f5;
  --surface: #ffffff;
  --surface-alt: #f2f5f8;
  --ink: #17212b;
  --muted: #63707c;
  --line: #d7dee5;
  --brand: #147d78;
  --brand-dark: #0b5b57;
  --accent: #de7c36;
  --success: #24805f;
  --danger: #b33f4b;
  --sidebar: #111c27;
  --sidebar-ink: #f2f7f9;
}

body.wellness-theme {
  --page: #f7f1e9;
  --surface: #fffdfa;
  --surface-alt: #f1e7dc;
  --ink: #303329;
  --muted: #716f62;
  --line: #ded4c7;
  --brand: #437d61;
  --brand-dark: #2f5b45;
  --accent: #d67652;
  --success: #4f8668;
  --danger: #a94b44;
  --sidebar: #30483b;
  --sidebar-ink: #fffdf6;
}

a {
  color: var(--brand-dark);
}

button,
input,
select,
textarea {
  font: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
.table-region:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.dashboard-shell {
  width: 100%;
  min-width: 18rem;
}

.sidebar {
  display: none;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark,
.nav-icon,
.title-icon,
.metric-icon,
.button-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  background: var(--accent);
  border-radius: 0.8rem;
  color: #241b0d;
}

.sidebar-nav {
  display: grid;
  gap: 0.35rem;
}

.sidebar-nav a {
  min-height: 2.75rem;
  padding: 0.7rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border-radius: 0.7rem;
  color: inherit;
  text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.14);
}

.nav-icon {
  width: 1.5rem;
  font-size: 1.1rem;
}

.sidebar-note {
  margin-top: auto;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.85rem;
  font-size: 0.85rem;
}

.sidebar-note p {
  margin: 0.4rem 0 0;
  color: rgba(255, 255, 255, 0.78);
}

.mobile-bar {
  min-height: 4.5rem;
  padding: 0.8rem 1rem;
  background: var(--sidebar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--sidebar-ink);
}

.mobile-menu {
  position: relative;
}

.mobile-menu summary {
  min-width: 3rem;
  min-height: 2.75rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 0.65rem;
  cursor: pointer;
  list-style: none;
}

.mobile-menu summary::-webkit-details-marker {
  display: none;
}

.mobile-menu-panel {
  width: min(18rem, calc(100vw - 2rem));
  padding: 0.6rem;
  background: var(--sidebar);
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  z-index: 30;
  display: grid;
  gap: 0.3rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.8rem;
  box-shadow: 0 1rem 2rem rgba(20, 24, 30, 0.24);
}

.mobile-menu-panel a {
  min-height: 2.75rem;
  padding: 0.7rem;
  border-radius: 0.55rem;
  color: var(--sidebar-ink);
  text-decoration: none;
}

.mobile-menu-panel a:hover {
  background: rgba(255, 255, 255, 0.14);
}

.dashboard-main {
  min-width: 0;
  padding: 1rem;
}

.topbar {
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.page-title h1 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2.25rem);
  line-height: 1.15;
}

.page-title p {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.title-icon,
.metric-icon {
  width: 2.75rem;
  height: 2.75rem;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  color: var(--brand-dark);
  font-size: 1.25rem;
}

.header-actions,
.inline-actions,
.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
}

.icon-button,
.primary-button,
.secondary-button {
  min-height: 2.75rem;
  border-radius: 0.7rem;
  cursor: pointer;
}

.icon-button {
  width: 2.75rem;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.15rem;
}

.primary-button,
.secondary-button {
  padding: 0.65rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-weight: 750;
  text-decoration: none;
}

.primary-button {
  background: var(--brand);
  border: 1px solid var(--brand-dark);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button {
  background: transparent;
  border: 1px solid var(--brand);
  color: var(--brand-dark);
}

.secondary-button:hover {
  background: var(--surface-alt);
}

.dashboard-grid,
.metric-grid,
.status-grid {
  display: grid;
  gap: 1rem;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1fr);
}

.metric-grid {
  margin-bottom: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.status-grid {
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.panel,
.metric-card,
.status-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
}

.panel {
  padding: 1.1rem;
  border-radius: 1rem;
  box-shadow: none;
}

.metric-card,
.status-card {
  padding: 1rem;
  border-radius: 0.9rem;
  box-shadow: none;
}

.learning-theme .panel,
.learning-theme .metric-card {
  border-top: 3px solid var(--brand);
}

.project-theme .panel,
.project-theme .metric-card {
  border-radius: 0.45rem;
  box-shadow: none;
}

.wellness-theme .panel,
.wellness-theme .metric-card,
.wellness-theme .status-card {
  border-radius: 1.4rem;
}

.panel-wide {
  grid-column: 1 / -1;
}

.panel-header {
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.panel-header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.metric-label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.metric-value {
  margin: 0.65rem 0 0.15rem;
  font-size: 1.75rem;
  font-weight: 850;
  line-height: 1;
}

.metric-change {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.35rem;
  padding: 0.2rem 0.55rem;
  background: #e3f3ec;
  border-radius: 999px;
  color: var(--success);
  font-size: 0.82rem;
  font-weight: 700;
}

.metric-change.negative {
  background: #fde8e8;
  color: var(--danger);
}

.ops-strip {
  margin: 0 0 1.25rem;
  padding: 0.9rem 1rem;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
}

.ops-item strong {
  display: block;
  font-size: 1.2rem;
  line-height: 1.2;
}

.ops-item span {
  color: var(--muted);
  font-size: 0.85rem;
}

@media (min-width: 40rem) {
  .ops-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.badge {
  padding: 0.28rem 0.55rem;
  background: var(--surface-alt);
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.badge.success {
  background: #e3f3ec;
  border-color: #a8d7c6;
  color: #176048;
}

.badge.warning {
  background: #fff0d3;
  border-color: #e8c278;
  color: #74470b;
}

.badge.danger {
  background: #f9e2e4;
  border-color: #dfabb0;
  color: #842f38;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem;
}

.field {
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field label,
.field legend,
.status-card label {
  display: block;
  margin: 0 0 0.35rem;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 750;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.62rem 0.72rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  color: var(--ink);
}

.field textarea {
  min-height: 6.5rem;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #858998;
  opacity: 1;
}

.learning-theme .search-field input {
  padding-left: 0;
  border-width: 0 0 2px;
  border-radius: 0;
}

.project-theme .field input,
.project-theme .field select,
.project-theme .field textarea {
  background: var(--surface-alt);
  border-radius: 0.35rem;
}

.wellness-theme .field input,
.wellness-theme .field select {
  border-radius: 999px;
}

.wellness-theme .field textarea {
  border-radius: 1.1rem;
}

.help-text {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.choice-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.choice {
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.choice label {
  margin: 0;
  font-weight: 650;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--brand);
}

input[type="color"] {
  width: 4rem;
  padding: 0.2rem;
}

input[type="range"] {
  padding-right: 0;
  padding-left: 0;
  accent-color: var(--brand);
}

input[type="file"] {
  padding: 0.45rem;
}

output {
  min-height: 2.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--surface-alt);
  display: block;
  border-left: 4px solid var(--accent);
  color: var(--ink);
  font-weight: 800;
}

.status-card progress,
.status-card meter {
  width: 100%;
  height: 1.35rem;
  accent-color: var(--brand);
}

.status-value {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.data-list,
.timeline,
.activity-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.data-list li,
.timeline li,
.activity-list li {
  padding: 0.75rem 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  border-bottom: 1px solid var(--line);
}

.data-list li:last-child,
.timeline li:last-child,
.activity-list li:last-child {
  border-bottom: 0;
}

.list-icon {
  width: 2rem;
  height: 2rem;
  background: var(--surface-alt);
  display: grid;
  place-items: center;
  border-radius: 0.65rem;
  color: var(--brand-dark);
}

.list-title {
  display: block;
  font-weight: 750;
}

.list-meta {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.description-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem 1rem;
  margin: 0;
}

.description-grid dt {
  color: var(--muted);
  font-weight: 650;
}

.description-grid dd {
  margin: 0;
  font-weight: 750;
  text-align: right;
}

.table-help {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.table-region {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

table {
  width: 100%;
  min-width: 40rem;
  border-collapse: collapse;
}

caption {
  padding: 0.8rem;
  background: var(--surface-alt);
  color: var(--ink);
  font-weight: 800;
  text-align: left;
}

th,
td {
  padding: 0.72rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

thead th {
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

tbody th {
  font-weight: 750;
}

tbody tr:hover {
  background: var(--surface-alt);
}

.spark-bars {
  min-height: 9rem;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 0.45rem;
}

.spark-bar {
  width: 100%;
  min-height: 1rem;
  background: var(--brand);
  border-radius: 0.35rem 0.35rem 0 0;
}

.spark-bar:nth-child(even) {
  background: var(--accent);
}

.bar-42 {
  height: 42%;
}

.bar-55 {
  height: 55%;
}

.bar-64 {
  height: 64%;
}

.bar-68 {
  height: 68%;
}

.bar-76 {
  height: 76%;
}

.bar-82 {
  height: 82%;
}

.bar-92 {
  height: 92%;
}

.chart-note {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.dashboard-footer {
  margin-top: 1rem;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

@media (min-width: 42rem) {
  .dashboard-main {
    padding: 1.5rem;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 64rem) {
  .dashboard-shell {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
  }

  .sidebar {
    height: 100vh;
    padding: 1.25rem;
    background: var(--sidebar);
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    color: var(--sidebar-ink);
  }

  .mobile-bar {
    display: none;
  }

  .dashboard-main {
    padding: 2rem;
  }

  .dashboard-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .span-4 {
    grid-column: span 4;
  }

  .span-5 {
    grid-column: span 5;
  }

  .span-6 {
    grid-column: span 6;
  }

  .span-7 {
    grid-column: span 7;
  }

  .span-8 {
    grid-column: span 8;
  }
}
