/* Department home pages (ms/, root selector): tool cards. The shell (header, buttons, dark mode) comes from evaluation-base.css /
   evaluation.css, the sign-in card from hub.css - this file only adds the card grid. Uses the same colour variables, so dark mode just works. */
.portal-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.portal-card { display: block; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 18px; color: var(--text-dark); text-decoration: none; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s; }
.portal-card:hover, .portal-card:focus-visible { border-color: var(--accent-blue); box-shadow: var(--shadow-md); transform: translateY(-1px); outline: none; }
.portal-card h2 { margin: 0 0 6px; font-size: 15px; font-weight: 600; color: var(--primary-blue); }
body.dark-mode .portal-card h2 { color: var(--accent-light); }
.portal-card p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--text-muted); }
.portal-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; vertical-align: middle; background: var(--border-color); color: var(--text-muted); }
.portal-admin { margin-top: 18px; }
.portal-status { margin: 10px 0 0; min-height: 1.4em; }
/* the same icons as the sidebar (shared/js/lia-shell.js) */
.portal-card-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; margin-bottom: 10px; border-radius: 10px; background: color-mix(in srgb, var(--accent-blue) 10%, transparent); color: var(--accent-blue); }
body.dark-mode .portal-card-icon { background: color-mix(in srgb, var(--accent-light) 14%, transparent); color: var(--accent-light); }
.portal-card-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* The public page for families: a card like the others, in grey */
.portal-card-public { background: #f1f5f9; border-style: dashed; }
.portal-card-public h2 { color: #475569; }
.portal-card-public .portal-card-icon { background: rgba(100, 116, 139, .16); color: #64748b; }
body.dark-mode .portal-card-public { background: #1e293b; }
body.dark-mode .portal-card-public h2 { color: #cbd5e1; }
body.dark-mode .portal-card-public .portal-card-icon { background: rgba(148, 163, 184, .16); color: #94a3b8; }

/* School cards on the first page: a colour edge and a code badge */
.portal-card-school { border-top: 4px solid var(--sc, var(--accent-blue)); padding-top: 16px; }
.portal-badge { display: inline-block; margin-bottom: 8px; padding: 2px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: .5px; background: var(--sc, var(--border-color)); color: #fff; }
.portal-card-public .portal-badge { background: #64748b; }

/* Under the header of the school home page: announcements and what happens today */
.home-card { margin: 0 0 16px; }
.home-card-title { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 18px; color: var(--primary-blue); }
.home-card-title small { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-left: 6px; }
.home-card-title .portal-card-icon { width: 28px; height: 28px; margin: 0; flex: none; }
body.dark-mode .home-card-title { color: var(--accent-light); }
.home-ann-card { margin: 16px 0 0; }
.home-ann-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.home-ann { padding: 12px 14px; border: 1px solid var(--border-color); border-radius: 12px; background: var(--tint-1, transparent); min-width: 0; }
.home-ann.pinned { border-color: var(--accent-blue); }
.home-ann h3 { margin: 0 0 4px; font-size: 15px; }
.home-ann p { margin: 0 0 4px; font-size: 14px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.home-ann small { color: var(--text-muted); }
.home-ann.pinned h3::before { content: '\1F4CC  '; }
.home-more { margin: 8px 0 0; font-size: 13px; }
.home-today { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.home-today a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-dark); text-decoration: none; font-size: 14px; }
.home-today a:hover { background: var(--bg-soft, rgba(148, 163, 184, .14)); }
.home-today li.imp b { font-weight: 800; }
/* a test: subject, grade, one chip per section with its period, the topic */
.home-today .home-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.home-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.home-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6;
  background: var(--tint-1, #e6f4f1); color: var(--accent-dark, #0f5f55); border: 1px solid var(--tint-2, #cde9e3); }
.home-chip i { font-style: normal; font-weight: 700; opacity: .75; }
.home-chip-grade { background: transparent; border-color: var(--tint-3, #a7d8cd); }
.home-topic { font-size: 12.5px; color: var(--text-muted, #64748b); }
.home-topic::before { content: '· '; }
.home-test-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; flex-basis: 100%; padding-left: 2px; }
.home-test-line > b { font-weight: 600; }
body.dark-mode .home-chip { background: rgba(148, 163, 184, .14); color: #e2e8f0; border-color: rgba(148, 163, 184, .28); }
body.dark-mode .home-chip-grade { background: transparent; }
body.dark-mode .home-topic { color: #94a3b8; }
.home-today small { color: var(--text-muted); }
.home-ico { width: 22px; height: 22px; flex: none; color: var(--primary-blue); }
.home-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.home-empty { margin: 0; color: var(--text-muted); font-size: 14px; }
.home-more a { color: var(--accent-blue, #2563eb); font-weight: 600; }

/* Phones: the tools are a grid of two, name and a big icon only (the description is in the card's title and in each tool's own page) */
@media (max-width: 640px) {
  .portal-tools.portal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .portal-tools .portal-card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 128px; padding: 18px 8px; }
  .portal-tools .portal-card p { display: none; }
  .portal-tools .portal-card h2 { margin: 0; font-size: 15px; line-height: 1.25; }
  .portal-tools .portal-card-icon { width: 58px; height: 58px; margin: 0 0 12px; border-radius: 16px; }
  .portal-tools .portal-card-icon svg { width: 32px; height: 32px; }
  .portal-tools .portal-card-public { grid-column: 1 / -1; min-height: 0; flex-direction: row; gap: 12px; justify-content: center; padding: 12px; }
  .portal-tools .portal-card-public .portal-card-icon { width: 40px; height: 40px; margin: 0; }
  .portal-tools .portal-card-public .portal-card-icon svg { width: 24px; height: 24px; }
}

/* Today: To do (what to act on) beside Happening today; a phone shows one half at a time */
.home-halves { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 8px 24px; }
.home-half { min-width: 0; }
.home-half-title { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; padding-left: 10px; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.home-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-blue); color: #fff; font-size: 11px; letter-spacing: 0; }
.home-todo .home-today a { border: 1px solid var(--border-color); margin-bottom: 4px; }
.home-todo .home-today a:hover { border-color: var(--accent-blue); }
.home-todo .home-empty { padding-left: 10px; }
.home-today li.home-more-item { display: none; }
.home-all .home-today li.home-more-item { display: block; }
.home-more-btn { font: inherit; font-size: 13px; font-weight: 700; color: var(--accent-blue); background: none; border: 0; padding: 6px 10px; cursor: pointer; }
.home-today-card .home-halves-tabs { display: none; }
/* with a Now card: three parts, then two (Happening today under them), then one tab at a time on a phone */
.home-halves.has-now { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr); }
.home-nowhalf .lia-now b { font-size: 17px; }
.home-nowhalf .lia-now span { font-size: 13px; opacity: .92; }
.home-nowhalf .home-next { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, .28); }
.home-daylist { display: none; list-style: none; margin: 8px 0 0; padding: 0; gap: 4px; }
.home-daylist li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 0 8px; padding: 7px 10px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--card-bg); font-size: 13px; }
.home-daylist li b { grid-row: 1 / span 3; color: var(--accent-blue); }
.home-daylist .home-dt { color: var(--text-muted); font-size: 12px; }
.home-daylist .home-dc { font-weight: 700; }
.home-daylist small { color: var(--text-muted); }
.home-daylist li.on { border-color: var(--accent-blue); box-shadow: inset 4px 0 0 var(--accent-blue); }
.home-daylist li.past { opacity: .55; }
@media (max-width: 1000px) and (min-width: 641px) { .home-halves.has-now { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .home-halves.has-now .home-half[data-half="day"] { grid-column: 1 / -1; } }
@media (max-width: 640px) {
  .home-halves, .home-halves.has-now { grid-template-columns: minmax(0, 1fr); }
  .home-daylist { display: grid; }
  .home-today-card[data-show="now"] .home-half:not([data-half="now"]), .home-today-card[data-show="todo"] .home-half[data-half="now"] { display: none; }
  .home-today-card .home-halves-tabs { display: flex; width: 100%; margin: 0 0 8px; }
  .home-halves-tabs > button { flex: 1; white-space: nowrap; }
  .home-today-card[data-show="todo"] .home-half[data-half="day"], .home-today-card[data-show="day"] .home-half[data-half="todo"], .home-today-card[data-show="day"] .home-half[data-half="now"] { display: none; }
  .home-half-title { display: none; }
}
