:root {
  --bg: #0e0d0b;
  --bg2: #161410;
  --bg3: #1e1c17;
  --bg4: #252118;
  --gold: #c8871a;
  --gold2: #e09d2a;
  --gold-soft: rgba(200, 135, 26, 0.12);
  --gold-border: rgba(200, 135, 26, 0.25);
  --text: #f0ebe0;
  --text2: #a89e8a;
  --text3: #6b6358;
  --red: #c0392b;
  --green: #27a060;
  --green-soft: rgba(39, 160, 96, 0.12);
  --red-soft: rgba(192, 57, 43, 0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --nav-h: 64px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "DM Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(200, 135, 26, 0.08) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 90% 80%, rgba(200, 135, 26, 0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 0 100px;
}

.header {
  padding: 28px 20px 0;
  animation: fadeUp 0.5s ease both;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--gold) 0%, #8b5a0d 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 2px 12px rgba(200, 135, 26, 0.3);
}

.brand-text {
  line-height: 1.2;
}

.brand-name {
  font-family: "DM Serif Display", serif;
  font-size: 17px;
  color: var(--text);
}

.brand-sub {
  font-size: 11px;
  color: var(--text3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 0 20px;
  margin-bottom: 24px;
  animation: fadeUp 0.5s 0.05s ease both;
}

.tab-btn {
  flex: 1;
  padding: 9px 4px;
  background: var(--bg3);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text3);
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.01em;
}

.tab-btn.active {
  background: var(--gold-soft);
  border-color: var(--gold-border);
  color: var(--gold2);
}

.card-copy {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text2);
  margin-top: -8px;
  margin-bottom: 16px;
}

.page {
  display: none;
  padding: 0 20px;
}

.page.active {
  display: block;
}

.card {
  background: var(--bg2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  animation: fadeUp 0.4s ease both;
}

.card-title {
  font-family: "DM Serif Display", serif;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 16px;
  background: var(--gold);
  border-radius: 2px;
}

.field {
  margin-bottom: 14px;
}

.field:last-of-type {
  margin-bottom: 0;
}

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}

input,
select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

input:focus,
select:focus {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 3px rgba(200, 135, 26, 0.1);
  background: var(--bg4);
}

input[type="number"] {
  font-size: 22px;
  font-weight: 500;
  color: var(--gold2);
  letter-spacing: -0.01em;
}

input[type="date"],
input[type="time"] {
  color-scheme: dark;
}

select option {
  background: var(--bg3);
  color: var(--text);
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.quick-grid .btn {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  margin-top: 0;
}

.divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 18px 0;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--gold) 0%, #9e6a0a 100%);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition:
    opacity 0.2s,
    transform 0.15s;
  box-shadow: 0 4px 16px rgba(200, 135, 26, 0.25);
  letter-spacing: 0.01em;
  margin-top: 6px;
}

.btn:hover {
  opacity: 0.92;
}

.btn:active {
  transform: scale(0.98);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gold-border);
  color: var(--gold2);
  box-shadow: none;
}

.btn-outline:hover {
  background: var(--gold-soft);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid rgba(192, 57, 43, 0.3);
  color: #e05a4a;
  box-shadow: none;
  font-size: 12px;
  padding: 7px 12px;
  width: auto;
}

.btn-danger-outline:hover {
  background: var(--red-soft);
}

.result-card {
  background: linear-gradient(135deg, var(--bg3) 0%, var(--bg4) 100%);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 14px;
  display: none;
  animation: fadeUp 0.3s ease both;
}

.result-card.show {
  display: block;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
}

.result-row:last-of-type {
  border-bottom: none;
}

.result-row span:first-child {
  color: var(--text2);
}

.result-row span:last-child {
  font-weight: 500;
  color: var(--text);
}

.result-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--gold-border);
}

.result-total-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.result-total-value {
  font-family: "DM Serif Display", serif;
  font-size: 32px;
  color: var(--gold2);
  letter-spacing: -0.02em;
}

.small-title {
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 12px;
}

.hist-item {
  background: var(--bg2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  animation: fadeUp 0.3s ease both;
  transition: border-color 0.2s;
}

.hist-item:hover {
  border-color: var(--gold-border);
}

.hist-info {
  flex: 1;
}

.hist-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
}

.hist-detail {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.6;
}

.hist-right {
  text-align: right;
}

.hist-val {
  font-family: "DM Serif Display", serif;
  font-size: 20px;
  color: var(--gold2);
  display: block;
}

.hist-date {
  font-size: 11px;
  color: var(--text3);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}

.badge-pago {
  background: var(--green-soft);
  color: var(--green);
}

.badge-pendente {
  background: var(--red-soft);
  color: #e05a4a;
}

.hist-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text3);
}

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text3);
}

.empty-icon {
  font-size: 36px;
  margin-bottom: 10px;
  opacity: 0.5;
}

.empty-text {
  font-size: 13px;
  line-height: 1.6;
}

.schedule-status {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text3);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.overlay.show {
  display: flex;
}

.modal {
  background: var(--bg2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 20px 40px;
  width: 100%;
  max-width: 520px;
  animation: slideUp 0.3s ease;
}

.modal-title {
  font-family: "DM Serif Display", serif;
  font-size: 18px;
  margin-bottom: 18px;
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--bg4);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg4);
  border: 1px solid var(--gold-border);
  color: var(--gold2);
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.card:nth-child(1) {
  animation-delay: 0.05s;
}

.card:nth-child(2) {
  animation-delay: 0.1s;
}

.card:nth-child(3) {
  animation-delay: 0.15s;
}

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg4);
  border-radius: 2px;
}

@media (min-width: 540px) {
  .app {
    padding-bottom: 40px;
  }

  .header {
    padding-top: 36px;
  }

  .modal {
    border-radius: var(--radius);
    max-width: 440px;
    margin-bottom: 40px;
  }

  .overlay {
    align-items: center;
  }
}

@media (max-width: 420px) {
  .tabs {
    gap: 4px;
  }

  .tab-btn {
    padding: 9px 2px;
    font-size: 11px;
  }

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

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

  .hist-item {
    flex-direction: column;
    gap: 12px;
  }

  .hist-right {
    width: 100%;
    text-align: left;
  }
}
