:root {
  --ink: #241b1d;
  --muted: #746b6d;
  --paper: #fbf8f5;
  --surface: #ffffff;
  --surface-soft: #f5efec;
  --line: #e7ded9;
  --red: #7c2432;
  --red-dark: #5d1824;
  --red-soft: #f5e7e9;
  --gold-soft: #f8f0dd;
  --green-soft: #e6f3eb;
  --green: #256b45;
  --blue-soft: #e8eef7;
  --blue: #345b88;
  --amber: #8a5a17;
  --shadow: 0 12px 34px rgba(47, 31, 34, 0.08);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 4% 0%, rgba(124, 36, 50, 0.06), transparent 26rem),
    var(--paper);
}

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

button {
  cursor: pointer;
}

a {
  color: var(--red);
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  font-size: clamp(1.75rem, 3vw, 2.4rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

h2 {
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1rem;
}

small, .muted { color: var(--muted); }

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 1rem;
  text-align: center;
  color: var(--muted);
}

.brand-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  position: relative;
}

.brand-mark span {
  position: absolute;
  inset: 8px 4px;
  border: 4px solid var(--red);
  border-radius: 50% 20% 50% 20%;
  transform: rotate(35deg);
}

.brand-mark span:last-child {
  transform: rotate(-35deg);
  opacity: 0.58;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
}

.auth-hero {
  padding: clamp(2rem, 7vw, 6rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(145deg, rgba(124,36,50,.97), rgba(76,22,32,.96)),
    var(--red);
  color: white;
  min-height: 100vh;
}

.auth-hero .eyebrow { color: rgba(255,255,255,.7); }
.auth-hero h1 { max-width: 680px; font-size: clamp(2.8rem, 6vw, 5.7rem); }
.auth-hero .lead { max-width: 620px; font-size: 1.15rem; color: rgba(255,255,255,.78); line-height: 1.7; }

.auth-brand {
  display: flex;
  align-items: center;
  gap: .85rem;
  font-weight: 650;
}

.auth-brand .brand-mark span { border-color: white; }

.auth-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 1rem;
  max-width: 720px;
}

.auth-point {
  border-top: 1px solid rgba(255,255,255,.25);
  padding-top: 1rem;
  color: rgba(255,255,255,.8);
  font-size: .93rem;
}

.auth-panel {
  display: grid;
  align-items: center;
  padding: clamp(1.5rem, 6vw, 5rem);
}

.auth-card {
  width: min(440px, 100%);
  margin: 0 auto;
}

.auth-card .subtitle {
  margin-bottom: 2rem;
  color: var(--muted);
  line-height: 1.6;
}

.invite-notice {
  padding: 1rem 1.1rem;
  border: 1px solid #dbc2c7;
  background: var(--red-soft);
  border-radius: 14px;
  margin-bottom: 1.25rem;
  color: var(--red-dark);
}

.segmented {
  display: flex;
  padding: 4px;
  background: var(--surface-soft);
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.segmented button {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: .7rem;
  color: var(--muted);
}

.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(40,25,28,.08);
}

.form-stack {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: .42rem;
  font-size: .88rem;
  color: #51484a;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  padding: .78rem .9rem;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(124,36,50,.55);
  box-shadow: 0 0 0 3px rgba(124,36,50,.08);
}

textarea { resize: vertical; min-height: 100px; }

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: .72rem 1rem;
  font-weight: 650;
  background: var(--surface);
  color: var(--ink);
}

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

.btn-primary {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

.btn-primary:hover { background: var(--red-dark); }

.btn-secondary {
  border-color: var(--line);
  background: var(--surface);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn-danger {
  background: #fff5f5;
  color: #8f2630;
  border-color: #f1ced2;
}

.btn-small { padding: .5rem .7rem; font-size: .86rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.error-text {
  color: #9a2833;
  background: #fff0f1;
  border: 1px solid #f2cdd1;
  border-radius: 10px;
  padding: .75rem .85rem;
  font-size: .9rem;
}

.success-text {
  color: var(--green);
  background: var(--green-soft);
  border-radius: 10px;
  padding: .75rem .85rem;
  font-size: .9rem;
}

.workspace-setup {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.workspace-card {
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: clamp(1.5rem, 5vw, 3.25rem);
  box-shadow: var(--shadow);
}

.workspace-card .brand-mark { margin: 0 0 1.25rem; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #2b2022;
  color: white;
  padding: 1.2rem 1rem;
  display: flex;
  flex-direction: column;
  z-index: 4;
}

.logo {
  display: flex;
  gap: .75rem;
  align-items: center;
  padding: .5rem .5rem 1.5rem;
}

.logo .brand-mark { width: 34px; height: 34px; margin: 0; }
.logo .brand-mark span { inset: 6px 3px; border-width: 3px; border-color: #fff; }
.logo strong { display: block; letter-spacing: -.02em; }
.logo small { color: rgba(255,255,255,.52); }

.nav {
  display: grid;
  gap: .3rem;
}

.nav button {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.66);
  padding: .78rem .82rem;
  border-radius: 11px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav button:hover, .nav button.active {
  background: rgba(255,255,255,.09);
  color: white;
}

.nav-count {
  min-width: 24px;
  padding: .1rem .38rem;
  border-radius: 999px;
  background: rgba(255,255,255,.13);
  text-align: center;
  font-size: .75rem;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.1);
  padding: 1rem .5rem .25rem;
}

.sidebar-footer strong { font-size: .9rem; display: block; }
.sidebar-footer span { color: rgba(255,255,255,.52); font-size: .8rem; }

.main {
  min-width: 0;
  padding: 1.2rem clamp(1rem, 3.8vw, 3.5rem) 4rem;
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.workspace-switcher {
  display: flex;
  align-items: center;
  gap: .65rem;
}

.workspace-switcher select {
  width: auto;
  min-width: 180px;
  padding: .55rem .7rem;
  border-radius: 10px;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: .7rem;
}

.role-chip, .chip, .status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border-radius: 999px;
  padding: .32rem .62rem;
  font-size: .76rem;
  font-weight: 700;
  line-height: 1;
}

.role-chip { background: var(--red-soft); color: var(--red-dark); text-transform: capitalize; }
.chip { background: var(--surface-soft); color: var(--muted); }
.chip.high { background: var(--red-soft); color: var(--red-dark); }
.chip.medium { background: var(--gold-soft); color: var(--amber); }
.chip.low { background: var(--blue-soft); color: var(--blue); }

.status.pending, .status.approval { background: var(--gold-soft); color: var(--amber); }
.status.approved, .status.published { background: var(--green-soft); color: var(--green); }
.status.declined, .status.archived { background: #f4e9ea; color: #815159; }
.status.needs_info, .status.drafting { background: var(--blue-soft); color: var(--blue); }
.status.idea, .status.planned, .status.scheduled { background: var(--surface-soft); color: #5c5355; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.page-head p { margin-bottom: 0; color: var(--muted); max-width: 680px; line-height: 1.55; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .72rem;
  font-weight: 800;
  color: var(--red);
  margin-bottom: .45rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.stat-card .number {
  font-size: 2rem;
  font-weight: 750;
  letter-spacing: -.04em;
  margin: .25rem 0;
}

.stat-card small { line-height: 1.4; display: block; }

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 1.25rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  margin-bottom: .8rem;
}

.panel-head h2, .panel-head h3 { margin: 0; }

.list {
  display: grid;
}

.list-row {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: .8rem;
  align-items: center;
  padding: .85rem 0;
  border-top: 1px solid var(--line);
}

.list-row:first-child { border-top: 0; }

.date-tile {
  width: 48px;
  min-height: 48px;
  display: grid;
  place-content: center;
  text-align: center;
  background: var(--surface-soft);
  border-radius: 11px;
}

.date-tile strong { font-size: 1.1rem; line-height: 1; }
.date-tile span { font-size: .68rem; text-transform: uppercase; color: var(--muted); margin-top: .2rem; }

.list-row p { margin: .18rem 0 0; color: var(--muted); font-size: .86rem; }
.list-row strong { font-size: .93rem; }

.empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.empty strong { display: block; color: var(--ink); margin-bottom: .35rem; }

.calendar-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.calendar-toolbar .month-title { font-size: 1.2rem; font-weight: 750; letter-spacing: -.02em; }
.toolbar-group { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}

.calendar {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
}

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

.weekdays {
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.weekdays div {
  padding: .65rem;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.day {
  min-height: 132px;
  padding: .52rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.day:nth-child(7n) { border-right: 0; }
.day.other-month { background: #fcfbfa; color: #aaa2a4; }
.day.today { box-shadow: inset 0 0 0 2px rgba(124,36,50,.32); }

.day-number {
  font-size: .78rem;
  font-weight: 750;
  margin-bottom: .4rem;
}

.calendar-item {
  display: block;
  width: 100%;
  border: 0;
  border-left: 3px solid var(--red);
  border-radius: 7px;
  background: var(--red-soft);
  padding: .38rem .42rem;
  margin: .3rem 0 0;
  text-align: left;
  color: var(--red-dark);
  font-size: .72rem;
  line-height: 1.25;
  overflow: hidden;
}

.calendar-item[data-type="event"] { border-left-color: var(--blue); background: var(--blue-soft); color: #2f557f; }
.calendar-item[data-type="campaign"] { border-left-color: var(--green); background: var(--green-soft); color: var(--green); }
.calendar-item[data-type="fundraising_opportunity"] { border-left-color: #a56c17; background: var(--gold-soft); color: var(--amber); }

.cards {
  display: grid;
  gap: .85rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.card h3 { margin-bottom: .35rem; }
.card p { color: var(--muted); line-height: 1.5; margin-bottom: .5rem; }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .8rem;
  color: var(--muted);
  font-size: .8rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .9rem;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 1rem;
}

.board-column {
  min-width: 0;
}

.board-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: .6rem;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.content-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .9rem;
  margin-bottom: .65rem;
}

.content-card h3 { font-size: .94rem; margin-bottom: .4rem; }
.content-card p { font-size: .82rem; line-height: 1.45; color: var(--muted); }

.inline-select {
  width: auto;
  padding: .42rem .55rem;
  font-size: .78rem;
  border-radius: 9px;
}

.team-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
  gap: 1rem;
}

.member-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: center;
  padding: .8rem 0;
  border-top: 1px solid var(--line);
}

.member-row:first-child { border-top: 0; }

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red-dark);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.invite-link {
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
}

.invite-link input { font-size: .8rem; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 1rem;
}

.integration {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  background: var(--surface-soft);
  border-radius: 14px;
  margin-top: .7rem;
}

.modal {
  width: min(680px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  border: 0;
  border-radius: 20px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(37,20,24,.25);
}

.modal::backdrop { background: rgba(35,26,28,.48); backdrop-filter: blur(3px); }

.modal-inner { padding: 1.3rem; }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.modal-head h2 { margin: 0; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: .9rem;
}
.form-grid .full { grid-column: 1 / -1; }

.toast-region {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  display: grid;
  gap: .5rem;
  width: min(360px, calc(100vw - 2rem));
}

.toast {
  background: #2c2325;
  color: white;
  padding: .85rem 1rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  animation: toast-in .2s ease-out;
}

.toast.error { background: #8b2935; }

@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.mobile-menu { display: none; }

@media (max-width: 980px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { min-height: auto; padding: 2rem; }
  .auth-hero h1 { font-size: 3rem; }
  .auth-points { margin-top: 2rem; }
  .auth-panel { min-height: 60vh; }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2, .team-grid { grid-template-columns: 1fr; }
  .board { grid-template-columns: 1fr 1fr; }
  .day { min-height: 112px; }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    padding: .7rem;
    flex-direction: row;
    align-items: center;
  }
  .sidebar .logo { padding: 0; margin-right: auto; }
  .sidebar .nav, .sidebar-footer { display: none; }
  .mobile-menu { display: inline-flex; }
  .main { padding: .8rem 1rem 3rem; }
  .topbar { min-height: auto; }
  .user-actions .role-chip { display: none; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .filters { grid-template-columns: 1fr; }
  .calendar { overflow-x: auto; }
  .weekdays, .month-grid { min-width: 700px; }
  .settings-grid, .board { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
}

@media (max-width: 520px) {
  .auth-points { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-card .number { font-size: 1.6rem; }
  .workspace-switcher select { min-width: 120px; max-width: 160px; }
}
