:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fbfe;
  --line: #d6dfeb;
  --line-strong: #b9c8da;
  --ink: #233447;
  --ink-soft: #64758a;
  --blue-50: #eef5fd;
  --blue-100: #dfecfb;
  --blue-200: #c7dcf4;
  --blue-500: #5c88b7;
  --blue-700: #355574;
  --sand-100: #f5ecdf;
  --sand-200: #ead8bc;
  --green-100: #e5f4ea;
  --green-600: #3d7c56;
  --amber-100: #f8f1df;
  --shadow: 0 18px 40px rgba(46, 70, 95, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Be Vietnam Pro", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(223, 236, 251, 0.7), transparent 25%),
    linear-gradient(180deg, #fbfdff 0%, #f3f0eb 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.portal-shell {
  width: min(1420px, calc(100% - 28px));
  margin: 14px auto;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 18px;
}

.portal-sidebar,
.portal-main {
  border: 1px solid rgba(214, 223, 235, 0.95);
  box-shadow: var(--shadow);
}

.portal-sidebar {
  min-height: calc(100vh - 28px);
  padding: 22px 18px;
  display: grid;
  align-content: start;
  gap: 18px;
  border-radius: 30px;
  background:
    radial-gradient(circle at top, rgba(245, 236, 223, 0.75), transparent 26%),
    linear-gradient(180deg, rgba(246, 250, 255, 0.97), rgba(240, 246, 252, 0.94));
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 6px;
}

.portal-brand__crest {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--blue-200), var(--sand-100));
  color: var(--blue-700);
  font-weight: 800;
}

.portal-brand__copy strong,
.portal-brand__copy small {
  display: block;
}

.portal-brand__copy small {
  color: var(--ink-soft);
  margin-top: 4px;
}

.portal-nav {
  display: grid;
  gap: 8px;
}

.portal-nav a,
.mobile-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 16px;
  color: var(--ink-soft);
  font-weight: 600;
  transition:
    transform 170ms ease,
    background-color 170ms ease,
    color 170ms ease,
    box-shadow 170ms ease;
}

.portal-nav a:hover,
.portal-nav a:focus-visible,
.portal-nav a.is-active,
.mobile-nav a.is-active {
  transform: translateX(2px);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 0 0 1px rgba(92, 136, 183, 0.14);
}

.side-note {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(214, 223, 235, 0.95);
}

.side-note--soft {
  background: linear-gradient(180deg, rgba(245, 236, 223, 0.7), rgba(255, 255, 255, 0.88));
}

.side-note__label,
.section-tag {
  display: inline-flex;
  margin-bottom: 10px;
  color: var(--blue-700);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.side-note strong,
.metric-box strong,
.list-row strong,
.badge-card strong,
.rank-row strong,
.leader-row strong,
.history-row strong,
.info-row strong {
  display: block;
}

.side-note p,
.metric-box span,
.list-row p,
.badge-card p,
.rank-row p,
.leader-row p,
.history-row p,
.info-row p,
.page-topbar p,
.profile-header span {
  margin: 6px 0 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.portal-main {
  min-height: calc(100vh - 28px);
  padding: 24px;
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.88);
}

.page-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.page-topbar h1,
.card h2 {
  margin: 0;
  font-size: clamp(1.5rem, 2vw, 2rem);
  line-height: 1.08;
}

.page-topbar__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.action-button,
.ghost-button,
.filter-chip {
  border: 0;
  border-radius: 999px;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 170ms ease,
    box-shadow 170ms ease,
    background-color 170ms ease,
    color 170ms ease;
}

.action-button {
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  color: #fff;
}

.ghost-button,
.filter-chip {
  background: rgba(245, 248, 252, 0.98);
  color: var(--ink);
}

.action-button:hover,
.ghost-button:hover,
.filter-chip:hover,
.action-button:focus-visible,
.ghost-button:focus-visible,
.filter-chip:focus-visible,
.filter-chip.is-active {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(53, 85, 116, 0.12);
}

.filter-chip.is-active {
  background: linear-gradient(135deg, var(--blue-200), var(--sand-100));
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 8px 12px;
  border-radius: 18px;
  background: rgba(249, 252, 255, 0.96);
  border: 1px solid var(--line);
}

.user-pill__avatar,
.profile-avatar {
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--blue-700);
  background: linear-gradient(135deg, var(--blue-200), var(--sand-100));
}

.user-pill__avatar {
  width: 40px;
  height: 40px;
  border-radius: 14px;
}

.user-pill small {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
}

.grid {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

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

.grid--opportunities,
.grid--board,
.grid--log {
  grid-template-columns: 1fr 320px;
}

.card {
  padding: 20px;
  border-radius: var(--radius-xl);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

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

.grid--overview > .card:nth-child(1) {
  grid-column: span 6;
}

.grid--overview > .card:nth-child(2) {
  grid-column: span 6;
}

.grid--overview > .card:nth-child(3),
.grid--overview > .card:nth-child(4),
.grid--overview > .card:nth-child(5),
.grid--overview > .card:nth-child(6) {
  grid-column: span 6;
}

.grid--profile > .card:nth-child(1),
.grid--profile > .card:nth-child(4) {
  grid-column: span 12;
}

.grid--profile > .card:nth-child(2),
.grid--profile > .card:nth-child(3) {
  grid-column: span 6;
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.mini-link {
  font-weight: 700;
  color: var(--blue-700);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--blue-50);
  color: var(--blue-700);
  font-weight: 700;
  font-size: 0.88rem;
}

.status-chip--green {
  background: var(--green-100);
  color: var(--green-600);
}

.progress-panel {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 22px;
  margin-top: 18px;
  align-items: center;
}

.progress-panel__ring {
  --progress: 0deg;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, white 56%, transparent 57%),
    conic-gradient(var(--blue-500) 0deg, var(--blue-700) var(--progress), rgba(214, 223, 235, 0.95) var(--progress), rgba(214, 223, 235, 0.95) 360deg);
}

.progress-panel__inner {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: white;
  border: 1px solid var(--line);
}

.progress-panel__inner strong {
  font-size: 1.7rem;
}

.progress-panel__inner span {
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.progress-metrics,
.summary-list,
.stack,
.opportunity-preview,
.badge-row,
.rank-preview,
.opportunity-grid,
.leader-table,
.history-list,
.info-stack {
  display: grid;
  gap: 12px;
}

.metric-box,
.list-row,
.badge-card,
.rank-row,
.leader-row,
.history-row,
.info-row {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.metric-box {
  padding: 16px;
}

.bar-line {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.bar-line__meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.bar-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(214, 223, 235, 0.95);
}

.bar-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue-500), var(--blue-700));
  transition: width 900ms cubic-bezier(0.19, 1, 0.22, 1);
}

.event-highlight {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  margin-top: 18px;
  align-items: start;
}

.event-icon {
  width: 110px;
  height: 110px;
  border-radius: 26px;
  background: linear-gradient(180deg, var(--blue-100), var(--panel));
  position: relative;
  overflow: hidden;
}

.event-icon::before,
.event-icon::after {
  content: "";
  position: absolute;
  border-radius: 999px;
}

.event-icon::before {
  left: 14px;
  right: 14px;
  bottom: 18px;
  height: 18px;
  background: linear-gradient(90deg, var(--blue-200), transparent);
}

.event-icon::after {
  width: 44px;
  height: 44px;
  right: 18px;
  top: 16px;
  background: var(--sand-200);
}

.plain-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--ink-soft);
}

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.search-box {
  display: grid;
  gap: 8px;
  width: min(360px, 100%);
}

.search-box span {
  font-weight: 700;
}

.search-box input,
.log-form input,
.log-form select,
.log-form textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #fff;
  padding: 12px 14px;
  color: var(--ink);
}

.toolbar-note {
  max-width: 28rem;
}

.toolbar-note span {
  display: block;
  color: var(--ink-soft);
  margin-top: 6px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.opportunity-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  transition:
    transform 170ms ease,
    box-shadow 170ms ease,
    background-color 170ms ease;
}

.opportunity-card:hover,
.leader-row:hover,
.badge-card:hover,
.rank-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(53, 85, 116, 0.08);
  background: #fff;
}

.opportunity-card__head,
.opportunity-card__meta,
.leader-row,
.history-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.opportunity-card__meta,
.history-row {
  flex-wrap: wrap;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.icon-token {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--blue-200), var(--sand-100));
}

.icon-token--events {
  background: linear-gradient(135deg, var(--sand-200), var(--amber-100));
}

.icon-token--welfare {
  background: linear-gradient(135deg, var(--green-100), var(--blue-50));
}

.icon-token--logistics {
  background: linear-gradient(135deg, var(--blue-100), var(--panel));
}

.opportunity-card__footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.opportunity-card__footer button {
  border: 0;
  border-radius: 14px;
  min-height: 40px;
  padding: 0 14px;
  background: linear-gradient(135deg, var(--blue-200), var(--sand-100));
  font-weight: 700;
  cursor: pointer;
}

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

.log-form label {
  display: grid;
  gap: 8px;
}

.log-form label span {
  font-weight: 700;
}

.log-form__full {
  grid-column: 1 / -1;
}

.leader-table {
  gap: 14px;
}

.leader-row {
  align-items: center;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.leader-row__rank {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--blue-200), var(--sand-100));
  font-weight: 800;
  color: var(--blue-700);
}

.leader-row__main {
  display: grid;
  gap: 6px;
  flex: 1;
}

.leader-row__stats {
  min-width: 230px;
  display: grid;
  gap: 8px;
}

.summary-list .metric-box strong {
  font-size: 1.25rem;
}

.profile-header {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 16px;
  align-items: center;
}

.profile-avatar {
  width: 92px;
  height: 92px;
  border-radius: 28px;
  font-size: 1.6rem;
}

.profile-header h2 {
  margin: 0;
}

.profile-header p {
  margin: 6px 0 8px;
  color: var(--blue-700);
  font-weight: 700;
}

.profile-stat-grid,
.badge-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

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

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

.badge-card {
  display: grid;
  gap: 12px;
}

.badge-glyph {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--blue-200), var(--sand-100));
  color: var(--blue-700);
  font-weight: 800;
}

.history-list {
  margin-top: 8px;
}

.history-row {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.mobile-nav {
  display: none;
}

@media (max-width: 1180px) {
  .portal-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .grid--opportunities,
  .grid--board,
  .grid--log {
    grid-template-columns: 1fr;
  }

  .profile-stat-grid,
  .opportunity-grid,
  .badge-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .portal-shell {
    width: min(100% - 20px, 100%);
    grid-template-columns: 1fr;
  }

  .portal-sidebar,
  .portal-main {
    min-height: auto;
  }

  .grid--overview,
  .grid--profile {
    grid-template-columns: 1fr;
  }

  .grid--overview > .card,
  .grid--profile > .card {
    grid-column: auto;
  }

  .page-topbar,
  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-topbar__actions {
    justify-content: flex-start;
  }

  .progress-panel {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .portal-sidebar {
    display: none;
  }

  .portal-main {
    padding: 18px 18px 86px;
  }

  .opportunity-grid,
  .profile-stat-grid,
  .badge-grid {
    grid-template-columns: 1fr;
  }

  .event-highlight,
  .profile-header,
  .leader-row,
  .list-row,
  .history-row {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .log-form {
    grid-template-columns: 1fr;
  }

  .mobile-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
  }

  .mobile-nav a {
    justify-content: center;
    min-height: 44px;
    padding: 0 8px;
    font-size: 0.78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .portal-nav a,
  .mobile-nav a,
  .action-button,
  .ghost-button,
  .filter-chip,
  .bar-fill,
  .opportunity-card,
  .leader-row,
  .badge-card,
  .rank-row {
    transition: none;
  }
}
