:root {
  --bg-1: #f6f3ec;
  --bg-2: #e6eef9;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-strong: #ffffff;
  --text: #1c2432;
  --muted: #5d6a7f;
  --border: rgba(30, 56, 93, 0.14);
  --brand: #0f4c81;
  --brand-2: #136ea8;
  --ring: rgba(19, 110, 168, 0.24);
  --shadow: 0 20px 40px rgba(25, 44, 72, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 700px at 90% 10%, #d7e7ff 0%, rgba(215, 231, 255, 0) 60%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
  min-height: 100vh;
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(300px 300px at 7% 18%, rgba(255, 188, 111, 0.2), transparent 70%),
    radial-gradient(280px 280px at 92% 85%, rgba(19, 110, 168, 0.16), transparent 65%);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1160px;
  margin: 0 auto;
  padding: 52px 18px 28px;
}

.hero {
  margin-bottom: 26px;
  animation: rise 0.55s ease;
}

.hero-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.badge {
  display: inline-block;
  margin: 0 0 10px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(15, 76, 129, 0.09);
  border: 1px solid rgba(15, 76, 129, 0.2);
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.hero-top .badge {
  margin: 0;
}

h1 {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(31px, 5.2vw, 52px);
  letter-spacing: -0.8px;
  line-height: 1.06;
}

.hero-subtitle {
  max-width: 690px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 2.1vw, 18px);
  line-height: 1.55;
}

.layout-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  animation: rise 0.65s ease;
}

.form-card,
.result-card {
  padding: 24px;
}

.card-header h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.3px;
}

.card-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.mode-switch {
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  border: 1px solid #cfe0f2;
  background: #eff7ff;
  border-radius: 999px;
  padding: 6px 9px 6px 11px;
  cursor: pointer;
  user-select: none;
}

.mode-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.mode-switch-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.25px;
  color: #1b4e7e;
  text-transform: uppercase;
}

.mode-switch-ui {
  position: relative;
  width: 74px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid #c7d7ea;
  background: linear-gradient(180deg, #f7fbff, #e7f1fc);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 9px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.mode-switch-state {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.35px;
  z-index: 1;
  transition: color 0.2s ease;
}

.mode-switch-state-off {
  color: #3d5a7c;
}

.mode-switch-state-on {
  color: #7fa2c6;
}

.mode-switch-knob {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #bfd2e7;
  box-shadow: 0 4px 8px rgba(15, 76, 129, 0.18);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.mode-switch input:checked + .mode-switch-ui {
  background: linear-gradient(180deg, #1a88c2, #136ea8);
  border-color: #0e5d90;
}

.mode-switch input:checked + .mode-switch-ui .mode-switch-state-off {
  color: rgba(255, 255, 255, 0.65);
}

.mode-switch input:checked + .mode-switch-ui .mode-switch-state-on {
  color: #ffffff;
}

.mode-switch input:checked + .mode-switch-ui .mode-switch-knob {
  transform: translateX(44px);
  border-color: #e3edf7;
}

.mode-switch input:focus-visible + .mode-switch-ui {
  box-shadow: 0 0 0 4px rgba(19, 110, 168, 0.24);
}

.form-grid {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  font-size: 13px;
  color: #42526a;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.45px;
}

.field-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.inline-day-note {
  border: 1px solid #c9dff5;
  background: #edf6ff;
  color: #12588a;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.quick-maturity {
  display: flex;
  gap: 8px;
  margin-bottom: 2px;
}

.chip-btn {
  border: 1px solid #c9d8e9;
  background: #f8fbff;
  color: #315277;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip-btn:hover {
  border-color: #9fc2e2;
  color: #1d4068;
  background: #edf5ff;
}

.chip-btn.is-active {
  border-color: #136ea8;
  background: #136ea8;
  color: #ffffff;
  box-shadow: 0 8px 15px rgba(19, 110, 168, 0.22);
}

.field input {
  height: 50px;
  width: 100%;
  border-radius: 13px;
  border: 1px solid #cad8e8;
  background: var(--surface-strong);
  padding: 0 14px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  outline: none;
}

.field input::placeholder {
  color: #8192aa;
}

.field input:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px var(--ring);
}

.date-note {
  margin-top: 1px;
  font-size: 12px;
  color: #5d6f8b;
  font-weight: 600;
}

.reverse-result input[readonly] {
  background: #f3f8ff;
  border-color: #cfe0f2;
  color: #0f4c81;
}

.holiday-warning {
  margin-top: 7px;
  border: 1px solid #f2b5b5;
  background: #fff1f1;
  border-radius: 12px;
  padding: 9px 10px;
}

.warning-text {
  margin: 0;
  color: #ad1f1f;
  font-size: 12px;
  font-weight: 700;
}

.warning-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.warning-btn {
  border: 1px solid #e88989;
  border-radius: 999px;
  background: #fff;
  color: #9f2222;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  cursor: pointer;
}

.warning-btn:hover {
  background: #ffe3e3;
}

.settings-menu {
  border: 1px solid #cedced;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.settings-menu summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.25px;
  color: #1b466f;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-menu summary::-webkit-details-marker {
  display: none;
}

.settings-menu summary::after {
  content: '+';
  font-size: 18px;
  line-height: 1;
}

.settings-menu[open] summary::after {
  content: '-';
}

.settings-content {
  border-top: 1px solid #dbe6f4;
  padding: 12px;
}

.settings-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.settings-btn {
  border: 0;
  border-radius: 10px;
  background: #136ea8;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
}

.settings-btn:hover {
  filter: brightness(1.06);
}

.settings-btn-ghost {
  background: #eef5fc;
  color: #1f4a73;
  border: 1px solid #cfe0f2;
}

.settings-note {
  display: block;
  margin-top: 8px;
  color: #4b6280;
  font-size: 12px;
  font-weight: 600;
}

.mini-tool {
  margin-top: 16px;
  border-top: 1px dashed #cddbef;
  padding-top: 14px;
}

.mini-tool h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.2px;
}

.mini-tool > p {
  margin: 4px 0 8px;
  color: #5f7088;
  font-size: 12px;
}

.mini-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.mini-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-grid.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mini-grid.compact-top-row {
  grid-template-columns: 1fr;
}

.mini-grid.compact-input-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mini-grid.compact-output-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mini-tool-compact .mini-grid {
  grid-template-columns: 1fr;
}

.mini-print-wrap {
  margin-top: 8px;
}

.mini-print-btn {
  border: 1px solid #b8cae0;
  border-radius: 8px;
  background: #f7fbff;
  color: #1f4a73;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  cursor: pointer;
}

.mini-print-btn:hover {
  background: #eaf3ff;
}

.mini-field {
  gap: 4px;
}

.mini-field span {
  font-size: 10px;
  letter-spacing: 0.3px;
}

.mini-field input {
  height: 36px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 13px;
}

.mini-locked-field input {
  background: #f1f5fa;
  color: #4b627f;
  border-color: #d4e0ee;
  pointer-events: none;
}

.mini-readonly input[readonly] {
  background: #f4f8fc;
}

.mini-readonly .full-col {
  grid-column: 1 / -1;
}

.primary-btn {
  height: 52px;
  margin-top: 4px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(90deg, #0f4c81, #136ea8 55%, #1a8ec0);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 14px 24px rgba(19, 110, 168, 0.25);
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 26px rgba(19, 110, 168, 0.3);
  filter: saturate(1.08);
}

.primary-btn:active {
  transform: translateY(0);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  margin-top: 18px;
}

.metric {
  padding: 13px;
  border-radius: 14px;
  border: 1px solid transparent;
}

.metric p {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  color: #556782;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(17px, 2.1vw, 22px);
  line-height: 1.25;
}

.soft-blue {
  background: #ecf4ff;
  border-color: #d3e6ff;
}

.soft-teal {
  background: #e9f8f8;
  border-color: #caeceb;
}

.soft-amber {
  background: #fff3e5;
  border-color: #ffe0b5;
}

.soft-green {
  background: #e9f8ee;
  border-color: #c9ebd5;
}

.detail-list {
  margin-top: 13px;
  border-top: 1px dashed #c8d4e4;
  padding-top: 11px;
  display: grid;
  gap: 8px;
}

.detail-list div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.detail-list span {
  color: #62738c;
  font-size: 14px;
}

.detail-list b {
  font-size: 15px;
}

.empty-state {
  margin-top: 16px;
  border: 1px dashed #c2d4ea;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  padding: 28px 16px;
  text-align: center;
}

.empty-state p {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.empty-state small {
  display: block;
  margin-top: 8px;
  color: #5f7088;
  font-size: 13px;
}

@media (max-width: 940px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding-top: 36px;
  }

  .card {
    border-radius: 18px;
  }

  .form-card,
  .result-card {
    padding: 16px;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .quick-maturity {
    flex-wrap: wrap;
  }

  .mini-grid.two-col,
  .mini-grid.three-col,
  .mini-grid.compact-top-row,
  .mini-grid.compact-input-row,
  .mini-grid.compact-output-row {
    grid-template-columns: 1fr;
  }
}

@keyframes rise {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
