/* ============================================================
   ORDA — shared shell, navigation and UI primitives
   ============================================================ */

/* ------------------------------------------------------------------ shell */

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

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

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 16px 14px;
  border-right: 1px solid var(--line);
  background: #fbf8f1;
  overflow-y: auto;
  z-index: 40;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 10px;
  border-radius: 12px;
}

.sidebar__brand .brand-mark {
  color: var(--brand);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.brand-word {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.19em;
  color: var(--brand);
  line-height: 1;
}

.brand-sub {
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}

.sidebar__search {
  padding: 0 2px;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13.5px;
  text-align: left;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.search-trigger:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  color: var(--ink-2);
}
.search-trigger .kbd {
  margin-left: auto;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 14px;
}
.nav-group:first-child {
  padding-top: 4px;
}

.nav-group__label {
  padding: 0 11px;
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--faint);
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.16s ease, color 0.16s ease;
}
.nav-link .icon {
  color: var(--muted);
  transition: color 0.16s ease;
}
.nav-link:hover {
  background: #f2eee3;
  color: var(--ink);
}
.nav-link:hover .icon {
  color: var(--ink-2);
}
.nav-link.is-active {
  background: var(--brand);
  color: #fbf7ec;
  box-shadow: 0 6px 14px -10px rgba(20, 40, 33, 0.7);
}
.nav-link.is-active .icon {
  color: #dcc38a;
}
.nav-link.is-active .nav-link__count {
  background: rgba(255, 255, 255, 0.16);
  color: #fbf7ec;
}
.nav-link__count {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.nav-link__badge {
  margin-left: auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
}

.sidebar__footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.me-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  margin-bottom: 6px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.me-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.me-card__body {
  min-width: 0;
  flex: 1;
}
.me-card__name {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.me-card__meta {
  font-size: 11.5px;
  color: var(--muted);
}
.me-card__ring {
  position: relative;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--brand) calc(var(--p, 80) * 1%), #e6e0d2 0);
  display: grid;
  place-items: center;
}
.me-card__ring::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--surface);
}
.me-card__ring span {
  position: relative;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--brand);
}
.me-card__ring--gold {
  background: conic-gradient(var(--gold) calc(var(--p, 80) * 1%), #e6e0d2 0);
}

/* ----------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: var(--topbar-h);
  padding: 0 var(--gutter);
  background: rgba(244, 241, 233, 0.82);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.topbar.is-scrolled {
  border-bottom-color: var(--line);
}
.topbar__crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
}
.topbar__crumbs .icon {
  color: var(--faint);
}
.topbar__crumb-current {
  color: var(--ink-2);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__right {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-search {
  display: none;
}

.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.icon-btn:hover {
  background: #ece7dc;
  border-color: var(--line);
}
.icon-btn__dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--clay);
  border: 1.5px solid var(--paper);
}

.avatar-btn {
  border-radius: 50%;
  padding: 2px;
  border: 1px solid transparent;
  transition: border-color 0.16s ease;
}
.avatar-btn:hover {
  border-color: var(--line-strong);
}

.guest-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

/* ------------------------------------------------------------------- page */

.page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 26px var(--gutter) 80px;
  flex: 1;
}
.page--wide {
  max-width: 1360px;
}
.page--narrow {
  max-width: 880px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.page-head__main {
  min-width: 0;
  max-width: 720px;
}
.page-head__title {
  font-size: clamp(1.7rem, 2.6vw, 2.25rem);
  margin-top: 6px;
}
.page-head__sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  max-width: 62ch;
}
.page-head__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
}
.back-link:hover {
  color: var(--brand);
}

.section {
  margin-top: 38px;
}
.section:first-child {
  margin-top: 0;
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.section-head__title {
  font-size: 1.22rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}
.section-head__sub {
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--muted);
}
.section-head__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  padding: 6px 2px;
}
.section-head__link:hover {
  color: var(--brand-3);
}

/* ----------------------------------------------------------------- avatar */

.avatar {
  --size: 40px;
  --h: 168;
  position: relative;
  width: var(--size);
  height: var(--size);
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: calc(var(--size) * 0.31);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: hsl(var(--h) 34% 23%);
  background:
    radial-gradient(120% 120% at 22% 12%, hsl(var(--h) 46% 93%) 0%, hsl(var(--h) 38% 82%) 52%, hsl(var(--h) 32% 72%) 100%);
  box-shadow:
    inset 0 0 0 1px hsl(var(--h) 30% 62% / 0.35),
    inset 0 -8px 16px hsl(var(--h) 40% 60% / 0.22),
    0 1px 2px rgba(24, 20, 14, 0.08);
  user-select: none;
}
.avatar::before {
  content: "";
  position: absolute;
  width: 72%;
  height: 72%;
  right: -22%;
  bottom: -30%;
  border-radius: 50%;
  background: hsl(var(--h) 50% 40% / 0.12);
}
.avatar > span {
  position: relative;
  z-index: 1;
}
.avatar__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
}
.avatar--xs { --size: 24px; }
.avatar--sm { --size: 32px; }
.avatar--md { --size: 40px; }
.avatar--lg { --size: 56px; }
.avatar--xl { --size: 76px; }
.avatar--2xl { --size: 104px; }
.avatar--ring {
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 3px hsl(var(--h) 26% 68% / 0.55),
    0 6px 16px -10px rgba(24, 20, 14, 0.4);
}
.avatar--square {
  border-radius: 14px;
}

.avatar-stack {
  display: flex;
  align-items: center;
}
.avatar-stack .avatar {
  margin-left: -9px;
  box-shadow:
    0 0 0 2px var(--surface),
    0 1px 2px rgba(24, 20, 14, 0.08);
}
.avatar-stack .avatar:first-child {
  margin-left: 0;
}
.avatar-stack__more {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  margin-left: -9px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 2px solid var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-border: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 11px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 14.2px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease;
}
.btn:active {
  transform: translateY(1px);
}
.btn .icon {
  opacity: 0.92;
}

.btn--primary {
  --btn-bg: var(--brand);
  --btn-fg: #fbf7ec;
  --btn-border: var(--brand);
  box-shadow: 0 1px 2px rgba(20, 30, 26, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.btn--primary:hover {
  --btn-bg: var(--brand-2);
  --btn-border: var(--brand-2);
}

.btn--secondary {
  --btn-bg: var(--surface);
  --btn-border: var(--line-strong);
  --btn-fg: var(--ink);
  box-shadow: var(--shadow-xs);
}
.btn--secondary:hover {
  --btn-bg: var(--surface-2);
  --btn-border: #c6bda9;
}

.btn--ghost {
  --btn-fg: var(--ink-2);
}
.btn--ghost:hover {
  --btn-bg: #ece7db;
}

.btn--gold {
  --btn-bg: #efe2c2;
  --btn-border: #ddc99d;
  --btn-fg: #3a2e12;
}
.btn--gold:hover {
  --btn-bg: #e9d8ac;
}

.btn--danger {
  --btn-bg: var(--danger-soft);
  --btn-border: #ecc8c2;
  --btn-fg: var(--danger);
}
.btn--danger:hover {
  --btn-bg: #f4d9d4;
}

.btn--soft {
  --btn-bg: var(--brand-soft);
  --btn-fg: var(--brand);
  --btn-border: transparent;
}
.btn--soft:hover {
  --btn-bg: #dce8de;
}

.btn--sm {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 9px;
  gap: 6px;
}
.btn--lg {
  height: 50px;
  padding: 0 24px;
  font-size: 15.4px;
  border-radius: 13px;
}
.btn--block {
  width: 100%;
}
.btn--icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
}
.btn.is-pressed {
  --btn-bg: var(--brand-soft);
  --btn-border: transparent;
  --btn-fg: var(--brand);
}
.btn[disabled] {
  opacity: 0.5;
}

/* ------------------------------------------------------------------- tags */

.tag {
  --tone: #5c574d;
  --soft: #f1eee5;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3.5px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--tone);
  font-size: 11.8px;
  font-weight: 650;
  letter-spacing: 0.005em;
  line-height: 1.5;
  white-space: nowrap;
}
.tag--outline {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
}
.tag--status {
  padding: 4px 10px;
}
.tag__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.16s ease;
}
.chip:hover {
  border-color: #bdb3a0;
  color: var(--ink);
}
.chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fbf7ec;
}
.chip.is-active:hover {
  background: var(--brand-2);
}
.chip--sm {
  padding: 4px 9px;
  font-size: 12px;
}
.chip--dashed {
  border-style: dashed;
  color: var(--muted);
}

/* ------------------------------------------------------------------ cards */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.card--pad {
  padding: 22px;
}
.card--pad-sm {
  padding: 16px;
}
.card--hover:hover {
  border-color: #cfc6b4;
  box-shadow: var(--shadow-md);
}
.card--interactive {
  cursor: pointer;
}
.card--interactive:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.card--dark {
  background: linear-gradient(155deg, #173a32 0%, #10241f 100%);
  color: #f4efe4;
  border-color: transparent;
}
.card--dark .card__title,
.card--dark h1,
.card--dark h2,
.card--dark h3 {
  color: #fbf7ec;
}
.card--dark .muted {
  color: #b9c4bc;
}
.card--cream {
  background: var(--gold-soft);
  border-color: #ecdfc1;
}
.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.card__title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.3;
}
.card__sub {
  margin-top: 5px;
  font-size: 13px;
  color: var(--muted);
}
.card__body {
  font-size: 14px;
  color: var(--ink-2);
}
.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.card__cover {
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  overflow: hidden;
}
.card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}
.card-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.card__actions {
  position: relative;
  z-index: 2;
}

/* -------------------------------------------------------------- stats */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.stat-grid--5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.stat-tile {
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
}
.stat-tile__value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 3px;
}
.stat-tile__value small {
  font-size: 14px;
  font-weight: 600;
  color: var(--gold-strong);
}
.stat-tile__label {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.stat-tile--dark {
  background: var(--brand);
  border-color: var(--brand);
  color: #ecf1ec;
}
.stat-tile--dark .stat-tile__value { color: #fbf7ec; }
.stat-tile--dark .stat-tile__label { color: #b7c6bc; }

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.metric-row:last-child {
  border-bottom: 0;
}
.metric-row__label {
  font-size: 13.5px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.metric-row__value {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 650;
}

/* ---------------------------------------------------------------- forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field__label {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 5px;
}
.field__label .optional {
  font-weight: 400;
  color: var(--faint);
  font-size: 11.5px;
}
.field__label .req {
  color: var(--clay);
}
.field__hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.field__error {
  font-size: 12px;
  color: var(--danger);
  font-weight: 500;
}
.input,
.textarea,
.select {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fffefb;
  color: var(--ink);
  font-size: 14.4px;
  line-height: 1.5;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.input::placeholder,
.textarea::placeholder {
  color: #a09a8e;
}
.input:hover,
.textarea:hover,
.select:hover {
  border-color: #c4baa6;
}
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 58, 50, 0.13);
}
.input.is-invalid,
.textarea.is-invalid,
.select.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(165, 67, 58, 0.1);
}
.textarea {
  min-height: 92px;
  resize: vertical;
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236c675d' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-grid .field--full {
  grid-column: 1 / -1;
}

.input-affix {
  position: relative;
}
.input-affix .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}
.input-affix .input {
  padding-left: 38px;
}

/* option cards / radio */
.option-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  cursor: pointer;
  font-size: 13.6px;
  line-height: 1.45;
  color: var(--ink-2);
  transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}
.option-card:hover {
  border-color: #bdb3a0;
}
.option-card.is-selected {
  border-color: var(--brand);
  background: var(--brand-tint);
  box-shadow: inset 0 0 0 1px var(--brand);
  color: var(--ink);
}
.option-card input {
  margin: 2px 0 0;
  accent-color: var(--brand);
  flex: none;
}
.option-card__label {
  min-width: 0;
}
.option-card__hint {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
}
.check-row input {
  margin-top: 3px;
  accent-color: var(--brand);
  width: 16px;
  height: 16px;
  flex: none;
}
.check-row.is-done {
  color: var(--muted);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch__track {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #ddd6c7;
  position: relative;
  transition: background 0.18s ease;
  flex: none;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fffdf8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s ease;
}
.switch input:checked + .switch__track {
  background: var(--brand);
}
.switch input:checked + .switch__track::after {
  transform: translateX(16px);
}
.switch input:focus-visible + .switch__track {
  box-shadow: 0 0 0 3px rgba(22, 58, 50, 0.18);
}

/* --------------------------------------------------------------- tabs */

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: #ebe6da;
  border: 1px solid #e2dccc;
}
.segmented__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 13.4px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
  white-space: nowrap;
}
.segmented__btn:hover {
  color: var(--ink-2);
}
.segmented__btn.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(24, 20, 14, 0.1);
}
.segmented__count {
  font-size: 11px;
  font-weight: 700;
  color: var(--faint);
}
.segmented__btn.is-active .segmented__count {
  color: var(--gold-strong);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar__filters {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.toolbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-field {
  position: relative;
  min-width: 220px;
  flex: 1;
  max-width: 380px;
}
.search-field .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}
.search-field .input {
  padding-left: 38px;
  min-height: 40px;
  background: var(--surface);
}
.search-field--wide {
  max-width: none;
}

.filter-panel {
  display: none;
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.filter-panel.is-open {
  display: block;
  animation: rise-in 0.18s ease both;
}

/* --------------------------------------------------------- progress etc. */

.progress {
  position: relative;
  height: 7px;
  border-radius: 999px;
  background: #e9e3d6;
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.progress--gold .progress__bar {
  background: var(--gold);
}
.progress--clay .progress__bar {
  background: var(--clay);
}
.progress--sm {
  height: 5px;
}

.ring {
  --size: 64px;
  position: relative;
  width: var(--size);
  height: var(--size);
  flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--brand) calc(var(--p, 60) * 1%), #e7e1d3 0);
  display: grid;
  place-items: center;
}
.ring::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--surface);
}
.ring__label {
  position: relative;
  font-family: var(--font-display);
  font-size: calc(var(--size) * 0.24);
  font-weight: 700;
  color: var(--brand);
}
.ring--lg {
  --size: 84px;
}

.meter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.meter__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
}
.meter__value {
  font-weight: 700;
  color: var(--ink-2);
}

/* ---------------------------------------------------------------- timeline */

.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 20px;
}
.timeline-item:last-child {
  padding-bottom: 0;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 26px;
  bottom: 0;
  width: 1px;
  background: var(--line-strong);
}
.timeline-item:last-child::before {
  display: none;
}
.timeline-item__dot {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--muted);
  border: 1px solid var(--line);
}
.timeline-item.is-done .timeline-item__dot {
  background: var(--brand);
  border-color: var(--brand);
  color: #f7f2e6;
}
.timeline-item__title {
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.4;
}
.timeline-item:not(.is-done) .timeline-item__title {
  color: var(--muted);
  font-weight: 550;
}
.timeline-item__hint {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}
.timeline-item__date {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--faint);
  margin-top: 3px;
}

/* --------------------------------------------------------------- comments */

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.comment {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.comment__body {
  min-width: 0;
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px 12px 12px 12px;
  padding: 10px 13px;
}
.comment__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.comment__name {
  font-size: 12.8px;
  font-weight: 650;
  color: var(--ink);
}
.comment__time {
  font-size: 11.5px;
  color: var(--faint);
}
.comment__text {
  font-size: 13.6px;
  color: var(--ink-2);
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.comment__author-role {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold-strong);
}
.comment-form {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
}
.comment-form .textarea {
  min-height: 46px;
  border-radius: 12px;
  padding: 11px 13px;
}

/* ----------------------------------------------------------------- notice */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
}
.notice .icon {
  margin-top: 2px;
  color: var(--muted);
}
.notice--info {
  background: var(--teal-soft);
  border-color: #d3e2e4;
  color: #234a51;
}
.notice--info .icon { color: var(--teal); }
.notice--gold {
  background: var(--gold-soft);
  border-color: #ecdfc1;
  color: #5c4716;
}
.notice--gold .icon { color: var(--gold-strong); }
.notice--brand {
  background: var(--brand-tint);
  border-color: #d8e4da;
  color: var(--brand);
}
.notice--brand .icon { color: var(--brand); }
.notice__title {
  font-weight: 650;
  color: inherit;
}

/* ------------------------------------------------------------------ empty */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 46px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: rgba(255, 253, 248, 0.6);
}
.empty__icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--muted);
  margin-bottom: 6px;
}
.empty__title {
  font-size: 15px;
  font-weight: 650;
}
.empty__text {
  font-size: 13px;
  color: var(--muted);
  max-width: 36ch;
}
.empty .btn {
  margin-top: 10px;
}

/* --------------------------------------------------------------- dropdown */

.dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 75;
  animation: rise-in 0.16s ease both;
}
.dropdown__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13.6px;
  color: var(--ink-2);
  text-align: left;
}
.dropdown__item:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.dropdown__item .icon {
  color: var(--muted);
}
.dropdown__item--danger {
  color: var(--danger);
}
.dropdown__item--danger .icon {
  color: var(--danger);
}
.dropdown__sep {
  height: 1px;
  background: var(--line);
  margin: 5px 4px;
}
.dropdown__label {
  padding: 7px 10px 4px;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 700;
}

/* ------------------------------------------------------------ notifications */

.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(390px, calc(100vw - 32px));
  max-height: min(74vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 80;
  overflow: hidden;
  animation: rise-in 0.18s ease both;
}
.notif-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.notif-panel__title {
  font-size: 14px;
  font-weight: 650;
}
.notif-panel__list {
  overflow-y: auto;
  padding: 6px;
}
.notif-item {
  display: flex;
  gap: 11px;
  padding: 11px;
  border-radius: 11px;
  transition: background 0.14s ease;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.notif-item:hover {
  background: var(--surface-2);
}
.notif-item.is-unread {
  background: #f7f4ea;
}
.notif-item__icon {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
}
.notif-item__text {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.45;
}
.notif-item__time {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--faint);
}
.notif-item__unread {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--clay);
  margin-top: 6px;
  flex: none;
}
.notif-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ----------------------------------------------------------------- modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 22px;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 16, 12, 0.48);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fade-in 0.2s ease both;
}
.modal__panel {
  position: relative;
  width: min(560px, 100%);
  max-height: min(88vh, 920px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.6);
  overflow: hidden;
  animation: modal-in 0.22s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.modal--sm .modal__panel { width: min(440px, 100%); }
.modal--lg .modal__panel { width: min(780px, 100%); }
.modal--xl .modal__panel { width: min(980px, 100%); }
.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 0;
  flex: none;
}
.modal__eyebrow {
  margin-bottom: 5px;
}
.modal__title {
  font-size: 1.32rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.modal__sub {
  margin-top: 5px;
  font-size: 13.4px;
  color: var(--muted);
  line-height: 1.5;
}
.modal__close {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: background 0.15s ease, color 0.15s ease;
}
.modal__close:hover {
  background: var(--surface-3);
  color: var(--ink);
}
.modal__body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  flex-wrap: wrap;
  flex: none;
}
.modal__footer--split {
  justify-content: space-between;
}
.modal__footer-start {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.modal--full .modal__panel {
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
}

/* ----------------------------------------------------------------- toast */

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: flex-end;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: min(380px, calc(100vw - 32px));
  padding: 11px 15px;
  border-radius: 12px;
  background: #1c2d27;
  color: #f7f3e9;
  font-size: 13.2px;
  line-height: 1.45;
  box-shadow: 0 18px 40px -20px rgba(18, 20, 16, 0.7);
  pointer-events: auto;
  animation: toast-in 0.24s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.toast.is-leaving {
  animation: toast-out 0.2s ease both;
}
.toast .icon {
  color: #d9c28b;
  margin-top: 1px;
}
.toast--error {
  background: #3a1f1c;
}
.toast--error .icon {
  color: #f0b4a8;
}
.toast--success .icon {
  color: #a9d3b4;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(6px); }
}

/* ------------------------------------------------------- command palette */

.command {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 9vh 18px 18px;
}
.command__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 16, 12, 0.52);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.16s ease both;
}
.command__panel {
  position: relative;
  width: min(700px, 100%);
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.6);
  overflow: hidden;
  animation: modal-in 0.2s ease both;
}
.command__input-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.command__input-row .icon {
  color: var(--muted);
}
.command__input {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 16px;
  outline: none;
  min-width: 0;
}
.command__input::placeholder {
  color: var(--faint);
}
.command__esc {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 2px 5px;
  background: var(--surface-2);
}
.command__results {
  max-height: min(58vh, 520px);
  overflow-y: auto;
  padding: 8px;
}
.command__group-label {
  padding: 9px 10px 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.command__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 11px;
  border-radius: 10px;
  text-align: left;
  border: 1px solid transparent;
}
.command__item.is-active {
  background: var(--brand-tint);
  border-color: #dbe6dc;
}
.command__item-icon {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.command__item-body {
  min-width: 0;
  flex: 1;
}
.command__item-title {
  font-size: 13.6px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.command__item-sub {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.command__item-sub mark,
.command__item-title mark {
  background: #f3e6c4;
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}
.command__hint {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--faint);
  background: var(--surface-2);
}
.command__suggestions {
  padding: 8px;
}
.command__suggestions-title {
  padding: 8px 10px 6px;
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
}
.command__empty {
  padding: 38px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 19px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 650;
}

/* ------------------------------------------------------- drawer & bottom */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(18, 16, 12, 0.45);
  backdrop-filter: blur(3px);
  animation: fade-in 0.18s ease both;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 95;
  width: min(340px, 88vw);
  background: #fbf8f1;
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 50px -30px rgba(20, 18, 14, 0.5);
  display: flex;
  flex-direction: column;
  padding: 18px 16px;
  overflow-y: auto;
  animation: slide-left 0.22s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.drawer__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.drawer__footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  background: rgba(251, 248, 241, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.bottom-nav__inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
}
.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px 4px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: center;
}
.bottom-nav__item.is-active {
  color: var(--brand);
  background: var(--brand-tint);
}
.bottom-nav__item.is-active .icon {
  color: var(--brand);
}
.bottom-nav__item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ------------------------------------------------------------ page misc */

.badge-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--clay);
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}
.meta-row__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.meta-row__item .icon {
  color: var(--faint);
}

.person-line {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.person-line__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.person-line__meta {
  font-size: 11.5px;
  color: var(--muted);
}

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

.hover-lift:hover {
  transform: translateY(-2px);
}

.skeleton {
  background: linear-gradient(90deg, #efeadd 25%, #f7f3e9 37%, #efeadd 63%);
  background-size: 400% 100%;
  animation: skeleton 1.4s ease infinite;
  border-radius: 6px;
  color: transparent;
}
@keyframes skeleton {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.spin {
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.mt-0 { margin-top: 0 !important; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.flex-1 { flex: 1; min-width: 0; }
