/* =====================================================================
   Mogadishu University - Task Management System
   Vanilla, responsive stylesheet. No external dependencies.
   ===================================================================== */

/* Palette taken from the university crest: navy blue ring + gold sun,
   with the flag's light blue as a supporting tint. */
:root {
    --brand:        #123b7a;   /* crest navy blue      */
    --brand-dark:   #0b2755;   /* deep ring outline    */
    --brand-light:  #e6eef9;   /* pale blue wash       */
    --sky:          #64c3ec;   /* Somali flag blue     */
    --accent:       #f6c700;   /* crest gold           */
    --accent-dark:  #b98f00;

    --bg:           #f2f5fa;
    --surface:      #ffffff;
    --surface-alt:  #f7f9fc;
    --border:       #dde4ee;

    --text:         #1c2430;
    --text-soft:    #5c6874;
    --muted:        #8a949e;

    --success:      #157347;
    --success-bg:   #e3f4ea;
    --danger:       #b02a37;
    --danger-bg:    #fdeaec;
    --warning:      #9a6700;
    --warning-bg:   #fdf3d8;
    --info:         #0b5ed7;
    --info-bg:      #e7f0fd;

    --radius:       10px;
    --radius-sm:    6px;
    --shadow:       0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .06);
    --sidebar-w:    260px;
    --font:         system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p  { margin: 0 0 .75rem; }

a { color: var(--brand); }
.link { color: var(--brand); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.text-right { text-align: right; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }

/* =====================================================================
   Login screen
   ===================================================================== */
.auth-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1.25rem;
    background:
        radial-gradient(circle at 20% 15%, rgba(246, 199, 0, .22), transparent 45%),
        linear-gradient(135deg, var(--brand-dark), #1b4fa0 70%);
}

.auth {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    width: min(940px, 100%);
    background: var(--surface);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 45px rgba(6, 30, 20, .28);
}

.auth__brand {
    padding: 2.5rem 2rem;
    color: #fff;
    background: linear-gradient(160deg, var(--brand), var(--brand-dark));
    border-bottom: 5px solid var(--accent);
}
/* The crest is shown exactly as supplied - no cropping, no recolouring. */
.auth__logo {
    width: 112px; height: 112px;
    display: grid; place-items: center;
    background: #fff;
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    margin-bottom: 1.25rem;
}
.auth__logo img { width: 100%; height: 100%; object-fit: contain; }
.auth__brand h1 { font-size: 1.5rem; color: #fff; }
.auth__tagline { color: rgba(255, 255, 255, .82); margin-bottom: 1.5rem; }
.auth__points { list-style: none; padding: 0; margin: 0; }
.auth__points li {
    padding: .35rem 0 .35rem 1.35rem;
    position: relative;
    color: rgba(255, 255, 255, .9);
    font-size: .9rem;
}
.auth__points li::before {
    content: "✓";
    position: absolute; left: 0;
    color: var(--accent); font-weight: 700;
}

.auth__card { padding: 2.5rem 2rem; border-top: 5px solid var(--accent); }
.auth__card h2 { color: var(--brand); }
.auth__hint { color: var(--text-soft); margin-bottom: 1.25rem; }
.auth__foot { margin-top: 1.5rem; text-align: center; }

/* =====================================================================
   App shell
   ===================================================================== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 55%);
    border-top: 4px solid var(--accent);
    color: #dbe5f5;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar__brand {
    display: flex; align-items: center; gap: .75rem;
    padding: 1.15rem 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.sidebar__logo {
    width: 48px; height: 48px; flex: 0 0 48px;
    display: grid; place-items: center;
    border-radius: 6px;
    background: #fff;
    padding: 3px;
}
.sidebar__logo img { width: 100%; height: 100%; object-fit: contain; }
.sidebar__brand strong { display: block; color: #fff; font-size: .95rem; }
.sidebar__brand small { color: rgba(255, 255, 255, .65); font-size: .78rem; }

.nav { padding: .75rem .6rem 1.5rem; flex: 1; }
.nav__section {
    margin: 1rem .55rem .35rem;
    font-size: .7rem;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .45);
}
.nav__item {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem .7rem;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: #d7e3dc;
    text-decoration: none;
    font-size: .92rem;
    transition: background .15s, color .15s;
}
.nav__item:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.nav__item.is-active {
    background: rgba(255, 255, 255, .14);
    border-left: 3px solid var(--accent);
    padding-left: calc(.7rem - 3px);
    color: #fff; font-weight: 600;
}
.nav__item--danger:hover { background: rgba(176, 42, 55, .55); }
.nav__icon { width: 1.1rem; text-align: center; opacity: .9; }
.nav__badge {
    margin-left: auto;
    background: var(--accent);
    color: #3a2c00;
    font-size: .72rem; font-weight: 700;
    border-radius: 999px;
    padding: .05rem .45rem;
}
.sidebar__footer {
    padding: .9rem 1.1rem;
    border-top: 1px solid rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .5);
    font-size: .75rem;
}
.sidebar-backdrop { display: none; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    display: flex; align-items: center; gap: 1rem;
    padding: .85rem 1.4rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: inset 0 -3px 0 var(--accent);
    position: sticky; top: 0; z-index: 20;
}
.topbar__logo { width: 34px; height: 34px; object-fit: contain; }
.topbar__burger {
    display: none;
    background: none; border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1.1rem; padding: .25rem .55rem; cursor: pointer;
}
.topbar__title { margin: 0; font-size: 1.1rem; flex: 1; }
.topbar__user { display: flex; align-items: center; gap: .7rem; }
.topbar__meta { text-align: right; line-height: 1.2; }
.topbar__meta strong { display: block; font-size: .88rem; }
.topbar__meta small { color: var(--muted); font-size: .76rem; }
/* =====================================================================
   Notification bell
   ===================================================================== */
.bell { position: relative; }
.bell__button {
    position: relative;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .35rem .6rem;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}
.bell__button:hover { background: var(--surface-alt); }
.bell__count {
    position: absolute; top: -7px; right: -7px;
    min-width: 19px; height: 19px;
    padding: 0 4px;
    display: grid; place-items: center;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: .68rem; font-weight: 700;
}
.bell--alarm .bell__button {
    border-color: var(--danger);
    animation: bell-ring 1.1s ease-in-out 4;
}
@keyframes bell-ring {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(-14deg); }
    40% { transform: rotate(12deg); }
    60% { transform: rotate(-8deg); }
    80% { transform: rotate(6deg); }
}
@media (prefers-reduced-motion: reduce) {
    .bell--alarm .bell__button { animation: none; }
}

.bell__panel {
    position: absolute; right: 0; top: calc(100% + .5rem);
    width: min(380px, 88vw);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 18px 40px rgba(16, 24, 40, .22);
    z-index: 40;
    overflow: hidden;
}
.bell__head, .bell__foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: .5rem;
    padding: .6rem .8rem;
    background: var(--surface-alt);
}
.bell__head { border-bottom: 1px solid var(--border); }
.bell__foot { border-top: 1px solid var(--border); }
.bell__mute { display: flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--text-soft); }
.bell__mute input { accent-color: var(--brand); }

.bell__list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.bell__item { display: flex; align-items: flex-start; border-bottom: 1px solid var(--border); }
.bell__item:last-child { border-bottom: none; }
.bell__item--alarm { background: #fff6f6; border-left: 3px solid var(--danger); }
.bell__link {
    flex: 1;
    display: flex; align-items: flex-start; gap: .6rem;
    padding: .65rem .8rem;
    color: inherit; text-decoration: none;
}
.bell__link:hover { background: var(--surface-alt); }
.bell__link strong { display: block; font-size: .88rem; }
.bell__icon { font-size: 1rem; line-height: 1.3; }
.bell__msg { display: block; font-size: .8rem; color: var(--text-soft); }
.bell__link small { color: var(--muted); font-size: .72rem; }
.bell__dismiss {
    background: none; border: none; cursor: pointer;
    padding: .65rem .6rem; color: var(--muted); font-size: 1.05rem; line-height: 1;
}
.bell__dismiss:hover { color: var(--danger); }
.bell__empty { padding: 1.5rem .8rem; text-align: center; color: var(--muted); font-size: .86rem; }

/* Notification history page */
.notice-list { list-style: none; margin: 0; padding: 0; }
.notice {
    display: flex; align-items: flex-start; gap: .75rem;
    padding: .8rem 1.1rem;
    border-bottom: 1px solid var(--border);
}
.notice:last-child { border-bottom: none; }
.notice.is-unread { background: var(--brand-light); }
.notice--alarm { border-left: 3px solid var(--danger); }
.notice__icon { font-size: 1.15rem; }
.notice__body { flex: 1; }
.notice__text { display: block; font-size: .85rem; color: var(--text-soft); }

/* Personal alarms on the task page */
.alarm-list { list-style: none; margin: 0; padding: 0; }
.alarm-list li {
    display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem;
    padding: .5rem 0;
    border-bottom: 1px dashed var(--border);
    font-size: .86rem;
}
.alarm-list li:last-child { border-bottom: none; }
.alarm-list li.is-fired { opacity: .6; }

.avatar {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--brand-light); color: var(--brand);
    font-weight: 700;
}

.content { padding: 1.4rem; flex: 1; }

.footer {
    display: flex; justify-content: space-between; gap: 1rem;
    padding: .9rem 1.4rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: .8rem;
    background: var(--surface);
}

/* =====================================================================
   Cards, grids, page heads
   ===================================================================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.card__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; flex-wrap: wrap;
    padding: .85rem 1.1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-alt);
}
.card__title { margin: 0; font-size: .98rem; font-weight: 650; color: var(--brand); }
.card__body { padding: 1.1rem; }
.card__body--flush { padding: 0; }

.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
    margin-bottom: 1.15rem;
}
.page-head p { color: var(--text-soft); margin: 0; }

.grid { display: grid; gap: 1.25rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Statistic cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .9rem;
    margin-bottom: 1.25rem;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--muted);
    border-radius: var(--radius);
    padding: .9rem 1rem;
    box-shadow: var(--shadow);
    display: flex; flex-direction: column;
}
.stat__value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stat__label { color: var(--text-soft); font-size: .82rem; }
.stat--total    { border-left-color: var(--accent); }
.stat--pending  { border-left-color: var(--warning); }
.stat--active   { border-left-color: var(--info); }
.stat--progress { border-left-color: #6f42c1; }
.stat--done     { border-left-color: var(--success); }
.stat--rejected { border-left-color: var(--danger); }

/* =====================================================================
   Tables
   ===================================================================== */
.table-wrap { width: 100%; overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
    background: var(--surface);
}
.table th, .table td {
    padding: .7rem .8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table thead th {
    background: var(--surface-alt);
    font-size: .76rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-soft);
    white-space: nowrap;
}
.table tbody tr:hover { background: #fbfcfd; }
.table tbody tr:last-child td { border-bottom: none; }
.table--tight th, .table--tight td { padding: .4rem .5rem; font-size: .84rem; }
.overdue { color: var(--danger); font-weight: 600; }

/* Narrative report tables: wording in the body, totals in the foot. */
.table--report td { font-size: .88rem; }
.table--report tfoot tr {
    background: var(--brand-light);
    font-weight: 600;
}
.table--report tfoot th,
.table--report tfoot td {
    border-top: 2px solid var(--brand);
    border-bottom: none;
    color: var(--brand);
}

/* "Summary at a glance" - the foot of a report */
.card--glance { border-top: 4px solid var(--accent); }
.glance {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .75rem;
}
.glance__item {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .7rem .8rem;
    display: flex; flex-direction: column;
}
.glance__value { font-size: 1.5rem; font-weight: 700; line-height: 1.15; color: var(--brand); }
.glance__label { font-size: .78rem; color: var(--text-soft); }
.glance__item--total  { background: var(--brand-light); border-color: #c3d6f2; }
.glance__item--good   { border-left: 4px solid var(--success); }
.glance__item--bad    { border-left: 4px solid var(--danger); }
.glance__item--bad .glance__value { color: var(--danger); }
.glance__item--rating { border-left: 4px solid var(--accent); }

.empty {
    padding: 1.75rem 1rem;
    text-align: center;
    color: var(--muted);
    background: var(--surface-alt);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    margin: 0;
}

/* =====================================================================
   Badges & tags
   ===================================================================== */
.badge {
    display: inline-block;
    padding: .18rem .55rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 650;
    white-space: nowrap;
}
.badge--pending  { background: var(--warning-bg); color: var(--warning); }
.badge--active   { background: var(--info-bg);    color: var(--info); }
.badge--progress { background: #efe7fb;           color: #59379e; }
.badge--done     { background: var(--success-bg); color: var(--success); }
.badge--rejected { background: var(--danger-bg);  color: var(--danger); }
.badge--muted    { background: #eceff2;           color: var(--text-soft); }

.tag {
    display: inline-block;
    padding: .05rem .4rem;
    border-radius: var(--radius-sm);
    background: #eef1f4;
    color: var(--text-soft);
    font-size: .7rem;
    font-weight: 600;
}
.tag--file   { background: var(--brand-light); color: var(--brand); }
.tag--danger { background: var(--danger-bg);   color: var(--danger); }

/* =====================================================================
   Forms
   ===================================================================== */
.field { display: block; margin-bottom: 1rem; }
.field__label {
    display: block;
    margin-bottom: .3rem;
    font-size: .84rem;
    font-weight: 600;
    color: var(--text-soft);
}
.field__input,
.field select,
select.field__input,
textarea.field__input {
    width: 100%;
    padding: .58rem .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font: inherit;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.field__input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(18, 59, 122, .14);
}
.field__input.is-invalid { border-color: var(--danger); }
.field__error { display: block; margin-top: .25rem; color: var(--danger); font-size: .78rem; }
textarea.field__input { min-height: 110px; resize: vertical; }

.field__pw { position: relative; display: block; }
.field__toggle {
    position: absolute; right: .45rem; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    color: var(--text-soft);
    font-size: .78rem; font-weight: 600;
    cursor: pointer;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0 1rem;
}

.check {
    display: flex; align-items: center; gap: .5rem;
    margin-bottom: 1rem;
    font-size: .9rem;
}
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: .75rem 1rem;
    align-items: end;
}
.filters .field { margin-bottom: 0; }
.filters__actions { display: flex; gap: .5rem; }

/* =====================================================================
   Buttons
   ===================================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .5rem .9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit; font-size: .88rem; font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s, opacity .15s;
    white-space: nowrap;
}
.btn:hover { background: var(--surface-alt); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn--success { background: var(--success); border-color: var(--success); color: #fff; }
.btn--success:hover { filter: brightness(.93); }
.btn--danger  { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(.93); }
.btn--ghost   { background: transparent; }
.btn--sm      { padding: .3rem .6rem; font-size: .8rem; }
.btn--block   { width: 100%; }

.btn-group { display: flex; flex-wrap: wrap; gap: .4rem; }

/* =====================================================================
   Alerts
   ===================================================================== */
.alert {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
    padding: .7rem .9rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    margin-bottom: 1rem;
    font-size: .9rem;
}
.alert--success { background: var(--success-bg); border-color: #b7e0c6; color: #10603a; }
.alert--error   { background: var(--danger-bg);  border-color: #f2c2c7; color: #86212b; }
.alert--warning { background: var(--warning-bg); border-color: #eddba4; color: #7a5200; }
.alert--info    { background: var(--info-bg);    border-color: #c2d7f8; color: #0a4bab; }
.alert__close {
    background: none; border: none; cursor: pointer;
    font-size: 1.05rem; line-height: 1; color: inherit; opacity: .6;
}
.alert__close:hover { opacity: 1; }

/* =====================================================================
   Task detail
   ===================================================================== */
.detail-list { margin: 0; }
.detail-list div {
    display: flex; justify-content: space-between; gap: 1rem;
    padding: .5rem 0;
    border-bottom: 1px dashed var(--border);
    font-size: .9rem;
}
.detail-list div:last-child { border-bottom: none; }
.detail-list dt { color: var(--text-soft); margin: 0; }
.detail-list dd { margin: 0; font-weight: 600; text-align: right; }

.description {
    white-space: pre-wrap;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .85rem;
    font-size: .92rem;
}

.attachment {
    display: flex; align-items: center; gap: .75rem;
    padding: .7rem .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
}
.attachment img { max-width: 100%; border-radius: var(--radius-sm); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
    position: relative;
    padding: 0 0 .95rem 1.25rem;
    border-left: 2px solid var(--border);
    font-size: .88rem;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
    content: "";
    position: absolute; left: -6px; top: .35rem;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--brand);
}
.timeline strong { display: block; }
.timeline small { color: var(--muted); }

/* =====================================================================
   Modal
   ===================================================================== */
.modal {
    position: fixed; inset: 0;
    background: rgba(16, 24, 40, .55);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 1.5rem 1rem;
    overflow-y: auto;
    z-index: 60;
}
.modal.is-open { display: flex; }
.modal__dialog {
    background: var(--surface);
    border-radius: var(--radius);
    width: min(620px, 100%);
    box-shadow: 0 24px 48px rgba(16, 24, 40, .28);
    margin: auto 0;
}
.modal__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: .9rem 1.1rem;
    border-bottom: 1px solid var(--border);
}
.modal__body { padding: 1.1rem; }
.modal__foot {
    display: flex; justify-content: flex-end; gap: .5rem;
    padding: .85rem 1.1rem;
    border-top: 1px solid var(--border);
    background: var(--surface-alt);
}
.modal__close {
    background: none; border: none; font-size: 1.3rem;
    line-height: 1; cursor: pointer; color: var(--text-soft);
}

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth__brand { display: none; }
}

@media (max-width: 820px) {
    .sidebar {
        position: fixed; z-index: 50; left: 0; top: 0;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, .3);
    }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar-backdrop.is-open {
        display: block;
        position: fixed; inset: 0;
        background: rgba(16, 24, 40, .45);
        z-index: 40;
    }
    .topbar__burger { display: block; }
    .topbar__meta { display: none; }
    .content { padding: 1rem; }

    /* Stacked "card" tables on small screens */
    .table thead { display: none; }
    .table, .table tbody, .table tfoot, .table tr, .table td, .table tfoot th {
        display: block; width: 100%;
    }
    .table tfoot th { text-align: left; padding: .5rem .8rem; }
    .table tr {
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        margin-bottom: .75rem;
        background: var(--surface);
        padding: .35rem .1rem;
    }
    .table td {
        display: flex; justify-content: space-between; gap: 1rem;
        border-bottom: 1px dashed var(--border);
        padding: .5rem .8rem;
        text-align: right;
    }
    .table td:last-child { border-bottom: none; }
    .table td::before {
        content: attr(data-label);
        font-weight: 650;
        color: var(--text-soft);
        font-size: .78rem;
        text-transform: uppercase;
        letter-spacing: .04em;
        text-align: left;
    }
}

/* =====================================================================
   Print - reports are laid out for A4 portrait
   ===================================================================== */
@page {
    size: A4 portrait;
    margin: 12mm 10mm 14mm 10mm;
}

@media print {
    .no-print, .sidebar, .topbar, .footer, .sidebar-backdrop, .bell { display: none !important; }

    html, body { background: #fff; }
    body {
        font-size: 8.5pt;
        line-height: 1.35;
        color: #000;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .layout { display: block; }
    .main { display: block; }
    .content { padding: 0; }

    /* Report header repeats the crest and the filter statement */
    .print-head { display: block !important; margin-bottom: 6mm; }
    .print-head img { width: 18mm; height: 18mm; }
    .print-head h2 { font-size: 13pt; margin-bottom: 1mm; }
    .print-head p { font-size: 8pt; margin: 0; }
    .print-filters {
        display: block !important;
        clear: both;
        margin: 3mm 0 4mm;
        padding: 2mm 3mm;
        border: .3mm solid #999;
        border-radius: 1mm;
        font-size: 7.8pt;
    }

    .card {
        box-shadow: none;
        border: .3mm solid #999;
        border-radius: 0;
        margin-bottom: 4mm;
        break-inside: auto;
    }
    .card__head { background: #eee; padding: 1.5mm 3mm; border-bottom: .3mm solid #999; }
    .card__title { font-size: 9.5pt; color: #000; }
    .card__body { padding: 2mm 3mm; }
    .card__body--flush { padding: 0; }

    /* Tables: full width, repeating header, no row split across pages */
    .table-wrap { overflow: visible !important; }
    .table {
        width: 100%;
        table-layout: fixed;
        font-size: 7.8pt;
        border-collapse: collapse;
    }
    .table thead { display: table-header-group; }
    .table tfoot { display: table-footer-group; }
    .table, .table tbody, .table tfoot, .table tr, .table td, .table th { display: revert; }
    .table tr { break-inside: avoid; page-break-inside: avoid; }
    .table th, .table td {
        padding: 1.2mm 1.5mm;
        border-bottom: .2mm solid #bbb;
        word-wrap: break-word;
        overflow-wrap: anywhere;
    }
    .table thead th { background: #eee; font-size: 7pt; letter-spacing: 0; color: #000; }
    .table td::before { content: none; }
    .table--report tfoot tr { background: #eee; }
    .table--report tfoot th, .table--report tfoot td { border-top: .4mm solid #000; color: #000; }
    .table--report td small { font-size: 6.8pt; }

    /* First column carries the task name - give it the room */
    .table--report th:first-child, .table--report td:first-child { width: 26%; }

    /* The foot of the report: four columns of figures */
    .card--glance { break-inside: avoid; page-break-inside: avoid; }
    .glance { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5mm; }
    .glance__item { background: #fff; border: .2mm solid #bbb; padding: 1.5mm; }
    .glance__value { font-size: 11pt; color: #000; }
    .glance__label { font-size: 6.8pt; }

    .badge { border: .2mm solid #666; color: #000 !important; background: #fff !important;
             padding: 0 .8mm; font-size: 7pt; }
    .empty { border: none; background: #fff; padding: 3mm; }
    a[href]::after { content: ""; }
    a { color: #000; text-decoration: none; }
    h2, h3 { color: #000; }
}

.print-filters { display: none; }

.print-head { display: none; }
.print-head img { width: 74px; height: 74px; object-fit: contain; float: left; margin-right: 1rem; }
.print-head h2 { color: var(--brand); }
