/* ============================================================
   Rev-Trac Savings Calculator — Stylesheet
   ============================================================ */

:root {
  --rt-navy:        #1B2A4A;
  --rt-navy-hover:  #243562;
  --rt-red:         #E53935;
  --rt-red-hover:   #C62828;
  --rt-bg:          #f0f2f5;
  --rt-white:       #ffffff;
  --rt-border:      #e2e6ea;
  --rt-text:        #1a1a2e;
  --rt-muted:       #6c757d;
  --rt-shadow:      0 2px 8px rgba(0,0,0,0.08);
  --rt-font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

/* ── Reset ───────────────────────────────────────────────────── */
.rt-calculator-wrapper *,
.rt-calculator-wrapper *::before,
.rt-calculator-wrapper *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.rt-calculator-wrapper {
  font-family: var(--rt-font);
  font-size: 14px;
  color: var(--rt-text);
  background: var(--rt-bg);
  line-height: 1.4;
}

.rt-calculator-wrapper button {
  font-family: var(--rt-font);
}

/* ── Top nav ─────────────────────────────────────────────────── */
.rt-topnav {
  background: var(--rt-white);
  border-bottom: 1px solid var(--rt-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.rt-topnav__brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rt-topnav__logo {
  height: 32px;
  width: auto;
}

.rt-topnav__logo-text {
  font-size: 20px;
  font-weight: 800;
  color: var(--rt-navy);
  letter-spacing: -0.5px;
  font-style: italic;
}

.rt-topnav__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── App layout ──────────────────────────────────────────────── */
.rt-app {
  display: flex;
  min-height: calc(100vh - 56px);
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.rt-sidebar {
  width: 200px;
  min-width: 200px;
  background: var(--rt-navy);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  flex-shrink: 0;
}

.rt-sidebar__heading {
  padding: 20px 16px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

.rt-sidebar__link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 16px 9px 13px;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  line-height: 1.3;
}

.rt-sidebar__link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--rt-white);
}

.rt-sidebar__link.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--rt-white);
  border-left-color: var(--rt-red);
  font-weight: 500;
}

/* ── Main content ────────────────────────────────────────────── */
.rt-main {
  flex: 1;
  overflow: auto;
  min-width: 0;
}

/* ── Report header ───────────────────────────────────────────── */
.rt-main__header {
  background: var(--rt-white);
  padding: 24px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--rt-border);
}

.rt-main__title {
  font-size: 21px;
  font-weight: 700;
  color: var(--rt-navy);
  line-height: 1.2;
}

.rt-main__subtitle {
  margin-top: 5px;
  color: var(--rt-muted);
  font-size: 13px;
}

.rt-main__actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  align-items: center;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.rt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.12s, opacity 0.12s;
  white-space: nowrap;
}

.rt-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.rt-btn--outline {
  background: transparent;
  border: 1.5px solid var(--rt-navy);
  color: var(--rt-navy);
}

.rt-btn--outline:hover:not(:disabled) {
  background: rgba(27, 42, 74, 0.05);
}

.rt-btn--primary {
  background: var(--rt-red);
  color: var(--rt-white);
}

.rt-btn--primary:hover:not(:disabled) {
  background: var(--rt-red-hover);
}

.rt-btn--calculate {
  background: var(--rt-navy);
  color: var(--rt-white);
  padding: 11px 28px;
  font-size: 14px;
}

.rt-btn--calculate:hover:not(:disabled) {
  background: var(--rt-navy-hover);
}

/* ── Cards grid ──────────────────────────────────────────────── */
.rt-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 28px 32px 20px;
}

/* ── Bottom action bar ───────────────────────────────────────── */
.rt-bottom-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 0 32px 32px;
}

/* ── Card ────────────────────────────────────────────────────── */
.rt-card {
  background: var(--rt-white);
  border-radius: 6px;
  box-shadow: var(--rt-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rt-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 16px 10px;
}

.rt-card__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--rt-navy);
  line-height: 1.3;
}

.rt-card__edit {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--rt-muted);
  padding: 4px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-left: 8px;
  transition: color 0.12s, background 0.12s;
  line-height: 0;
}

.rt-card__edit:hover {
  color: var(--rt-navy);
  background: var(--rt-bg);
}

.rt-card__body {
  padding: 0 16px 12px;
  flex: 1;
}

.rt-card__line {
  padding: 10px 0;
  border-bottom: 1px solid var(--rt-bg);
}

.rt-card__line:last-child {
  border-bottom: none;
}

.rt-card__line-label {
  font-size: 11px;
  color: var(--rt-muted);
  margin-bottom: 3px;
  letter-spacing: 0.01em;
}

.rt-card__line-amount {
  font-size: 20px;
  font-weight: 700;
  color: var(--rt-navy);
  line-height: 1.1;
}

.rt-card__line-sublabel {
  font-size: 15px;
  font-weight: 600;
  color: var(--rt-navy);
  line-height: 1.2;
}

/* Card total footer */
.rt-card__footer {
  background: var(--rt-navy);
  color: var(--rt-white);
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rt-card__total-label {
  font-size: 11px;
  opacity: 0.75;
  flex-shrink: 0;
}

.rt-card__total-value {
  font-size: 19px;
  font-weight: 700;
  flex: 1;
  text-align: right;
}

.rt-card__total-icon {
  flex-shrink: 0;
  opacity: 0.65;
  line-height: 0;
}

/* ── Modal overlay ───────────────────────────────────────────── */
.rt-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.rt-modal-overlay.is-open {
  display: flex;
}

/* ── Modal box ───────────────────────────────────────────────── */
.rt-modal {
  background: var(--rt-white);
  border-radius: 8px;
  width: 520px;
  max-width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
  position: relative;
}

.rt-modal__close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--rt-muted);
  line-height: 1;
  padding: 5px 9px;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s;
  z-index: 1;
}

.rt-modal__close:hover {
  color: var(--rt-text);
  background: var(--rt-bg);
}

.rt-modal__content {
  padding: 24px 24px 8px;
  overflow-y: auto;
  flex: 1;
}

.rt-modal__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--rt-navy);
  margin-bottom: 18px;
  padding-right: 30px;
}

.rt-modal__footer {
  padding: 14px 24px 18px;
  border-top: 1px solid var(--rt-border);
  display: flex;
  justify-content: flex-end;
}

/* ── Form elements ───────────────────────────────────────────── */
.rt-form-group {
  margin-bottom: 16px;
}

.rt-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--rt-text);
  margin-bottom: 3px;
}

.rt-hint {
  font-size: 12px;
  color: var(--rt-muted);
  margin-bottom: 7px;
  line-height: 1.45;
}

.rt-input,
.rt-select {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--rt-border);
  border-radius: 4px;
  font-size: 14px;
  font-family: var(--rt-font);
  color: var(--rt-text);
  background: var(--rt-white);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
  appearance: none;
  -webkit-appearance: none;
}

.rt-input:focus,
.rt-select:focus {
  border-color: var(--rt-navy);
  box-shadow: 0 0 0 3px rgba(27, 42, 74, 0.1);
}

.rt-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}

/* ── Toast notification ──────────────────────────────────────── */
.rt-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--rt-navy);
  color: var(--rt-white);
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 10000;
  animation: rt-fadein 0.2s ease;
}

.rt-toast.is-error {
  background: var(--rt-red);
}

@keyframes rt-fadein {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .rt-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 820px) {
  .rt-topnav { padding: 0 16px; }
  .rt-sidebar { display: none; }
  .rt-main__header { flex-direction: column; align-items: flex-start; padding: 20px 20px; }
  .rt-cards-grid { grid-template-columns: 1fr; padding: 20px; gap: 16px; }
  .rt-main__actions { width: 100%; }
  .rt-btn { flex: 1; justify-content: center; }
}

@media (max-width: 480px) {
  .rt-main__title { font-size: 17px; }
  .rt-modal { max-height: 95vh; }
  .rt-modal__content { padding: 20px 16px 8px; }
  .rt-modal__footer { padding: 12px 16px 16px; }
}
