:root {
  --bg: #f3eee4;
  --bg-strong: #e7dcc8;
  --panel: rgba(255, 252, 246, 0.88);
  --panel-strong: #fffaf0;
  --line: rgba(89, 62, 28, 0.12);
  --text: #2b2116;
  --muted: #6f624f;
  --brand: #97552d;
  --brand-deep: #6f3714;
  --accent: #c2844f;
  --good: #356644;
  --warning: #9c6a12;
  --shadow: 0 24px 80px rgba(66, 42, 18, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(194, 132, 79, 0.22), transparent 32%),
    radial-gradient(circle at top right, rgba(151, 85, 45, 0.2), transparent 26%),
    linear-gradient(180deg, #fbf7f1 0%, var(--bg) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(151, 85, 45, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(151, 85, 45, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 75%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

.app-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 18px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-card,
.portal-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(110, 76, 37, 0.14);
  box-shadow: var(--shadow);
  background: var(--panel);
  backdrop-filter: blur(16px);
}

.login-card {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  border-radius: 36px;
}

.login-hero,
.login-form {
  padding: 42px;
}

.login-hero {
  background:
    linear-gradient(135deg, rgba(151, 85, 45, 0.96), rgba(82, 47, 25, 0.92)),
    var(--brand);
  color: #fff8f0;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.76rem;
  opacity: 0.8;
}

.display {
  margin: 14px 0 18px;
  font-family: "Fraunces", serif;
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  line-height: 0.94;
}

.lede {
  max-width: 34rem;
  color: rgba(255, 248, 240, 0.86);
  line-height: 1.7;
}

.hero-points {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.hero-point {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 248, 240, 0.11);
  border: 1px solid rgba(255, 248, 240, 0.12);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  justify-content: center;
}

.section-title {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1.8rem;
}

.section-copy {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 0.92rem;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(111, 98, 79, 0.2);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
}

.field textarea {
  min-height: 140px;
  resize: vertical;
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.button {
  padding: 13px 18px;
  border-radius: 999px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  box-shadow: 0 12px 30px rgba(111, 55, 20, 0.25);
}

.button-secondary {
  color: var(--brand-deep);
  background: rgba(151, 85, 45, 0.08);
}

.button-ghost {
  color: var(--muted);
  background: rgba(111, 98, 79, 0.08);
}

.search-shell {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  flex: 1 1 280px;
  min-width: 220px;
  padding: 14px 16px;
  border-radius: 999px;
  border: 1px solid rgba(111, 98, 79, 0.2);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
}

.credential-grid {
  display: grid;
  gap: 10px;
}

.credential-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.credential-card strong {
  display: block;
  margin-bottom: 4px;
}

.portal-shell {
  border-radius: 34px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 36px);
}

.sidebar {
  padding: 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(243, 232, 212, 0.66), rgba(255, 250, 240, 0.42));
}

.brand-lockup {
  padding: 16px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(151, 85, 45, 0.1), rgba(151, 85, 45, 0.02));
  border: 1px solid rgba(151, 85, 45, 0.12);
}

.brand-lockup h1 {
  margin: 6px 0 8px;
  font-family: "Fraunces", serif;
  font-size: 2rem;
}

.brand-lockup p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.user-summary {
  margin-top: 22px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--line);
}

.user-summary small,
.pill,
.meta {
  color: var(--muted);
}

.pill-row,
.nav-list,
.stats-grid,
.calendar-grid,
.journal-grid,
.form-grid,
.admin-grid,
.timeline-list,
.member-grid {
  display: grid;
  gap: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(151, 85, 45, 0.08);
  font-size: 0.86rem;
}

.nav-list {
  margin-top: 24px;
}

.nav-button {
  text-align: left;
  padding: 14px 16px;
  border-radius: 18px;
  background: transparent;
  color: var(--text);
}

.nav-button.active {
  background: linear-gradient(135deg, rgba(151, 85, 45, 0.14), rgba(151, 85, 45, 0.04));
  color: var(--brand-deep);
  border: 1px solid rgba(151, 85, 45, 0.12);
}

.sidebar-actions {
  margin-top: 24px;
  display: grid;
  gap: 12px;
}

.content {
  padding: 20px 22px 24px;
  display: grid;
  gap: 22px;
}

.header-card,
.section-card,
.timeline-card,
.calendar-card,
.journal-card,
.admin-card,
.empty-card {
  padding: 24px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  box-shadow: 0 18px 48px rgba(79, 58, 39, 0.08);
}

.header-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.header-actions {
  display: grid;
  gap: 14px;
  min-width: min(520px, 100%);
}

.header-card h2,
.section-card h3,
.timeline-card h3,
.calendar-card h3,
.journal-card h3,
.admin-card h3 {
  margin: 0;
  font-family: "Fraunces", serif;
}

.header-copy {
  max-width: 42rem;
}

.header-copy p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(245, 239, 228, 0.75), rgba(255, 255, 255, 0.92));
  border: 1px solid var(--line);
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 1.8rem;
  font-family: "Fraunces", serif;
}

.timeline-list {
  margin-top: 18px;
}

.timeline-item,
.calendar-item,
.journal-item,
.member-card,
.admin-item {
  position: relative;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.95), rgba(245, 239, 228, 0.72));
  border: 1px solid rgba(111, 98, 79, 0.12);
}

.timeline-item::before,
.calendar-item::before,
.journal-item::before,
.member-card::before,
.admin-item::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.5), transparent 55%);
  pointer-events: none;
}

.item-topline,
.item-heading,
.item-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.item-heading h4 {
  margin: 6px 0 0;
  font-size: 1.08rem;
}

.item-heading p,
.item-body,
.item-footer {
  color: var(--muted);
}

.item-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.search-result-card {
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(244, 238, 229, 0.9));
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
  background: rgba(151, 85, 45, 0.1);
  color: var(--brand-deep);
}

.badge.type-event {
  background: rgba(53, 102, 68, 0.14);
  color: var(--good);
}

.badge.type-journal {
  background: rgba(156, 106, 18, 0.14);
  color: var(--warning);
}

.badge.upcoming {
  background: rgba(53, 102, 68, 0.14);
  color: var(--good);
}

.calendar-grid,
.journal-grid,
.admin-grid,
.member-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.two-column {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 22px;
}

.calendar-layout {
  position: relative;
}

.form-grid {
  margin-top: 18px;
}

.checkbox-list {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(151, 85, 45, 0.07);
}

.checkbox-pill input {
  margin: 0;
}

.empty-card {
  text-align: center;
  color: var(--muted);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 18px 0;
}

.calendar-toolbar,
.calendar-day-head,
.editor-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.calendar-topbar,
.calendar-topbar-left,
.calendar-topbar-right,
.calendar-view-switch,
.calendar-hero-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.calendar-surface {
  padding: 18px 0 0;
  overflow: hidden;
  background: linear-gradient(180deg, #23201f 0%, #1f1d1b 100%);
  border-color: rgba(255, 255, 255, 0.06);
  color: #f4f1ed;
}

.calendar-surface .divider {
  background: rgba(255, 255, 255, 0.08);
  margin: 0;
}

.calendar-topbar,
.calendar-hero,
.calendar-toolbar,
.day-agenda {
  padding-left: 18px;
  padding-right: 18px;
}

.calendar-topbar {
  justify-content: space-between;
  padding-bottom: 14px;
}

.calendar-view-switch {
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.calendar-view-button {
  padding: 8px 14px;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.74);
}

.calendar-view-button.active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.calendar-top-button,
.calendar-today-button,
.calendar-accent-button {
  background: rgba(255, 255, 255, 0.06);
  color: #f4f1ed;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.calendar-top-button {
  min-width: 42px;
}

.calendar-accent-button {
  background: rgba(182, 104, 46, 0.92);
  border-color: rgba(182, 104, 46, 0.92);
  box-shadow: 0 12px 30px rgba(182, 104, 46, 0.24);
}

.calendar-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  padding-top: 6px;
  padding-bottom: 18px;
}

.calendar-title {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.calendar-copy,
.calendar-surface .section-copy,
.calendar-surface .meta,
.calendar-surface .item-body,
.calendar-surface .item-footer,
.calendar-surface .item-heading p {
  color: rgba(255, 255, 255, 0.66);
}

.calendar-surface .calendar-item,
.calendar-surface .week-day-column .calendar-item {
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.98), rgba(242, 235, 225, 0.94));
  border: 1px solid rgba(92, 74, 51, 0.18);
  color: #2b2116;
}

.calendar-surface .calendar-item::before {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.45), transparent 55%);
}

.calendar-surface .calendar-item .item-heading h4,
.calendar-surface .calendar-item .item-heading p,
.calendar-surface .calendar-item .item-body,
.calendar-surface .calendar-item .item-footer,
.calendar-surface .calendar-item .meta {
  color: #4c3b2b;
}

.calendar-surface .calendar-item .button-ghost {
  background: rgba(111, 98, 79, 0.08);
  color: #5f4a36;
}

.calendar-surface .calendar-item .button-ghost.danger {
  color: #8a2d21;
}

.calendar-pill {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
}

.calendar-subtitle {
  margin: 0;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.62);
}

.calendar-month-label {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.86);
  font-weight: 700;
}

.calendar-weekdays,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.calendar-weekdays {
  margin-top: 8px;
  padding: 0 18px;
}

.calendar-weekday {
  text-align: center;
  padding: 10px 0 12px;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.66);
}

.month-grid {
  gap: 0;
  margin-top: 0;
}

.calendar-day {
  min-height: 132px;
  padding: 8px 10px 10px;
  text-align: left;
  border-radius: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: #1f1d1b;
  color: #f2efea;
}

.calendar-day-number {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 1rem;
}

.calendar-day.muted {
  color: rgba(255, 255, 255, 0.42);
  background: #252220;
}

.calendar-day.selected {
  background: #24201f;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.calendar-day.today {
  background: #282422;
}

.calendar-day-count {
  display: inline-flex;
  min-width: 24px;
  min-height: 24px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
}

.calendar-day-events {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.calendar-chip,
.calendar-more {
  display: block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  line-height: 1.35;
  background: rgba(255, 255, 255, 0.08);
  color: #f8f5f1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.calendar-chip.family {
  background: #37623a;
}

.calendar-chip.shared {
  background: #6b2a74;
}

.calendar-chip.private {
  background: #41444f;
}

.day-agenda {
  display: grid;
  gap: 14px;
  padding-top: 18px;
  padding-bottom: 18px;
}

.day-agenda .item-heading h4,
.day-agenda .item-heading p {
  color: #f4f1ed;
}

.day-mode .timeline-list {
  margin-top: 8px;
}

.day-mode-list {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  padding: 0 18px 18px;
}

.week-day-column {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.week-day-column.selected {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
}

.week-day-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  color: #f4f1ed;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.week-day-name {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.62);
}

.week-day-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.week-empty {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.58);
  text-align: center;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 0 18px 18px;
}

.mini-month {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mini-month h5 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: #f4f1ed;
}

.mini-weekdays,
.mini-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.mini-weekdays span {
  text-align: center;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.54);
}

.mini-day {
  min-height: 30px;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.78rem;
}

.mini-day.muted {
  color: rgba(255, 255, 255, 0.26);
}

.mini-day.has-items {
  background: rgba(55, 98, 58, 0.42);
}

.mini-day.selected {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(16, 12, 10, 0.58);
  backdrop-filter: blur(10px);
  z-index: 20;
}

.modal-card {
  width: min(760px, calc(100vw - 40px));
  max-height: calc(100vh - 56px);
  overflow: auto;
  padding: 24px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(244, 238, 229, 0.98));
  border: 1px solid rgba(92, 74, 51, 0.16);
  box-shadow: 0 30px 90px rgba(22, 15, 11, 0.28);
}

.modal-form-card {
  width: min(560px, calc(100vw - 40px));
}

.modal-detail-card {
  width: min(820px, calc(100vw - 40px));
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.modal-detail-body {
  margin-top: 18px;
}

.modal-detail-body .calendar-item {
  margin: 0;
}

.editor-shell {
  display: grid;
  gap: 10px;
}

.editor-toolbar {
  padding: 8px;
  border-radius: 16px;
  background: rgba(151, 85, 45, 0.06);
  border: 1px solid rgba(111, 98, 79, 0.12);
  justify-content: flex-start;
}

.editor-button {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--brand-deep);
}

.rich-editor {
  min-height: 300px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(111, 98, 79, 0.2);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  line-height: 1.7;
}

.rich-editor:focus {
  outline: 2px solid rgba(151, 85, 45, 0.18);
  border-color: rgba(151, 85, 45, 0.38);
}

.rich-content p,
.rich-content ul,
.rich-content ol,
.rich-content blockquote {
  margin: 0 0 12px;
}

.rich-content blockquote {
  padding-left: 14px;
  border-left: 3px solid rgba(151, 85, 45, 0.35);
  color: var(--brand-deep);
}

.danger {
  color: #8a2d21;
}

.journal-card {
  min-height: 72vh;
}

.motion-rise {
  animation: rise 500ms ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1120px) {
  .portal-shell,
  .login-card,
  .two-column {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .app-shell,
  .content,
  .sidebar,
  .login-hero,
  .login-form {
    padding: 18px;
  }

  .stats-grid,
  .calendar-grid,
  .journal-grid,
  .admin-grid,
  .member-grid,
  .calendar-weekdays,
  .month-grid {
    grid-template-columns: 1fr;
  }

  .calendar-hero,
  .calendar-topbar {
    align-items: start;
    flex-direction: column;
  }

  .modal-backdrop {
    padding: 16px;
  }

  .week-grid,
  .year-grid {
    grid-template-columns: 1fr;
  }

  .mini-weekdays,
  .mini-days {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .calendar-weekdays {
    display: none;
  }

  .calendar-day {
    min-height: auto;
  }

  .header-card {
    align-items: start;
    flex-direction: column;
  }

  .header-actions,
  .search-shell {
    width: 100%;
  }

  .portal-shell,
  .login-card {
    border-radius: 24px;
  }
}
