/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  --page: #f7f5ef;
  --surface: #ffffff;
  --surface-muted: #f0eee7;
  --ink: #18212b;
  --muted: #5f6874;
  --border: #d8d2c6;
  --primary: #126a72;
  --primary-strong: #0d4d55;
  --positive: #207044;
  --negative: #b33a2f;
  --focus: #d5a11e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
}

.language-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
}

.language-link.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--border);
}

.nav-link {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--primary);
}

.account-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.account-email {
  max-width: 34ch;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flash-messages {
  display: grid;
  gap: 0.5rem;
  margin: 1rem auto 0;
  width: min(1120px, calc(100% - 2rem));
}

.flash {
  margin: 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.flash-alert {
  border-color: #e2a29b;
  color: var(--negative);
}

.dashboard,
.edit-page,
.auth-page,
.management-page,
.settings-page,
.transactions-page {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.dashboard-header,
.member-card-header,
.member-actions,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dashboard-header {
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2rem, 3rem, 3rem);
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1rem;
}

.balance {
  display: grid;
  gap: 0.1rem;
  min-width: 10rem;
  text-align: right;
}

.balance span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.balance strong {
  font-size: 1.55rem;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.member-editor,
.edit-panel,
.auth-panel {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.member-editor {
  position: sticky;
  top: 1rem;
}

.member-editor h2 {
  margin-bottom: 1rem;
}

.register-list {
  display: grid;
  gap: 1rem;
}

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

.member-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

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

.member-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.stacked-form,
.transaction-form {
  display: grid;
  gap: 0.85rem;
}

.transaction-form {
  grid-template-columns: minmax(7rem, 0.9fr) minmax(9rem, 1fr) minmax(11rem, 2fr) auto;
  align-items: end;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
}

.transaction-form .form-errors {
  grid-column: 1 / -1;
}

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

.dashboard .transaction-form .description-field,
.dashboard .transaction-form .button {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 0.35rem;
}

label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input[type="checkbox"] {
  width: 1rem;
  min-height: 1rem;
}

input:focus,
select:focus,
.button:focus-visible,
.text-button:focus-visible,
.language-link:focus-visible,
.brand:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus), transparent 45%);
  outline-offset: 2px;
}

.button,
.text-button {
  min-height: 2.5rem;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.9rem;
}

.button-primary {
  background: var(--primary);
  color: #fff;
}

.button-primary:hover {
  background: var(--primary-strong);
}

.button-secondary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--ink);
}

.button-danger {
  border-color: #e2a29b;
  background: #fff4f2;
  color: var(--negative);
}

.text-button {
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--negative);
}

.transactions {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 38rem;
}

th,
td {
  padding: 0.7rem 0.5rem;
  border-top: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.amount-column,
.action-column {
  text-align: right;
}

.page-actions {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 1rem;
}

.positive {
  color: var(--positive);
}

.negative {
  color: var(--negative);
}

.empty-state,
.empty-row {
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
}

.empty-state h2 {
  color: var(--muted);
  font-size: 1rem;
}

.form-errors {
  padding: 0.75rem;
  border: 1px solid #e2a29b;
  border-radius: 6px;
  background: #fff4f2;
  color: var(--negative);
}

.form-errors ul {
  margin: 0.35rem 0 0;
  padding-left: 1.15rem;
}

.edit-page,
.settings-page {
  max-width: 36rem;
}

.auth-page {
  max-width: 28rem;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  color: var(--primary);
  font-weight: 800;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-weight: 700;
}

.section-heading {
  margin-bottom: 1rem;
}

@media (max-width: 820px) {
  .topbar,
  .dashboard-header,
  .member-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    align-items: flex-start;
    flex-direction: column;
    width: 100%;
  }

  .account-nav {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .dashboard .register-list {
    grid-template-columns: 1fr;
  }

  .member-editor {
    position: static;
  }

  .balance {
    min-width: 0;
    text-align: left;
  }

  .transaction-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .account-nav,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .button,
  .account-nav form {
    width: 100%;
  }

  .button {
    white-space: normal;
  }
}
