:root {
    --bg: #756c7b;
    --bg-deep: #6f6675;
    --panel: #ffffff;
    --panel-soft: #f8f7fa;
    --line: #d9d4dd;
    --line-strong: #c7c0cb;
    --text: #2c2530;
    --muted: #736779;
    --primary: #8f6691;
    --primary-dark: #6d447b;
    --danger: #b33a54;
    --success: #3b8d5d;
    --shadow: 0 14px 34px rgba(52, 34, 58, .16);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
}
a { color: inherit; text-decoration: none; }
code { color: var(--primary-dark); }
img { max-width: 100%; display: block; }
.container { width: min(1800px, calc(100% - 24px)); margin: 12px auto 24px; }
.narrow { width: min(720px, calc(100% - 32px)); }
.hero, .card {
    background: var(--panel);
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.hero {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 12px;
}
.public-hero {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0 10px 8px;
    justify-content: center;
}
.card { padding: 12px; margin-bottom: 12px; }
.badge {
    display: inline-block;
    padding: 7px 11px;
    border-radius: 999px;
    background: #f1ebf4;
    border: 1px solid #e0d8e4;
    color: var(--primary-dark);
    font-size: 12px;
    margin-bottom: 10px;
    font-weight: 700;
}
.logo-stack {
    text-align: center;
    color: #fff;
}
.site-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 10px;
    object-fit: contain;
}
.site-logo-fallback {
    border-radius: 50%;
    background: #26395a;
    color: #fff;
    border: 2px solid rgba(255,255,255,.35);
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 700;
}
.hero-campus {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: .3px;
}
.public-hero h1 {
    margin: 0;
    color: #fff;
    font-size: 24px;
    font-weight: 500;
}
h1, h2, h3, h4 { margin: 0 0 10px; }
p { margin: 0; line-height: 1.5; }
.muted { color: var(--muted); }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    border-radius: 6px;
    border: 1px solid #a98eb1;
    background: var(--primary);
    color: white;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
}
.btn-light { background: #ece8ee; border-color: #d2cad7; color: var(--text); }
.btn-ghost { background: var(--primary); border-color: #a98eb1; color: #fff; }
.btn-danger { background: var(--danger); border-color: #9f2f47; }
.btn-small { padding: 7px 11px; font-size: 12px; }
.hero-actions, .nav-inline, .form-actions, .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.filters { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; }
.public-filters {
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 12px;
}
.calendar-actions-left,
.calendar-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
label { display: grid; gap: 8px; font-weight: 600; color: var(--muted); }
input, select {
    min-width: 200px;
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
}
.compact-select select {
    min-width: auto;
    padding: 8px 10px;
    border-radius: 6px;
    background: #faf8fb;
}
.stack { display: grid; gap: 14px; }
.login-card { margin-top: 10vh; }
.alert {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #d8cfdb;
    background: #edf7f0;
}
.alert.danger { background: #fbecef; border-color: #efc5cf; }
.alert.success { background: #edf7f0; border-color: #cfe4d7; }
.calendar-card {
    padding: 10px 8px 12px;
    overflow: hidden;
}
.public-calendar-card {
    border-radius: 14px;
    background: #f7f7f8;
}
.calendar-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 4px 6px 10px;
}
.calendar-topline h2 {
    font-size: 18px;
    font-weight: 700;
}
.top-switches {
    display: flex;
    gap: 8px;
}
.public-toolbar {
    padding: 0 6px 10px;
    margin: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0;
    margin-bottom: 0;
}
.weekdays div {
    text-align: center;
    color: #fff;
    font-weight: 700;
    padding: 0;
    background: var(--primary);
    border-right: 1px solid rgba(255,255,255,.35);
    height: 18px;
    line-height: 18px;
}
.weekdays div:last-child { border-right: 0; }
.day-cell {
    min-height: 138px;
    background: #fff;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 8px;
    position: relative;
}
.public-calendar-grid .day-cell:first-child,
.public-weekdays div:first-child { border-left: 1px solid var(--line); }
.public-calendar-grid:last-of-type .day-cell { border-bottom: 1px solid var(--line); }
.day-cell.empty { background: #fafafa; }
.day-number {
    font-weight: 700;
    margin-bottom: 8px;
}
.day-number span {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-dark);
    color: #fff;
    font-size: 11px;
}
.event-chip {
    display: grid;
    gap: 4px;
    background: #f0e8f3;
    border: 1px solid #dfd0e7;
    border-radius: 8px;
    padding: 6px;
    margin-bottom: 6px;
    font-size: 11px;
    line-height: 1.3;
}
.list { display: grid; gap: 10px; }
.list-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
}
.list-content h4 {
    margin: 0;
    line-height: 1.35;
}

.list-content p {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}
.list-date {
    display: grid;
    gap: 6px;
    align-content: start;
    color: var(--primary-dark);
}
.agenda-card {
    background: #f7f7f8;
}
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.site-footer {
    color: #fff;
    font-size: 11px;
    line-height: 1.35;
    padding: 8px 12px 0;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
@media (max-width: 1100px) {
    .day-cell { min-height: 110px; }
}
@media (max-width: 900px) {
    .hero, .calendar-header, .filters, .public-filters, .calendar-topline { flex-direction: column; align-items: stretch; }
    .calendar-grid { grid-template-columns: repeat(7, minmax(120px, 1fr)); }
    .calendar-card, .table-wrap { overflow-x: auto; }
    .calendar-card > .calendar-grid,
    .calendar-card > .public-calendar-grid { min-width: 840px; }
}
@media (max-width: 640px) {
    .container { width: min(100%, calc(100% - 12px)); }
    .public-hero h1 { font-size: 18px; }
    .hero-campus { font-size: 16px; }
    .list-item { grid-template-columns: 1fr; }
    input, select { min-width: 100%; }
    .calendar-actions-left,
    .calendar-actions-right,
    .top-switches { width: 100%; }
}
