/* Student portal */
.portal-page { background: var(--paper); }

/* auth */
.auth { min-height: 100svh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth--single { grid-template-columns: 1fr; }
.auth__art { position: relative; background: #142010; overflow: hidden; }
.auth__art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.auth__art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(9,14,7,.92), rgba(9,14,7,.1) 60%); }
.auth__quote { position: absolute; z-index: 1; left: 48px; right: 48px; bottom: 48px; color: #fff; }
.auth__quote p { font: 600 clamp(1.4rem, 2.4vw, 2rem)/1.25 var(--f-display); letter-spacing: -.02em; max-width: 24ch; margin-bottom: 12px; }
.auth__quote span { color: #A6E07F; font-weight: 600; }
.auth__panel { display: flex; flex-direction: column; padding: 24px clamp(20px, 5vw, 64px) 40px; }
.auth__top { display: flex; justify-content: space-between; align-items: center; }
.auth__top img { height: 30px; width: auto; }
.auth__box { width: 100%; max-width: 420px; margin: auto; padding: 40px 0; }
.auth__box h1 { font-size: clamp(2rem, 3.6vw, 2.6rem); }
.auth__tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: var(--surface-2); border-radius: 999px; margin: 24px 0; }
.auth__tabs a { text-align: center; padding: 10px; border-radius: 999px; text-decoration: none; font-weight: 600; color: var(--ink-2); }
.auth__tabs a[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.auth__alt { text-align: center; margin: 16px 0 0; font-size: .95rem; }
.auth__help { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: .93rem; text-align: center; }
.pw { position: relative; }
.pw input { padding-right: 70px; }
.pw .linkish { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); text-decoration: none; }
.meter { height: 6px; background: var(--surface-2); border-radius: 9px; margin-top: 8px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--danger); transition: width .25s, background-color .25s; }
.meter span[data-s="3"] { background: var(--amber); }
.meter span[data-s="4"], .meter span[data-s="5"] { background: var(--green); }

/* app shell */
.pt { display: grid; grid-template-columns: 260px 1fr; min-height: 100svh; }
.pt__side { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; padding: 22px 16px; background: var(--surface); border-right: 1px solid var(--line); }
.pt__logo { padding: 0 10px 22px; }
.pt__logo img { height: 28px; width: auto; }
.pt__nav { display: grid; gap: 2px; }
.pt__nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; text-decoration: none; font-weight: 600; color: var(--ink-2); }
.pt__nav a:hover { background: var(--surface-2); color: var(--ink); }
.pt__nav a.is-active { background: var(--green-soft); color: var(--green); }
.pt__nav em { margin-left: auto; font-style: normal; font-size: .75rem; min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; border-radius: 99px; background: var(--amber); color: #2a1c00; }
.pt__side-foot { margin-top: auto; display: grid; gap: 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.pt__side-foot a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: .95rem; }
.pt__side-foot a:hover { background: var(--surface-2); }
.pt__main { padding: 26px clamp(18px, 3.5vw, 44px) 60px; min-width: 0; }
.pt__top { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; }
.pt__top h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); margin: 4px 0 0; }
.pt__top-actions { display: flex; gap: 8px; align-items: center; }
.pt__avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--green); color: var(--on-green); font-weight: 700; text-decoration: none; }
.pt__avatar:hover { color: var(--on-green); }
.pt__grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; margin-bottom: 18px; align-items: start; }
.pt__tabs { display: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(18px, 2.5vw, 26px); margin-bottom: 18px; }
.pt__grid .card { margin-bottom: 0; }
.card__head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.card__head h2 { font-size: 1.3rem; margin: 0; }
.empty-sm { color: var(--ink-3); margin: 0; padding: 14px 0; }
.banner { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 20px; border-radius: var(--r); background: color-mix(in srgb, var(--amber) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); margin-bottom: 18px; }
.banner p { margin: 2px 0 0; color: var(--ink-2); font-size: .95rem; }

.kpis { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.kpis--3 { grid-template-columns: repeat(3, 1fr); }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); text-decoration: none; transition: border-color .2s; }
a.kpi:hover { border-color: var(--green); color: inherit; }
.kpi__label { color: var(--ink-3); font-size: .9rem; font-weight: 600; }
.kpi strong { font: 700 clamp(1.6rem, 2.6vw, 2.1rem)/1.1 var(--f-display); letter-spacing: -.02em; }
.kpi span:last-child { color: var(--ink-2); font-size: .9rem; }
.kpi--ring { flex-direction: row; align-items: center; gap: 16px; }
.kpi--ring strong { font-size: 1.3rem; }
.ring { position: relative; flex: none; width: 112px; height: 112px; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring__bg { stroke: var(--surface-2); }
.ring__fg { stroke: var(--green); stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease); }
.ring > span { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring > span strong { font: 700 1.4rem var(--f-display); }
.ring > span small { color: var(--ink-3); font-size: .7rem; }

.next { padding: 20px; border-radius: var(--r); background: var(--green-soft); }
.next__wk { font: 600 .82rem var(--f-mono); color: var(--green); }
.next h3 { margin: 6px 0 14px; font-size: 1.3rem; }
.next__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.notes li { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.notes li:last-child { border-bottom: 0; padding-bottom: 0; }
.notes p { margin: 4px 0; color: var(--ink-2); font-size: .96rem; }
.notes small { color: var(--ink-3); }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick a { padding: 16px; border-radius: var(--r); border: 1px solid var(--line); text-decoration: none; }
.quick a:hover { border-color: var(--green); color: inherit; }
.quick strong { display: block; }
.quick span { color: var(--ink-3); font-size: .9rem; }

.mods { list-style: none; margin: 0; padding: 0; }
.mod { display: flex; align-items: center; gap: 16px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.mod:last-child { border-bottom: 0; }
.mod__form { display: flex; }
.mod__check { position: relative; cursor: pointer; }
.mod__check input { position: absolute; z-index: 1; opacity: 0; width: 28px; height: 28px; margin: 0; cursor: pointer; }
.mod__check span:first-of-type { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); transition: all .2s; }
.mod__check input:checked + span { background: var(--green); border-color: var(--green); }
.mod__check input:checked + span::after { content: ""; width: 7px; height: 12px; border: solid var(--on-green); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.mod__check input:focus-visible + span { outline: 3px solid var(--green); outline-offset: 2px; }
.mod__body { flex: 1; min-width: 0; }
.mod__wk { display: block; font: 600 .78rem var(--f-mono); color: var(--green); }
.mod.is-done .mod__body strong { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line); }

.asgs { display: grid; gap: 0; }
.status { display: inline-block; padding: 5px 11px; border-radius: 99px; font-size: .8rem; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.status--graded, .status--submitted, .status--present { background: var(--green-soft); color: var(--green); }
.status--overdue, .status--absent { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.status--late, .status--todo { background: color-mix(in srgb, var(--amber) 20%, transparent); color: #8a5d00; }
[data-theme="dark"] .status--late, [data-theme="dark"] .status--todo { color: var(--amber); }
.grade { display: flex; gap: 16px; align-items: flex-start; padding: 16px; border-radius: var(--r); background: var(--green-soft); margin-bottom: 12px; }
.grade strong { font: 700 1.6rem var(--f-display); color: var(--green); white-space: nowrap; }
.grade p { margin: 0; color: var(--ink-2); }

.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .97rem; }
.tbl th { text-align: left; color: var(--ink-3); font-weight: 600; font-size: .85rem; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.paybar { height: 10px; border-radius: 9px; background: var(--surface-2); overflow: hidden; margin: -4px 0 18px; }
.paybar span { display: block; height: 100%; background: var(--green); border-radius: 9px; }

.idwrap { display: grid; justify-items: center; gap: 18px; padding: 10px 0; }
.idwrap__actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.idcard { width: min(460px, 100%); border-radius: 20px; overflow: hidden; background: #fff; color: #141A10; box-shadow: var(--shadow-lg); border: 1px solid #DCE3D3; }
.idcard__head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; background: linear-gradient(135deg, #F2F8EC, #fff); border-bottom: 4px solid #3D8D19; }
.idcard__head img { height: 62px; width: auto; }
.idcard__head span { font: 700 1rem "Bricolage Grotesque", sans-serif; color: #3D8D19; }
.idcard__body { display: grid; grid-template-columns: 72px 1fr; gap: 16px; padding: 20px; position: relative; }
.idcard__av { display: grid; place-items: center; width: 72px; height: 88px; border-radius: 12px; background: #3D8D19; color: #fff; font: 700 1.6rem "Bricolage Grotesque", sans-serif; }
.idcard__name { display: block; font: 700 1.25rem/1.2 "Bricolage Grotesque", sans-serif; margin-bottom: 8px; }
.idcard dl { margin: 0; display: grid; gap: 4px; font-size: .88rem; }
.idcard dl div { display: grid; grid-template-columns: 80px 1fr; }
.idcard dt { color: #6C7663; }
.idcard dd { margin: 0; font-weight: 600; }
.idcard__qr { grid-column: 1 / -1; justify-self: end; margin-top: -8px; }
.idcard__qr img, .idcard__qr canvas { width: 96px; height: 96px; }
.idcard__foot { padding: 10px 20px; background: #141A10; color: #DCE3D3; font-size: .78rem; text-align: center; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .quick { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth__art { display: none; }
  .pt { grid-template-columns: 1fr; }
  .pt__side { display: none; }
  .pt__grid { grid-template-columns: 1fr; }
  .pt__main { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  .pt__tabs { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .pt__tabs a { display: grid; justify-items: center; gap: 2px; padding: 6px 0; font-size: .72rem; font-weight: 600; text-decoration: none; color: var(--ink-3); }
  .pt__tabs a.is-active { color: var(--green); }
}
@media (max-width: 560px) {
  .kpis, .kpis--3 { grid-template-columns: 1fr 1fr; }
  .kpi--ring { grid-column: 1 / -1; }
  .kpis--3 .kpi:first-child { grid-column: 1 / -1; }
  .quick { grid-template-columns: 1fr; }
  .banner { flex-direction: column; align-items: flex-start; }
  .card__head .ring { width: 84px; height: 84px; }
  .card__head .ring svg { width: 84px; height: 84px; }
  .mod { flex-wrap: wrap; }
  .mod .btn { margin-left: 44px; }
  .idcard__body { grid-template-columns: 60px 1fr; }
  .idcard__av { width: 60px; height: 74px; }
}
@media print {
  body * { visibility: hidden; }
  #idcard, #idcard * { visibility: visible; }
  #idcard { position: absolute; left: 0; top: 0; box-shadow: none; }
  .pt__tabs, .toast { display: none; }
}
.kpi--ring > div > strong, .kpi--ring > div > span { display: block; }
@media (min-width: 901px) { .pt { background: linear-gradient(90deg, var(--surface) 259px, var(--line) 259px 260px, transparent 260px); } }
.ring > span strong, .ring > span small { display: block; line-height: 1.15; }
@media (max-width: 560px) { .kpis:not(.kpis--3) .kpi:nth-child(4) { grid-column: 1 / -1; } }

/* ---------- Portal v3 ---------- */
.kpis--4 { grid-template-columns: repeat(4, 1fr); }
.pt__me { display: flex; align-items: center; gap: 12px; padding: 12px; margin: 0 0 14px; border-radius: 14px; background: var(--surface-2); }
.pt__me img, .pt__me > span { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; display: grid; place-items: center; background: var(--green); color: var(--on-green); font-weight: 700; }
.pt__me strong { display: block; font-size: .95rem; line-height: 1.2; }
.pt__me small { color: var(--green); font-weight: 600; }
.pt__avatar { overflow: hidden; }
.pt__avatar img { width: 100%; height: 100%; object-fit: cover; }
.banner--ok { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.journey { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.journey li { position: relative; padding-top: 14px; font-size: .82rem; font-weight: 600; color: var(--ink-3); }
.journey li::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px; border-radius: 6px; background: var(--line); }
.journey li.is-done { color: var(--ink-2); } .journey li.is-done::before { background: var(--green); }
.journey li.is-now { color: var(--green); } .journey li.is-now::before { background: linear-gradient(90deg, var(--green) 50%, var(--line) 50%); }
.checkin { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 22px; margin-bottom: 18px; border-radius: var(--r-lg); background: var(--ink); color: var(--paper); }
[data-theme="dark"] .checkin { background: var(--green-soft); color: var(--ink); }
.checkin p { margin: 2px 0 0; opacity: .8; }
.checkin.is-done { background: var(--green-soft); color: var(--ink); }
.checkin__form { display: flex; gap: 8px; }
.checkin__form input { width: 150px; padding: 10px 14px; border-radius: 99px; border: 0; font: 600 1rem var(--f-mono); text-transform: uppercase; text-align: center; }
.mat-group { font-size: 1rem; margin: 18px 0 8px; color: var(--ink-2); }
.mat-group:first-of-type { margin-top: 0; }
.mats { list-style: none; margin: 0; padding: 0; }
.mat { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mat__ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--green-soft); color: var(--green); }
.mat__body { flex: 1 1 220px; min-width: 0; }
.mat__body strong, .mat__body small { display: block; }
.mat__body small { color: var(--ink-3); }
.mat__video { width: 100%; max-width: 560px; margin-top: 10px; border-radius: 10px; background: #000; }
.mat__act { display: flex; gap: 6px; }
.meets { list-style: none; margin: 0; padding: 0; }
.meet { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.meet__when { flex: none; width: 54px; text-align: center; border-radius: 12px; background: var(--surface-2); padding: 6px 0; }
.meet__when b { display: block; font: 700 1.4rem/1.1 var(--f-display); }
.meet__when span { font-size: .78rem; color: var(--ink-3); }
.meet.is-live .meet__when { background: var(--green); color: var(--on-green); }
.meet.is-live .meet__when span { color: inherit; }
.meet__body { flex: 1 1 220px; }
.meet__body strong, .meet__body small { display: block; }
.meet__body small { color: var(--ink-3); }
.meet__body p { margin: 6px 0 0; color: var(--ink-2); font-size: .95rem; }
.meet__act { display: flex; gap: 6px; }
.defense { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px; border-radius: var(--r); background: var(--surface-2); margin-bottom: 16px; }
.defense small { display: block; color: var(--ink-3); }
.defense p { margin: 4px 0 0; }
.docs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.docs .card { margin: 0; }
.doc-card__ico { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--green-soft); color: var(--green); margin-bottom: 12px; }
.doc-card h2 { font-size: 1.2rem; margin-bottom: 4px; }
.idcard__av { overflow: hidden; }
.idcard__av img { width: 100%; height: 100%; object-fit: cover; }
.thread { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.thread .msg { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); max-width: 92%; }
.thread .msg--student { justify-self: end; background: var(--green-soft); }
.thread .msg small { display: block; color: var(--ink-3); font-size: .78rem; }
.thread .msg p { margin: 4px 0 0; }
.me-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.me-head img, .me-head > span { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: var(--green); color: var(--on-green); font-weight: 700; }
.me-head strong, .me-head small { display: block; }
@media (max-width: 1100px) { .kpis--4 { grid-template-columns: 1fr 1fr; } .docs { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .journey { grid-template-columns: repeat(3, 1fr); row-gap: 12px; }
  .checkin__form { width: 100%; } .checkin__form input { flex: 1; } .checkin__form .btn { flex: 1; }
  .defense { grid-template-columns: 1fr; }
  .kpis--4 .kpi:nth-child(4) { grid-column: auto; }
}
