:root {
  color-scheme: dark;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111213;
  color: #f7f7f4;
  --surface: #202223;
  --raised: #2b2e2f;
  --line: #35383a;
  --secondary: #a8afae;
  --mint: #aaf3d0;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main {
  max-width: 430px;
  margin: auto;
  padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}
button, input, select { font: inherit; color: inherit; }
button, select { touch-action: manipulation; }
button, select {
  border: 1px solid transparent;
  border-radius: 13px;
  background: var(--raised);
  min-height: 44px;
}
button { cursor: pointer; }
button:active { filter: brightness(.84); }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.display {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  margin-bottom: 8px;
}
.amount { min-width: 0; }
.amount > label, .amount > span {
  display: block;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .09em;
  margin-bottom: 2px;
}
.number {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: 0;
  padding: 0;
  font-size: clamp(31px, 9vw, 43px);
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.05em;
}
.number[data-compact] { font-size: clamp(20px, 6.4vw, 32px); overflow-wrap: anywhere; }
.number::placeholder { color: var(--secondary); opacity: 1; }
.tax {
  display: flex;
  padding: 3px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #141516;
}
.tax label {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0 7px;
  min-height: 44px;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 8px;
  font-size: 11px;
  color: var(--secondary);
}
.tax input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.tax label:has(input:checked) { background: var(--raised); color: #f7f7f4; }
.tax label:has(input:focus-visible) { outline: 2px solid var(--mint); }
.result { background: #17231e; border-color: #2b483b; }
.result .number { color: var(--mint); display: block; }
.refresh { width: 47px; font-size: 25px; color: var(--mint); background: #263a30; }
.rate {
  grid-column: 1 / -1;
  justify-self: start;
  background: transparent;
  margin: -6px 0 -8px -7px;
  padding: 0 7px;
  text-align: left;
  min-height: 34px;
  color: #b3c9bd;
  font-size: 12px;
}
.actions { display: grid; grid-template-columns: .62fr 1.25fr .88fr 1.13fr; gap: 6px; margin: 12px 0; }
.actions > * {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-inline: 5px;
  font-size: clamp(11px, 3.3vw, 14px);
  font-weight: 650;
  text-align: center;
  border-color: var(--line);
}
.actions > select { appearance: none; padding-right: 13px; background: linear-gradient(45deg, transparent 50%, #bbc1bf 50%) calc(100% - 10px) 52% / 4px 4px no-repeat, linear-gradient(135deg, #bbc1bf 50%, transparent 50%) calc(100% - 6px) 52% / 4px 4px no-repeat, var(--raised); }
#addBtn, .primary { background: var(--mint); color: #13251c; }
#basketCount { color: var(--mint); margin-left: 2px; }
.keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.keys button {
  min-height: clamp(48px, 8.4svh, 72px);
  background: var(--surface);
  border-radius: 22px;
  font-size: 29px;
}
.keys button:nth-child(-n+3) { background: #373a3b; font-size: 21px; }
.keys .zero { grid-column: span 2; }
#toast { margin: 7px 0 0; min-height: 16px; color: var(--secondary); font-size: 12px; text-align: center; }
header, #basketTotal, li { display: flex; justify-content: space-between; align-items: center; gap: 9px; }
header button, li button { padding-inline: 10px; }
h1, h2 { margin: 0; font-size: 22px; }
.danger { color: #ffc2b9; }
ul { list-style: none; margin: 14px 0; padding: 0; }
li, #basketTotal { border-bottom: 1px solid var(--line); padding: 10px 0; }
.item { flex: 1; overflow-wrap: anywhere; }
.prices { text-align: right; }
small { display: block; color: var(--secondary); }
#basketTotal { border-bottom: 0; }
#basketTotal > span:last-child { text-align: right; }
#basketEmpty { color: var(--secondary); }
dialog { max-width: min(360px, calc(100% - 28px)); width: 100%; padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
dialog::backdrop { background: #000a; }
.panel, .panel label { display: grid; gap: 8px; }
.panel { gap: 12px; }
.panel p { margin: 0; }
.panel a { color: var(--mint); }
.panel input, .panel select { width: 100%; min-height: 44px; padding-inline: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--raised); }
.dialog-actions { display: flex; gap: 8px; }
.dialog-actions button { flex: 1; }
