:root {
  --bg: #f0f3f7;
  --panel: #ffffff;
  --ink: #1e2a38;
  --muted: #5e6c7a;
  --line: #d9e1ea;
  --accent: #0a6e8a;
  --accent-2: #0f9d92;
  --danger: #a72e2e;
}

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

body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at top left, #f9fbff, var(--bg) 42%);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
}

a {
  color: var(--accent);
}

.site-header {
  background: linear-gradient(110deg, #082a37, #0f4b60);
  color: #fff;
  padding: 0.9rem 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.logo {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.header-link {
  color: #d8edf5;
  text-decoration: none;
  font-size: 0.94rem;
}

.header-user {
  font-size: 0.84rem;
  color: #d8edf5;
  text-decoration: none;
}

.main-shell {
  max-width: 1080px;
  margin: 1.3rem auto 2rem;
  padding: 0 1rem;
}

.flash-stack {
  margin-bottom: 1rem;
  display: grid;
  gap: 0.45rem;
}

.flash {
  border-radius: 0.6rem;
  padding: 0.65rem 0.8rem;
  font-size: 0.9rem;
}

.flash-success {
  background: #e3f4ea;
  border: 1px solid #b2e1c4;
}

.flash-error {
  background: #fde9e9;
  border: 1px solid #f3c3c3;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 1rem 1.1rem 1.2rem;
  box-shadow: 0 5px 24px rgba(20, 45, 70, 0.06);
}

.panel.narrow,
.auth-card {
  max-width: 700px;
  margin: 0 auto;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 1.4rem 1.2rem;
  box-shadow: 0 5px 24px rgba(20, 45, 70, 0.06);
}

h1,
h2,
h3 {
  margin: 0 0 0.55rem;
}

h1 {
  font-size: 1.4rem;
}

h2 {
  font-size: 1.1rem;
}

h3 {
  font-size: 1rem;
}

.muted {
  color: var(--muted);
  margin: 0 0 0.7rem;
  font-size: 0.93rem;
}

.stack-form {
  display: grid;
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
}

input,
select,
textarea {
  border: 1px solid #c9d5e2;
  border-radius: 0.55rem;
  padding: 0.55rem 0.64rem;
  font: inherit;
  color: inherit;
  background: #fff;
}

textarea {
  resize: vertical;
}

.btn {
  border-radius: 0.55rem;
  border: 1px solid transparent;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.3rem;
}

.btn-primary {
  background: linear-gradient(110deg, var(--accent), var(--accent-2));
  color: #fff;
}

.btn-subtle {
  background: #edf3f8;
  border-color: #d0dde9;
  color: #2a4359;
}

.module-grid,
.task-grid,
.stats-grid {
  display: grid;
  gap: 0.9rem;
}

.module-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.task-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.module-card,
.task-card,
.stat-card {
  background: #f9fbfd;
  border: 1px solid #dfe8f0;
  border-radius: 0.75rem;
  padding: 0.8rem;
  display: grid;
  gap: 0.5rem;
}

.stat-value {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: #18475d;
}

.progress-metric {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  margin: 0.6rem 0 0.3rem;
  font-size: 0.9rem;
}

.progress-bar {
  width: 100%;
  height: 0.5rem;
  border-radius: 999px;
  overflow: hidden;
  background: #e4ecf3;
}

.progress-fill {
  background: linear-gradient(110deg, #1765a9, #0f9d92);
  height: 100%;
}

.grid-2,
.two-col {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.checkbox-row input {
  margin-top: 0.15rem;
}

.field-title {
  margin: 0 0 0.4rem;
  font-size: 0.92rem;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.45rem;
}

.option-grid-cancers {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.option-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid #d7e2ec;
  border-radius: 0.5rem;
  padding: 0.45rem 0.55rem;
  background: #fbfdff;
}

.option-item input {
  margin: 0;
}

.help-text {
  color: var(--muted);
  font-size: 0.82rem;
}

.panel-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

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

.top-gap {
  margin-top: 1.3rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

th {
  background: #f0f5fa;
}

.tiny-bar {
  margin-top: 0.3rem;
  width: 100%;
  height: 0.3rem;
  background: #e3ebf3;
  border-radius: 999px;
  overflow: hidden;
}

.tiny-bar > div {
  height: 100%;
  background: linear-gradient(110deg, #1765a9, #0f9d92);
}

.simple-list {
  margin: 0;
  padding-left: 1.1rem;
}

.chip {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font-size: 0.8rem;
  width: fit-content;
  text-decoration: none;
}

.chip-done {
  background: #dff4eb;
  color: #1e6f4f;
}

.chip-open {
  background: #ecf2f8;
  color: #2f4f69;
}

.chip-current {
  background: #d9eef7;
  color: #14506d;
}

.task-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.guideline-card {
  border: 1px solid #d8e3ee;
  border-radius: 0.75rem;
  margin-bottom: 0.85rem;
  overflow: hidden;
  background: #fff;
}

.guideline-card summary {
  cursor: pointer;
  list-style: none;
  padding: 0.65rem 0.7rem;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: center;
  background: #f5f9fc;
}

.guideline-card summary::-webkit-details-marker {
  display: none;
}

.guideline-inner {
  padding: 0.75rem;
}

.org-row {
  border: 1px solid #dbe5ee;
  border-radius: 0.55rem;
  padding: 0.6rem;
  margin-bottom: 0.5rem;
  background: #fcfdfe;
}

.org-row-head {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.org-row-head input {
  flex: 1;
}

.btn-danger {
  background: #ffe9e9;
  color: var(--danger);
  border: 1px solid #f4cbcb;
}

@media (max-width: 820px) {
  .panel-row {
    flex-direction: column;
  }

  .grid-2,
  .two-col {
    grid-template-columns: 1fr;
  }

  .main-shell {
    margin-top: 0.8rem;
  }

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