/* =========================================================
   AP PCC — portal (student / coach / admin) + auth pages
   ========================================================= */
:root {
  --ink: #17130f;
  --ink-2: #241e19;
  --ink-3: #3a322b;
  --muted: #776c62;
  --bg: #f7f3ed;
  --paper: #ffffff;
  --sand: #f3ebe0;
  --line: #e9e0d4;
  --line-2: #f1ebe2;
  --red: #e2421f;
  --red-600: #c8361a;
  --red-50: #fdefe9;
  --blue: #2f5fd0;
  --blue-50: #ebf1fd;
  --green: #23835a;
  --green-50: #e7f5ee;
  --amber: #b7791f;
  --amber-50: #fcf3e2;
  --gray-50: #f2efeb;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(23, 19, 15, 0.05), 0 1px 6px rgba(23, 19, 15, 0.03);
  --shadow: 0 16px 40px -20px rgba(23, 19, 15, 0.3);
  --display: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --side: 264px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  font: 400 0.95rem/1.55 var(--body);
  color: var(--ink-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: var(--red-600);
}
h1,
h2,
h3 {
  color: var(--ink);
  margin: 0;
  line-height: 1.2;
}
p {
  margin: 0 0 0.75em;
}
code,
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}
.ic {
  flex: none;
}
.img-missing {
  opacity: 0 !important;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.86rem;
}
.text-red {
  color: var(--red-600) !important;
}
.text-amber {
  color: var(--amber) !important;
}
.pre {
  white-space: pre-wrap;
}
.mt {
  margin-top: 1.25rem;
}
:focus-visible {
  outline: 3px solid rgba(226, 66, 31, 0.55);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- buttons ---------- */
.btn {
  --b: var(--ink);
  --f: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 1.05rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--b);
  color: var(--f);
  font: 600 0.9rem/1.2 var(--body);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  white-space: nowrap;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  --b: var(--red);
  box-shadow: 0 6px 16px -8px rgba(226, 66, 31, 0.7);
}
.btn-primary:hover {
  --b: var(--red-600);
}
.btn-dark:hover {
  --b: #000;
}
.btn-outline {
  --b: var(--paper);
  --f: var(--ink);
  border-color: var(--line);
}
.btn-outline:hover {
  border-color: var(--ink-3);
}
.btn-ghost {
  --b: transparent;
  --f: var(--ink-3);
}
.btn-ghost:hover {
  --b: var(--sand);
}
.btn-danger-ghost {
  --b: transparent;
  --f: var(--red-600);
}
.btn-danger-ghost:hover {
  --b: var(--red-50);
}
.btn-sm {
  padding: 0.45rem 0.75rem;
  font-size: 0.84rem;
  border-radius: 8px;
}
.btn-lg {
  padding: 0.85rem 1.25rem;
  font-size: 0.98rem;
}
.btn-block {
  width: 100%;
}
.btn-stack {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:hover {
  background: var(--sand);
  color: var(--ink);
}
.icon-btn-sm {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.link-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
}
.inline-form {
  display: inline;
}

/* ---------- layout ---------- */
.app {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--side);
  background: var(--ink);
  color: #c9beb2;
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform 0.25s var(--ease);
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1.2rem 1.25rem 1.1rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.side-brand img {
  border-radius: 50%;
}
.side-brand strong {
  display: block;
  font: 600 1.08rem/1.15 var(--display);
  color: #fff;
}
.side-brand small {
  color: #a3968a;
  font-size: 0.76rem;
}
.side-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-nav a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  text-decoration: none;
  color: #cfc4b8;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.side-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.side-nav a.is-active {
  background: rgba(226, 66, 31, 0.16);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--red);
}
.side-nav a.is-active .ic {
  color: #ff8a6b;
}
.side-section {
  margin: 1.1rem 0 0.35rem 0.8rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7f7368;
}
.side-badge {
  margin-left: auto;
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--red);
  color: #fff;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
}
.side-foot {
  padding: 0.9rem 1rem 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.side-site {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #a3968a;
  text-decoration: none;
  font-size: 0.86rem;
}
.side-site:hover {
  color: #fff;
}
.sidebar-scrim {
  display: none;
}

.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--side);
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 64px;
  padding: 0 1.75rem;
  background: rgba(247, 243, 237, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-spacer {
  flex: 1;
}
.menu-btn {
  display: none;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.user-meta strong {
  font-size: 0.9rem;
  color: var(--ink);
}
.user-meta small {
  font-size: 0.75rem;
  color: var(--muted);
}
.avatar {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2b231d, #4a3a2e);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  flex: none;
}
.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 0.7rem;
}
.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 0.95rem;
  background: linear-gradient(135deg, var(--red), #f07a45);
}

.content {
  padding: 1.75rem 1.75rem 3rem;
  max-width: 1320px;
  width: 100%;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.page-head h1 {
  font: 600 clamp(1.6rem, 2.4vw, 2.05rem) / 1.15 var(--display);
  letter-spacing: -0.015em;
}
.page-sub {
  color: var(--muted);
  margin: 0.35rem 0 0;
  max-width: 70ch;
}
.page-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ---------- alerts ---------- */
.alert {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-weight: 500;
  animation: slideIn 0.35s var(--ease);
}
.alert-ok {
  background: var(--green-50);
  color: #17603f;
}
.alert-err {
  background: var(--red-50);
  color: var(--red-600);
}
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}
.info-box {
  display: flex;
  gap: 0.75rem;
  background: var(--sand);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin: 1.25rem 0;
}
.info-box .ic {
  color: var(--red);
  margin-top: 2px;
}
.info-box p {
  margin: 0;
}

/* ---------- cards & grids ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card + .card {
  margin-top: 1.25rem;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line-2);
}
.card-head h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font: 600 1rem/1.3 var(--body);
}
.card-body {
  padding: 1.25rem;
}
.card-highlight {
  border-color: #f4c2b2;
  box-shadow: 0 0 0 3px rgba(226, 66, 31, 0.07);
}
details.card > summary {
  cursor: pointer;
  list-style: none;
}
details.card > summary::-webkit-details-marker {
  display: none;
}
details.card:not([open]) > summary {
  border-bottom: 0;
}
.add-panel {
  margin-bottom: 1.25rem;
}
.add-panel h2 {
  color: var(--red-600);
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
.grid-2 > .card + .card,
.grid-main-side > .card + .card,
.dash-grid .card + .card {
  margin-top: 0;
}
.grid-main-side {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.side-stack {
  display: grid;
  gap: 1.25rem;
  min-width: 0;
}
.side-stack > .card + .card {
  margin-top: 0;
}
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.dash-main,
.dash-side {
  display: grid;
  gap: 1.25rem;
  min-width: 0;
}

/* ---------- stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
a.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--sand);
  color: var(--ink-3);
}
.tone-red {
  background: var(--red-50);
  color: var(--red);
}
.tone-blue {
  background: var(--blue-50);
  color: var(--blue);
}
.tone-green {
  background: var(--green-50);
  color: var(--green);
}
.tone-amber {
  background: var(--amber-50);
  color: var(--amber);
}
.stat-text strong {
  display: block;
  font: 600 1.7rem/1.05 var(--display);
  color: var(--ink);
}
.stat-text small {
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---------- badges / tags ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-green {
  background: var(--green-50);
  color: #17603f;
}
.badge-red {
  background: var(--red-50);
  color: var(--red-600);
}
.badge-blue {
  background: var(--blue-50);
  color: #23479f;
}
.badge-amber {
  background: var(--amber-50);
  color: #8c5b12;
}
.badge-gray {
  background: var(--gray-50);
  color: #6a6058;
}
.badge-ink {
  background: var(--ink);
  color: #fff;
}
.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  background: var(--sand);
  color: var(--ink-3);
}

/* ---------- tabs / toolbar ---------- */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 0.95rem;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabs a:hover {
  color: var(--ink);
}
.tabs a.is-active {
  color: var(--ink);
  border-bottom-color: var(--red);
}
.tabs em {
  font-style: normal;
  font-size: 0.74rem;
  background: var(--sand);
  color: var(--ink-3);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}
.toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 0.85rem;
  flex: 1;
  max-width: 420px;
  color: var(--muted);
}
.search input {
  border: 0;
  outline: 0;
  padding: 0.7rem 0;
  font: inherit;
  width: 100%;
  background: transparent;
  color: var(--ink);
}
.search:focus-within {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(226, 66, 31, 0.12);
}

/* ---------- forms ---------- */
.form {
  display: grid;
  gap: 1rem;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-row-3 {
  grid-template-columns: repeat(3, 1fr);
}
.field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}
.field-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink);
}
.field-hint {
  display: block;
  font-size: 0.79rem;
  color: var(--muted);
  font-weight: 400;
}
input,
select,
textarea {
  width: 100%;
  font: 400 0.95rem/1.45 var(--body);
  color: var(--ink);
  background: #fdfbf8;
  border: 1px solid #ddd2c4;
  border-radius: 10px;
  padding: 0.62rem 0.8rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--red);
  padding: 0;
  margin: 2px 0 0;
  flex: none;
}
input:disabled {
  background: var(--gray-50);
  color: var(--muted);
}
textarea {
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--red);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(226, 66, 31, 0.12);
}
.mono-area {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
}
.check {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-weight: 500;
  cursor: pointer;
}
.form-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}
.sticky-actions {
  position: sticky;
  bottom: 0;
  padding: 1rem 0;
  background: linear-gradient(transparent, var(--bg) 35%);
  margin-top: 0.5rem;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem 1rem 1.1rem;
  margin: 0;
  display: grid;
  gap: 1rem;
}
legend {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0.4rem;
}
.input-group {
  display: flex;
  gap: 0.5rem;
}
.pw-wrap {
  position: relative;
}
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}

/* ---------- tables ---------- */
.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.table th {
  text-align: left;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.8rem 1rem;
  background: #fbf8f4;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line-2);
  vertical-align: top;
}
.table tr:last-child td {
  border-bottom: 0;
}
.table a {
  color: var(--ink);
  text-decoration: none;
}
.table-click tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}
.table-click tbody tr:hover {
  background: #fcfaf6;
}
.cell-sub {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2px;
}
.cell-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.cell-actions {
  text-align: right;
  white-space: nowrap;
}
.row-edit {
  display: inline-block;
  text-align: left;
}
.row-edit > summary {
  list-style: none;
}
.row-edit > summary::-webkit-details-marker {
  display: none;
}
.row-edit[open] > summary {
  background: var(--sand);
}
.row-edit-panel {
  margin-top: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: #fbf8f4;
  border: 1px solid var(--line);
  min-width: min(620px, 80vw);
  white-space: normal;
  display: grid;
  gap: 0.75rem;
}
td .row-edit[open] {
  display: block;
}
.inline-edit {
  margin-top: 0.5rem;
}
.inline-edit .row-edit-panel {
  min-width: 0;
}

/* ---------- empty ---------- */
.empty {
  text-align: center;
  padding: 2.25rem 1rem;
  color: var(--muted);
}
.empty-icon {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--sand);
  color: var(--ink-3);
  margin-bottom: 0.75rem;
}
.empty h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}
.empty p {
  max-width: 40ch;
  margin: 0 auto 0.9rem;
}

/* ---------- progress ---------- */
.progress-stack {
  display: grid;
  gap: 1.1rem;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  color: var(--ink-3);
}
.progress {
  height: 9px;
  background: var(--sand);
  border-radius: 999px;
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), #f2864f);
  transition: width 0.6s var(--ease);
}
.mini-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  font-size: 0.86rem;
  color: var(--muted);
}
.mini-stats strong {
  color: var(--ink);
  font-size: 1.05rem;
}

/* ---------- tasks ---------- */
.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.task {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line-2);
}
.task:first-child {
  padding-top: 0;
}
.task:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.task-check {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 2px solid #cfc3b5;
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  margin-top: 1px;
  transition: all 0.15s;
  padding: 0;
}
.task-check:hover {
  border-color: var(--green);
}
.task.is-done .task-check {
  background: var(--green);
  border-color: var(--green);
}
.task-main {
  flex: 1;
  min-width: 0;
}
.task-title {
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}
.task.is-done .task-title {
  text-decoration: line-through;
  color: var(--muted);
}
.task-details {
  color: var(--muted);
  font-size: 0.87rem;
  margin: 0.2rem 0 0;
}
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.8rem;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.4rem 0 0;
}
.task-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* ---------- meetings ---------- */
.meeting-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
}
.meeting {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line-2);
}
.meeting:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.date-tile {
  width: 52px;
  flex: none;
  text-align: center;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}
.date-tile span {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--red);
  color: #fff;
  padding: 0.2rem 0;
}
.date-tile strong {
  display: block;
  font: 600 1.35rem/1.6 var(--display);
  color: var(--ink);
}
.meeting-cancelled .date-tile span {
  background: #9c928a;
}
.meeting-completed .date-tile span {
  background: var(--green);
}
.meeting-requested .date-tile span {
  background: var(--amber);
}
.meeting-main {
  flex: 1;
  min-width: 0;
}
.meeting-title {
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.meeting-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.3rem 0 0;
}
.meeting-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.meeting-note {
  font-size: 0.86rem;
  margin: 0.5rem 0 0;
  background: #fbf8f4;
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  white-space: pre-wrap;
}
.meeting-summary {
  background: var(--green-50);
}
.compact .meeting-note {
  display: none;
}

/* ---------- essays ---------- */
.essay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.essay-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.15rem 1.2rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s;
}
.essay-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: transparent;
}
.essay-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
}
.essay-card h3 {
  font: 600 1.1rem/1.3 var(--display);
}
.essay-student {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.84rem;
  color: var(--ink-3);
  margin: 0;
}
.essay-prompt {
  font-size: 0.85rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}
.essay-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  padding-top: 0.5rem;
}
.mini-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--sand);
  overflow: hidden;
}
.mini-bar span {
  display: block;
  height: 100%;
  background: var(--green);
}
.mini-bar span.over {
  background: var(--red);
}
.essay-text {
  font: 400 1.02rem/1.75 var(--display);
  min-height: 420px;
}
.wordcount {
  text-align: right;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.5rem 0 0;
}
.wordcount.over {
  color: var(--red-600);
  font-weight: 600;
}
.essay-editor .card-body {
  display: grid;
  gap: 1rem;
}
.feedback {
  border-radius: var(--radius);
  background: #fff8ec;
  border: 1px solid #f1dfbd;
  overflow: hidden;
}
.feedback-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1dfbd;
  color: #7a5415;
}
.feedback-head small {
  margin-left: auto;
  color: #a17a3a;
}
.feedback-body {
  padding: 1rem;
  white-space: pre-wrap;
  font-size: 0.93rem;
}
.prompt-box {
  background: var(--sand);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.prompt-box p {
  margin: 0.25rem 0 0;
}
.essay-read {
  white-space: pre-wrap;
  font: 400 1.05rem/1.85 var(--display);
  color: var(--ink);
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}
.danger-zone {
  margin-top: 1.25rem;
  display: flex;
  justify-content: flex-end;
}

/* ---------- messages ---------- */
.card-thread {
  overflow: hidden;
}
.thread-wrap {
  display: flex;
  flex-direction: column;
  height: min(70vh, 720px);
}
.thread {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  background: radial-gradient(circle at 1px 1px, rgba(23, 19, 15, 0.05) 1px, transparent 0) 0 0 / 22px 22px, #fcfaf7;
}
.bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: 78%;
}
.bubble-row.mine {
  margin-left: auto;
  flex-direction: row-reverse;
}
.bubble {
  background: #fff;
  border: 1px solid var(--line);
  padding: 0.65rem 0.9rem;
  border-radius: 16px 16px 16px 4px;
  box-shadow: var(--shadow-sm);
}
.bubble p {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.bubble small {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.3rem;
}
.mine .bubble {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
}
.mine .bubble small {
  color: #b8ab9d;
}
.composer {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  padding: 0.85rem;
  border-top: 1px solid var(--line);
  background: #fff;
}
.composer textarea {
  resize: none;
  min-height: 44px;
  max-height: 160px;
}
.convo-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.convo-list a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1.25rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--line-2);
}
.convo-list li:last-child a {
  border-bottom: 0;
}
.convo-list a:hover {
  background: #fcfaf6;
}
.convo-list a > div {
  flex: 1;
  min-width: 0;
}
.convo-list strong {
  color: var(--ink);
}
.convo-list p {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.convo-list .is-unread p {
  color: var(--ink);
  font-weight: 600;
}
.convo-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  font-size: 0.76rem;
  color: var(--muted);
}

/* ---------- students ---------- */
.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.student-card {
  display: grid;
  gap: 0.85rem;
  padding: 1.2rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.student-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.student-card-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.student-card-top strong {
  display: block;
  color: var(--ink);
  font-size: 1.02rem;
}
.student-card-top small {
  color: var(--muted);
}
.student-card-top .badge {
  margin-left: auto;
}
.student-card-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.student-card-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--line-2);
  padding-top: 0.75rem;
}
.student-card-stats span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* ---------- misc lists ---------- */
.dl {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 0.6rem 1rem;
  margin: 0;
}
.dl dt {
  color: var(--muted);
  font-size: 0.85rem;
}
.dl dd {
  margin: 0;
  color: var(--ink);
  min-width: 0;
  overflow-wrap: anywhere;
}
.coach-card {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}
.coach-card strong {
  display: block;
  color: var(--ink);
}
.coach-card small {
  color: var(--muted);
}
.coach-card p {
  font-size: 0.87rem;
  color: var(--ink-3);
  margin: 0.5rem 0 0.75rem;
}
.coach-card .btn {
  margin-top: 0.6rem;
}
.plan-line {
  margin: 1rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line-2);
  font-size: 0.87rem;
  color: var(--muted);
}
.announce-list,
.people-list,
.resource-list,
.kv-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
}
.announce-list li {
  display: flex;
  gap: 0.7rem;
}
.announce-list .ic {
  color: var(--red);
  margin-top: 3px;
}
.announce-list p {
  margin: 0.15rem 0;
  font-size: 0.87rem;
  color: var(--ink-3);
}
.announce-list small {
  color: var(--muted);
  font-size: 0.76rem;
}
.people-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.people-list li > div {
  flex: 1;
  min-width: 0;
}
.people-list strong {
  display: block;
  color: var(--ink);
}
.people-list small {
  color: var(--muted);
}
.resource-list li {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
}
.resource-list li > div {
  flex: 1;
  min-width: 0;
}
.resource-list a {
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.resource-list p {
  margin: 0.15rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}
.resource-list small {
  font-size: 0.76rem;
  color: var(--muted);
}
.resource-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--red-50);
  color: var(--red);
  flex: none;
}
.kv-list {
  gap: 0;
  margin-bottom: 1rem;
}
.kv-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 0.9rem;
}
.kv-list strong {
  color: var(--ink);
}
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.quick-grid a {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.86rem;
  transition: border-color 0.15s, background 0.15s;
}
.quick-grid a .ic {
  color: var(--red);
}
.quick-grid a:hover {
  border-color: var(--red);
  background: var(--red-50);
}
.cred-box {
  display: grid;
  gap: 0.75rem;
  background: var(--sand);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.cred-box p {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
  flex-wrap: wrap;
}
.cred-box span {
  width: 160px;
  color: var(--muted);
  font-size: 0.86rem;
}
.cred-box strong {
  color: var(--ink);
  font-size: 1.05rem;
}

/* ---------- auth pages ---------- */
.auth {
  background: var(--paper);
}
.auth-grid {
  display: grid;
  grid-template-columns: minmax(380px, 1fr) 1.1fr;
  min-height: 100vh;
}
.auth-panel {
  display: flex;
  flex-direction: column;
  padding: 2rem clamp(1.5rem, 5vw, 4.5rem);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
}
.auth-brand img {
  border-radius: 50%;
}
.auth-brand strong {
  display: block;
  font: 600 1.15rem/1.1 var(--display);
  color: var(--ink);
}
.auth-brand small {
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  margin: auto 0;
  padding: 3rem 0;
}
.auth-card h1 {
  font: 600 2.2rem/1.1 var(--display);
  letter-spacing: -0.02em;
  margin: 0.5rem 0 0.5rem;
}
.auth-sub {
  color: var(--muted);
  margin-bottom: 1.75rem;
}
.auth-card .pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--red-50);
  color: var(--red-600);
}
.auth-card input {
  padding: 0.8rem 0.95rem;
  font-size: 1rem;
}
.auth-links {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
  font-size: 0.9rem;
}
.auth-links a {
  text-decoration: none;
  font-weight: 500;
}
.auth-foot a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.auth-visual {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(80% 60% at 90% 10%, rgba(226, 66, 31, 0.55), transparent 60%),
    radial-gradient(70% 60% at 0% 100%, rgba(201, 150, 47, 0.35), transparent 60%),
    var(--ink);
}
.auth-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.auth-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(23, 19, 15, 0.85));
}
.auth-visual-copy {
  position: absolute;
  z-index: 2;
  left: clamp(2rem, 5vw, 4rem);
  right: clamp(2rem, 5vw, 4rem);
  bottom: clamp(2rem, 6vw, 4rem);
  color: #fff;
}
.auth-quote {
  font: 500 clamp(1.5rem, 2.4vw, 2.2rem) / 1.3 var(--display);
  margin-bottom: 0.75rem;
}
.auth-visual-copy span {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 1080px) {
  .grid-main-side,
  .dash-grid,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.3);
  }
  .sidebar.is-open {
    transform: none;
  }
  .sidebar-scrim.is-open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(23, 19, 15, 0.45);
    z-index: 35;
  }
  .main {
    margin-left: 0;
  }
  .menu-btn {
    display: inline-grid;
  }
  .topbar,
  .content {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .auth-grid {
    grid-template-columns: 1fr;
  }
  .auth-visual {
    display: none;
  }
}
@media (max-width: 640px) {
  .stats {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }
  .stat {
    padding: 0.85rem;
    gap: 0.6rem;
  }
  .stat-icon {
    width: 38px;
    height: 38px;
  }
  .stat-text strong {
    font-size: 1.35rem;
  }
  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr;
  }
  .user-meta {
    display: none;
  }
  .dl {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
  .dl dd {
    margin-bottom: 0.6rem;
  }
  .bubble-row {
    max-width: 92%;
  }
  .cred-box span {
    width: 100%;
  }
}

/* =========================================================
   Avatars, uploads, files, media
   ========================================================= */
.avatar-img {
  object-fit: cover;
  background: var(--sand);
  padding: 0;
}
.avatar-xl {
  width: 96px;
  height: 96px;
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--red), #f07a45);
  box-shadow: 0 10px 24px -10px rgba(226, 66, 31, 0.55);
}
img.avatar-xl {
  border: 3px solid #fff;
}
.mb {
  margin-bottom: 1.25rem;
}
.avatar-upload {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.avatar-preview {
  position: relative;
}
.avatar-preview img,
.avatar-preview canvas {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
}
.avatar-upload-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}
.avatar-upload-body .field-hint {
  flex-basis: 100%;
}
.avatar-form {
  display: flex;
  gap: 0.6rem;
}
.avatar-form label {
  cursor: pointer;
}

.dropzone {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  text-align: center;
  padding: 1.6rem 1rem;
  border: 2px dashed #d9ccbc;
  border-radius: var(--radius);
  background: #fdfaf6;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease);
}
.dropzone:hover,
.dropzone.is-over {
  border-color: var(--red);
  background: var(--red-50);
}
.dropzone.is-over {
  transform: scale(1.015);
}
.dropzone input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}
.dropzone strong {
  color: var(--ink);
}
.dropzone small {
  color: var(--muted);
  font-size: 0.8rem;
}
.dropzone-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff;
  color: var(--red);
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.3rem;
  transition: transform 0.3s var(--ease);
}
.dropzone:hover .dropzone-icon,
.dropzone.is-over .dropzone-icon {
  transform: translateY(-4px);
  animation: bob 1s ease-in-out infinite;
}
@keyframes bob {
  50% { transform: translateY(-8px); }
}
.dropzone-sm {
  padding: 1rem;
}
.dropzone-sm .dropzone-icon {
  width: 40px;
  height: 40px;
}
.dropzone-list {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
  width: 100%;
  position: relative;
  z-index: 1;
  pointer-events: none;
}
.dropzone-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  animation: slideIn 0.3s var(--ease);
}
.dropzone-list li span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 500;
}
.dropzone-list li.bad {
  border-color: #f4c2b2;
  color: var(--red-600);
}
.btn.is-loading {
  pointer-events: none;
  opacity: 0.8;
}
.btn.is-loading .ic {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line-2);
}
.file-row:first-child {
  padding-top: 0;
}
.file-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.file-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  flex: none;
  background: var(--sand);
  color: var(--ink-3);
}
.file-pdf { background: #fde9e5; color: #c8361a; }
.file-doc { background: var(--blue-50); color: var(--blue); }
.file-sheet { background: var(--green-50); color: var(--green); }
.file-slides { background: var(--amber-50); color: var(--amber); }
.file-image { background: #f2ebfb; color: #7c4dbd; }
.file-main {
  flex: 1;
  min-width: 0;
}
.file-name {
  display: block;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-name:hover {
  color: var(--red-600);
}
.file-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.7rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.2rem 0 0;
}
.file-note {
  font-size: 0.82rem;
  color: var(--ink-3);
  margin: 0.25rem 0 0;
}
.grid-tight {
  gap: 1.25rem;
}
.card-divider {
  height: 1px;
  background: var(--line-2);
  margin: 1.25rem -1.25rem;
}
.mini-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  margin-bottom: 0.75rem;
}
.upload-form {
  margin-top: 0.9rem;
}
.inline-filter select {
  padding: 0.4rem 0.6rem;
  font-size: 0.84rem;
}
.storage-line {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 0;
}
.storage-line .ic {
  color: var(--green);
  margin-top: 2px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.media-item {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.2s, transform 0.2s var(--ease);
}
.media-item:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.media-thumb {
  display: block;
  aspect-ratio: 4 / 3;
  background: repeating-conic-gradient(#f3ede4 0 25%, #fff 0 50%) 0 0 / 16px 16px;
}
.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-item figcaption {
  padding: 0.7rem;
  display: grid;
  gap: 0.25rem;
}
.media-item strong {
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.media-item small {
  color: var(--muted);
  font-size: 0.75rem;
}
.media-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.3rem;
}
.media-url {
  flex: 1;
  min-width: 0;
  font-size: 0.72rem !important;
  padding: 0.35rem 0.45rem !important;
}

/* =========================================================
   Portal motion
   ========================================================= */
.content > * {
  animation: fadeUp 0.55s var(--ease) both;
}
.content > :nth-child(2) { animation-delay: 0.05s; }
.content > :nth-child(3) { animation-delay: 0.1s; }
.content > :nth-child(4) { animation-delay: 0.15s; }
.content > :nth-child(5) { animation-delay: 0.2s; }
.stats .stat {
  animation: fadeUp 0.55s var(--ease) both;
}
.stats .stat:nth-child(2) { animation-delay: 0.06s; }
.stats .stat:nth-child(3) { animation-delay: 0.12s; }
.stats .stat:nth-child(4) { animation-delay: 0.18s; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
}
.progress span {
  animation: grow 1.2s 0.3s var(--ease) both;
}
@keyframes grow {
  from { width: 0; }
}
.stat-icon {
  transition: transform 0.3s var(--ease);
}
a.stat:hover .stat-icon {
  transform: rotate(-8deg) scale(1.1);
}
.task-check {
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s;
}
.task-check:active {
  transform: scale(0.85);
}
.task.is-done .task-check .ic {
  animation: popIn 0.4s var(--ease);
}
@keyframes popIn {
  from { transform: scale(0); }
}
.side-nav a .ic {
  transition: transform 0.25s var(--ease);
}
.side-nav a:hover .ic {
  transform: translateX(2px) scale(1.08);
}
.bubble-row {
  animation: fadeUp 0.35s var(--ease) both;
}
.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* =========================================================
   POLISH v2 — Outfit type, smoother motion, richer icons
   ========================================================= */
html {
  scroll-behavior: smooth;
}
h1,
h2,
h3,
h4 {
  letter-spacing: -0.02em;
}
.btn,
.icon-btn,
.side-nav a,
.card,
.stat {
  transition-timing-function: var(--ease);
}
.stat-icon,
.resource-icon,
.empty-icon,
.dropzone-icon {
  box-shadow: inset 0 0 0 1px rgba(23, 19, 15, 0.05), 0 8px 18px -12px rgba(23, 19, 15, 0.35);
}
.stat-icon .ic,
.resource-icon .ic,
.empty-icon .ic,
.dropzone-icon .ic {
  stroke-width: 1.6;
}
.stat-icon .ic > :is(path, rect, circle),
.resource-icon .ic > :is(path, rect, circle),
.empty-icon .ic > :is(path, rect, circle),
.dropzone-icon .ic > :is(path, rect, circle) {
  fill: currentColor;
  fill-opacity: 0.12;
}
.content > * {
  animation-duration: 0.9s;
  animation-timing-function: var(--ease);
}

/* =========================================================
   AUTH v2 — login / forgot / register / setup
   ========================================================= */
.auth {
  background: var(--paper);
}
.auth-grid {
  grid-template-columns: minmax(420px, 1fr) 1.05fr;
}
.auth-panel {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(rgba(23, 19, 15, 0.08) 1px, transparent 1.3px) 0 0 / 24px 24px,
    linear-gradient(180deg, #fdfaf5 0%, #f8f1e7 100%);
}
.auth-blob {
  position: absolute;
  z-index: -1;
  width: 520px;
  height: 520px;
  top: -220px;
  left: -180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 170, 145, 0.55), transparent 68%);
  filter: blur(40px);
  animation: authBlob 18s cubic-bezier(0.65, 0, 0.35, 1) infinite alternate;
}
@keyframes authBlob {
  to {
    transform: translate3d(90px, 120px, 0) scale(1.15);
  }
}
.auth-card {
  align-self: center;
  max-width: 460px;
  margin: auto;
  padding: clamp(1.75rem, 4vw, 2.6rem);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(23, 19, 15, 0.06);
  box-shadow: 0 1px 0 #fff inset, 0 40px 80px -40px rgba(23, 19, 15, 0.35), 0 12px 24px -18px rgba(23, 19, 15, 0.2);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: authIn 1s var(--ease) both;
}
@keyframes authIn {
  from {
    opacity: 0;
    transform: translate3d(0, 24px, 0) scale(0.98);
  }
}
.auth-card h1 {
  font: 650 clamp(1.9rem, 3vw, 2.4rem) / 1.08 var(--display);
  letter-spacing: -0.03em;
  margin: 1rem 0 0.5rem;
}
.auth-sub {
  font-size: 0.98rem;
  line-height: 1.55;
}
.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--red-50);
  color: var(--red);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.auth-form {
  gap: 1.05rem;
}
.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.field-label-row a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--red);
  text-decoration: none;
}
.field-label-row a:hover {
  text-decoration: underline;
}
.input-ic {
  position: relative;
}
.input-ic > .ic {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  transition: color 0.3s;
}
.input-ic:focus-within > .ic {
  color: var(--red);
}
.auth-card .input-ic input {
  padding: 0.9rem 1rem 0.9rem 2.85rem;
  border-radius: 14px;
  background: #fbf8f4;
  transition: border-color 0.3s, box-shadow 0.3s, background-color 0.3s;
}
.auth-card .input-ic input:focus {
  background: #fff;
}
.auth-card .pw-wrap input {
  padding-right: 3rem;
}
.pw-toggle {
  right: 8px;
  transition: color 0.3s, background-color 0.3s;
}
.pw-toggle:hover {
  color: var(--ink);
  background: var(--sand);
}
.auth-card .btn-lg {
  padding-block: 0.95rem;
  border-radius: 14px;
  margin-top: 0.35rem;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 1.6rem 0 1.1rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.auth-alt {
  display: grid;
  gap: 0.8rem;
  text-align: center;
}
.auth-alt .btn {
  border-radius: 14px;
}
.auth-register {
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
}
.auth-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 1.4rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.auth-secure .ic {
  color: var(--green);
}
.auth-foot {
  margin: 0;
}
.auth-foot a {
  padding: 0.45rem 0.8rem 0.45rem 0.6rem;
  border-radius: 999px;
  transition: background-color 0.3s, color 0.3s;
}
.auth-foot a:hover {
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
}

/* right-hand visual */
.auth-visual {
  margin: 14px 14px 14px 0;
  border-radius: 28px;
}
.auth-visual img {
  animation: authZoom 22s ease-out both;
}
@keyframes authZoom {
  from {
    transform: scale(1.08);
  }
}
.auth-visual::after {
  background:
    linear-gradient(180deg, rgba(23, 19, 15, 0.05) 30%, rgba(23, 19, 15, 0.88) 100%),
    radial-gradient(60% 50% at 100% 0%, rgba(226, 66, 31, 0.28), transparent 70%);
}
.auth-glass {
  max-width: 420px;
  margin-bottom: 1.8rem;
  padding: 1.2rem 1.3rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
  animation: authIn 1s 0.3s var(--ease) both;
}
.auth-glass-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffd2c4;
}
.auth-features {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.auth-features li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.97rem;
  color: #fff;
  animation: authFeat 0.8s var(--ease) both;
}
.auth-features li:nth-child(1) { animation-delay: 0.55s; }
.auth-features li:nth-child(2) { animation-delay: 0.68s; }
.auth-features li:nth-child(3) { animation-delay: 0.81s; }
.auth-features li:nth-child(4) { animation-delay: 0.94s; }
.auth-features li > span {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
@keyframes authFeat {
  from {
    opacity: 0;
    transform: translate3d(14px, 0, 0);
  }
}
.auth-quote {
  font: 500 clamp(1.15rem, 1.7vw, 1.45rem) / 1.4 var(--display);
  max-width: 34ch;
  margin-bottom: 0.6rem;
  opacity: 0.95;
}
.auth-quote-by {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.75;
}
@media (max-width: 900px) {
  .auth-grid {
    grid-template-columns: 1fr;
  }
  .auth-panel {
    min-height: 100vh;
    padding: 1.25rem;
  }
  .auth-card {
    margin: 2rem auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  .auth-blob,
  .auth-visual img {
    animation: none;
  }
}
.auth-visual-copy .auth-features li > span {
  font-size: inherit;
  letter-spacing: 0;
  text-transform: none;
  opacity: 1;
}

/* =========================================================
   PORTAL v2 — sidebar, topbar, welcome banner, cards
   ========================================================= */
.app {
  background:
    radial-gradient(900px 500px at 100% -10%, rgba(226, 66, 31, 0.06), transparent 60%),
    var(--bg, #f7f3ed);
}

/* sidebar */
.sidebar {
  background:
    radial-gradient(420px 260px at 0% 0%, rgba(226, 66, 31, 0.22), transparent 70%),
    radial-gradient(360px 300px at 100% 100%, rgba(201, 150, 47, 0.12), transparent 70%),
    linear-gradient(180deg, #1e1915 0%, #14110e 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}
.side-brand {
  padding: 1.3rem 1.25rem 1.2rem;
}
.side-brand img {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08), 0 8px 18px -8px rgba(226, 66, 31, 0.7);
}
.side-nav {
  gap: 3px;
  padding-top: 1rem;
}
.side-nav a {
  position: relative;
  padding: 0.62rem 0.8rem;
  border-radius: 12px;
  transition: background-color 0.35s var(--ease), color 0.3s, transform 0.35s var(--ease);
}
.side-nav a:hover {
  background: rgba(255, 255, 255, 0.07);
  transform: translateX(3px);
}
.side-nav a.is-active {
  background: linear-gradient(100deg, var(--red) 0%, #ef6a3b 100%);
  color: #fff;
  box-shadow: 0 12px 24px -12px rgba(226, 66, 31, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.side-nav a.is-active .ic {
  color: #fff;
}
.side-nav a.is-active .side-badge {
  background: #fff;
  color: var(--red);
}
.side-section {
  margin: 1.3rem 0 0.4rem 0.85rem;
  color: #8a7d71;
}
.side-foot {
  display: grid;
  gap: 0.6rem;
  padding: 0.9rem 0.85rem 1.1rem;
}
.side-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.7rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.07);
  text-decoration: none;
  transition: background-color 0.3s;
}
.side-user:hover {
  background: rgba(255, 255, 255, 0.1);
}
.side-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.side-user strong {
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-user small {
  color: #a3968a;
  font-size: 0.74rem;
}
.side-user .avatar {
  background: linear-gradient(135deg, var(--red), #f07a45);
}
.side-site {
  padding: 0 0.35rem;
}

/* topbar */
.topbar {
  height: 66px;
  background: rgba(247, 243, 237, 0.72);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border-bottom-color: rgba(23, 19, 15, 0.06);
}
.topbar-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-3, #4a4038);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip {
  padding: 0.3rem 0.85rem 0.3rem 0.3rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.user-chip .avatar {
  width: 34px;
  height: 34px;
}

/* welcome banner */
.welcome {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.5rem;
  padding: clamp(1.5rem, 3vw, 2.2rem) clamp(1.5rem, 3vw, 2.4rem);
  border-radius: 26px;
  color: #f4ebe2;
  background:
    radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1.3px) 0 0 / 22px 22px,
    linear-gradient(120deg, #1f1915 0%, #2c211a 55%, #3a2116 100%);
  box-shadow: 0 30px 60px -36px rgba(23, 19, 15, 0.7);
  animation: welcomeIn 0.9s var(--ease) both;
}
.welcome-glow {
  position: absolute;
  z-index: -1;
  right: -120px;
  top: -160px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 106, 59, 0.55), transparent 65%);
  filter: blur(20px);
  animation: welcomeGlow 14s cubic-bezier(0.65, 0, 0.35, 1) infinite alternate;
}
@keyframes welcomeGlow {
  to {
    transform: translate3d(-80px, 60px, 0) scale(1.1);
  }
}
@keyframes welcomeIn {
  from {
    opacity: 0;
    transform: translate3d(0, 16px, 0) scale(0.99);
  }
}
.welcome-date {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.75rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  font-size: 0.8rem;
  color: #ffd2c4;
}
.welcome h1 {
  margin: 0;
  color: #fff;
  font: 650 clamp(1.8rem, 3vw, 2.5rem) / 1.1 var(--display);
  letter-spacing: -0.03em;
}
.welcome-sub {
  max-width: 62ch;
  margin: 0.55rem 0 0;
  color: #cbbfb3;
  font-size: 0.98rem;
}
.welcome-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.4rem;
}
.wl {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.35s var(--ease), transform 0.4s var(--ease), border-color 0.3s;
}
.wl:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}
.wl:first-child {
  background: linear-gradient(100deg, var(--red), #ef6a3b);
  border-color: transparent;
  box-shadow: 0 10px 22px -12px rgba(226, 66, 31, 0.9);
}
.welcome-aside {
  flex: none;
}

/* progress ring */
.ring-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.3rem 1rem 1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.ring {
  position: relative;
  width: 112px;
  height: 112px;
}
.ring svg {
  transform: rotate(-90deg);
}
.ring circle {
  fill: none;
  stroke-width: 9;
}
.ring-track {
  stroke: rgba(255, 255, 255, 0.1);
}
.ring-bar {
  stroke: #ef6a3b;
  stroke-linecap: round;
  stroke-dasharray: var(--ring-c);
  stroke-dashoffset: var(--ring-off);
  animation: ringFill 1.6s 0.3s var(--ease) both;
  filter: drop-shadow(0 0 6px rgba(239, 106, 59, 0.6));
}
@keyframes ringFill {
  from {
    stroke-dashoffset: var(--ring-c);
  }
}
.ring-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  grid-auto-flow: column;
  align-items: baseline;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
}
.ring-num strong {
  font-size: 1.9rem;
  font-weight: 650;
  letter-spacing: -0.03em;
}
.ring-label {
  display: flex;
  flex-direction: column;
  margin: 0;
  line-height: 1.3;
}
.ring-label strong {
  color: #fff;
  font-weight: 600;
}
.ring-label small {
  color: #bfb2a5;
  font-size: 0.82rem;
}

/* coach "today's focus" */
.welcome-todo {
  display: grid;
  gap: 0.45rem;
  min-width: 260px;
  padding: 1.1rem 1.2rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.welcome-todo-title {
  margin: 0 0 0.2rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffd2c4;
}
.welcome-todo a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.55rem;
  border-radius: 12px;
  color: #e9ded3;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background-color 0.3s;
}
.welcome-todo a:hover {
  background: rgba(255, 255, 255, 0.08);
}
.welcome-todo strong {
  min-width: 34px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 650;
}

/* stats */
.stat {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  border-color: rgba(23, 19, 15, 0.06);
  background: #fff;
  padding: 1.15rem 1.25rem;
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
.stat::after {
  content: '';
  position: absolute;
  right: -30px;
  bottom: -30px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(226, 66, 31, 0.08), transparent 70%);
  transition: transform 0.6s var(--ease);
}
a.stat:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 40px -24px rgba(23, 19, 15, 0.4);
}
a.stat:hover::after {
  transform: scale(1.5);
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 15px;
}
.stat-text strong {
  font: 650 1.85rem/1.05 var(--display);
  letter-spacing: -0.03em;
}

/* cards */
.card {
  background: #fff;
  border-color: rgba(23, 19, 15, 0.06);
  border-radius: 22px;
  box-shadow: 0 1px 2px rgba(23, 19, 15, 0.04), 0 14px 34px -26px rgba(23, 19, 15, 0.35);
}
.card-head {
  padding: 1.05rem 1.35rem;
}
.card-head h2 {
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card-head h2::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--red), #f2864f);
}
.card-body {
  padding: 1.25rem 1.35rem;
}
.page-head h1 {
  font-weight: 650;
  letter-spacing: -0.03em;
}

@media (max-width: 1080px) {
  .welcome {
    flex-direction: column;
    align-items: stretch;
  }
  .welcome-aside {
    align-self: flex-start;
  }
}
@media (max-width: 640px) {
  .topbar-title {
    display: none;
  }
  .user-meta {
    display: none;
  }
  .user-chip {
    padding-right: 0.3rem;
  }
  .wl {
    flex: 1 1 auto;
    justify-content: center;
  }
}
@media (prefers-reduced-motion: reduce) {
  .welcome-glow,
  .ring-bar {
    animation: none;
  }
}

.main:has(.welcome) .topbar-title {
  visibility: hidden;
}

/* sidebar footer: view website + log out */
.side-foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.side-foot-row form {
  margin: 0;
}
.side-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #e9ded3;
  font: 500 0.86rem/1 var(--body);
  cursor: pointer;
  transition: background-color 0.3s var(--ease), border-color 0.3s, color 0.3s;
}
.side-logout:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.side-logout:focus-visible {
  outline: 2px solid #ff8a6b;
  outline-offset: 2px;
}
