:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-strong: #eef3f8;
  --ink: #162033;
  --muted: #647085;
  --line: #dbe2eb;
  --primary: #126d62;
  --primary-strong: #0a574e;
  --primary-soft: #dff3ef;
  --accent: #d4861d;
  --accent-soft: #fff0db;
  --danger: #ba2737;
  --danger-soft: #ffe5e9;
  --ok: #137a39;
  --ok-soft: #e4f7ea;
  --info: #2c62b8;
  --info-soft: #e9f1ff;
  --shadow: 0 18px 45px rgba(22, 32, 51, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(18, 109, 98, 0.12), transparent 36%),
    linear-gradient(225deg, rgba(212, 134, 29, 0.12), transparent 42%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
}

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

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
  align-items: stretch;
  background: var(--bg);
}

.login-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: 36px;
  overflow: hidden;
  background:
    linear-gradient(rgba(10, 87, 78, 0.82), rgba(10, 87, 78, 0.82)),
    url("https://images.unsplash.com/photo-1554224155-6726b3ff858f?auto=format&fit=crop&w=1600&q=80") center/cover;
  color: #ffffff;
}

.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.36));
  pointer-events: none;
}

.login-visual > * {
  position: relative;
  z-index: 1;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.brand-icon svg {
  width: 23px;
  height: 23px;
}

.login-copy {
  max-width: 560px;
}

.login-copy h1 {
  margin: 0 0 16px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 0.98;
  letter-spacing: 0;
}

.login-copy p {
  margin: 0;
  max-width: 500px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 18px;
  line-height: 1.7;
}

.login-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.login-stat {
  min-width: 0;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.login-stat strong {
  display: block;
  font-size: 24px;
}

.login-stat span {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  line-height: 1.35;
}

.login-panel {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 40px 24px;
}

.login-card {
  width: min(100%, 440px);
  padding: 30px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-card h2,
.section-title h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.login-card .helper,
.section-title p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

.field textarea {
  resize: vertical;
  min-height: 84px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 109, 98, 0.14);
}

.password-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.password-field input {
  min-width: 0;
}

.password-field .icon-button {
  height: 42px;
  width: 42px;
}

.alert {
  display: none;
  margin-top: 14px;
  padding: 11px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
}

.alert.is-visible {
  display: block;
}

.alert.error {
  color: var(--danger);
  background: var(--danger-soft);
}

.alert.success {
  color: var(--ok);
  background: var(--ok-soft);
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease,
    color 0.16s ease;
}

.button {
  padding: 10px 16px;
  font-weight: 800;
}

.button svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

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

.button.primary:hover {
  background: var(--primary-strong);
  box-shadow: 0 10px 24px rgba(18, 109, 98, 0.24);
}

.button.secondary,
.icon-button {
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.button.secondary:hover,
.icon-button:hover {
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(22, 32, 51, 0.08);
}

.button.danger,
.icon-button.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

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

.button.full {
  width: 100%;
}

.button:active,
.icon-button:active {
  transform: translateY(1px);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  background: #10232f;
  color: #ffffff;
}

.sidebar .brand-mark {
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.user-box {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f4b04f;
  color: #10232f;
  font-weight: 800;
}

.user-box strong,
.user-box span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-box strong {
  font-size: 14px;
}

.user-box span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-button {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.76);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.nav-button svg {
  width: 19px;
  height: 19px;
}

.nav-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.nav-button:hover,
.nav-button.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.main-content {
  min-width: 0;
  padding: 26px;
}

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

.topbar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.month-control {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 102px;
  gap: 8px;
  align-items: center;
  min-width: 280px;
}

.month-control select,
.month-control input {
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.panel,
.table-panel,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(22, 32, 51, 0.06);
}

.metric-card {
  min-height: 126px;
  display: grid;
  gap: 16px;
  padding: 18px;
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.metric-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
}

.metric-icon.warning {
  background: var(--accent-soft);
  color: var(--accent);
}

.metric-icon.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.metric-icon.info {
  background: var(--info-soft);
  color: var(--info);
}

.metric-icon svg {
  width: 20px;
  height: 20px;
}

.metric-value {
  display: block;
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 800;
  line-height: 1;
  word-break: break-word;
}

.metric-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 16px;
}

.panel {
  padding: 18px;
}

.panel-header,
.section-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-header h3,
.section-row h3 {
  margin: 0;
  font-size: 18px;
}

.panel-header p,
.section-row p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.progress-list {
  display: grid;
  gap: 14px;
}

.progress-item {
  display: grid;
  gap: 8px;
}

.progress-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
}

.progress-title span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.progress-bar span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  border-radius: inherit;
  background: var(--primary);
}

.activity-list,
.notification-list {
  display: grid;
  gap: 10px;
}

.activity-item,
.notification-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.activity-item .activity-icon,
.notification-item .activity-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--info-soft);
  color: var(--info);
}

.activity-icon svg {
  width: 18px;
  height: 18px;
}

.activity-item strong,
.notification-item strong {
  display: block;
  font-size: 13px;
  line-height: 1.4;
}

.activity-item span,
.notification-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.search-input {
  flex: 1 1 220px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.table-panel {
  overflow: hidden;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #fbfcfe;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.member-cell {
  display: grid;
  gap: 3px;
}

.member-cell strong {
  font-size: 14px;
}

.member-cell span {
  color: var(--muted);
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.developer {
  color: #0a574e;
  background: var(--primary-soft);
}

.pill.treasurer {
  color: #8a4f07;
  background: var(--accent-soft);
}

.pill.member {
  color: #2c62b8;
  background: var(--info-soft);
}

.pill.paid {
  color: var(--ok);
  background: var(--ok-soft);
}

.pill.unpaid {
  color: var(--danger);
  background: var(--danger-soft);
}

.payment-check {
  width: 26px;
  height: 26px;
  accent-color: var(--primary);
  cursor: pointer;
}

.payment-check:disabled {
  cursor: default;
}

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

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 16px;
}

.expense-layout,
.account-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.mini-total {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.mini-total span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mini-total strong {
  font-size: 22px;
}

.credential-box {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--info-soft);
}

.credential-box strong {
  color: var(--info);
}

.credential-box p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.credential-list {
  display: grid;
  gap: 8px;
}

.credential-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: var(--radius);
  background: #ffffff;
}

.credential-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}

.credential-item code {
  padding: 4px 6px;
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 12px;
}

.empty-state {
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

.monitor-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
}

.own-status {
  display: grid;
  gap: 10px;
}

.own-week {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.own-week strong {
  display: block;
  font-size: 13px;
}

.own-week span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.mobile-header {
  display: none;
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-2,
  .expense-layout,
  .account-layout,
  .monitor-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 470px;
  }

  .login-panel {
    min-height: auto;
  }

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: min(82vw, 310px);
    transform: translateX(-104%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: rgba(245, 247, 251, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }

  .main-content {
    padding: 18px;
  }

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

  .topbar-actions,
  .month-control {
    width: 100%;
  }

  .month-control {
    min-width: 0;
  }
}

@media (max-width: 620px) {
  .login-visual {
    min-height: 420px;
    padding: 24px;
  }

  .login-stats,
  .summary-grid,
  .form-columns {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 22px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .panel-header,
  .section-row,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .button,
  .icon-button {
    width: 100%;
  }

  .password-field .icon-button,
  .topbar-actions .icon-button,
  td .icon-button {
    width: 42px;
  }

  table {
    min-width: 680px;
  }
}
