:root {
  --brand: #27348b;
  --yellow: #ffdd00;
  --brand-dark: #1d2768;
  --bg: #f3f5fb;
  --panel: #ffffff;
  --side: #eef0fd;
  --text: #1f2430;
  --muted: #6b7280;
  --line: #dde2ec;
  --danger: #d6336c;
  --ok: #2f9e44;
  --warn: #e67700;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }

.topbar { border-bottom: 3px solid var(--yellow) !important; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.logo { display: flex; align-items: center; gap: 8px; font-size: 24px; font-weight: 700; color: var(--brand); text-decoration: none; letter-spacing: -0.5px; }
.logo small { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 2px; align-self: flex-end; margin-bottom: 6px; }
.logo-mark { width: 32px; height: 32px; border-radius: 8px; display: block; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.school-logo { height: 40px; max-width: 160px; object-fit: contain; }
.logo-preview { height: 56px; max-width: 220px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; }
.save-state { font-size: 12px; color: var(--muted); }
.icon-btn { background: none; border: 0; font-size: 20px; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--bg); }
#menuToggle { display: none; }

.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 270px; flex: none; background: var(--side); border-right: 1px solid var(--line); padding: 12px 0; overflow-y: auto; height: calc(100vh - 56px); position: sticky; top: 56px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 18px; color: var(--text); text-decoration: none; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; font-size: 15px; }
.nav-item:hover { background: rgba(10, 34, 224, .08); }
.nav-item.active { background: rgba(10, 34, 224, .15); font-weight: 600; }
.nav-item .ico { width: 24px; text-align: center; font-size: 18px; }
.nav-item .soon { margin-left: auto; font-size: 10px; background: #fff; color: var(--muted); border: 1px solid var(--line); border-radius: 20px; padding: 1px 7px; }
.nav-sub { display: flex; align-items: center; gap: 8px; padding: 7px 18px 7px 54px; color: var(--text); text-decoration: none; font-size: 14px; }
.nav-sub:hover { background: rgba(10, 34, 224, .08); }
.nav-sub.active { font-weight: 600; background: rgba(10, 34, 224, .15); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.nav-sub.add { color: var(--brand); }

.main { flex: 1; min-width: 0; padding: 24px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.page-head .spacer { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.muted { color: var(--muted); }

.btn { border: 1px solid var(--line); background: var(--panel); padding: 7px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 13px; }

.today { max-width: 900px; margin: 0 auto; text-align: center; }
.today .date { font-size: 22px; margin: 8px 0 4px; }
.today .empty { font-size: 20px; font-weight: 600; margin: 24px 0 8px; }
.today .quote { color: var(--muted); font-style: italic; margin: 6px 0 28px; }
.group-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; text-align: left; }
.group-card { background: var(--panel); border: 1px solid var(--line); border-left: 6px solid; border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--text); }
.group-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.07); }
.group-card b { display: block; margin-bottom: 4px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tab { padding: 8px 14px; border: 0; background: none; cursor: pointer; border-bottom: 3px solid transparent; color: var(--muted); }
.tab.active { color: var(--text); border-bottom-color: var(--brand); font-weight: 600; }

.table-wrap { overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); max-height: calc(100vh - 220px); }
table.grid { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.grid th, .grid td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; height: 40px; }
.grid thead th { position: sticky; top: 0; background: #f8f9fd; z-index: 2; font-weight: 600; font-size: 13px; vertical-align: bottom; }
.grid .stu { position: sticky; left: 0; background: var(--panel); z-index: 1; min-width: 220px; text-align: left; padding: 0 12px; white-space: nowrap; }
.grid thead .stu { z-index: 3; background: #f8f9fd; }
.grid .num { width: 34px; min-width: 34px; text-align: center; color: var(--muted); font-size: 12px; position: sticky; left: 0; background: var(--panel); z-index: 1; }
.grid thead .num { z-index: 3; background: #f8f9fd; }
.grid .stu.with-num { left: 34px; }
.colhead { min-width: 96px; max-width: 150px; padding: 6px 8px; cursor: pointer; text-align: center; }
.colhead:hover { background: #eef0fe; }
.colhead .cname { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.colhead .cmeta { display: block; font-weight: 400; color: var(--muted); font-size: 11px; margin-top: 2px; }
.colhead .cat { display: inline-block; height: 4px; width: 100%; border-radius: 2px; margin-bottom: 5px; }
.colhead.final { background: #fff9cc; cursor: default; }
.colhead.addcol { min-width: 60px; color: var(--brand); font-size: 20px; }
.cell { width: 100%; height: 39px; border: 0; background: transparent; text-align: center; padding: 0 6px; outline: none; }
.cell:focus { background: #fff8db; box-shadow: inset 0 0 0 2px var(--brand); }
select.cell { appearance: none; cursor: pointer; }
.cell.obs { text-align: left; min-width: 160px; }
td.calc { text-align: center; font-weight: 600; background: #fafbff; padding: 0 8px; }
td.final { text-align: center; font-weight: 700; background: #fff9cc; padding: 0 10px; }
.fail { color: var(--danger); }
.pass { color: var(--ok); }
.grid tfoot td { background: #f8f9fd; font-size: 13px; text-align: center; color: var(--muted); position: sticky; bottom: 0; }
.grid tfoot .stu { background: #f8f9fd; font-weight: 600; color: var(--text); }
.stu-name { cursor: pointer; }
.stu-name:hover { color: var(--brand); text-decoration: underline; }
.empty-state { padding: 40px; text-align: center; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 24, 40, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--panel); border-radius: 14px; width: min(560px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; padding: 16px 20px 8px; }
.modal-head h2 { margin: 0; font-size: 18px; flex: 1; }
.modal-body { padding: 8px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
.field textarea { min-height: 160px; resize: vertical; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.check-list { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.check-list label { font-weight: 400; color: var(--text); display: flex; gap: 8px; align-items: center; font-size: 14px; }
.colors { display: flex; gap: 8px; flex-wrap: wrap; }
.color-opt { width: 28px; height: 28px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.color-opt.sel { border-color: var(--text); }
.list-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.list-row input { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; min-width: 0; }
.hint { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.settings { display: grid; gap: 16px; max-width: 820px; }
.settings h2 { margin: 0 0 6px; font-size: 17px; }
.scale-chip { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; margin: 2px; border: 1px solid var(--line); }
.soon-page { max-width: 640px; margin: 40px auto; text-align: center; }
.soon-page .big { font-size: 48px; }

@media (max-width: 820px) {
  #menuToggle { display: block; }
  .sidebar { position: fixed; left: 0; top: 56px; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.1); }
  .sidebar.open { transform: none; }
  .main { padding: 16px; }
  .logo small { display: none; }
  .grid .stu { min-width: 150px; }
}
@media print {
  .topbar, .sidebar, .page-head .btn, .tabs { display: none !important; }
  .main { padding: 0; }
  .table-wrap { max-height: none; overflow: visible; border: 0; }
}

.confirm-backdrop { z-index: 70; }
.modal.confirm { width: min(420px, 100%); }
.modal.confirm .modal-body { padding-top: 18px; font-size: 15px; line-height: 1.5; }
.rb-cell { cursor: pointer; font-weight: 600; }
.rb-cell:hover { background: #eef0fe; }

/* ---- Seccions ---- */
.small { font-size: 13px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--line); color: var(--muted); background: var(--panel); white-space: nowrap; }
.gsel, .page-head input[type="date"] { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--panel); }
.card.flush { padding: 0; overflow-x: auto; }
.agenda { text-align: left; margin: 18px 0; padding: 8px 20px; }
.agenda-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.agenda-row:last-child { border-bottom: 0; }
.agenda-row .pill { min-width: 128px; text-align: center; }
.today-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 10px 0 24px; }
a.btn { text-decoration: none; color: var(--text); display: inline-block; }
a.btn.primary { color: #fff; }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.unit-card { display: flex; flex-direction: column; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-top: 5px solid var(--brand); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--text); }
.unit-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.07); }
.unit-card .pill { align-self: flex-start; }
.progress { display: block; height: 7px; background: #e9ecf5; border-radius: 4px; overflow: hidden; flex: 1; min-width: 80px; }
.progress span { display: block; height: 100%; border-radius: 4px; }
.unit-detail { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.unit-detail > * { min-width: 0; }
.unit-detail h3 { font-size: 14px; margin: 16px 0 6px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 14px; }
.kv span { color: var(--muted); }
.list-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.list-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f8f9fd; position: sticky; top: 0; }
.list-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.list-table tr:last-child td { border-bottom: 0; }
.list-table tr.late td { background: #fff5f5; }
.list-table .url { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-input { width: 100%; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; background: transparent; }
.inline-input:hover, .inline-input:focus { border-color: var(--line); background: #fff; outline: none; }
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 18px; display: flex; flex-direction: column; min-width: 150px; }
.stat b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.warn b { color: var(--warn); }
.prog-row { display: grid; grid-template-columns: minmax(140px, 260px) 1fr auto; gap: 12px; align-items: center; padding: 6px 0; }
.lvl-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.lvl-edit { display: flex; gap: 4px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.lvl-edit input { border: 0; padding: 4px 6px; width: 110px; background: transparent; }
.lvl-edit input + input { width: 52px; border-left: 1px solid var(--line); }
.rb-table { border-collapse: collapse; width: 100%; min-width: 720px; }
.rb-table th { background: #f8f9fd; font-size: 13px; padding: 10px; border: 1px solid var(--line); position: sticky; top: 0; }
.rb-table td { border: 1px solid var(--line); padding: 0; vertical-align: top; }
.rb-table textarea { width: 100%; min-height: 84px; border: 0; padding: 8px; resize: vertical; font-size: 13px; background: transparent; }
.rb-table textarea:focus { outline: 2px solid var(--brand); background: #fffdf0; }
.rb-crit { width: 230px; background: #fafbff; }
.rb-crit > b, .rb-crit > div { padding: 0 8px; }
.rb-table.eval .rb-crit { padding: 8px 0; }
.rb-row-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 0 8px 8px; font-size: 12px; color: var(--muted); }
.rb-row-meta input { width: 44px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 5px; }
.rb-opt { width: 100%; min-height: 84px; border: 0; background: transparent; padding: 8px; font-size: 13px; text-align: left; cursor: pointer; }
.rb-opt:hover { background: #eef0fe; }
.rb-opt.sel { background: var(--brand); color: #fff; font-weight: 600; }
.rb-score { font-size: 16px; text-align: right; margin: 12px 0 4px; }
.modal.wide { width: min(980px, 100%); }
.comp .code { width: 80px; flex: none; font-weight: 600; }
.comp .list-row.crit { padding-left: 24px; }
.att-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.att-row:last-child { border-bottom: 0; }
.att-name { flex: 1; min-width: 160px; }
.att-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.att-btn { min-width: 42px; padding: 6px 8px; border-radius: 8px; border: 1.5px solid var(--c); color: var(--c); background: var(--panel); font-weight: 700; cursor: pointer; font-size: 13px; }
.att-btn.sel { background: var(--c); color: #fff; }
.cal-title { min-width: 150px; text-align: center; }
.cal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head span { padding: 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; background: #f8f9fd; border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 104px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.empty { background: #fafbfd; }
.cal-cell.today { background: #fffbe0; }
.cal-day { align-self: flex-start; border: 0; background: none; font-weight: 600; font-size: 13px; padding: 2px 6px; border-radius: 6px; cursor: pointer; }
.cal-day:hover { background: var(--brand); color: #fff; }
.cal-cell.today .cal-day { background: var(--brand); color: #fff; }
.cal-item { display: block; font-size: 12px; padding: 2px 6px; border-radius: 5px; background: var(--c); color: #fff; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item.soft { background: transparent; color: var(--text); border-left: 3px solid var(--c); border-radius: 2px; }
.cal-item.ghost { background: transparent; color: var(--muted); }
.tt { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 12px; overflow-x: auto; }
.tt-col { display: flex; flex-direction: column; gap: 8px; }
.tt-day { font-weight: 700; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.tt-slot { text-align: left; border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: 8px; background: var(--panel); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.tt-slot:hover { box-shadow: 0 2px 8px rgba(0,0,0,.07); }
.report { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 16px; max-width: 900px; }
.report header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid var(--brand); padding-bottom: 12px; }
.r-name { font-size: 18px; }
.r-final { font-size: 30px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.r-final span { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.r-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; }
.r-grid > * { min-width: 0; }
.report h4 { margin: 16px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); }
.r-comment { width: 100%; min-height: 70px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; resize: vertical; }
.row.wrap { flex-wrap: wrap; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.msg { padding: 10px 0; border-bottom: 1px solid var(--line); }
.msg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.msg:last-child { border-bottom: 0; }
.msg .pre { margin-top: 4px; color: var(--muted); }
@media (max-width: 820px) {
  .unit-detail, .r-grid { grid-template-columns: 1fr; }
  .prog-row { grid-template-columns: 1fr; gap: 4px; }
  .cal-cell { min-height: 70px; }
  .cal-item { font-size: 10px; }
  .agenda-row { flex-direction: column; align-items: flex-start; gap: 4px; }
}
@media print {
  body { background: #fff; }
  .page-head .gsel, .page-head input, .today-actions, .hint, .btn { display: none !important; }
  .report { border: 0; page-break-after: always; max-width: none; }
  .r-comment { border: 0; resize: none; }
}

/* ---- Quadern per categories (estil del quadern d'avaluació) ---- */
.term-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.term { border: 1px solid var(--line); background: var(--panel); border-radius: 20px; padding: 6px 14px; cursor: pointer; font-size: 14px; }
.term.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.grid thead tr:nth-child(1) th { height: 38px; }
.grid thead tr:nth-child(2) th { top: 38px; height: 52px; }
.grid thead tr:nth-child(3) th { top: 90px; height: 28px; }
.grid .stu-head { vertical-align: bottom; padding-bottom: 8px; font-size: 15px; color: var(--muted); font-weight: 600; }
.grid th.band { background: color-mix(in srgb, var(--band) 22%, #fff); text-align: center; padding: 0 8px; white-space: nowrap; border-bottom: 0; }
.grid th.band span { font-weight: 700; color: color-mix(in srgb, var(--band) 75%, #000); }
.grid th.band small { font-weight: 500; opacity: .75; }
.band-add { border: 0; background: none; font-size: 18px; cursor: pointer; color: color-mix(in srgb, var(--band) 75%, #000); margin-left: 6px; border-radius: 6px; padding: 0 6px; }
.band-add:hover { background: rgba(255,255,255,.7); }
.grid th.colhead, .grid th.crithead { background: color-mix(in srgb, var(--band, #e9ecf5) 12%, #fff); }
.grid th.colhead.final { background: #fff9cc; }
.grid th.colhead .cname { white-space: normal; line-height: 1.2; color: color-mix(in srgb, var(--band, #333) 70%, #000); font-size: 14px; }
.grid th.catavg .cname { font-weight: 700; }
.grid th.crithead { font-size: 11px; font-weight: 500; padding: 0 6px; white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.comp-code { color: #0b7285; font-weight: 700; }
.grid td.gcell { background: color-mix(in srgb, var(--band) 7%, #fff); position: relative; }
.grid td.catavg { background: color-mix(in srgb, var(--band) 16%, #fff); font-weight: 700; min-width: 76px; }
.grid td.calc:not(.catavg) { background: color-mix(in srgb, var(--band, #fafbff) 10%, #fff); }
.grid tbody tr:nth-child(even) td.stu, .grid tbody tr:nth-child(even) td.num { background: #f6f8fd; }
td.has-note::after { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 10px 10px 0; border-color: transparent #12b886 transparent transparent; pointer-events: none; }
.grid td.stu { display: table-cell; }
.flag { border: 0; background: none; cursor: pointer; font-size: 16px; color: #ced4da; padding: 0 2px; margin-left: auto; }
.grid td.stu > .stu-name { margin-right: 8px; }
.grid tbody td.stu { white-space: nowrap; }
.grid tbody td.stu .flag { float: right; }
.flag:hover { color: #fa5252; }
.flag.on { color: #e03131; }
.grid select.cell option { color: var(--text); font-size: 15px; }

/* ---- Accés ---- */
.auth-screen { position: fixed; inset: 0; z-index: 80; background: linear-gradient(160deg, #e6e9fe, #fffbe0 85%); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.auth-screen[hidden] { display: none; }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; width: min(400px, 100%); box-shadow: 0 20px 50px rgba(30, 40, 80, .12); }
.auth-card h1 { font-size: 20px; margin: 18px 0 14px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 14px; }
.auth-brand img.auth-app-logo { width: 52px; height: 52px; border-radius: 12px; flex: none; }
.auth-brand b { display: block; font-size: 26px; color: var(--brand); letter-spacing: -0.5px; }
.auth-brand span { font-size: 12px; color: var(--muted); }
.auth-btn { width: 100%; padding: 10px; font-size: 15px; }
.auth-msg { min-height: 20px; color: var(--danger); font-size: 14px; margin: 0 0 10px; }
.user-box { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.user-name small { font-size: 10px; background: var(--brand); color: #fff; border-radius: 10px; padding: 1px 6px; }
@media (max-width: 820px) { .user-name { display: none; } .save-state { display: none; } }

.nav-item.active, .nav-sub.active { box-shadow: inset 4px 0 0 var(--yellow); }
.term.active, .btn.primary { box-shadow: inset 0 -2px 0 rgba(255, 224, 0, .55); }
.setup-steps { padding-left: 20px; line-height: 1.7; }

/* Fitxers adjunts */
.file-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; margin: 2px 0; border: 1px solid var(--line, #dde1ea); border-radius: 999px; background: var(--bg, #f6f7fb); font-size: 13px; text-decoration: none; color: inherit; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.file-chip:hover { border-color: var(--brand); color: var(--brand); }
.file-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.link-btn { border: 0; background: none; cursor: pointer; color: var(--muted, #667); padding: 0 2px; font-size: 13px; }
.link-btn:hover { color: #c62828; }
.file-pick { cursor: pointer; }
.share-badge { font-size: 12px; margin-left: 4px; }

.auth-school { text-align: center; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.auth-school img { height: 64px; }

/* Arrossegar grups al menú */
.nav-sub[data-gdrag] { cursor: grab; }
.nav-sub.dragging { opacity: .45; }
.nav-sub.drop-before { box-shadow: inset 0 2px 0 var(--brand); }
.nav-sub.drop-after { box-shadow: inset 0 -2px 0 var(--brand); }
