* {
  box-sizing: border-box;
}

:root {
  --bg: #f3f6f8;
  --panel: #ffffff;
  --ink: #17242b;
  --muted: #5e6b73;
  --line: #d8e0e4;
  --field: #f9fbfc;
  --brand: #0f3f46;
  --brand-strong: #092f35;
  --accent: #b68224;
  --green: #17633a;
  --amber: #a35a12;
  --red: #b3261e;
  --shadow: 0 22px 60px rgba(28, 45, 52, 0.12);
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 32px;
  background:
    linear-gradient(180deg, rgba(15, 63, 70, 0.08), transparent 240px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
  width: min(1040px, 100%);
  margin: auto;
}

[hidden] {
  display: none !important;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 0;
  color: #102029;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.98;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.15;
}

.summary {
  display: none;
  grid-template-columns: repeat(2, minmax(132px, 1fr));
  gap: 10px;
}

.is-signed-in .summary {
  display: grid;
}

.summary span {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 14px;
  box-shadow: 0 12px 32px rgba(28, 45, 52, 0.07);
}

.summary strong {
  display: block;
  color: var(--ink);
  font-size: 22px;
}

.auth-panel,
form,
.list-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
  width: min(860px, 100%);
  margin-top: 24px;
  padding: 24px;
}

.auth-copy {
  display: grid;
  gap: 12px;
  padding: 4px 8px 4px 0;
}

.auth-copy p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.auth-badge {
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 63, 70, 0.09);
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 13px;
  margin-bottom: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.auth-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef4f6;
}

.auth-mode-button {
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.auth-mode-button.active {
  background: var(--panel);
  color: var(--brand);
  box-shadow: 0 8px 20px rgba(28, 45, 52, 0.11);
}

.auth-actions,
.account-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

#sign-out-button {
  border: 1px solid #b9c6cb;
  background: var(--panel);
  color: var(--brand);
}

.auth-message {
  grid-column: 1 / -1;
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 14px;
  font-weight: 800;
}

.account-bar {
  justify-content: space-between;
  margin: 0 0 16px;
}

.sync-status {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

#sign-out-button {
  width: auto;
  min-width: 98px;
}

#app-shell {
  display: block;
}

#march-form {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 1fr 0.85fr 0.75fr auto;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 18px;
  padding: 18px;
}

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

input,
select,
button {
  width: 100%;
  min-height: 46px;
  padding: 12px;
  border: 1px solid #b9c6cb;
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(15, 63, 70, 0.18);
  outline-offset: 2px;
  border-color: var(--brand);
}

button {
  border: 0;
  background: var(--brand);
  color: white;
  font-weight: 900;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.06);
}

input:disabled,
select:disabled,
button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.list-panel {
  padding: 18px;
}

.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

li {
  margin: 0;
}

.march-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.march-details {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.march-details strong,
.march-details span {
  overflow-wrap: anywhere;
}

.march-details strong {
  font-size: 17px;
}

.march-details span {
  color: var(--muted);
  font-size: 14px;
}

.march-location {
  color: var(--brand) !important;
  font-weight: 800;
}

.march-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.march-actions button {
  width: auto;
  min-width: 86px;
  min-height: 38px;
  padding: 8px 12px;
  font-size: 14px;
}

.status-button.paid {
  background: var(--green);
}

.status-button.unpaid {
  background: var(--amber);
}

.delete-button {
  background: var(--red);
}

#empty-state {
  margin: 18px 0 0;
  padding: 22px;
  border: 1px dashed #b9c6cb;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

#empty-state[hidden] {
  display: none;
}

@media (max-width: 860px) {
  body {
    padding: 20px;
  }

  .app-header,
  .auth-panel {
    grid-template-columns: 1fr;
  }

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

  #march-form {
    grid-template-columns: 1fr 1fr;
  }

  #march-form button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  body {
    padding: 14px;
  }

  h1 {
    font-size: 34px;
  }

  .summary,
  #march-form {
    grid-template-columns: 1fr;
  }

  .auth-panel,
  #march-form,
  .list-panel {
    padding: 14px;
  }

  .auth-actions,
  .account-bar {
    align-items: stretch;
    flex-direction: column;
  }

  #sign-out-button {
    width: 100%;
  }

  .march-item {
    align-items: stretch;
    flex-direction: column;
  }

  .march-actions {
    width: 100%;
  }

  .march-actions button {
    flex: 1;
    min-width: 0;
  }
}
