:root {
  --moss: #24201b;
  --sage: #7d8c76;
  --ochre: #c6a27d;
  --sand: #f7f2ea;
  --oat: #fff8ed;
  --ink: #15130f;
  --muted: #6f675f;
  --danger: #8f3329;
  --shadow: 0 24px 55px rgba(21, 19, 15, 0.16);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  min-width: 320px;
  background: var(--sand);
  color: var(--ink);
  font-family: "Epilogue", system-ui, sans-serif;
}

.auth-screen {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  min-height: 100vh;
  background: var(--sand);
}

.auth-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(38px, 7vw, 90px);
  overflow: hidden;
  color: var(--oat);
  background: var(--moss);
}

.auth-visual::before {
  position: absolute;
  right: -140px;
  bottom: -120px;
  width: 440px;
  height: 440px;
  border: 1px solid rgba(255, 248, 237, 0.28);
  border-radius: 50%;
  box-shadow: inset 0 0 0 72px rgba(198, 162, 125, 0.12), inset 0 0 0 144px rgba(125, 140, 118, 0.12);
  content: "";
}

.auth-visual img {
  position: relative;
  z-index: 1;
  width: 92px;
  height: 92px;
  padding: 9px;
  object-fit: contain;
  border-radius: 25px;
  background: var(--oat);
}

.auth-visual > div { position: relative; z-index: 1; }
.auth-visual span { color: var(--ochre); font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.auth-visual strong { display: block; margin-top: 18px; font-size: clamp(42px, 6vw, 78px); line-height: 0.96; letter-spacing: -0.055em; }

.auth-panel { display: grid; place-items: center; padding: 38px; }

.auth-card {
  display: grid;
  gap: 19px;
  width: min(430px, 100%);
  padding: clamp(30px, 5vw, 52px);
  border: 1px solid rgba(21, 19, 15, 0.1);
  border-radius: 28px;
  background: var(--oat);
  box-shadow: var(--shadow);
}

.auth-logo { display: none; width: 72px; height: 72px; object-fit: contain; }
.auth-heading p { margin: 0 0 12px; color: #9d7856; font-size: 10px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; }
.auth-heading h1 { margin: 0; font-size: 42px; letter-spacing: -0.05em; }
.auth-heading > span { display: block; margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.55; }

.auth-card label:not(.auth-remember) { display: grid; gap: 8px; font-size: 11px; font-weight: 700; }
.auth-card input[type="email"], .auth-card input[type="password"] {
  width: 100%;
  height: 48px;
  border: 1px solid rgba(21, 19, 15, 0.16);
  border-radius: 12px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--sand);
  outline: none;
  transition: border-color 220ms ease, box-shadow 220ms ease;
}

.auth-card input:focus { border-color: #9d7856; box-shadow: 0 0 0 3px rgba(198, 162, 125, 0.2); }
.auth-remember { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; }
.auth-remember input { accent-color: var(--moss); }
.auth-submit { height: 48px; border: 0; border-radius: 12px; color: var(--oat); background: var(--moss); cursor: pointer; font-weight: 700; }
.auth-submit:disabled { cursor: wait; opacity: 0.65; }
.auth-status { min-height: 34px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.auth-status.is-error { color: var(--danger); }

body.authenticated .auth-screen { display: none; }

button, a { font: inherit; }

button { color: inherit; }

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 26px 18px 20px;
  overflow-y: auto;
  color: var(--sand);
  background: var(--moss);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 26px;
  border-bottom: 1px solid rgba(255, 248, 237, 0.22);
}

.brand img {
  width: 54px;
  height: 54px;
  padding: 4px;
  object-fit: contain;
  border-radius: 18px;
  background: var(--sand);
}

.brand strong, .brand span { display: block; }
.brand strong { font-size: 14px; line-height: 1.2; }
.brand span { margin-top: 5px; color: rgba(255, 248, 237, 0.72); font-size: 10px; }

.sidebar-nav { display: grid; gap: 7px; padding-top: 24px; }

.project-subnav {
  display: grid;
  max-height: 0;
  margin: -2px 0 2px 19px;
  overflow: hidden;
  border-left: 1px solid rgba(255, 248, 237, 0.18);
  opacity: 0;
  transition: max-height 260ms ease, opacity 220ms ease;
}

.project-subnav.is-open {
  max-height: 170px;
  padding: 4px 0 6px 10px;
  opacity: 1;
}

.project-subnav button {
  position: relative;
  display: block;
  width: 100%;
  min-height: 31px;
  overflow: hidden;
  border: 0;
  border-radius: 9px;
  padding: 0 9px 0 14px;
  color: rgba(255, 248, 237, 0.58);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 500;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 200ms ease, background 200ms ease;
}

.project-subnav button::before {
  position: absolute;
  left: 1px;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  transform: translateY(-50%);
}

.project-subnav button:hover,
.project-subnav button.is-active { color: var(--oat); background: rgba(255, 248, 237, 0.08); }
.project-subnav button.is-active::before { color: var(--ochre); }

.nav-label {
  margin: 20px 12px 4px;
  color: var(--oat);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 13px;
  border: 0;
  border-radius: 16px;
  color: rgba(255, 248, 237, 0.78);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  transition: background 240ms ease, color 240ms ease, transform 240ms ease;
}

.nav-item:hover { color: var(--sand); transform: translateX(2px); }
.nav-item.is-active { color: var(--moss); background: var(--sand); }

.nav-item svg, .menu-button svg, .project-icon svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-account {
  margin-top: auto;
  padding: 17px;
  border: 1px solid rgba(255, 248, 237, 0.22);
  border-radius: 20px;
  background: rgba(125, 140, 118, 0.18);
}

.sidebar-account span { display: block; overflow: hidden; color: var(--oat); font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account button { margin-top: 10px; padding: 0; border: 0; color: rgba(255, 248, 237, 0.68); background: transparent; cursor: pointer; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
.sidebar-account button:hover { color: var(--oat); }

.workspace {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
  min-height: 100vh;
  background: var(--sand);
}

.workspace-header {
  display: none;
}

.workspace-header > div { min-width: 0; }
.workspace-header p { margin: 0 0 5px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; }
.workspace-header h1 { margin: 0; overflow: hidden; font-size: clamp(19px, 2vw, 26px); line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }

.open-project {
  margin-left: auto;
  padding: 10px 14px;
  border: 1px solid rgba(21, 19, 15, 0.25);
  border-radius: 14px;
  color: var(--moss);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  transition: background 220ms ease, color 220ms ease;
}

.open-project:hover { color: var(--sand); background: var(--moss); }

.workspace-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

body.home-active .dashboard-home { width: 100%; max-width: none; box-sizing: border-box; }

.amount-privacy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.amount-privacy svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.amount-privacy:hover,
.amount-privacy[aria-pressed="true"] {
  color: var(--sand);
  background: var(--moss);
}

.amount-privacy.is-hidden { display: none !important; }

.menu-button {
  display: none;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(21, 19, 15, 0.22);
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
}

.dashboard-home {
  display: grid;
  align-content: start;
  gap: 18px;
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 3vw, 38px);
}

.dashboard-greeting {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(390px, .65fr);
  min-height: 230px;
  overflow: hidden;
  border-radius: 28px;
  color: var(--sand);
  background: var(--moss);
  box-shadow: var(--shadow);
}

.greeting-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(30px, 5vw, 54px);
}

.greeting-copy::after {
  position: absolute;
  right: -90px;
  bottom: -145px;
  width: 310px;
  height: 310px;
  border: 1px solid rgba(255, 248, 237, .22);
  border-radius: 50%;
  box-shadow: inset 0 0 0 62px rgba(198, 162, 125, .09), inset 0 0 0 124px rgba(125, 140, 118, .08);
  content: "";
}

.greeting-copy > * { position: relative; z-index: 1; }
.greeting-copy > p { margin: 0 0 14px; color: var(--ochre); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.greeting-copy h2 { max-width: 720px; margin: 0; font-size: clamp(34px, 4.5vw, 58px); line-height: .98; letter-spacing: -.055em; }
.greeting-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 23px; color: rgba(255, 248, 237, .68); font-size: 11px; }
.greeting-meta span + span { position: relative; }
.greeting-meta span + span::before { position: absolute; left: -10px; content: "·"; }

.dashboard-counters { display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); padding: 14px; gap: 10px; background: rgba(255, 248, 237, .05); }
.dashboard-counters button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: end;
  gap: 4px 18px;
  border: 1px solid rgba(255, 248, 237, .12);
  border-radius: 18px;
  padding: 19px 21px;
  color: var(--sand);
  background: rgba(255, 248, 237, .07);
  cursor: pointer;
  text-align: left;
  transition: background 180ms ease, transform 180ms ease;
}
.dashboard-counters button:hover { background: rgba(255, 248, 237, .12); transform: translateX(-2px); }
.dashboard-counters span { align-self: start; color: var(--ochre); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.dashboard-counters strong { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: clamp(32px, 4vw, 48px); line-height: 1; letter-spacing: -.05em; }
.dashboard-counters small { color: rgba(255, 248, 237, .62); font-size: 10px; }

.dashboard-information-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 18px; }
.dashboard-panel { min-width: 0; border: 1px solid rgba(21, 19, 15, .1); border-radius: 24px; padding: 24px; background: var(--oat); box-shadow: 0 14px 32px rgba(21, 19, 15, .07); }
.dashboard-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.dashboard-panel-heading p,
.dashboard-projects-heading p { margin: 0 0 6px; color: #9d7856; font-size: 9px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.dashboard-panel-heading h3,
.dashboard-projects-heading h3 { margin: 0; font-size: 21px; letter-spacing: -.035em; }
.dashboard-panel-heading button { border: 0; padding: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 10px; font-weight: 800; }
.dashboard-panel-heading button:hover { color: var(--ink); }

.upcoming-events { display: grid; gap: 9px; }
.upcoming-event {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 66px;
  border: 1px solid rgba(21, 19, 15, .08);
  border-radius: 15px;
  padding: 9px 13px 9px 9px;
  color: var(--ink);
  background: rgba(255, 255, 255, .5);
  cursor: pointer;
  text-align: left;
}
.upcoming-event:hover { border-color: rgba(157, 120, 86, .38); background: #fffaf2; }
.event-date { display: grid; min-height: 46px; place-items: center; border-radius: 11px; color: var(--sand); background: var(--sage); }
.event-date strong { font-size: 18px; line-height: 1; }
.event-date span { font-size: 8px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.event-copy { min-width: 0; }
.event-copy strong,.event-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-copy strong { font-size: 12px; }
.event-copy span { margin-top: 5px; color: var(--muted); font-size: 10px; }
.event-arrow { color: var(--muted); font-size: 16px; }

.recent-activity { display: grid; gap: 10px; }
.recent-record { display: grid; gap: 7px; min-height: 104px; border: 1px solid rgba(21, 19, 15, .09); border-radius: 16px; padding: 17px; color: var(--ink); background: rgba(255, 255, 255, .52); cursor: pointer; text-align: left; }
.recent-record:hover { border-color: rgba(157, 120, 86, .38); background: #fffaf2; }
.recent-record > span { color: #9d7856; font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.recent-record strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.recent-record small { color: var(--muted); font-size: 9px; line-height: 1.45; }
.dashboard-empty { margin: 0; border: 1px dashed rgba(21, 19, 15, .14); border-radius: 14px; padding: 22px; color: var(--muted); font-size: 10px; text-align: center; }

.dashboard-projects-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 8px 2px 0; }
.dashboard-projects-heading > span { max-width: 430px; color: var(--muted); font-size: 10px; line-height: 1.5; text-align: right; }

.welcome-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 220px;
  padding: clamp(28px, 5vw, 56px);
  overflow: hidden;
  border-radius: 30px;
  color: var(--sand);
  background: var(--moss);
  box-shadow: var(--shadow);
}

.welcome-card::after {
  position: absolute;
  right: -55px;
  bottom: -95px;
  width: 270px;
  height: 270px;
  border-radius: 50%;
  background: var(--ochre);
  content: "";
  opacity: 0.92;
}

.welcome-card > div:first-child { position: relative; z-index: 1; max-width: 650px; }
.welcome-card p { margin: 0 0 13px; color: var(--oat); font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.welcome-card h2 { margin: 0; font-size: clamp(28px, 4.3vw, 52px); line-height: 1.03; letter-spacing: -0.045em; }
.welcome-card span { display: block; margin-top: 18px; color: rgba(255, 248, 237, 0.76); font-size: 12px; line-height: 1.6; }

.welcome-mark {
  position: relative;
  z-index: 1;
  display: grid;
  width: 94px;
  height: 94px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 248, 237, 0.35);
  border-radius: 50%;
  font-size: 24px;
  font-weight: 700;
}

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

.project-card {
  position: relative;
  display: grid;
  min-height: 205px;
  padding: 25px;
  overflow: hidden;
  border: 0;
  border-radius: 26px;
  color: var(--ink);
  background: var(--oat);
  box-shadow: 0 16px 36px rgba(21, 19, 15, 0.1);
  cursor: pointer;
  text-align: left;
  transition: transform 260ms ease, box-shadow 260ms ease;
}

.project-card:hover { transform: translateY(-5px); box-shadow: 0 24px 44px rgba(21, 19, 15, 0.16); }
.project-card--planner { background: var(--sage); }
.project-card--invoices { background: var(--ochre); }
.project-number { position: absolute; top: 22px; right: 22px; margin: 0; color: rgba(21, 19, 15, 0.55); font-size: 10px; font-weight: 700; }
.project-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 15px; color: var(--sand); background: var(--moss); }
.project-card h3 { margin: 22px 0 8px; font-size: 20px; letter-spacing: -0.03em; }
.project-card p { margin: 0; color: rgba(21, 19, 15, 0.72); font-size: 11px; line-height: 1.6; }
.card-action { align-self: end; margin-top: 20px; color: var(--moss); font-size: 10px; font-weight: 700; }

.project-stage { position: relative; min-height: 0; padding: 0; }

#projectFrame {
  display: block;
  width: 100%;
  height: 100vh;
  min-height: 100%;
  border: 0;
  border-radius: 0;
  background: var(--sand);
  box-shadow: var(--shadow);
}

.frame-loader {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 0;
  color: var(--muted);
  background: var(--sand);
  font-size: 11px;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.frame-loader span { width: 16px; height: 16px; border: 2px solid var(--sage); border-top-color: var(--moss); border-radius: 50%; animation: spin 700ms linear infinite; }
.frame-loader.is-loaded { visibility: hidden; opacity: 0; }

.sidebar-scrim { display: none; }
.is-hidden { display: none !important; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

@media (max-width: 900px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100vh; padding: 22px; }
  .auth-logo { display: block; }
  .dashboard-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: min(280px, 86vw); box-shadow: 22px 0 44px rgba(21, 19, 15, 0.22); transition: transform 260ms ease; }
  body.nav-open .sidebar { transform: translateX(0); }
  .menu-button { display: grid; }
  .menu-button {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 20;
    display: grid;
    background: rgba(247, 242, 234, 0.92);
    backdrop-filter: blur(12px);
  }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 15; border: 0; background: rgba(21, 19, 15, 0.45); }
  body.nav-open .sidebar-scrim { display: block; }
  .dashboard-greeting { grid-template-columns: 1fr; }
  .dashboard-counters { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; }
  .dashboard-information-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card { min-height: 205px; }
}

@media (max-width: 620px) {
  .auth-card { padding: 28px 23px; border-radius: 22px; }
  .auth-heading h1 { font-size: 36px; }
  .open-project { padding: 9px 11px; font-size: 9px; }
  .dashboard-home { gap: 14px; padding: 14px; }
  .dashboard-greeting { min-height: 0; border-radius: 22px; }
  .greeting-copy { min-height: 210px; padding: 30px 24px; }
  .greeting-copy h2 { font-size: clamp(33px, 11vw, 46px); }
  .dashboard-counters { grid-template-columns: 1fr; padding: 10px; }
  .dashboard-counters button { min-height: 100px; padding: 17px; }
  .dashboard-information-grid { gap: 14px; }
  .dashboard-panel { border-radius: 20px; padding: 19px; }
  .dashboard-panel-heading { align-items: flex-end; }
  .upcoming-event { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; }
  .dashboard-projects-heading { align-items: flex-start; flex-direction: column; gap: 7px; }
  .dashboard-projects-heading > span { text-align: left; }
  .welcome-card { align-items: flex-start; min-height: 270px; padding: 30px 26px; }
  .welcome-card h2 { font-size: 34px; }
  .welcome-mark { display: none; }
  .project-stage { padding: 0; }
  #projectFrame { height: 100vh; min-height: 100%; border-radius: 0; }
  .frame-loader { inset: 0; border-radius: 0; }
}
