/* ii-learn — base stylesheet. Phone-first: written for 360 px, scaled up with min-width queries.
   Own stylesheet, not SMART's Inspinia theme (docs/decisions/0001). II black with red highlights. */

:root {
    --ii-black: #000000;
    --ii-ink: #16181b;          /* body text */
    --ii-charcoal: #1f2226;     /* dark surfaces */
    --ii-red: #ED1F24;          /* fills, borders, focus — not for text on white */
    --ii-red-dark: #B3161B;     /* red text/links on white (AA contrast) */
    --ii-red-press: #c8191e;
    --ii-grey-50: #f6f6f7;
    --ii-grey-100: #ececee;
    --ii-grey-300: #c9cace;
    --ii-grey-600: #5d6168;     /* secondary text on white (AA) */
    --ii-white: #ffffff;
    --ok: #1d7a3e;
    --ok-bg: #e8f5ec;
    --warn: #8a5a00;
    --warn-bg: #fff4dc;
    --info: #24508f;
    --info-bg: #e9f0fb;

    --radius: 10px;
    --tap: 44px;                /* minimum tap target */
    --gap: 16px;
    --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.06);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;            /* 16px stops iOS zooming on input focus */
    line-height: 1.5;
    color: var(--ii-ink);
    background: var(--ii-grey-50);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--ii-red-dark); }
a:hover { color: var(--ii-black); }

:focus-visible { outline: 3px solid var(--ii-red); outline-offset: 2px; }

img, svg, video, iframe { max-width: 100%; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }

.muted { color: var(--ii-grey-600); }
.fine { font-size: .875rem; color: var(--ii-grey-600); margin: .75rem 0 0; }

.skip {
    position: absolute; left: -9999px; top: 0;
    background: var(--ii-white); color: var(--ii-black); padding: 8px 12px; z-index: 100;
}
.skip:focus { left: 8px; top: 8px; }

/* ---- top bar ------------------------------------------------------------ */
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 56px;
    padding: 8px 16px;
    padding-top: max(8px, env(safe-area-inset-top));
    background: var(--ii-black);
    color: var(--ii-white);
    border-bottom: 3px solid var(--ii-red);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ii-white); min-height: var(--tap); }
.brand img { height: 22px; width: auto; display: block; }
.brand-app {
    font-weight: 700; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase;
    padding-left: 10px; border-left: 2px solid var(--ii-red);
}
.brand:hover { color: var(--ii-white); }
.topbar-user { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-name { display: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ii-grey-300); font-size: .9rem; }

/* ---- main --------------------------------------------------------------- */
.main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px; }

.page-head { margin-bottom: var(--gap); }
.page-head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.page-head h1 { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.page-sub { margin: .25rem 0 0; color: var(--ii-grey-600); }

.crumbs ol { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-wrap: wrap; font-size: .85rem; color: var(--ii-grey-600); }
.crumbs li + li::before { content: "›"; margin: 0 6px; color: var(--ii-grey-300); }
.crumbs a { color: var(--ii-grey-600); text-decoration: none; }
.crumbs a:hover { color: var(--ii-red-dark); text-decoration: underline; }

.card {
    background: var(--ii-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: var(--gap);
}
.card > :last-child { margin-bottom: 0; }

/* ---- buttons ------------------------------------------------------------ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    min-height: var(--tap);
    padding: 10px 18px;
    border: 2px solid transparent;
    border-radius: 8px;
    font: inherit; font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--ii-red); color: var(--ii-white); }
.btn-primary:hover, .btn-primary:active { background: var(--ii-red-press); color: var(--ii-white); }
.btn-secondary { background: var(--ii-white); color: var(--ii-ink); border-color: var(--ii-grey-300); }
.btn-secondary:hover { border-color: var(--ii-ink); color: var(--ii-ink); }
.btn-ghost { background: transparent; color: var(--ii-white); border-color: rgba(255,255,255,.35); }
.btn-ghost:hover { border-color: var(--ii-white); color: var(--ii-white); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .875rem; }
.btn-block { display: flex; width: 100%; }
/* a .btn-sm inside the top bar still gets a full-size touch area */
.topbar .btn-sm { min-height: var(--tap); }

/* ---- notices ------------------------------------------------------------ */
.notice { border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; border-left: 4px solid; }
.notice-ok   { background: var(--ok-bg);   color: var(--ok);   border-color: var(--ok); }
.notice-warn { background: var(--warn-bg); color: var(--warn); border-color: #d99a00; }
.notice-info { background: var(--info-bg); color: var(--info); border-color: var(--info); }

/* ---- sign-in (bare pages) ---------------------------------------------- */
body.is-bare { background: var(--ii-black); }
.main-bare { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.signin { width: 100%; max-width: 400px; }
.signin-brand { text-align: center; margin-bottom: 24px; }
.signin-brand img { width: 200px; height: auto; }
.signin-card {
    background: var(--ii-white);
    border-radius: 14px;
    border-top: 4px solid var(--ii-red);
    padding: 24px 20px;
}
.signin-card h1 { font-size: 1.4rem; }
.signin-card .muted { margin: 0 0 20px; }
.ms-logo { flex: none; background: var(--ii-white); padding: 2px; border-radius: 2px; }

/* ---- nav strip (under the top bar) -------------------------------------- */
.nav { background: var(--ii-charcoal); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nav ul { list-style: none; margin: 0 auto; padding: 0 8px; display: flex; max-width: 1100px; }
.nav a {
    display: flex; align-items: center; min-height: var(--tap); padding: 0 12px;
    color: var(--ii-grey-300); text-decoration: none; white-space: nowrap; font-size: .95rem;
    border-bottom: 3px solid transparent;
}
.nav a:hover { color: var(--ii-white); }
.nav a[aria-current="page"] { color: var(--ii-white); border-bottom-color: var(--ii-red); }

/* ---- forms -------------------------------------------------------------- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field input, .field select, .field textarea {
    width: 100%; min-height: var(--tap); padding: 8px 12px;
    font: inherit; color: inherit; background: var(--ii-white);
    border: 1px solid var(--ii-grey-300); border-radius: 8px;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ii-ink); outline: 2px solid var(--ii-red); outline-offset: 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); margin-bottom: 12px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--ii-red); }
.filters-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- list tables: stacked cards on phones, a table from 760 px ------------ */
.list { width: 100%; border-collapse: collapse; }
.list thead { position: absolute; left: -9999px; }
.list tr { display: block; background: var(--ii-white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; margin-bottom: 10px; }
.list td { display: grid; grid-template-columns: 7.5em 1fr; gap: 8px; padding: 3px 0; }
.list td::before { content: attr(data-label); color: var(--ii-grey-600); font-size: .85rem; padding-top: 2px; }
.list td:first-child { display: block; padding-bottom: 6px; }
.list td:first-child::before { content: none; }
.list .sub { display: block; font-size: .85rem; color: var(--ii-grey-600); word-break: break-all; }

@media (min-width: 760px) {
    .filters { display: grid; grid-template-columns: 2fr 1.4fr auto auto; gap: 12px; align-items: end; }
    .filters .field, .filters .check { margin-bottom: 0; }
    .list { background: var(--ii-white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
    .list thead { position: static; }
    .list tr { display: table-row; box-shadow: none; border-radius: 0; padding: 0; margin: 0; }
    .list th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ii-grey-600); background: var(--ii-grey-50); padding: 10px 12px; border-bottom: 1px solid var(--ii-grey-100); }
    .list td { display: table-cell; padding: 10px 12px; border-bottom: 1px solid var(--ii-grey-100); vertical-align: top; }
    .list td::before { content: none; }
    .list tbody tr:last-child td { border-bottom: 0; }
    .list .sub { word-break: normal; }
}

/* ---- footer ------------------------------------------------------------- */
.foot {
    padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom));
    text-align: center; font-size: .8rem; color: var(--ii-grey-600);
}

/* ---- larger screens ----------------------------------------------------- */
@media (min-width: 600px) {
    .main { padding: 24px; }
    .card { padding: 20px 24px; }
    .topbar { padding-left: 24px; padding-right: 24px; }
    .brand img { height: 26px; }
    .topbar-name { display: inline; max-width: 240px; }
    h1 { font-size: 1.75rem; }
    .signin-card { padding: 32px 28px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
