:root {
  color-scheme: light;
  --bg: #f4f2ed;
  --surface: #fffdf8;
  --ink: #20201e;
  --muted: #6c6a64;
  --line: #dfdbd1;
  --accent: #167761;
  --accent-dark: #0f5f4d;
  --warning: #b4442a;
  --shadow: 0 18px 50px rgba(49, 44, 34, 0.1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
}

.brand-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(32px, 6vw, 88px);
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(18, 84, 70, 0.86), rgba(32, 32, 30, 0.58)),
    url("https://images.unsplash.com/photo-1511578314322-379afb476865?auto=format&fit=crop&w=1800&q=80")
      center / cover;
  color: #fffdf8;
}

.brand-pane::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 34%;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.35), transparent);
  pointer-events: none;
}

.brand-pane > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 10px;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-pane h1,
.topbar h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 96px);
  line-height: 0.94;
  letter-spacing: 0;
}

.brand-copy {
  max-width: 520px;
  margin: 22px 0 0;
  color: rgba(255, 253, 248, 0.82);
  font-size: 18px;
  line-height: 1.7;
}

.auth-panel {
  align-self: center;
  width: min(420px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  animation: rise 520ms ease both;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ede9df;
}

.segment {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  transition:
    background 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.segment.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(49, 44, 34, 0.08);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: rgba(22, 119, 97, 0.55);
  box-shadow: 0 0 0 4px rgba(22, 119, 97, 0.12);
  background: #fff;
}

.auth-panel label + label,
.auth-panel button {
  margin-top: 16px;
}

.primary-action,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 850;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.primary-action {
  width: 100%;
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
}

.primary-action:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.primary-action svg,
.ghost-button svg,
.icon-button svg {
  width: 17px;
  height: 17px;
}

.form-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--warning);
  font-size: 13px;
  font-weight: 750;
}

.workspace {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 44px;
  animation: fade 360ms ease both;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0 26px;
}

.topbar .eyebrow {
  color: var(--accent);
}

.topbar h1 {
  font-size: clamp(34px, 4vw, 64px);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 750;
}

.ghost-button,
.icon-button {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
  padding: 0 13px;
}

.ghost-button:hover,
.icon-button:hover {
  background: var(--surface);
  transform: translateY(-1px);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metrics article {
  padding: 22px 18px;
  border-right: 1px solid var(--line);
}

.metrics article:last-child {
  border-right: 0;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1;
}

.creation-panel,
.activity-panel {
  min-width: 0;
}

.app-tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  margin: 28px 0 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ede9df;
}

.app-tab {
  min-width: 124px;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  transition:
    background 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.app-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(49, 44, 34, 0.08);
}

.tab-panel {
  animation: fade 220ms ease both;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0;
}

#activityForm {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 720px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.wide {
  grid-column: 1 / -1;
}

.activity-list {
  display: grid;
  gap: 12px;
}

.activity-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.activity-item:hover {
  transform: translateY(-2px);
  border-color: rgba(22, 119, 97, 0.35);
  box-shadow: 0 12px 30px rgba(49, 44, 34, 0.08);
}

.activity-main {
  min-width: 0;
}

.activity-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 9px;
  font-size: 18px;
  line-height: 1.3;
}

.owner-tag,
.status-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e7f1ed;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 850;
}

.status-tag {
  background: #eee7d5;
  color: #715b19;
}

.activity-meta,
.activity-description {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.activity-description {
  margin-top: 8px;
}

.participants {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.participants-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.participant-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8f5ed;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.participant-chip span {
  color: var(--muted);
  font-weight: 700;
}

.empty-participants {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.activity-actions {
  display: grid;
  gap: 8px;
  justify-items: stretch;
}

.join-button {
  min-width: 108px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0 13px;
  min-height: 40px;
  font-weight: 850;
}

.join-button.joined {
  background: transparent;
  color: var(--accent-dark);
}

.delete-button {
  min-width: 108px;
  min-height: 40px;
  border: 1px solid rgba(180, 68, 42, 0.34);
  border-radius: 8px;
  background: transparent;
  color: var(--warning);
  padding: 0 13px;
  font-weight: 850;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.delete-button:hover {
  background: rgba(180, 68, 42, 0.08);
  transform: translateY(-1px);
}

.empty-state {
  padding: 34px 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

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

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 920px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .brand-pane {
    min-height: 42vh;
  }

  .auth-panel {
    margin: 24px auto 38px;
  }

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

  .metrics article {
    border-bottom: 1px solid var(--line);
  }

}

@media (max-width: 640px) {
  .workspace {
    width: min(100% - 24px, 1240px);
    padding-top: 18px;
  }

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

  .user-chip {
    width: 100%;
    justify-content: space-between;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .app-tabs {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .metrics article {
    border-right: 0;
  }

  #activityForm {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .activity-item {
    grid-template-columns: 1fr;
  }

  .activity-actions,
  .join-button,
  .delete-button {
    width: 100%;
  }
}
