:root {
  --primary-navy: #071b33;
  --accent-green: #66b947;
  --background: #f7f9fc;
  --card-white: #ffffff;
  --main-text: #1f2933;
  --secondary-text: #6b7280;
  --warning-red: #b91c1c;
  --border-grey: #d9e2ec;
  --soft-green: #eaf7e6;
  --shadow: 0 12px 28px rgba(7, 27, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--main-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--background);
}

.screen {
  min-height: 100vh;
  padding: 24px 18px 120px;
}

.auth-screen {
  padding-bottom: 128px;
  text-align: center;
}

.register-screen {
  padding-bottom: 140px;
}

.splash {
  display: grid;
  place-content: center;
  text-align: center;
  background: var(--primary-navy);
  color: white;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 24px;
  background: var(--accent-green);
  color: var(--primary-navy);
  font-size: 28px;
  font-weight: 900;
}

.brand-mark.small {
  width: 44px;
  height: 44px;
  margin: 0;
  border-radius: 14px;
  font-size: 16px;
}

.logo-button {
  flex: 0 0 auto;
  padding: 0;
  background: transparent;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--secondary-text);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

h1 {
  margin-bottom: 6px;
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 12px;
  font-size: 23px;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.muted {
  color: var(--secondary-text);
}

.card {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--border-grey);
  border-radius: 20px;
  background: var(--card-white);
  box-shadow: var(--shadow);
}

.card.compact {
  padding: 12px;
}

.password-control {
  position: relative;
  display: flex;
  align-items: center;
}

.password-control input {
  padding-right: 76px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: auto;
  min-height: 30px;
  border: 0;
  border-radius: 11px;
  background: var(--background);
  color: var(--primary-navy);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
}

.password-toggle:focus {
  outline: 2px solid var(--primary-navy);
  outline-offset: 2px;
}

.welcome-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: var(--primary-navy);
  color: white;
  padding: 24px 18px;
  text-align: center;
}

.welcome-card::before {
  content: "";
  width: 34px;
  height: 5px;
  border-radius: 999px;
  background: var(--accent-green);
}

.welcome-card h2,
.welcome-card p {
  margin-bottom: 0;
  color: white;
}

.welcome-card h2 {
  font-size: 24px;
}

.welcome-card p {
  line-height: 1.45;
}

.auth-card {
  margin-top: 36px;
  text-align: left;
}

.auth-action-card {
  text-align: left;
}

.auth-action-card h1 {
  margin-bottom: 12px;
}

.info-panel {
  margin-bottom: 16px;
  border: 1px solid rgba(102, 185, 71, 0.32);
  border-radius: 18px;
  background: var(--soft-green);
  color: var(--primary-navy);
  padding: 14px;
}

.info-panel.compact {
  padding: 12px;
}

.info-panel h1,
.info-panel h2,
.info-panel p {
  margin-bottom: 8px;
}

.info-panel p:last-child {
  margin-bottom: 0;
}

.password-requirements {
  margin: 0 0 14px;
  border: 1px solid var(--border-grey);
  border-radius: 16px;
  background: var(--background);
  padding: 12px;
  color: var(--secondary-text);
  font-size: 13px;
}

.password-requirements strong {
  display: block;
  margin-bottom: 6px;
  color: var(--main-text);
}

.password-requirements ul {
  margin: 0;
  padding-left: 18px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field span,
label span {
  font-size: 13px;
  font-weight: 750;
  color: var(--main-text);
}

.helper-text {
  color: var(--secondary-text);
  font-size: 12px;
  line-height: 1.35;
}

.currency-custom-fields[hidden] {
  display: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border-grey);
  border-radius: 14px;
  background: white;
  color: var(--main-text);
  padding: 12px;
  min-height: 46px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary-navy);
  box-shadow: 0 0 0 3px rgba(7, 27, 51, 0.12);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--warning-red);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.1);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 16px;
}

.checkbox-row input {
  width: auto;
}

.button,
.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  width: 100%;
  border-radius: 15px;
  padding: 12px 16px;
  font-weight: 850;
  text-decoration: none;
}

.button.navy {
  background: var(--primary-navy);
  color: white;
}

.button.green {
  background: var(--accent-green);
  color: var(--primary-navy);
}

.button.ghost {
  border: 1px solid var(--border-grey);
  background: white;
  color: var(--primary-navy);
}

.button.warning {
  background: var(--warning-red);
  color: white;
}

.button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button + .button {
  margin-top: 10px;
}

.compact-button {
  width: auto;
  min-height: 38px;
  padding: 8px 12px;
  font-size: 13px;
}

.row .button + .button {
  margin-top: 0;
}

.link-button {
  width: auto;
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--primary-navy);
  font-weight: 850;
  text-decoration: underline;
}

.link-button:focus {
  outline: 2px solid var(--primary-navy);
  outline-offset: 3px;
  border-radius: 6px;
}

.auth-switch {
  margin: 14px 0 0;
  color: var(--secondary-text);
  text-align: center;
}

.auth-link {
  color: var(--primary-navy);
  vertical-align: baseline;
}

.grid {
  display: grid;
  gap: 12px;
}

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

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

.stat {
  padding: 14px;
  border-radius: 18px;
  background: white;
  border: 1px solid var(--border-grey);
}

.stat strong {
  display: block;
  margin-top: 6px;
  color: var(--primary-navy);
  font-size: 22px;
}

.underpaid {
  color: var(--warning-red);
}

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

.list {
  display: grid;
  gap: 10px;
}

.button + .list {
  margin-top: 12px;
}

.detail-actions {
  margin-top: 14px;
  padding-bottom: 6px;
}

.list-item {
  display: grid;
  gap: 6px;
  padding: 13px;
  border: 1px solid var(--border-grey);
  border-radius: 16px;
  background: white;
  text-align: left;
  color: inherit;
}

.list-main {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.list-item strong {
  color: var(--primary-navy);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pill {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--soft-green);
  color: var(--primary-navy);
  font-size: 12px;
  font-weight: 850;
}

.notice {
  margin-bottom: 14px;
  border-radius: 16px;
  padding: 12px;
  background: #fff7ed;
  color: #7c2d12;
}

.danger-zone {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  border-top: 1px solid var(--border-grey);
  padding-top: 16px;
}

.danger-zone h3,
.danger-zone p {
  margin: 0;
}

.report-range {
  margin: 0 0 14px;
  color: var(--secondary-text);
}

.report-range strong {
  color: var(--main-text);
}

.currency-total-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  border: 1px solid var(--border-grey);
  border-radius: 18px;
  background: white;
  padding: 14px;
}

.currency-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--main-text);
}

.currency-total-row strong {
  color: var(--primary-navy);
}

.error {
  color: var(--warning-red);
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(100%, 480px);
  margin: 0 auto;
  border-top: 1px solid var(--border-grey);
  background: white;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}

.nav-button {
  min-height: 42px;
  border-radius: 12px;
  padding: 8px 4px;
  background: transparent;
  color: var(--secondary-text);
  font-size: 12px;
}

.nav-button.active {
  background: var(--primary-navy);
  color: white;
}

.empty-state {
  border: 1px dashed var(--border-grey);
  border-radius: 18px;
  padding: 16px;
  color: var(--secondary-text);
  text-align: center;
}

.chart-wrap {
  display: grid;
  gap: 16px;
  justify-items: center;
  min-height: 252px;
  align-content: center;
}

.chart-card {
  min-height: 280px;
}

.chart-card h2 {
  text-align: center;
}

.donut-chart {
  position: relative;
  display: grid;
  place-items: center;
  width: 176px;
  height: 176px;
  border: 0;
  border-radius: 50%;
  background: white;
  color: var(--primary-navy);
  font-weight: 900;
  box-shadow: var(--shadow);
}

.donut-chart svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-base-ring,
.donut-empty-ring {
  fill: none;
  stroke: var(--border-grey);
  stroke-width: 8;
}

.donut-segment {
  fill: none;
  stroke-width: 8;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.donut-segment:hover {
  opacity: 0.78;
}

.donut-chart span {
  position: relative;
  z-index: 1;
  max-width: 96px;
  text-align: center;
  line-height: 1.2;
}

.empty-donut {
  cursor: pointer;
}

.empty-donut span {
  color: var(--main-text);
  font-size: 14px;
}

.chart-helper {
  margin: -4px 0 0;
  text-align: center;
}

.chart-legend {
  display: grid;
  gap: 8px;
  width: 100%;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-grey);
  border-radius: 14px;
  background: white;
  color: var(--main-text);
  padding: 10px;
  text-align: left;
}

.legend-dot {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border-radius: 999px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  left: 18px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(calc(100% - 36px), 444px);
  margin: 0 auto;
  border-radius: 16px;
  background: var(--primary-navy);
  color: white;
  padding: 13px 15px;
  box-shadow: var(--shadow);
}

.toast-accent {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent-green);
}

.chart-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 11;
  display: grid;
  align-items: end;
  justify-items: center;
  background: rgba(7, 27, 51, 0.22);
  padding: 18px;
}

.chart-popup-card {
  width: min(100%, 444px);
  border: 1px solid var(--border-grey);
  border-radius: 22px;
  background: white;
  padding: 16px;
  box-shadow: var(--shadow);
}

.chart-popup-card p {
  margin-bottom: 8px;
}

.danger-dialog-overlay {
  align-items: center;
  background: rgba(7, 27, 51, 0.58);
}

.danger-dialog-card {
  width: min(100%, 440px);
  border: 1px solid var(--border-grey);
  border-radius: 24px;
  background: var(--card-white);
  padding: 22px;
  box-shadow: 0 22px 60px rgba(7, 27, 51, 0.28);
}

.danger-dialog-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 14px;
  border-radius: 16px;
  background: rgba(185, 28, 28, 0.1);
  color: var(--warning-red);
  font-size: 24px;
  font-weight: 950;
}

.danger-dialog-title {
  margin: 0 0 8px;
  color: var(--main-text);
  font-size: 22px;
  line-height: 1.15;
}

.danger-dialog-job {
  margin: 0 0 14px;
  color: var(--primary-navy);
  font-weight: 850;
}

.danger-dialog-body p {
  margin: 0 0 10px;
  color: var(--secondary-text);
  line-height: 1.45;
}

.danger-dialog-body .danger-dialog-warning {
  color: var(--warning-red);
  font-weight: 850;
}

.danger-dialog-meta {
  display: grid;
  gap: 8px;
  margin: 16px 0 18px;
  border: 1px solid var(--border-grey);
  border-radius: 16px;
  background: var(--background);
  padding: 12px;
  color: var(--main-text);
  font-weight: 800;
}

.danger-dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.danger-dialog-actions .button + .button {
  margin-top: 0;
}

@media (max-width: 390px) {
  .danger-dialog-actions {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 760px) {
  body {
    background: linear-gradient(130deg, #eef4fb, #f7f9fc);
  }

  .app-shell {
    box-shadow: 0 0 70px rgba(7, 27, 51, 0.16);
  }
}
