:root {
  --ink: #0e1a2b;
  --ink2: #1c3152;
  --mid: #2c5282;
  --steel: #4a7fb5;
  --mist: #c8ddf0;
  --fog: #e8f1fa;
  --paper: #f4f8fd;
  --white: #ffffff;
  --gold: #c8923a;
  --gold2: #f0b850;
  --green: #1a6e45;
  --green2: #27a96a;
  --red: #b02a1e;
  --red2: #e05545;
  --amber: #d97706;
  --border: rgba(44, 82, 130, 0.15);
  --shadow: 0 2px 16px rgba(14, 26, 43, 0.10);
  --r: 12px
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh
}

.app-header {
  background: var(--ink);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 2px solid var(--gold)
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px
}

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

.brand h1 {
  font-family: 'Fraunces', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--white);
  letter-spacing: -.02em
}

.brand p {
  font-size: .7rem;
  color: rgba(255, 255, 255, .45)
}

.tabs-bar {
  background: var(--ink2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none
}

.tabs-bar::-webkit-scrollbar {
  display: none
}

.tabs-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex
}

.tab {
  padding: 12px 18px;
  font-size: .78rem;
  font-weight: 500;
  color: rgba(255, 255, 255, .45);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all .2s;
  flex-shrink: 0
}

.tab:hover {
  color: rgba(255, 255, 255, .75)
}

.tab.active {
  color: var(--gold2);
  border-bottom-color: var(--gold2)
}

.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 60px
}

.panel {
  display: none
}

.panel.active {
  display: block;
  animation: fadeUp .25s ease
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

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

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px
}

.card-title {
  font-family: 'Fraunces', serif;
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink2);
  display: flex;
  align-items: center;
  gap: 8px
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
  display: inline-block
}

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

.stat {
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--fog)
}

.stat.accent {
  background: var(--ink);
  border-color: var(--ink)
}

.stat.green {
  background: #e8f7f0;
  border-color: rgba(26, 110, 69, .2)
}

.stat.red {
  background: #fdf0ee;
  border-color: rgba(176, 42, 30, .15)
}

.stat.gold {
  background: #fdf5e8;
  border-color: rgba(200, 146, 58, .25)
}

.stat-label {
  font-size: .68rem;
  color: var(--steel);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px
}

.stat.accent .stat-label {
  color: rgba(255, 255, 255, .5)
}

.stat-val {
  font-family: 'Fraunces', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink)
}

.stat.accent .stat-val {
  color: var(--gold2)
}

.stat.green .stat-val {
  color: var(--green)
}

.stat.red .stat-val {
  color: var(--red2)
}

.stat.gold .stat-val {
  color: var(--amber)
}

.stat-sub {
  font-size: .68rem;
  color: var(--steel);
  margin-top: 2px
}

.progress-wrap {
  margin: 0 0 16px
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: .7rem;
  color: var(--steel);
  margin-bottom: 6px
}

.progress-track {
  height: 6px;
  background: var(--mist);
  border-radius: 3px;
  overflow: hidden
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--mid), var(--gold));
  transition: width .8s ease
}

.field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--fog)
}

.field-row:last-child {
  border-bottom: none
}

.field-label {
  flex: 1;
  font-size: .82rem;
  color: var(--ink)
}

.field-hint {
  font-size: .7rem;
  color: var(--steel);
  margin-top: 2px
}

.field-row input,
.field-row select {
  width: 148px;
  flex-shrink: 0;
  border: 1.5px solid var(--mist);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  color: var(--mid);
  background: var(--fog);
  text-align: right;
  transition: border-color .15s
}

.field-row input:focus,
.field-row select:focus {
  outline: none;
  border-color: var(--mid);
  background: var(--white)
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s
}

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

.btn-primary:hover {
  background: var(--ink2)
}

.btn-ghost {
  background: var(--fog);
  color: var(--ink2);
  border: 1px solid var(--border)
}

.btn-ghost:hover {
  background: var(--mist)
}

.btn-danger {
  background: #fdf0ee;
  color: var(--red2);
  border: 1px solid rgba(176, 42, 30, .2)
}

.btn-sm {
  padding: 5px 10px;
  font-size: .72rem
}

.euribor-entry {
  display: grid;
  grid-template-columns: 130px 1fr 90px auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 4px;
  border: 1px solid var(--border);
  background: var(--white);
  transition: box-shadow .15s
}

.euribor-entry:hover {
  box-shadow: 0 2px 8px rgba(14, 26, 43, .08)
}

.euribor-entry.historical {
  border-left: 3px solid var(--green2)
}

.euribor-entry.future {
  border-left: 3px solid var(--mist);
  background: var(--fog)
}

.entry-period {
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink2)
}

.entry-bar-wrap {
  position: relative;
  height: 6px;
  background: var(--mist);
  border-radius: 3px
}

.entry-bar {
  height: 100%;
  border-radius: 3px;
  transition: width .4s
}

.entry-rate {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  font-weight: 600;
  text-align: right
}

.entry-rate.historical {
  color: var(--green)
}

.entry-rate.future-opt {
  color: #1a7a4a
}

.entry-rate.future-base {
  color: var(--amber)
}

.entry-rate.future-pess {
  color: var(--red2)
}

.scenario-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px
}

.scenario-tab {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--fog);
  font-size: .75rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  color: var(--steel)
}

.euribor-tenor-btn {
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--fog);
  border-radius: 8px;
  color: var(--ink2);
  cursor: pointer;
  transition: .15s
}

.euribor-tenor-btn.active {
  background: var(--mid);
  color: var(--white);
  border-color: var(--mid)
}

.sc-opt.active {
  background: #f0fdf4;
  border-color: #16a34a;
  color: #15803d
}

.sc-base.active {
  background: #fffbeb;
  border-color: #d97706;
  color: #b45309
}

.sc-pess.active {
  background: #fef2f2;
  border-color: #dc2626;
  color: #dc2626
}

.scenario-card {
  border-radius: 10px;
  padding: 14px;
}

.scenario-card .scenario-card-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px
}

.scenario-card.opt {
  background: #f0fdf4;
  border: 1px solid #86efac
}

.scenario-card.base {
  background: #fffbeb;
  border: 1px solid #fcd34d
}

.scenario-card.pess {
  background: #fef2f2;
  border: 1px solid #fca5a5
}

.scenario-card.opt .scenario-card-title {
  color: #15803d
}

.scenario-card.base .scenario-card-title {
  color: #b45309
}

.scenario-card.pess .scenario-card-title {
  color: #dc2626
}

.add-form {
  background: var(--fog);
  border: 1px dashed var(--mist);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 16px
}

.add-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px
}

.form-field label {
  font-size: .72rem;
  color: var(--steel);
  display: block;
  margin-bottom: 4px
}

.form-field input,
.form-field select {
  width: 100%;
  border: 1.5px solid var(--mist);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  color: var(--mid);
  background: var(--white)
}

.form-field input:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--mid)
}

.tbl-wrap {
  overflow-x: auto;
  border-radius: var(--r);
  border: 1px solid var(--border)
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .76rem;
  min-width: 540px
}

thead th {
  background: var(--ink);
  color: rgba(255, 255, 255, .8);
  padding: 10px;
  text-align: right;
  font-weight: 600;
  font-size: .7rem;
  white-space: nowrap
}

thead th:first-child {
  text-align: center
}

tbody td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid var(--fog);
  font-size: .75rem
}

tbody td:first-child {
  text-align: center;
  font-weight: 600
}

tbody tr:hover td {
  background: var(--fog)
}

.row-fixed {
  background: #fefdf5
}

.row-hist {
  background: #f5fcf8
}

.row-today {
  background: #fffbf0 !important
}

.row-today td {
  font-weight: 600;
  color: var(--amber)
}

.row-opt {
  background: #f5fcf8
}

.row-base {
  background: #fefdf5
}

.row-pess {
  background: #fdf5f4
}

.chip {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em
}

.chip-fixed {
  background: #fef3c7;
  color: #92400e
}

.chip-hist {
  background: #d1fae5;
  color: #065f46
}

.chip-today {
  background: #fef3c7;
  color: #92400e
}

.chip-opt {
  background: #d1fae5;
  color: #065f46
}

.chip-base {
  background: #fef3c7;
  color: #92400e
}

.chip-pess {
  background: #fee2e2;
  color: #991b1b
}

.sc-compare {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px
}

.sc-box {
  border-radius: var(--r);
  padding: 16px;
  border: 2px solid;
  text-align: center
}

.sc-box.opt {
  background: #f0fdf4;
  border-color: #86efac
}

.sc-box.base {
  background: #fffbeb;
  border-color: #fcd34d
}

.sc-box.pess {
  background: #fef2f2;
  border-color: #fca5a5
}

.sc-box-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px
}

.sc-box.opt .sc-box-label {
  color: #15803d
}

.sc-box.base .sc-box-label {
  color: #b45309
}

.sc-box.pess .sc-box-label {
  color: #dc2626
}

.sc-box-val {
  font-family: 'Fraunces', serif;
  font-size: 1.35rem;
  font-weight: 700
}

.sc-box.opt .sc-box-val {
  color: #16a34a
}

.sc-box.base .sc-box-val {
  color: #d97706
}

.sc-box.pess .sc-box-val {
  color: #dc2626
}

.sc-box-sub {
  font-size: .7rem;
  color: var(--steel);
  margin-top: 4px
}

.result-banner {
  background: linear-gradient(135deg, var(--green), #1a4a2e);
  border-radius: var(--r);
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
  color: var(--white)
}

.result-banner .big {
  font-family: 'Fraunces', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold2)
}

.result-banner .sub {
  font-size: .78rem;
  opacity: .8;
  margin-top: 4px
}

.warn {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 12px;
  font-size: .78rem;
  color: #92400e;
  margin-top: 12px
}

.info {
  background: var(--fog);
  border: 1px solid var(--mist);
  border-radius: 8px;
  padding: 12px;
  font-size: .78rem;
  color: var(--mid);
  margin-top: 12px
}

.empty {
  text-align: center;
  padding: 32px;
  color: var(--steel);
  font-size: .82rem
}

.sc-input {
  width: 120px;
  border: 1.5px solid;
  border-radius: 8px;
  padding: 7px 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  text-align: right;
  background: inherit
}

.sc-input:focus {
  outline: none
}

/* Responsive design */
@media (max-width: 768px) {
  .main {
    padding: 20px 10px 60px;
  }

  .sc-compare {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .sc-box {
    padding: 12px;
  }

  .sc-box-val {
    font-size: 1.1rem;
  }

  .euribor-entry {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 8px 10px;
  }

  .euribor-entry>div:first-child {
    order: 1;
  }

  .euribor-entry>.entry-bar-wrap {
    order: 2;
    height: 8px;
  }

  .euribor-entry>.entry-rate {
    order: 3;
    text-align: left;
  }

  .euribor-entry>div:last-child {
    order: 4;
    justify-content: flex-end;
  }

  .entry-period {
    font-size: 0.75rem;
  }

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

  .card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .tabs-bar {
    overflow-x: auto;
  }

  .tabs-inner {
    flex-wrap: nowrap;
  }

  .tab {
    padding: 10px 12px;
    font-size: 0.7rem;
  }
}