.auth-pending .app {
  display: none;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: #f7f8fa;
}

.auth-gate[hidden] {
  display: none;
}

.auth-shell {
  width: min(100%, 420px);
  background: #fff;
  border: 1px solid #eceff3;
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(31, 35, 41, 0.09);
  overflow: hidden;
}

.auth-accent {
  height: 4px;
  background: #ff8a00;
}

.auth-content {
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 22px;
}

.auth-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #ff8a00;
  font-weight: 800;
}

.auth-brand strong {
  display: block;
  font-size: 19px;
}

.auth-brand span {
  display: block;
  margin-top: 2px;
  color: #7a8494;
  font-size: 12px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  margin-bottom: 20px;
  border: 1px solid #eceff3;
  border-radius: 8px;
  background: #f8fafc;
}

.auth-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  color: #7a8494;
  background: transparent;
  cursor: pointer;
}

.auth-tabs button.is-active {
  color: #b45309;
  background: #fff;
  box-shadow: 0 1px 4px rgba(31, 35, 41, 0.08);
  font-weight: 700;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form[hidden] {
  display: none;
}

.auth-field label {
  display: block;
  margin-bottom: 6px;
  color: #5f6978;
  font-size: 13px;
  font-weight: 650;
}

.auth-field input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #dfe3e8;
  border-radius: 7px;
  color: #1f2329;
  background: #fff;
  outline: none;
}

.auth-field input:focus {
  border-color: #ff9b22;
  box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.1);
}

.auth-submit,
.account-primary {
  min-height: 46px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: #e87400;
  font-weight: 750;
  cursor: pointer;
}

.auth-submit:disabled,
.account-primary:disabled {
  opacity: 0.55;
  cursor: wait;
}

.auth-link {
  border: 0;
  padding: 3px 0;
  color: #2f80ed;
  background: transparent;
  font-size: 13px;
  cursor: pointer;
}

.auth-secondary {
  text-align: center;
}

.auth-status {
  min-height: 20px;
  color: #7a8494;
  font-size: 13px;
  line-height: 1.5;
}

.auth-status.is-error {
  color: #c43d4a;
}

.auth-status.is-success {
  color: #12825f;
}

.auth-dev-link {
  display: block;
  margin-top: 8px;
  color: #2f80ed;
  overflow-wrap: anywhere;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.account-trigger {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 7px;
  border: 1px solid #eceff3;
  border-radius: 8px;
  color: #1f2329;
  background: #fff;
  cursor: pointer;
}

.account-avatar {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #b45309;
  background: #fff3e1;
  font-size: 12px;
  font-weight: 800;
}

.account-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(17, 24, 39, 0.42);
}

.account-modal.is-open {
  display: flex;
}

.account-dialog {
  width: min(100%, 520px);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 22px 56px rgba(17, 24, 39, 0.2);
}

.account-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 18px;
  border-bottom: 1px solid #eceff3;
}

.account-head h2 {
  margin: 0;
  font-size: 18px;
}

.account-close {
  width: 34px;
  height: 34px;
  border: 1px solid #eceff3;
  border-radius: 7px;
  color: #5f6978;
  background: #fff;
  font-size: 21px;
  cursor: pointer;
}

.account-body {
  display: grid;
  gap: 20px;
  padding: 18px;
}

.account-section {
  display: grid;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eceff3;
}

.account-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.account-section h3 {
  margin: 0;
  font-size: 15px;
}

.account-email {
  padding: 11px 12px;
  border: 1px solid #eceff3;
  border-radius: 7px;
  color: #5f6978;
  background: #f8fafc;
  overflow-wrap: anywhere;
}

.account-logout {
  min-height: 42px;
  border: 1px solid #dfe3e8;
  border-radius: 7px;
  color: #1f2329;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

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

  .auth-content {
    padding: 23px 18px;
  }

  .topbar {
    flex-direction: row !important;
    align-items: center !important;
  }

  .brand-subtitle,
  .account-trigger > span:last-child {
    display: none;
  }

  .top-actions {
    margin-left: auto;
  }

  .top-actions .asof {
    display: none;
  }

  .tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    min-height: 62px;
    margin: 0;
    padding: 5px 5px calc(5px + env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 0;
    box-shadow: 0 -8px 24px rgba(31, 35, 41, 0.08);
    overflow: visible;
  }

  .tab {
    min-width: 0;
    padding: 9px 2px;
    border-radius: 6px;
    font-size: 11px;
  }

  .hero {
    padding: 14px;
  }

  .app:not([data-active-tab="overview"]) .hero {
    display: none;
  }

  .asset-value {
    font-size: 30px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
  }

  .metric:last-child {
    grid-column: 1 / -1;
  }

  .panel,
  .group-card,
  .hero {
    border-radius: 8px;
    box-shadow: none;
  }

  .group-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px !important;
  }

  .table-wrap {
    overflow: visible !important;
  }

  .table {
    min-width: 0 !important;
  }

  .table thead {
    display: none;
  }

  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    padding: 14px;
    border-bottom: 1px solid #eceff3;
  }

  .table td {
    position: relative;
    padding: 0 !important;
    border: 0 !important;
    text-align: left !important;
    white-space: normal !important;
  }

  .table td:first-child {
    grid-column: 1 / -1;
    padding-bottom: 4px !important;
  }

  .table td:not(:first-child)::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: #7a8494;
    font-size: 11px;
  }

  .calendar-grid {
    gap: 3px;
  }

  .calendar-cell {
    min-height: 52px;
    padding: 4px;
    font-size: 10px;
  }

  .account-modal {
    align-items: flex-end;
    padding: 0;
  }

  .account-dialog {
    max-height: 90vh;
    border-radius: 10px 10px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
}
