:root {
  color-scheme: light;
  font-family: Inter, "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", "Segoe UI", sans-serif;
  color: #29263b;
  background: #fbfafc;
  --purple: #8060da;
  --deep: #6f4ec9;
  --muted: #777586;
  --border: #e7e5ee;
  --focus: #7050ce;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; min-height: 100svh; display: flex; flex-direction: column; }
main.container { flex: 1; padding-top: clamp(22px,3.2vw,46px); }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }
button { border: 0; background: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
button, a { transition: background-color .15s, border-color .15s, box-shadow .15s, color .15s, transform .15s; }
[hidden] { display: none !important; }
svg { display: block; width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
button > span[data-icon] { display: inline-flex; }
h1, h2, h3, p { margin: 0; }
.container { width: min(1184px, calc(100% - 88px)); margin-inline: auto; }
.skip { position: fixed; z-index: 10; top: -100px; left: 20px; background: white; padding: 12px; }
.skip:focus { top: 10px; }
.topbar { background: #fff; border-bottom: 1px solid var(--border); }
.topbar-inner { height: 74px; display: flex; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 1.6rem; font-weight: 750; letter-spacing: -1.4px; font-family: Inter, "Segoe UI", sans-serif; line-height: 1; }
.brand > span > span { color: var(--purple); }
.main-nav { display: flex; gap: 7px; margin: 0 18px 0 clamp(16px,3vw,44px); }
.main-nav a { border-radius: 9px; padding: 9px 15px; font-size: .91rem; font-weight: 600; color: #6a6878; letter-spacing: -.03em; white-space: nowrap; }
.main-nav a:hover { background: #f7f5fb; }
.main-nav [aria-current=page] { color: var(--deep); background: #f1ecfc; }
.history-open { display: flex; flex: none; align-items: center; gap: 7px; margin-left: 10px; padding: 9px 13px; border: 1px solid var(--border); border-radius: 10px; background: white; color: #625d70; font-size: .88rem; font-weight: 600; }
.history-open svg { width: 17px; height: 17px; }
.history-open:hover { background: #f8f6fd; border-color: #d7cdee; }
#workspace { outline: none; }
.panel, .tool-card { background: white; border: 1px solid var(--border); box-shadow: 0 3px 9px #34234204; }
.panel { border-radius: 22px; padding: clamp(18px,2.25vw,32px); box-shadow: 0 8px 32px #37234b06; }
.section-heading, .dialog-head, .title-group { display: flex; align-items: center; }
.title-group { gap: 10px; }
h1, h2 { font-size: 1.35rem; line-height: 1.4; letter-spacing: -.055em; font-weight: 730; }
.icon-button { display: inline-grid; place-items: center; width: 33px; height: 33px; border-radius: 8px; color: #86808f; }
.icon-button:hover { background: #f6f2fc; color: var(--purple); }
.favorite { margin-left: auto; }
.favorite[aria-pressed=true] { color: var(--purple); background: #f6f1ff; }
.favorite[aria-pressed=true] svg { fill: #e3d6ff; }
.tile-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: var(--ink); background: var(--tint); }
.tile-icon svg { width: 25px; height: 25px; stroke-width: 1.85; }
.violet { --ink: #8860d8; --tint: #eee7fc; }
.coral { --ink: #e77c50; --tint: #fff0e7; }
.blue { --ink: #4d83cf; --tint: #eaf2ff; }
.mint { --ink: #389f8b; --tint: #e3f5ee; }
.rose { --ink: #d16d93; --tint: #fbe8f0; }
.gold { --ink: #b48728; --tint: #fff4d9; }
html { scrollbar-gutter: stable; }
.panel-desc { margin: 0 0 16px; color: #686171; font-size: .94rem; line-height: 1.5; }
.fx-conversion { grid-column: 1/-1; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; min-width: 0; }
.fx-market { grid-column: 1/-1; min-width: 0; }
.fx-market header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.fx-market h2 { margin: 0; font-size: .95rem; color: #564b65; }
.fx-scroll-controls { display: flex; gap: 4px; }
.fx-scroll-controls button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--deep); }
.fx-scroll-controls button:disabled { opacity: .4; cursor: default; }
.fx-scroll-controls svg { width: 15px; }
.fx-scroll-controls [data-shift="-1"] svg { transform: rotate(180deg); }
.fx-quotes { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(158px,22%,225px); gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-color: #b8a6cc #f6f3fa; padding-bottom: 8px; }
.fx-quote { min-width: 0; min-height: 120px; position: relative; isolation: isolate; overflow: hidden; display: grid; align-content: start; justify-items: start; gap: 3px; padding: 14px 16px 37px; border: 1px solid var(--border); border-radius: 12px; background: white; font-variant-numeric: tabular-nums; }
.fx-quote { scroll-snap-align: start; }
.fx-quote span { font-size: .81rem; color: #685e77; }
.fx-quote strong { font-size: clamp(1.15rem,2vw,1.65rem); }
.fx-quote small { color: #655484; font-size: .78rem; }
.fx-quote svg { position: absolute; z-index: -1; inset: auto 12px 4px; width: calc(100% - 24px); height: 31px; }
.fx-quote polygon { fill: #dff5ec; opacity: .65; }
.fx-quote polyline { stroke: #62ae95; stroke-width: 1.25; vector-effect: non-scaling-stroke; fill: none; }
.fx-conversion { align-items: stretch; padding-block: 5px; }
.fx-conversion label, .fx-total { display: grid; align-content: start; gap: 6px; min-width: 0; color: #635b71; font-size: .87rem; font-weight: 600; }
.fx-rate { display: grid; align-content: start; gap: 6px; min-width: 0; padding: 0; border: 0; margin: 0; font-size: .87rem; color: #635b71; font-weight: 600; }
.compound-term { display: grid; gap: 8px; align-content: start; }
.compound-term label { display: grid; gap: 6px; font-size: .87rem; font-weight: 600; color: #635b71; }
.fx-total { grid-column: 1/-1; gap: 7px; padding: clamp(18px,2.5vw,30px); border: 1px solid #e2d8f3; border-radius: 14px; background: #f6f2fc; }
.fx-total strong { color: #422b6b; font-size: clamp(2rem,4.2vw,3.7rem); line-height: 1.12; letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#rate-info:empty { display: none; }
@media (max-width: 650px) {
  .fx-quotes { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: minmax(130px,42%); overflow-x: auto; padding: 3px; scroll-snap-type: x proximity; gap: 8px; }
  .fx-conversion { gap: 8px; }
  .fx-conversion select { padding-inline: 6px 20px; background-position: right 3px center; }
  .fx-select { position: relative; min-width: 0; }
  .fx-select label { height: 100%; grid-template-rows: 1fr auto; }
  .fx-conversion .fx-select select { color: transparent; }
  .fx-select option { color: #302b3e; }
  .fx-select::after { content: attr(data-code); position: absolute; bottom: 0; left: 8px; line-height: 51px; font-weight: 600; font-size: .92rem; pointer-events: none; }
  .fx-conversion label, .fx-total { font-size: .8rem; }
}
.basic-panel .screen { container-type: inline-size; align-items: flex-end; justify-content: flex-end; gap: 4px; height: clamp(150px,21vh,200px); padding: clamp(12px,1.5vw,22px); }
.basic-panel #display, .basic-panel #display.long { font-size: clamp(1.2rem, min(152cqw / var(--display-length,1), 10vw + 1rem, 9vh + 1rem), 5.5rem); }
.basic-panel #expression { color: #746883; font-size: .95rem; }
#expression { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.keypad { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-top: 16px; }
.key:hover, .key.pressed { background: #ece8f6; border-color: #dcd2ed; }
.key:active { transform: scale(.96); }
.key.utility { background: #f1eff6; color: #635a73; font-size: 1.16rem; }
.key.clear { color: var(--deep); }
.key.operator { background: #eee8fb; color: #7853c4; border-color: #e7def6; font-size: 1.5rem; }
.key.operator.selected { border-color: #9575d6; background: #e2d7f9; }
.key.utility:hover, .key.operator:hover { background: #e5dcf5; }
.key.equals { background: #8762dc; border-color: #805ad8; color: white; font-size: 1.5rem; }
.key.equals:hover { background: #7652ca; }
.key-hint { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 15px 0 -2px; color: #878290; font-size: .79rem; letter-spacing: -.025em; }
.key-hint svg { width: 15px; height: 15px; }
.section-heading { justify-content: space-between; margin: 1px 0 15px; min-height: 30px; gap: 12px; }
.section-heading .title-group { gap: 8px; }
.section-heading .title-group > svg { width: 20px; height: 20px; color: #8e74b8; }
.tool-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.tool-card { position: relative; display: block; padding: 17px 20px 16px; border-radius: 16px; min-width: 0; }
.tool-card:hover, .tool-card:focus-visible { border-color: #c9b6ed; box-shadow: 0 5px 15px #4932680c; transform: translateY(-2px); }
.tool-card h3 { font-size: 1.06rem; line-height: 1.45; font-weight: 720; letter-spacing: -.055em; margin-top: 9px; }
.tool-card p { font-size: .875rem; line-height: 1.5; color: #777281; letter-spacing: -.03em; margin-top: 2px; overflow-wrap: anywhere; }
.tool-card:lang(ko) p { word-break: keep-all; }
.tool-card h3 { overflow-wrap: anywhere; }

.tile-category { position: absolute; top: 20px; right: 17px; font-size: .75rem; color: #80798b; border: 1px solid #eeebf2; background: #fcfbfd; border-radius: 6px; padding: 2px 7px; }
.footer { margin-top: 31px; border-top: 1px solid var(--border); }
.footer-inner { min-height: 63px; display: flex; align-items: center; justify-content: space-between; font-size: .78rem; color: #8a8593; }
.footer-brand { display: inline-flex; align-items: center; gap: 6px; font: 650 .99rem "Segoe UI",sans-serif; letter-spacing: -.04em; color: #777180; }
.footer-brand img { filter: grayscale(1); opacity: .55; }
.footer-privacy { color: #645876; text-decoration: underline; text-underline-offset: 3px; }
.footer-inner { gap: 12px; flex-wrap: wrap; }
.privacy-wrap { width: min(760px,calc(100% - 40px)); margin-inline: auto; }
.privacy-header { padding: 20px 0; background: white; border-bottom: 1px solid var(--border); }
.privacy-main { flex: 1; padding-block: clamp(28px,5vw,60px); }
.privacy-article { background: white; border: 1px solid var(--border); border-radius: 18px; padding: clamp(24px,5vw,48px); line-height: 1.75; overflow-wrap: anywhere; }
.privacy-article h1 { font-size: clamp(1.65rem,4vw,2.15rem); }
.privacy-date { margin: 8px 0 28px; color: var(--muted); font-size: .88rem; }
.privacy-article section { margin-top: 26px; }
.privacy-article h2 { margin: 0 0 8px; font-size: 1.08rem; letter-spacing: 0; }
.privacy-article p, .privacy-links { color: #514b5c; }
.privacy-article a { color: var(--deep); text-decoration: underline; text-underline-offset: 3px; }
.privacy-links { margin: 10px 0; padding-inline-start: 20px; }
.catalog { min-height: 370px; }
.catalog .tool-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.filters { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 19px; }
.filters button, .secondary-btn { border: 1px solid var(--border); background: white; padding: 7px 14px; border-radius: 9px; font-size: .88rem; }
.filters [aria-pressed=true] { background: #efe9fb; color: var(--deep); border-color: #d6c6f0; }
.empty { padding: 42px 20px; text-align: center; border: 1px dashed #dcd6e5; border-radius: 14px; color: var(--muted); background: #fff; }
.empty svg { margin: 0 auto 12px; color: #aa93cb; width: 28px; height: 28px; }
.empty p { margin: 7px 0 14px; font-size: .9rem; }
.empty a { color: var(--deep); font-weight: 650; font-size: .9rem; }
.tool-fields { display: grid; gap: 15px; }
.field-note { font-size: .85rem; line-height: 1.55; color: var(--muted); }
.calculation-modes, .frequency { grid-column: 1/-1; min-width: 0; border: 0; padding: 0; margin: 0; }
.frequency legend { margin-bottom: 6px; color: #635b71; font-weight: 600; font-size: .87rem; }
.frequency .term-switch { flex-wrap: wrap; }
.calculation-modes .term-switch { width: 100%; display: flex; padding: 4px; }
.calculation-modes label { flex: 1; min-width: 0; }
.calculation-modes .term-switch span { height: 100%; min-height: 38px; padding: 7px 8px; display: grid; place-items: center; text-align: center; overflow-wrap: anywhere; }
.clock-pair, .percent-inputs { grid-column: 1/-1; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.percent-inputs label, .clock-dials label { display: grid; min-width: 0; gap: 6px; color: #635b71; font-size: .87rem; font-weight: 600; }
.percent-inputs { align-items: start; }
.percent-field { min-width: 0; }
.percent-inputs input { font-variant-numeric: tabular-nums; }
.percent-field small:not(:empty) { display: block; margin-top: 5px; color: var(--muted); font-size: .82rem; }
@media (max-width: 480px) {
  .percent-inputs { grid-template-columns: minmax(0,1fr); }
}
.time-card { min-width: 0; margin: 0; padding: 12px 16px 16px; border: 1px solid #e7dff3; border-radius: 14px; background: #faf8fd; }
.time-card legend { padding: 0 5px; color: #605271; font-size: .9rem; font-weight: 650; }
.clock-dials { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: end; gap: 10px; margin-top: 10px; }
.time-card :is(select,input[type=number]) { background-color: white; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.duration-sum { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 12px; grid-column: 1/-1; }
.join-sign { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #f2ecfb; color: var(--deep); }
@media (max-width: 650px) {
  .clock-pair { grid-template-columns: minmax(0,1fr); }
  .duration-sum { grid-template-columns: minmax(0,1fr); gap: 4px; }
  .join-sign { justify-self: center; }
}
.result-source { display: inline-block; margin-top: 9px; font-size: .81rem; color: var(--deep); text-decoration: underline; text-underline-offset: 3px; }
.tool-fields > label, .unit-pair label { display: grid; gap: 6px; color: #635b71; font-weight: 600; font-size: .87rem; }
.tool-fields input, .tool-fields select { height: 45px; width: 100%; min-width: 0; border: 1px solid #dcd7e5; background: #fdfcfe; border-radius: 9px; padding: 0 12px; color: #302b3e; font-weight: 500; }
.tool-fields select { appearance: none; background: #fdfcfe url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='12' viewBox='0 0 16 12'%3E%3Cpath d='m3 3 5 5 5-5' fill='none' stroke='%23797088' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center; padding-right: 36px; }
.unit-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.primary-btn { border-radius: 10px; background: var(--purple); color: #fff; font-weight: 650; padding: 13px 18px; }
.primary-btn:hover { background: var(--deep); }
dialog { border: 1px solid var(--border); width: min(440px,calc(100% - 32px)); max-height: min(72vh,620px); padding: 23px; border-radius: 18px; color: inherit; box-shadow: 0 20px 75px #30233d29; }
dialog::backdrop { background: #27223655; }
.result-actions { grid-column: 1/-1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.result-box .schedule-open { color: var(--deep); border-color: #d5c6e9; }
.share-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.share-slot:empty { display: none; }
.share-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 10px; border: 1px solid #e0d7ec; border-radius: 9px; background: white; color: #674993; font-size: .82rem; font-weight: 600; line-height: 1.3; }
.share-button:hover, .share-options button:hover { background: #f5f0fb; }
.share-button svg { width: 15px; height: 15px; flex: none; }
.share-heading .share-button { white-space: nowrap; padding: 3px 7px; }
.history-row .share-button { justify-self: start; margin-top: 4px; }
.share-dialog { width: min(500px,calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: clamp(14px,3vw,24px); }
.share-dialog h2 { font-size: 1.2rem; }
.share-preview { margin: 16px 0; max-height: 53dvh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.share-preview canvas { display: block; width: 100%; height: auto; }
.share-options { display: flex; flex-wrap: wrap; gap: 8px; }
.share-options .secondary-btn { color: var(--deep); }
.share-dialog [role=status]:not(:empty) { display: block; margin-top: 10px; color: #5e506c; }
.share-dialog textarea { margin-top: 8px; width: 100%; min-height: 70px; }
body:has(.loan-schedule[open],.share-dialog[open]) { overflow: hidden; }
.loan-schedule { width: min(840px,calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: clamp(14px,2.3vw,26px); overflow: auto; }
.loan-schedule h2 { font-size: 1.2rem; }
.schedule-meta { color: var(--deep); margin: 4px 0 10px; font-size: .88rem; font-weight: 600; }
.schedule-intro { margin: 0 0 14px; color: #61586b; line-height: 1.45; font-size: .92rem; }
.loan-schedule table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.loan-schedule :is(th,td) { padding: 9px 6px; border-bottom: 1px solid var(--border); text-align: end; font-size: .9rem; overflow-wrap: anywhere; }
.loan-schedule thead th { color: #675d73; background: #f7f4fb; font-size: .82rem; }
.loan-schedule th:first-child { text-align: start; }
.loan-schedule tbody td:nth-child(4) { color: var(--deep); font-weight: 700; }
.schedule-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.schedule-pages { display: inline-flex; align-items: center; max-width: 100%; padding: 3px; border-radius: 11px; background: #f5f1fa; }
.schedule-pages[hidden] { display: none; }
.schedule-pages :is(button,select) { background: transparent; border: 0; color: #59456e; border-radius: 8px; }
.schedule-pages button { width: 32px; height: 32px; flex: none; display: grid; place-items: center; }
.schedule-pages button svg { width: 16px; height: 16px; }
.schedule-pages [data-step="-1"] svg { transform: rotate(180deg); }
.schedule-pages select { min-width: 0; min-height: 32px; padding-inline: 6px; cursor: pointer; font-size: .85rem; font-weight: 650; }
.schedule-pages :is(button:enabled,select):hover { background: #e9e1f4; }
.schedule-pages button:disabled { opacity: .35; cursor: default; }
.schedule-totals { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin-top: 10px; padding: 12px; border-radius: 10px; background: #f6f2fc; font-size: .86rem; }
.schedule-totals b { margin-inline-start: 4px; }
@media (max-width: 620px) {
  .loan-schedule thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  .loan-schedule :is(table,tbody) { display: block; }
  .loan-schedule tbody tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px 12px; padding: 8px 0; border-top: 1px solid var(--border); }
  .loan-schedule tbody :is(th,td) { padding: 0; border: 0; text-align: start; }
  .loan-schedule tbody th { grid-column: 1/-1; }
  .loan-schedule tbody [data-label]::before { content: attr(data-label); display: block; color: #73697d; font-size: .76rem; font-weight: 500; }
  .loan-schedule tbody th::before { display: inline; margin-inline-end: 6px; }
}
.dialog-head { justify-content: space-between; }
.dialog-intro { font-size: .9rem; color: var(--muted); margin: 7px 0 18px; }
.history-row { border-top: 1px solid var(--border); padding: 12px 2px; display: grid; gap: 3px; overflow-wrap: anywhere; }
.history-row small, .history-row span { font-size: .86rem; color: var(--muted); }
.history-row strong { font-size: 1.12rem; }
#history-list .secondary-btn { margin-top: 12px; }
@media (max-width: 980px) {
  .container { width: calc(100% - 48px); }
  .panel { padding: 18px; }
  .tool-card { padding: 16px; }
}
@media (max-width: 760px) {
  .container { width: calc(100% - 32px); }
  .topbar-inner { height: auto; display: grid; grid-template-columns: auto minmax(0,1fr) auto; column-gap: 8px; }
  .brand { font-size: 1.42rem; padding: 12px 0; }
  .brand img { width: 29px; height: 31px; }
  .main-nav { order: 3; grid-column: 1/-1; margin: 0 0 9px; gap: 4px; }
  .main-nav a { padding: 7px 12px; }
  .history-open { margin-left: 0; }
  .panel { padding: 20px; }
  .catalog .tool-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .footer { margin-top: 24px; }
}
@media (max-width: 520px) {
  .history-open { width: 38px; height: 39px; justify-content: center; padding: 0; }
  .history-open > span:last-child { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  .keypad { gap: 8px; }
  .tool-grid { gap: 9px; }
  .tool-card { padding: 14px 12px; }
  .tile-category { top: 15px; right: 10px; padding: 1px 5px; }
  .tile-icon { width: 38px; height: 38px; border-radius: 11px; }
  .tool-card h3 { font-size: .98rem; }
  .tool-card p { font-size: .82rem; }
}
main.container:has(.dashboard) { padding-top: 16px; }
.dashboard { width: 100%; margin-inline: auto; }
.tool-menu { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; padding-bottom: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tool-menu .favorite { flex: none; }
.menu-arrow { flex: none; display: grid; place-items: center; width: 28px; height: 36px; color: var(--deep); border-radius: 8px; }
.menu-arrow:hover { background: #f1edf8; }
.menu-arrow:disabled { opacity: .3; cursor: default; }
.menu-arrow svg { width: 16px; }
.menu-arrow[data-scroll="-1"] svg { transform: rotate(180deg); }
@media (max-width: 650px) { .menu-arrow { display: none; } }
.menu-links { position: relative; display: flex; flex: 1; align-items: center; min-width: 0; gap: 4px; padding: 4px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: #d5cce5 transparent; }
.menu-links a, .all-tools { display: inline-flex; align-items: center; justify-content: center; flex: none; gap: 7px; min-height: 42px; padding: 8px 12px; border-radius: 9px; color: #676270; font-size: .91rem; letter-spacing: -.035em; white-space: nowrap; }
.menu-links a:hover { background: #f3f0f8; color: #393044; }
.menu-links a { max-width: 100%; }
.menu-links a span { white-space: normal; overflow-wrap: anywhere; }
.menu-links a[aria-current=page] { background: #eee7fb; color: #6a43be; font-weight: 700; }
.menu-links svg, .all-tools svg { width: 16px; height: 16px; }
.all-tools { position: relative; color: var(--deep); font-weight: 650; }
.all-tools::before { content: ""; position: absolute; left: -5px; height: 18px; border-left: 1px solid var(--border); }
.all-tools:hover { background: #f1edf8; }
.screen, .result-box { position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 132px; overflow: hidden; padding: 17px 24px; border: 1px solid #e6def5; border-radius: 14px; background: linear-gradient(112deg,#f0e9fc,#f5f1fc 62%,#f0ecfa); }
.screen::before, .result-box::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(circle,#c6b6e2 1px,transparent 1.25px) left bottom / 12px 12px; mask-image: linear-gradient(30deg,#0005,transparent 45%); }
#display { align-self: end; max-width: 100%; font: 550 clamp(2.8rem,4.5vw,4rem)/1.1 Inter,"Segoe UI",sans-serif; font-variant-numeric: tabular-nums; letter-spacing: -.05em; text-align: right; overflow-wrap: anywhere; }
#display.long { font-size: clamp(1.55rem,3.1vw,2.8rem); }
.key { display: grid; place-items: center; height: clamp(53px,6.8vh,70px); border: 1px solid #e9e6ee; border-radius: 11px; background: #fcfbfe; font: 550 1.48rem/1 Inter,"Segoe UI",sans-serif; }
.result-box { margin: 0 0 23px; overflow-wrap: anywhere; }
.result-box span { font-size: .83rem; color: #776b87; }
.result-box strong { align-self: end; font-size: clamp(1.8rem,3.4vw,3.2rem); line-height: 1.2; letter-spacing: -.045em; }
.result-box small { font-size: .89rem; color: #73677d; text-align: right; }
.result-box .pending-result { color: #bfb3cd; font-weight: 400; }
.result-source { align-self: end; }
.form-panel .tool-fields { gap: 18px; }
.form-panel input, .form-panel select { height: 51px; font-size: 1.02rem; }
.form-panel .primary-btn { min-height: 49px; }
.loan-term { grid-column: 1/-1; min-width: 0; margin: 0; padding: 0; border: 0; }
.loan-term legend { margin-bottom: 8px; padding: 0; font-size: .87rem; font-weight: 600; color: #635b71; }
.term-switch { display: inline-flex; gap: 3px; padding: 3px; border-radius: 9px; background: #f1eef7; }
.term-switch label { position: relative; cursor: pointer; }
.term-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.term-switch span { display: block; padding: 6px 15px; border-radius: 6px; font-size: .9rem; }
.term-switch input:checked + span { background: white; color: var(--deep); font-weight: 650; box-shadow: 0 1px 4px #31254a19; }
.term-switch input:focus-visible + span { outline: 2px solid var(--focus); }
.term-values { display: flex; gap: 10px; margin-block: 10px; }
.term-number { display: flex; align-items: center; flex: 1; min-width: 0; overflow: hidden; border: 1px solid #dcd7e5; border-radius: 9px; background: #fdfcfe; }
.term-number input { border: none; flex: 1; width: 0; background: transparent; }
.term-number:focus-within { outline: 2px solid var(--focus); }
.term-number input:focus-visible { outline: 0; }
.term-number span { padding-inline: 8px 14px; font-size: .9rem; color: #675e75; }
.term-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.term-presets button { padding: 7px 13px; border: 1px solid var(--border); border-radius: 8px; background: white; font-size: .89rem; }
.term-presets button:hover, .term-presets [aria-pressed=true] { background: #f2ecfc; border-color: #d5c4ee; color: var(--deep); }
@media (min-width: 900px) { .tool-fields:has(.loan-term) > .amount-field:has([name=principal]) { grid-column: auto; } }
@media (min-width: 900px) {
  .form-panel .tool-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .tool-fields > label:has(select), .tool-fields > .unit-pair, .tool-fields > .primary-btn, .tool-fields > .field-note { grid-column: 1/-1; }
}
@media (max-width: 760px) {
  main.container:has(.dashboard) { padding-top: 8px; }
  .tool-menu { gap: 5px; padding-bottom: 4px; }
  .menu-links a, .all-tools { padding-inline: 9px; font-size: .86rem; }
  .screen, .result-box { min-height: 104px; padding: 13px 16px; }
  .panel { padding: 16px; border-radius: 17px; }
  .key { height: clamp(49px,6.5vh,59px); }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { transition: none !important; scroll-behavior: auto !important; } }

.language-control { position: relative; z-index: 5; margin-inline-start: auto; color: #645b73; font-size: .88rem; }
.language-control summary { display: flex; gap: 6px; align-items: center; min-height: 39px; padding: 0 7px; white-space: nowrap; cursor: pointer; list-style: none; border-radius: 7px; }
.language-control summary::-webkit-details-marker { display: none; }
.language-control summary::after { content: ""; width: 5px; height: 5px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); margin-inline-start: 2px; }
.language-control summary:focus-visible { outline: 3px solid var(--focus); }
.language-list { position: absolute; right: 0; top: 100%; min-width: 156px; max-height: 65vh; overflow-y: auto; padding: 5px; border: 1px solid var(--border); border-radius: 11px; background: white; box-shadow: 0 8px 25px #36264917; }
.language-list a { display: block; padding: 8px 12px; border-radius: 6px; }
.language-list a:hover, .language-list [aria-current] { background: #f3effb; color: var(--deep); }
.language-control svg { width: 16px; height: 16px; }
.amount-field { min-width: 0; display: grid; align-content: start; gap: 6px; }
.amount-field > label { font-size: .87rem; font-weight: 600; color: #635b71; }
.amount-control { display: flex; align-items: center; min-width: 0; border: 1px solid #dcd7e5; border-radius: 10px; background: #fdfcfe; }
.amount-control:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.amount-control input { flex: 1; width: 0; min-width: 0; font-variant-numeric: tabular-nums; border: 0; background: transparent; }
.amount-control input:focus-visible { outline: 0; }
.amount-control select, .amount-control > span { flex: none; width: auto; height: auto; max-width: 90px; padding: 6px 25px 6px 9px; font-size: .8rem; font-weight: 650; color: #68548c; border: 0; border-left: 1px solid var(--border); border-radius: 0; background-color: transparent; background-position: right 6px center; }
.amount-control > span { padding-inline-end: 12px; }
.amount-field small, #rate-info { color: #70677c; font-size: .84rem; line-height: 1.45; }
.tool-fields > label { align-content: start; min-width: 0; }
.result-box { display: grid; min-height: auto; gap: 12px; margin: 22px 0 0; align-items: center; padding: 20px 22px; border: 1px solid #e8e0f5; border-radius: 12px; background: #f7f4fc; }
.result-main { display: grid; gap: 5px; min-width: 0; }
.result-box dl { display: grid; gap: 6px; margin: 0; padding-top: 10px; border-top: 1px solid #e4dbf1; }
.result-box dl > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 18px; align-items: baseline; }
.result-box dt { color: #6a6078; font-size: .86rem; }
.result-box dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.result-source { justify-self: start; }
.result-box::before { content: none; }
.result-box strong { align-self: start; font: 650 clamp(1.8rem,3.2vw,2.75rem)/1.2 Inter,"Segoe UI",sans-serif; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.result-box small { text-align: start; white-space: pre-line; line-height: 1.55; }
.result-box.error-result strong { font-weight: 550; font-size: 1rem; line-height: 1.5; }
.tool-fields:has(.calculation-modes) + .result-box { gap: 14px; background: linear-gradient(115deg,#f4effd,#fbf9fe); }
.tool-fields:has(.calculation-modes) + .result-box:not(.error-result) strong { color: #4b3075; }
.tool-fields:has(.calculation-modes) + .result-box .result-main small { font-variant-numeric: tabular-nums; }
.deposit-tax { grid-column: 1/-1; display: grid; grid-template-columns: minmax(0,1fr); gap: inherit; align-items: end; border-top: 1px solid var(--border); padding-top: 16px; }
.deposit-tax > label { display: grid; gap: 6px; min-width: 0; color: #635b71; font-size: .87rem; font-weight: 600; }
.deposit-notes { grid-column: 1/-1; padding-top: 12px; border-top: 1px solid #e4dbf1; line-height: 1.55; overflow-wrap: anywhere; }
.deposit-notes .result-source { display: inline; margin: 0; font-size: .85rem; }
.result-box:has(.deposit-notes) { grid-template-columns: minmax(0,1fr); gap: 16px; background: linear-gradient(125deg,#f6f1ff,#fbf9fe); }
.result-box:has(.deposit-notes) .result-main > span { color: #60477d; font-size: .92rem; font-weight: 650; }
.result-box:has(.deposit-notes) .result-main > strong { color: #4b3075; font-size: clamp(2.1rem,4.5vw,3.2rem); }
.result-box:has(.deposit-notes) dl { gap: 9px; padding: 12px 14px; background: #fff; border: 1px solid #e8e1f1; border-radius: 10px; }
.result-box:has(.deposit-notes) dl > div { display: grid; grid-template-columns: minmax(0,1fr) fit-content(60%); }
.result-box:has(.deposit-notes) dd { text-align: end; }
.result-box:has(.deposit-notes) .result-actions > button { min-height: 34px; max-width: 100%; }
@media (min-width: 620px) {
  .deposit-tax { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .result-box:has(.deposit-notes) { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
.payment-comparison { grid-column: 1/-1; width: 100%; table-layout: fixed; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.payment-comparison :is(th,td) { padding: 7px 5px; text-align: end; border-bottom: 1px solid #e5dced; }
.payment-comparison th:first-child { text-align: start; }
.payment-comparison th { color: #675b75; font-weight: 550; }
.payment-comparison thead th { font-size: .83rem; }
.payment-comparison tbody tr:last-child td { font-weight: 700; color: var(--deep); }
.finance-note { grid-column: 1/-1; }
@media (min-width: 620px) {
  .result-box:has(dl) { grid-template-columns: minmax(0,3fr) minmax(0,2fr); }
  .result-box dl { border-top: 0; border-inline-start: 1px solid #e4dbf1; padding: 8px 0 8px 22px; }
}
#rate-info, .tool-fields > .amount-field:has([name=principal]) { grid-column: 1/-1; }
.all-tools { max-width: 32%; white-space: normal; }
@media (max-width: 800px) {
  .topbar-inner { height: auto; display: grid; grid-template-columns: minmax(0,1fr) auto auto; grid-template-areas: "brand lang history" "nav nav nav"; align-items: center; gap: 2px 6px; padding-block: 6px; }
  .brand { grid-area: brand; padding-block: 6px; }
  .history-open { grid-area: history; margin: 0; }
  .main-nav { grid-area: nav; margin: 0; gap: 1px; min-width: 0; flex-wrap: wrap; }
  .main-nav a { padding: 6px 9px; white-space: normal; }
  .language-control { grid-area: lang; margin: 0; justify-self: end; }
  .language-control summary { font-size: .82rem; min-height: 34px; }
}

.form-panel .tool-fields:has(.fx-market) {
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: clamp(9px,1.7vh,16px) 12px;
}
.tool-fields:has(.fx-market):not(:has(.fx-rate)) > .amount-field { grid-column: 1/-1; }
.fx-select, .fx-rate { min-width: 0; }
@media (max-height: 850px) {
  .panel:has(.fx-market) { padding: clamp(12px,2vh,20px); }
  .panel:has(.fx-market) .panel-desc { margin-bottom: 9px; }
  .fx-conversion { padding-block: 0; }
  .fx-total { padding: 14px 18px; gap: 3px; }
  .fx-total strong { font-size: clamp(1.9rem,5.6vh,3rem); }
  .fx-quote { min-height: 88px; padding: 8px 12px 25px; gap: 1px; }
  .fx-quote svg { height: 20px; }
  .fx-market header { margin-bottom: 5px; }
  body:has(.dashboard) .footer { margin-top: 10px; }
  body:has(.dashboard) .footer-inner { min-height: 35px; }
}
@media (max-height: 700px) {
  main.container:has(.dashboard) { padding-top: 4px; }
  .dashboard .tool-menu { margin-bottom: 8px; padding-bottom: 2px; }
  .panel:has(.fx-market) .tool-fields { row-gap: 8px; }
  .panel:has(.fx-market) :is(input,select) { height: 40px; }
  .fx-select::after { line-height: 40px; }
  .fx-total { padding-block: 10px; }
  .fx-market .fx-quote { min-height: 76px; padding-bottom: 19px; }
  .fx-quote svg { height: 15px; }
}
@media (min-width: 850px) and (max-height: 950px) {
  .form-panel .tool-fields:has(.fx-market) { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .fx-conversion { grid-column: span 2; padding: 0; }
}
@media (max-height: 700px) {
  body:has(.fx-market) .footer { margin-top: 4px; }
  body:has(.fx-market) .footer-inner { min-height: 25px; }
}
@media (max-height: 660px) {
  .panel:has(.fx-market) { padding: 10px 12px; }
  .panel:has(.fx-market) .panel-desc { font-size: .85rem; margin-bottom: 6px; }
  .panel:has(.fx-market) .tool-fields { row-gap: 5px; }
  .fx-market header { margin-bottom: 2px; }
  .fx-market .fx-quote { padding: 4px 8px; min-height: 46px; grid-template-columns: 1fr auto; align-items: baseline; gap: 0 3px; }
  .fx-quote span { grid-column: 1/-1; font-size: .72rem; }
  .fx-quote strong { font-size: 1rem; }
  .fx-quote svg { position: static; width: 100%; height: 9px; grid-column: 1/-1; }
  .fx-scroll-controls button { height: 26px; }
  .fx-total { padding: 7px 12px; }
  .fx-total strong { font-size: 1.8rem; }
  body:has(.fx-market) .menu-links { padding-block: 0; }
  body:has(.fx-market) .menu-links a { min-height: 34px; padding-block: 4px; }
}
@media (max-width: 649px) and (max-height: 600px) {
  body:has(.fx-market) .topbar-inner { padding-block: 2px; gap: 0 6px; }
  body:has(.fx-market) .language-control summary { min-height: 28px; }
  body:has(.fx-market) .tool-menu { margin-bottom: 4px; }
  body:has(.fx-market) .footer-inner { min-height: 20px; }
}
@media (min-width: 650px) and (max-height: 500px) {
  .form-panel .tool-fields:has(.fx-market) { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .fx-conversion { grid-column: span 2; }
  .fx-total { grid-column: 1; }
  .fx-market { grid-column: 2/-1; }
}

.date-picker { position: relative; min-width: 0; margin: 0; padding: 12px 15px 16px; border: 1px solid #e4ddec; border-radius: 15px; background: #faf8fd; }
.date-picker legend { padding: 0 7px; font-size: .95rem; font-weight: 650; }
.date-picker legend span { display: inline-flex; align-items: center; gap: 7px; }
.date-picker legend svg { width: 17px; color: #8058bd; }
.date-parts { display: flex; align-items: stretch; padding: 4px; background: white; border: 1px solid #e1d9ec; border-radius: 11px; }
.date-parts > * { flex: 1; min-width: 0; display: grid; align-content: start; gap: 2px; padding: 6px 8px; font-size: .8rem; color: #71677d; }
.date-parts > * + * { border-inline-start: 1px solid #eae4f0; }
.date-parts .date-year, .date-parts .date-month { flex: 1.35; }
.date-parts select, .year-picker summary { box-sizing: border-box; width: 100%; height: 36px; padding: 0 17px 0 2px; background-color: white; background-position: right 1px center; border: 0; border-radius: 5px; font-size: 1.07rem; font-weight: 650; color: #352b42; cursor: pointer; }
.year-picker summary { display: flex; align-items: center; justify-content: space-between; padding-inline-end: 1px; list-style: none; }
.year-picker summary::-webkit-details-marker { display: none; }
.year-picker summary svg { width: 12px; height: 12px; transform: rotate(90deg); color: #776984; }
.year-picker[open] summary { color: var(--deep); background: #f4effb; }
.year-picker[open] summary svg { transform: rotate(-90deg); }
.year-pop { position: absolute; z-index: 7; inset-inline-start: 14px; top: calc(100% - 7px); width: min(295px,calc(100% - 28px)); box-sizing: border-box; padding: 12px; background: white; border: 1px solid #ddd3e9; border-radius: 12px; box-shadow: 0 10px 30px #33204624; }
.year-pop label { display: grid; grid-template-columns: auto minmax(58px,86px); align-items: center; justify-content: space-between; gap: 8px; }
.year-pop input { height: 34px; }
.year-pages { display: flex; align-items: center; justify-content: space-between; margin: 9px 0 4px; color: #534362; }
.year-pages button, .year-options button { min-height: 32px; border-radius: 7px; }
.year-pages button { width: 36px; font-size: 1.2rem; }
.year-options { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 3px; }
.year-options button:hover, .year-pages button:hover { background: #f6f2fb; }
.year-options [aria-pressed=true] { background: #eee5fb; color: var(--deep); font-weight: 700; }
.repayment { grid-column: 1/-1; margin: 0; padding: 0; border: 0; min-width: 0; }
.repayment legend { margin-bottom: 7px; padding: 0; font-weight: 600; color: #635b71; font-size: .87rem; }
.repayment .term-switch { flex-wrap: wrap; }
.date-actions { grid-column: 1/-1; display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }

@media (max-height: 1000px) {
  body:has(.basic-panel) .footer { margin-top: 6px; }
  body:has(.basic-panel) .footer-inner { min-height: 28px; }
}
@media (max-height: 950px) {
  .basic-panel { padding: clamp(10px,2vh,20px); }
  .basic-panel .screen { min-height: 0; height: clamp(82px,calc(28svh - 77px),158px); padding: 8px 16px; }
  .basic-panel #display { font-size: clamp(1.2rem,min(152cqw / var(--display-length,1),8svh),4.6rem); }
  .basic-panel .keypad { gap: 6px; margin-top: 9px; }
  .basic-panel .key { height: clamp(36px,6.1svh,58px); }
  .basic-panel .panel-desc, .basic-panel .key-hint { margin-block: 0 6px; }
  .basic-panel .key-hint { margin-block: 7px 0; }
}
@media (min-width: 620px) and (max-height: 520px) {
  .basic-panel { display: grid; grid-template-columns: 1fr 1.45fr; gap: 8px 16px; align-content: center; }
  .basic-panel .panel-desc { grid-column: 1; }
  .basic-panel .keypad { grid-column: 2; grid-row: 1/span 3; margin: 0; }
  .basic-panel .screen, .basic-panel .key-hint { grid-column: 1; }
  .basic-panel .screen { height: auto; min-height: clamp(88px,22svh,108px); }
}
@media (max-height: 620px) {
  .basic-panel .key-hint { margin-top: 3px; }
  body:has(.basic-panel) .tool-menu { margin-bottom: 4px; }
}
@media (min-width: 620px) and (max-height: 450px) {
  body:has(.basic-panel) .topbar-inner { display: flex; gap: 4px; height: 46px; padding-block: 0; }
  body:has(.basic-panel) .main-nav { order: 0; }
  body:has(.basic-panel) .language-control { margin-inline-start: auto; }
  .basic-panel .key { height: 32px; }
  body:has(.basic-panel) .footer-inner { min-height: 22px; }
}
