:root {
    color-scheme: light;
    --primary: #155e75;
    --primary-dark: #164e63;
    --surface: #ffffff;
    --background: #f1f5f9;
    --text: #172033;
    --muted: #526173;
    --success-bg: #dcfce7;
    --success-text: #166534;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--text); font-size: 17px; line-height: 1.55; }
a { color: inherit; }
.topbar { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 5vw; background: var(--primary); color: #fff; }
.brand { font-weight: 750; text-decoration: none; font-size: 1.2rem; }
.user-name { font-size: .92rem; font-weight: 650; }
.user-tools { display: flex; align-items: center; gap: 10px; }
.install-app { min-height: 36px; border: 1px solid rgb(255 255 255 / 55%); border-radius: 8px; padding: 5px 10px; background: transparent; color: #fff; font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; }
.install-app:hover { background: rgb(255 255 255 / 14%); }
.notification-link { position: relative; display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: #fff; text-decoration: none; }
.notification-link:hover { background: rgb(255 255 255 / 14%); }
.notification-link span { position: absolute; top: -4px; right: -5px; min-width: 20px; height: 20px; border-radius: 10px; padding: 0 5px; background: #dc2626; color: #fff; font-size: .72rem; line-height: 20px; text-align: center; }
.page { min-height: calc(100vh - 64px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px 100px; }
.skip-link { position: fixed; z-index: 20; left: 12px; top: -60px; background: #fff; color: var(--text); padding: 10px; }
.skip-link:focus { top: 10px; }
.desktop-nav { display: none; gap: 8px; }
.desktop-nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 8px; text-decoration: none; font-weight: 650; }
.desktop-nav a:hover { background: rgb(255 255 255 / 15%); }
.card { width: min(680px, 100%); background: var(--surface); border-radius: 20px; padding: clamp(28px, 6vw, 56px); box-shadow: 0 18px 50px rgb(15 23 42 / 9%); }
.auth-card { max-width: 520px; }
.eyebrow { color: var(--primary-dark); font-weight: 750; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; }
h1 { margin: 10px 0 14px; font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.08; }
p { color: var(--muted); }
.status { margin-top: 26px; padding: 14px 16px; border-radius: 12px; background: var(--success-bg); color: var(--success-text); font-weight: 650; }
.field { display: grid; gap: 7px; margin: 18px 0; }
.field label { font-weight: 700; }
.field input { width: 100%; min-height: 50px; border: 1px solid #aab6c5; border-radius: 10px; padding: 10px 12px; font: inherit; }
.field input:focus { outline: 3px solid rgb(21 94 117 / 25%); border-color: var(--primary); }
.field small, .help { color: var(--muted); font-size: .88rem; }
.button { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; border: 0; border-radius: 10px; padding: 10px 20px; font: inherit; font-weight: 750; cursor: pointer; text-decoration: none; }
.button.primary { width: 100%; background: var(--primary); color: #fff; }
.button.secondary { background: #e2e8f0; color: var(--text); }
.button.danger { background: #fee2e2; color: #991b1b; }
.alert { width: min(680px, 100%); border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; font-weight: 650; }
.alert.error { background: #fee2e2; color: #991b1b; }
.alert.success { background: var(--success-bg); color: var(--success-text); }
.logout-form { margin-top: 36px; padding-top: 24px; border-top: 1px solid #dbe2ea; }
.field select, .copy-field { width: 100%; min-height: 50px; border: 1px solid #aab6c5; border-radius: 10px; padding: 10px 12px; font: inherit; background: #fff; }
.copy-field { margin-top: 8px; }
.member-list { display: grid; gap: 10px; }
.member-list article { display: grid; padding: 14px; border: 1px solid #dbe2ea; border-radius: 12px; }
.member-list span { color: var(--muted); font-size: .9rem; }
.member-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.member-actions form { display: flex; flex-wrap: wrap; gap: 8px; }
.member-actions select { min-height: 44px; border: 1px solid #aab6c5; border-radius: 8px; padding: 6px; }
.calendar-page { width: min(1180px, 100%); }
.calendar-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.calendar-heading h1 { margin-bottom: 0; }
#calendar { margin-top: 24px; padding: clamp(10px, 2vw, 22px); background: #fff; border-radius: 16px; box-shadow: 0 12px 36px rgb(15 23 42 / 8%); }
#calendar button { min-height: 42px; border: 1px solid var(--primary-dark); border-radius: 9px; padding: 8px 13px; background: var(--primary); color: #fff; font: inherit; font-size: .9rem; font-weight: 750; cursor: pointer; box-shadow: 0 2px 5px rgb(15 23 42 / 12%); transition: background-color .15s ease, transform .15s ease, box-shadow .15s ease; }
#calendar button:hover:not(:disabled) { background: var(--primary-dark); box-shadow: 0 4px 10px rgb(15 23 42 / 18%); transform: translateY(-1px); }
#calendar button:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
#calendar button:disabled { opacity: .45; cursor: default; }
#calendar button[aria-pressed="true"] { background: #0f172a; border-color: #0f172a; }
#calendar table { border-collapse: collapse; }
#calendar td[data-date], #calendar th { border: 1px solid #d7dee8 !important; }
#calendar th { background: #f8fafc; color: #334155; font-weight: 750; }
#calendar td[data-date] { background-clip: padding-box; }
#calendar td[data-date]:hover { background-color: #f8fafc; }
#calendar .agenda-event { position: relative; min-height: 24px; border: 0 !important; border-radius: 6px; padding: 2px 22px 2px 6px; color: #fff !important; font-weight: 700; line-height: 1.25; cursor: pointer; box-shadow: 0 2px 5px rgb(15 23 42 / 14%); }
#calendar .agenda-category-marker { position: absolute; z-index: 4; top: 50%; right: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--agenda-category-color, #94a3b8); box-shadow: 0 0 0 2px rgb(255 255 255 / 90%); transform: translateY(-50%); pointer-events: none; }
#calendar .agenda-event-appointment, #calendar .agenda-event-appointment .fc-event-main { --fc-event-color: #2563eb; background-color: #2563eb !important; }
#calendar .agenda-event-deadline, #calendar .agenda-event-deadline .fc-event-main { --fc-event-color: #dc2626; background-color: #dc2626 !important; }
#calendar .agenda-event-reminder, #calendar .agenda-event-reminder .fc-event-main { --fc-event-color: #d97706; background-color: #d97706 !important; }
#calendar .agenda-event-recurring { box-shadow: inset 0 0 0 2px #c4b5fd, 0 2px 5px rgb(15 23 42 / 14%); }
.event-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; color: var(--muted); font-size: .88rem; font-weight: 650; }
.event-legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { width: 12px; height: 12px; display: inline-block; border-radius: 3px; }
.legend-dot.appointment { background: #2563eb; }
.legend-dot.deadline { background: #dc2626; }
.legend-dot.reminder { background: #d97706; }
.legend-dot.recurring { background: #7c3aed; box-shadow: inset 0 0 0 2px #c4b5fd; }
.category-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 14px; margin-top: 9px; color: var(--muted); font-size: .84rem; }
.category-legend span { display: inline-flex; align-items: center; gap: 6px; }
.category-dot { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; box-shadow: 0 0 0 1px rgb(15 23 42 / 15%); }
.category-dot.uncategorized { background: #94a3b8; }
.event-details { position: relative; margin-top: 18px; padding: 24px; background: #fff; border-left: 5px solid var(--primary); border-radius: 12px; box-shadow: 0 10px 30px rgb(15 23 42 / 8%); }
.event-details h2 { margin: 0 44px 12px 0; }
.event-details dl { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.event-details dl div { display: grid; }
.event-details dt { font-weight: 750; }
.event-details dd { margin: 0; color: var(--muted); }
.details-close { position: absolute; right: 14px; top: 12px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #e2e8f0; font-size: 1.6rem; cursor: pointer; }
.compact-button { width: auto !important; min-width: 120px; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.details-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
dialog { width: min(620px,calc(100% - 24px)); max-height: calc(100vh - 24px); border: 0; border-radius: 16px; padding: 0; box-shadow: 0 24px 70px rgb(15 23 42 / 30%); }
dialog::backdrop { background: rgb(15 23 42 / 60%); }
#event-form { padding: clamp(22px,5vw,38px); overflow-y: auto; }
#folder-dialog form, #upload-dialog form, #post-dialog form { padding: clamp(24px,5vw,38px); }
.dialog-heading { position: relative; padding-right: 50px; }
.dialog-heading h2 { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field textarea { width: 100%; border: 1px solid #aab6c5; border-radius: 10px; padding: 10px 12px; font: inherit; resize: vertical; }
.check-field { display: flex; gap: 10px; align-items: center; min-height: 48px; font-weight: 700; }
.check-field input { width: 22px; height: 22px; }
.recurrence-fields { margin: 20px 0; padding: 12px 16px 4px; border: 1px solid #cbd5e1; border-radius: 12px; }
.recurrence-fields[hidden] { display: none; }
.recurrence-fields legend { padding: 0 8px; color: var(--primary-dark); font-weight: 800; }
.event-options { margin: 20px 0; padding: 12px 16px 14px; border: 1px solid #cbd5e1; border-radius: 12px; }
.event-options legend { padding: 0 8px; color: var(--primary-dark); font-weight: 800; }
.choice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px 16px; }
.choice-grid label { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.choice-grid input { width: 18px; height: 18px; flex: 0 0 auto; }
.custom-reminder { margin-top: 12px; }
.archive-page { width: min(1180px,100%); }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 20px 0 12px; }
.breadcrumbs a { color: var(--primary-dark); font-weight: 700; text-decoration: none; }
.breadcrumbs a[aria-current="page"] { color: var(--muted); pointer-events: none; }
.archive-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; margin-bottom: 14px; color: var(--muted); font-size: .88rem; }
.archive-filters { margin: 12px 0; }
.archive-filters > label { display: block; margin-bottom: 6px; font-weight: 700; }
.archive-filters > div { display: flex; gap: 8px; align-items: center; }
.archive-filters input { flex: 1; min-width: 160px; min-height: 42px; border: 1px solid #aab6c5; border-radius: 9px; padding: 8px 11px; font: inherit; }
.archive-filters select { min-height: 42px; border: 1px solid #aab6c5; border-radius: 9px; padding: 7px 10px; background: #fff; font: inherit; }
.archive-view-switch { display: flex; gap: 4px; }
.archive-view-switch a { border-radius: 7px; padding: 5px 9px; color: var(--primary-dark); font-weight: 750; text-decoration: none; }
.archive-view-switch a.active { background: var(--primary); color: #fff; }
.archive-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 14px; }
.archive-grid.list-view { grid-template-columns: 1fr; }
.archive-grid.list-view .archive-item { min-height: 0; }
.archive-grid.list-view .archive-main-link { min-height: 58px; }
.upload-progress { display: grid; gap: 6px; margin: 14px 0; color: var(--muted); font-size: .88rem; }
.upload-progress[hidden] { display: none; }
.upload-progress progress { width: 100%; height: 12px; accent-color: var(--primary); }
.archive-item { min-width: 0; min-height: 130px; display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 18px; border: 1px solid #dbe2ea; border-radius: 14px; background: #fff; color: var(--text); text-decoration: none; box-shadow: 0 5px 16px rgb(15 23 42 / 6%); }
.archive-item:hover { border-color: #94a3b8; transform: translateY(-1px); }
.archive-main-link { min-width: 0; display: flex; flex: 1; flex-direction: column; justify-content: center; gap: 5px; color: inherit; text-decoration: none; }
.archive-item strong, .archive-item small { max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
.archive-item small { color: var(--muted); }
.download-label { margin-top: 5px; color: var(--primary); font-size: .84rem; font-weight: 750; }
.file-item { justify-content: flex-start; }
.file-item audio, .file-item video { width: 100%; max-height: 180px; }
.thumbnail-button { width: calc(100% + 36px); height: 150px; margin: -18px -18px 8px; overflow: hidden; border: 0; border-radius: 14px 14px 0 0; padding: 0; background: #e2e8f0; cursor: zoom-in; }
.thumbnail-button img { width: 100%; height: 100%; display: block; object-fit: cover; }
.file-actions { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: auto; }
.file-actions a { color: var(--primary); font-size: .88rem; font-weight: 750; }
.image-dialog { width: min(1100px,calc(100% - 24px)); background: #0f172a; }
.image-dialog > div { position: relative; display: grid; place-items: center; min-height: 220px; padding: 58px 18px 18px; }
.image-dialog img { max-width: 100%; max-height: calc(100vh - 150px); object-fit: contain; }
.image-dialog p { margin: 10px 0 0; color: #fff; }
.empty-actions { justify-content: center; }
.item-management { width: 100%; margin-top: 8px; padding-top: 8px; border-top: 1px solid #e2e8f0; }
.item-management summary { color: var(--primary); font-size: .88rem; font-weight: 750; cursor: pointer; }
.item-management form { display: grid; gap: 7px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #eef2f7; }
.item-management label { display: grid; gap: 4px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.item-management input, .item-management select { width: 100%; min-height: 40px; border: 1px solid #aab6c5; border-radius: 8px; padding: 6px 8px; font: inherit; }
.item-management .button { min-height: 40px; padding: 7px 10px; font-size: .84rem; }
.archive-trash { margin-top: 24px; }
.communications-page { width: min(900px,100%); }
.notifications-page { width: min(900px,100%); }
.search-page { width: min(900px,100%); }
.activity-page { width: min(1000px,100%); }
.activity-filters { display: flex; align-items: end; gap: 12px; margin: 20px 0; }
.activity-filters .field { flex: 1; margin: 0; }
.activity-list { display: grid; gap: 8px; }
.activity-list article { display: flex; justify-content: space-between; gap: 18px; padding: 13px 15px; border: 1px solid #dbe2ea; border-radius: 10px; background: #fff; }
.activity-list article div { display: grid; }
.activity-list span,.activity-list time { color: var(--muted); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 22px; }
.global-search { margin: 20px 0; }
.global-search > label { display: block; margin-bottom: 7px; font-weight: 700; }
.global-search > div { display: flex; gap: 10px; }
.global-search input { flex: 1; min-width: 0; min-height: 48px; border: 1px solid #aab6c5; border-radius: 10px; padding: 9px 12px; font: inherit; }
.global-search .button { width: auto; min-width: 88px; flex: 0 0 auto; padding-inline: 16px; }
.search-summary { color: var(--muted); }
.search-group { margin-top: 24px; }
.search-group > div { display: grid; gap: 8px; }
.search-group a { display: flex; justify-content: space-between; gap: 14px; padding: 13px 15px; border: 1px solid #dbe2ea; border-radius: 10px; background: #fff; text-decoration: none; }
.search-group a:hover { border-color: var(--primary); }
.search-group small { color: var(--muted); white-space: nowrap; }
.notifications-page > .calendar-heading { margin-bottom: 10px; }
.notification-list { display: grid; gap: 12px; }
.notification-list article { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 18px; border: 1px solid #dbe2ea; border-radius: 12px; background: #fff; }
.notification-list article.unread { border-left: 5px solid var(--primary); background: #f0f9ff; }
.notification-list h2 { margin: 0; font-size: 1.05rem; }
.notification-list p { margin: 5px 0; }
.notification-list small { color: var(--muted); }
.communications-page > .calendar-heading { margin-bottom: 10px; }
.attachment-picker { margin: 18px 0; padding: 14px; border: 1px solid #dbe2ea; border-radius: 12px; }
.attachment-picker legend { padding: 0 6px; font-weight: 700; }
.attachment-picker small { display: block; margin-top: 8px; color: var(--muted); }
.post-attachments, .post-management { margin-top: 18px; padding: 18px; background: #fff; border: 1px solid #dbe2ea; border-radius: 14px; }
.post-attachments h2 { margin-top: 0; }
.attachment-list, .trash-list { display: grid; gap: 10px; }
.attachment-list article, .trash-list article { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px; border: 1px solid #dbe2ea; border-radius: 10px; }
.attachment-list article > div, .trash-list article > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.attachment-list small, .trash-list small { color: var(--muted); }
.post-management > summary { cursor: pointer; font-weight: 800; }
.post-management > form { margin-top: 18px; }
.post-management > form + form { margin-top: 14px; padding-top: 14px; border-top: 1px solid #dbe2ea; }
.post-feed { display: grid; gap: 16px; margin-top: 24px; }
.post-card { padding: clamp(20px,4vw,30px); border: 1px solid #dbe2ea; border-left: 5px solid #94a3b8; border-radius: 14px; background: #fff; box-shadow: 0 8px 24px rgb(15 23 42 / 7%); }
.post-card.pinned { border-left-color: var(--primary); }
.post-card.important { box-shadow: inset 0 0 0 1px #fecaca, 0 8px 24px rgb(15 23 42 / 7%); }
.post-card h2 { margin: 10px 0; }
.post-meta, .post-card footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--muted); font-size: .84rem; }
.post-category { display: inline-flex; align-items: center; gap: 6px; font-weight: 750; }
.post-category i { width: 10px; height: 10px; border-radius: 50%; }
.post-badge { padding: 2px 8px; border-radius: 999px; background: #cffafe; color: #155e75; font-weight: 750; }
.post-badge.important { background: #fee2e2; color: #991b1b; }
.post-badge.unread { background: #fef3c7; color: #92400e; }
.post-body { overflow-wrap: anywhere; }
.post-card footer { justify-content: space-between; margin-top: 18px; padding-top: 12px; border-top: 1px solid #eef2f7; }
.post-card h2 a, .post-card footer a, .back-link { color: var(--primary-dark); }
.back-link { display: inline-block; margin-bottom: 16px; font-weight: 750; }
.post-detail h1 { font-size: clamp(2rem,5vw,3rem); }
.readers-panel { margin: 16px 0; padding: 14px 18px; border: 1px solid #dbe2ea; border-radius: 12px; background: #fff; }
.readers-panel summary { color: var(--primary); font-weight: 750; cursor: pointer; }
.readers-panel li { margin-top: 6px; }
.readers-panel small { color: var(--muted); }
.comments-section { margin-top: 24px; }
.comment-form { padding: 18px; border-radius: 14px; background: #fff; }
.comment-list { display: grid; gap: 12px; margin-top: 16px; }
.comment-list > article { padding: 18px; border: 1px solid #dbe2ea; border-radius: 12px; background: #fff; }
.comment-list header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.comment-list time { color: var(--muted); font-size: .84rem; }
.comment-actions summary { color: var(--primary); font-size: .85rem; font-weight: 750; cursor: pointer; }
.comment-actions form { display: grid; gap: 8px; margin-top: 10px; }
.comment-actions textarea { width: 100%; border: 1px solid #aab6c5; border-radius: 8px; padding: 9px; font: inherit; }
.archive-icon { color: #d97706; font-size: 2rem; line-height: 1; }
.empty-state { padding: clamp(34px,8vw,76px) 20px; border: 1px dashed #94a3b8; border-radius: 16px; background: #fff; text-align: center; }
.empty-state > span { display: block; color: #94a3b8; font-size: 3rem; }
.empty-state h2 { margin-bottom: 5px; }
.optional { color: var(--muted); font-size: .85rem; font-weight: 500; }
.trash-content { padding: clamp(22px,5vw,38px); }
.trash-list { display: grid; gap: 10px; }
.trash-list article { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid #dbe2ea; border-radius: 10px; }
.trash-list article div { display: grid; }
.trash-list span { color: var(--muted); font-size: .88rem; }
.mobile-nav { position: fixed; inset: auto 0 0; display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 1px solid #dbe2ea; padding-bottom: env(safe-area-inset-bottom); }
.mobile-nav a { min-height: 68px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; font-size: .72rem; font-weight: 650; color: var(--muted); }
.mobile-nav a[aria-current="page"] { color: var(--primary); }
.mobile-nav a[aria-disabled="true"] { opacity: .55; pointer-events: none; }
.mobile-nav span { font-size: 1.25rem; line-height: 1; }
a:focus-visible, button:focus-visible, select:focus-visible { outline: 3px solid #fbbf24; outline-offset: 3px; }

@media (min-width: 800px) {
    .mobile-nav { position: static; display: none; }
    .desktop-nav { display: flex; margin-left: auto; }
    .page { padding-bottom: 32px; }
}

@media (max-width: 650px) {
    .archive-filters > div { align-items: stretch; flex-wrap: wrap; }
    .archive-filters input { flex-basis: 100%; }
    .archive-filters select { flex: 1; }
    .activity-filters { display: grid; }
    .activity-list article { display: grid; }
    .calendar-heading { display: block; }
    .calendar-heading p { margin-top: 6px; }
    #calendar { margin-inline: -12px; border-radius: 10px; }
    #calendar button { min-height: 44px; padding: 7px 10px; font-size: .82rem; }
    .event-legend { gap: 7px 12px; }
    .event-details dl { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; gap: 0; }
    .choice-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; }
}
