/* ------------------------------------------------------------------
   AWPL admin panel — one stylesheet, no build step.
   The palette is the mobile app's palette, so the two read as one product.
   ------------------------------------------------------------------ */

:root {
  --primary: #1e7a5e;
  --primary-dark: #155944;
  --tint: #e4f2ed;
  --accent: #c9922b;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --border: #dde4e1;
  --text: #16211d;
  --muted: #5d6b66;
  --danger: #b3261e;
  --warning: #b87514;
  --info: #1b5e9c;

  /* Chart series — fixed order, never cycled. */
  --c1: #0e8a5f;
  --c2: #2563eb;
  --c3: #c96a00;
  --c4: #7c3aed;
  --c5: #d62a6b;
  --c6: #0e9aa7;
  --c7: #a16207;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(22, 33, 29, 0.06), 0 4px 14px rgba(22, 33, 29, 0.05);
  --shadow-lg: 0 12px 40px rgba(22, 33, 29, 0.18);
  --sidebar-w: 232px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 21px;
}
h2 {
  font-size: 16px;
}
h3 {
  font-size: 14px;
}

p {
  margin: 0 0 10px;
}
p:last-child {
  margin-bottom: 0;
}

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

.boot {
  display: grid;
  place-items: center;
  height: 100%;
}
.boot-note {
  color: var(--muted);
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.strong {
  font-weight: 650;
}
.mono {
  font-variant-numeric: tabular-nums;
}
.nowrap {
  white-space: nowrap;
}
.right {
  text-align: right;
}
.center {
  text-align: center;
}
.spacer {
  flex: 1 1 auto;
}
.hidden {
  display: none !important;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.row-tight {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ */
/* Login                                                               */
/* ------------------------------------------------------------------ */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 520px at 50% -12%, var(--tint), transparent 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 392px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
}

.login-title {
  font-size: 19px;
}

.demo-note {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #fbfcfc;
  font-size: 12px;
  color: var(--muted);
}
.demo-note dl {
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
}
.demo-note dt {
  font-weight: 650;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.demo-note dd {
  margin: 0;
}

/* ------------------------------------------------------------------ */
/* Shell                                                               */
/* ------------------------------------------------------------------ */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--primary-dark);
  color: #eaf3f0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.side-brand .brand-mark {
  background: var(--primary);
}
.side-brand-text {
  min-width: 0;
}
.side-brand-name {
  font-weight: 650;
  font-size: 14px;
  color: #fff;
}
.side-brand-sub {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.62);
}

.side-nav {
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
}

.side-nav a {
  display: block;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}
.side-nav a:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}
.side-nav a.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.side-nav a .nav-count {
  float: right;
  background: var(--accent);
  color: #241a05;
  border-radius: 999px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  margin-top: 1px;
}

.side-foot {
  padding: 12px 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}
.side-foot .who {
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}
.side-foot button {
  margin-top: 8px;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 11px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 46px;
}
.topbar .crumb {
  font-size: 12.5px;
  color: var(--muted);
}
.topbar .crumb-current {
  color: var(--text);
  font-weight: 600;
}

.page {
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1440px;
  width: 100%;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.page-head .sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

/* ------------------------------------------------------------------ */
/* Cards, tiles                                                        */
/* ------------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.card-head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-head .sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}
.card-body {
  padding: 16px;
  flex: 1 1 auto;
  min-width: 0;
}
.card-body.flush {
  padding: 0;
}
.card-foot {
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  background: #fafbfb;
  border-radius: 0 0 var(--radius) var(--radius);
}

.grid {
  display: grid;
  gap: 14px;
}
.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid-2-1 {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}
.grid-1-2 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  font: inherit;
  color: inherit;
}
button.tile {
  cursor: pointer;
}
button.tile:hover {
  border-color: var(--primary);
}
.tile-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.tile-value {
  font-size: 27px;
  font-weight: 680;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.tile-hint {
  font-size: 11.5px;
  color: var(--muted);
}
.tile.tone-primary .tile-value {
  color: var(--primary);
}
.tile.tone-warning .tile-value {
  color: var(--warning);
}
.tile.tone-danger .tile-value {
  color: var(--danger);
}
.tile.tone-info .tile-value {
  color: var(--info);
}

.callout {
  border: 1px solid var(--accent);
  background: #fdf7ea;
  border-radius: var(--radius);
  padding: 15px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.callout h2 {
  color: #7a5407;
}
.callout .sub {
  color: #8a6410;
  font-size: 13px;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 550;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  line-height: 1.3;
}
.btn:hover:not(:disabled) {
  border-color: #c3cdc9;
  background: #f7f9f8;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #8f1e17;
  border-color: #8f1e17;
}
.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--primary);
}
.btn-quiet:hover:not(:disabled) {
  background: var(--tint);
  border-color: transparent;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12.5px;
}
.btn-block {
  width: 100%;
}
.btn-dark {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.btn-dark:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn:focus-visible,
.input:focus-visible,
a:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Forms                                                               */
/* ------------------------------------------------------------------ */

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.field > label,
.label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.field .hint {
  font-size: 11.5px;
  color: var(--muted);
}

.input {
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  width: 100%;
  min-width: 0;
}
select.input {
  padding-right: 26px;
  cursor: pointer;
}
textarea.input {
  resize: vertical;
  min-height: 76px;
  line-height: 1.5;
}
.input::placeholder {
  color: #9aa8a3;
}
.input:disabled {
  background: #f2f5f4;
  color: var(--muted);
}
.input.invalid {
  border-color: var(--danger);
  background: #fdf5f4;
}

.field-error {
  font-size: 11.5px;
  color: var(--danger);
  font-weight: 550;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  cursor: pointer;
}
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  flex: 0 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}
.form-grid .span-2 {
  grid-column: span 2;
}

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

.search-wrap {
  position: relative;
  flex: 1 1 260px;
  min-width: 200px;
}

.banner {
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 13px;
  border: 1px solid;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.banner-error {
  background: #fdf3f2;
  border-color: #eccbc8;
  color: #8f1e17;
}
.banner-warning {
  background: #fdf7ea;
  border-color: #ecdcb4;
  color: #7a5407;
}
.banner-info {
  background: var(--tint);
  border-color: #c3e0d6;
  color: var(--primary-dark);
}
.banner strong {
  font-weight: 650;
}

/* ------------------------------------------------------------------ */
/* Badges, bars, chips                                                 */
/* ------------------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 620;
  line-height: 18px;
  white-space: nowrap;
  background: #eef1f0;
  color: var(--muted);
  border: 1px solid transparent;
}
.badge-success {
  background: var(--tint);
  color: var(--primary-dark);
}
.badge-warning {
  background: #fdf1dd;
  color: #7a5407;
}
.badge-danger {
  background: #fbe9e7;
  color: #8f1e17;
}
.badge-info {
  background: #e8f1fa;
  color: #144a7c;
}
.badge-neutral {
  background: #eef1f0;
  color: var(--muted);
}
.badge-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.pbar {
  position: relative;
  height: 7px;
  border-radius: 999px;
  background: #eaeeec;
  overflow: hidden;
  min-width: 60px;
}
.pbar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}
.pbar-row {
  display: flex;
  align-items: center;
  gap: 9px;
}
.pbar-row .pbar {
  flex: 1 1 auto;
}
.pbar-row .pnum {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 12.5px;
  min-width: 38px;
  text-align: right;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--muted);
}
.chip button {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
  padding: 0 2px;
  line-height: 1;
}

/* A row of one-click filters — the stage chips above a member's names list. */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
}
.chip-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}
.chip-btn.active {
  background: var(--tint);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 650;
}
.chip-btn .chip-count {
  font-variant-numeric: tabular-nums;
  font-weight: 680;
  color: var(--text);
}
.chip-btn.active .chip-count {
  color: var(--primary-dark);
}

.kv {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 7px 16px;
  font-size: 13px;
}
.kv dt {
  color: var(--muted);
  font-weight: 500;
}
.kv dd {
  margin: 0;
  word-break: break-word;
}

/* ------------------------------------------------------------------ */
/* Tables                                                              */
/* ------------------------------------------------------------------ */

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th,
table.data td {
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data thead th {
  background: #fafbfb;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  color: var(--muted);
  font-weight: 680;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data tbody tr:last-child td {
  border-bottom: 0;
}
table.data tbody tr:hover {
  background: #f8faf9;
}
table.data tr.clickable {
  cursor: pointer;
}
table.data th.sortable {
  cursor: pointer;
  user-select: none;
}
table.data th.sortable:hover {
  color: var(--text);
}
table.data th .sort-arrow {
  margin-left: 4px;
  color: var(--primary);
  font-weight: 700;
}
table.data td.num,
table.data th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
table.data td.tight {
  white-space: nowrap;
}
table.data .cell-main {
  font-weight: 600;
}
table.data .cell-sub {
  font-size: 11.5px;
  color: var(--muted);
}
.awpl-id {
  white-space: nowrap;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}

.empty {
  padding: 40px 22px;
  text-align: center;
  color: var(--muted);
}
.empty h3 {
  color: var(--text);
  margin-bottom: 4px;
}

.loading {
  padding: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.spinner {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  animation: spin 0.7s linear infinite;
  flex: 0 0 auto;
}
.btn .spinner {
  width: 13px;
  height: 13px;
  border-width: 2px;
  border-top-color: currentColor;
  border-color: rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------------------------------------------------ */
/* Tabs                                                                */
/* ------------------------------------------------------------------ */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--muted);
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabs button:hover {
  color: var(--text);
}
.tabs button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 650;
}

.subtabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.subtabs button {
  appearance: none;
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.subtabs button:hover {
  border-color: #c3cdc9;
}
.subtabs button.active {
  background: var(--tint);
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* ------------------------------------------------------------------ */
/* Overlays: modal, drawer, toast                                      */
/* ------------------------------------------------------------------ */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(22, 33, 29, 0.42);
  z-index: 100;
  display: flex;
  animation: fade 0.12s ease-out;
}
.backdrop-center {
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.backdrop-right {
  justify-content: flex-end;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: pop 0.13s ease-out;
}
.modal.wide {
  max-width: 720px;
}
@keyframes pop {
  from {
    transform: translateY(8px) scale(0.99);
    opacity: 0;
  }
}

.drawer {
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: slide 0.16s ease-out;
}
.drawer.wide {
  max-width: 680px;
}
@keyframes slide {
  from {
    transform: translateX(24px);
    opacity: 0.4;
  }
}

.overlay-head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.overlay-head .sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.overlay-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.overlay-foot {
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
  background: #fafbfb;
}
.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 19px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.icon-btn:hover {
  background: #f0f3f2;
  color: var(--text);
}

.toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 15px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  max-width: 380px;
  animation: pop 0.13s ease-out;
  pointer-events: auto;
}
.toast.success {
  background: var(--primary-dark);
}
.toast.error {
  background: var(--danger);
}

/* ------------------------------------------------------------------ */
/* Charts                                                              */
/* ------------------------------------------------------------------ */

.chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart text {
  font-family: var(--font);
  fill: var(--muted);
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.donut-wrap > svg {
  width: 148px;
  flex: 0 0 auto;
}
.legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  min-width: 130px;
  flex: 1 1 auto;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex: 0 0 auto;
}
.legend-val {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 640;
  color: var(--text);
}

/* ------------------------------------------------------------------ */
/* DMO month grid                                                      */
/* ------------------------------------------------------------------ */

.dmo-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.dmo-grid .dow {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  font-weight: 640;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 2px;
}
.day-cell {
  appearance: none;
  font: inherit;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 7px 8px 8px;
  cursor: pointer;
  text-align: left;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.day-cell:hover {
  border-color: var(--primary);
}
.day-cell.blank {
  border: 0;
  background: transparent;
  cursor: default;
  min-height: 0;
}
.day-cell.future {
  opacity: 0.45;
  cursor: not-allowed;
  background: #fafbfb;
}
.day-cell .dnum {
  font-size: 12px;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
}
.day-cell .dpc {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.day-cell .dbar {
  height: 4px;
  border-radius: 999px;
  background: #eaeeec;
  overflow: hidden;
  margin-top: auto;
}
.day-cell .dbar > span {
  display: block;
  height: 100%;
}

.checklist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.checklist-row:last-child {
  border-bottom: 0;
}
.checklist-row .cl-label {
  font-weight: 600;
  font-size: 13px;
}
.checklist-row .cl-help {
  font-size: 11.5px;
  color: var(--muted);
}
.checklist-row .cl-input {
  flex: 0 0 auto;
  width: 92px;
}
/* A row switched off in the DMO builder that still holds a value on this day. */
.checklist-row.off {
  opacity: 0.72;
  background: #f7f9f8;
}

.builder-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  background: #fdfefe;
}
.builder-row .ord {
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 8px;
}
.builder-row.off {
  opacity: 0.6;
  background: #f7f9f8;
}

.audit-details {
  font-size: 11.5px;
  color: var(--muted);
  word-break: break-word;
  max-width: 460px;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.timeline {
  display: flex;
  flex-direction: column;
}
.timeline-item {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.timeline-item:last-child {
  border-bottom: 0;
}
.timeline-when {
  color: var(--muted);
  font-size: 12px;
}

.secret-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}
.secret-row .input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}
.secret {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.secret code {
  background: #f2f5f4;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 12.5px;
}

/* ------------------------------------------------------------------ */
/* Goals and the rank ladder                                           */
/* ------------------------------------------------------------------ */

/* A figure on the rank ladder that is out of step with the rungs either
   side. Quiet on purpose — it asks a question, it does not raise an alarm. */
.odd-figure {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: #fdf7ec;
  font-size: 10.5px;
  font-weight: 700;
  cursor: help;
}

/* The rank ladder is eleven columns wide, the catalogue and the activity
   report not much less. Rather than squeeze every cell until it wraps, they
   keep their width and the wrapper scrolls sideways. */
.wide-wrap table.data {
  min-width: 1080px;
}
.wide-wrap table.data th,
.wide-wrap table.data td {
  padding-left: 10px;
  padding-right: 10px;
}
.wide-wrap table.data td {
  white-space: nowrap;
}
.wide-wrap table.data td .row-tight.nowrap {
  flex-wrap: nowrap;
}
.wide-wrap table.data td .cell-sub {
  white-space: normal;
}
/* Except the rank name and the tour package, which are words rather than
   figures and are allowed to wrap onto a second line. */
.wide-wrap table.data td.wrap-cell {
  white-space: normal;
  min-width: 150px;
}
.wide-wrap table.data thead th {
  white-space: normal;
}

/* One square a day, thirty days of "I re-read my goals". */
.streak-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.streak-day {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #f2f5f4;
}
.streak-day.done {
  background: var(--primary);
  border-color: var(--primary);
}
.streak-day.today {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* A member's goal, laid out as a small block of read-only facts. */
.goal-leg {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.goal-leg .goal-leg-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}
.goal-leg .goal-leg-head .strong {
  font-variant-numeric: tabular-nums;
}
.goal-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.goal-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.goal-item .goal-item-main {
  flex: 1 1 auto;
  min-width: 0;
}
.goal-item .goal-item-cost {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Responsive — down to a tablet                                       */
/* ------------------------------------------------------------------ */

@media (max-width: 1180px) {
  .grid-2-1,
  .grid-1-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
  .kv {
    grid-template-columns: 160px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: column;
  }
  .side-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
    gap: 4px;
  }
  .side-nav a {
    padding: 7px 12px;
  }
  .side-foot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
  }
  .side-foot button {
    margin-top: 0;
    margin-left: auto;
  }
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .page,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }
  .timeline-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .kv {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px 0;
  }
  .kv dt {
    margin-top: 8px;
  }
}
