:root {
  color-scheme: light;
  font-family: "Trebuchet MS", system-ui, sans-serif;
  color: #211631;
  background: #f7f4fc;
  font-synthesis: none;
  --ink: #211631;
  --muted: #645873;
  --violet: #7025cd;
  --line: #eee7f5;
  --soft: #f2e8fd;
  --paper: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
[hidden] { display: none !important; }

header { background: var(--paper); border-bottom: 1px solid var(--line); }
.top {
  max-width: 1192px; margin: auto; min-height: 72px; padding: 12px 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px; color: var(--ink);
  font-size: 1.24rem; font-weight: 800; letter-spacing: -.045em;
  text-decoration: none; white-space: nowrap;
}
.brand img { border-radius: 12px; }
#profile { display: flex; align-items: center; min-width: 0; gap: 10px; }
#identity { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; color: var(--muted); }

main { max-width: 1192px; margin: auto; padding: 25px 26px 52px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.75rem); line-height: 1.08; letter-spacing: -.055em; margin-bottom: 7px; }
h2 { font-size: 1.08rem; letter-spacing: -.025em; margin-bottom: 12px; }
.dashboard-heading {
  display: flex; align-items: end; justify-content: space-between; gap: 16px;
  margin: 8px 0 20px;
}
#period { color: var(--muted); margin: 0; text-transform: capitalize; }
.toolbar, .filter { display: flex; align-items: center; gap: 8px; }
.toolbar .primary span { font-size: 1.25em; vertical-align: -.03em; }

.hero {
  position: relative; isolation: isolate; overflow: hidden; min-height: 216px;
  display: flex; align-items: center; padding: clamp(24px, 4vw, 42px);
  color: white; border-radius: 30px;
  background: linear-gradient(112deg, #4c1597, #7325cc 58%, #8e41e4);
  box-shadow: 0 17px 32px -20px #5821aeaa;
}
.hero-content { position: relative; z-index: 1; min-width: 0; }
.hero h2 { color: #f0deff; font-weight: 600; }
.hero strong {
  display: block; margin-bottom: 11px; line-height: 1.05; letter-spacing: -.065em;
  font-size: clamp(2.4rem, 7vw, 5rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.hero p { margin: 0; color: #f2e6ff; font-size: .86rem; }
.hero-art {
  position: absolute; right: 3%; top: 50%; width: 300px; height: 300px;
  transform: translateY(-50%) rotate(-23deg); opacity: .72; pointer-events: none;
}
.hero-art i {
  position: absolute; inset: calc(var(--ring, 0) * 25px);
  border: 1px solid #ecd2ff7d; border-radius: 36% 64% 61% 39% / 53% 43% 57% 47%;
  background: linear-gradient(135deg, #dcadff29, #dcadff00 66%);
}
.hero-art i:nth-child(2) { --ring: 1; }
.hero-art i:nth-child(3) { --ring: 2; }
.hero-art i:nth-child(4) { --ring: 3; }
.hero-art { animation: drift 12s ease-in-out infinite alternate; }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
.metric, .panel {
  min-width: 0; padding: 18px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 22px;
  box-shadow: 0 8px 24px -22px #4c1769a0;
}
.metric { display: flex; align-items: center; gap: 12px; }
.metric > div { min-width: 0; }
.metric-label { display: block; margin-bottom: 4px; font-size: .82rem; color: var(--muted); }
.metric strong { display: block; font-size: clamp(1.05rem, 2.5vw, 1.55rem); letter-spacing: -.035em; overflow-wrap: anywhere; }
.metric-icon, .movement-icon {
  display: grid; place-items: center; flex: none; width: 42px; height: 42px;
  border-radius: 14px; font-size: 1.18rem; font-weight: 800; line-height: 1;
}
.incoming, .movement-icon.income { background: #e3f7ed; color: #176344; }
.outgoing, .movement-icon.expense { background: #f2e8fd; color: #6b28ba; }
.pending { background: #ffefdf; color: #904b1b; }

.overview { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; gap: 16px; }
.secondary { min-width: 0; display: grid; gap: 16px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.section-title h2 { margin: 0; }
.items { list-style: none; padding: 0; margin: 10px 0 0; }
.item {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 5px 12px; padding: 12px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere;
}
.item small { display: block; color: var(--muted); margin-top: 4px; }
.movement-description { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 130px; }
.movement-description > div { min-width: 0; }
.movement-icon { width: 37px; height: 37px; border-radius: 12px; }
.amount { font-weight: 800; font-variant-numeric: tabular-nums; }
.amount.income { color: #176344; }
.actions { display: flex; flex-basis: 100%; justify-content: end; gap: 5px; }
.movement-list .actions { margin-top: -4px; }
.movement-list .item { animation: reveal .24s ease both; }
.empty { color: var(--muted); font-size: .9rem; padding: 12px 0; margin: 0; }
.category { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 14px 0; font-size: .86rem; }
.category progress { grid-column: 1 / -1; display: block; width: 100%; height: 8px; border: 0; border-radius: 12px; background: var(--soft); accent-color: var(--violet); }
.category progress::-webkit-progress-bar { background: var(--soft); border-radius: 12px; }
.category progress::-webkit-progress-value { background: linear-gradient(90deg, #792bd2, #a761ec); border-radius: 12px; }
.category progress::-moz-progress-bar { background: #792bd2; border-radius: 12px; }

.primary, .quiet, .link {
  min-height: 42px; border: 0; border-radius: 13px; padding: 9px 13px; font-weight: 750;
  transition: background-color .18s, box-shadow .18s, transform .18s;
}
.primary { background: var(--violet); color: white; box-shadow: 0 5px 12px #7025cd28; }
.quiet { background: var(--soft); color: #6023a7; }
.link { background: transparent; color: #6023a7; padding: 5px 7px; font-size: .82rem; }
.link.delete { color: #a02e54; }
@media (hover: hover) {
  .primary:hover { background: #5d1bb5; box-shadow: 0 7px 18px #7025cd42; }
  .quiet:hover, .link:hover { background: #eadbfa; }
}
button:active:not(:disabled) { transform: translateY(1px); }
.toggle-entries { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 8px; }
.chevron {
  width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .18s;
}
.toggle-entries[aria-expanded="true"] .chevron { transform: translateY(2px) rotate(225deg); }
input, select {
  min-width: 0; max-width: 100%; min-height: 42px; color: var(--ink); background: white;
  border: 1px solid #ded3eb; padding: 8px 10px; border-radius: 12px;
}
label { font-size: .85rem; font-weight: 700; }
form label { display: grid; gap: 6px; margin: 0 0 14px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #9852e8; outline-offset: 3px; }

.access {
  max-width: 540px; margin: 7vh auto 0; padding: clamp(24px, 7vw, 50px);
  background: radial-gradient(ellipse at 100% 0%, #ead8ff, #fff 65%);
}
.access h1 { font-size: clamp(2.7rem, 8vw, 4.6rem); color: #431680; }
.access p { color: var(--muted); margin: 17px 0 23px; }
#workspace, .access { animation: reveal .35s ease both; }
dialog {
  width: min(480px, calc(100% - 24px)); max-height: 90dvh; padding: 23px;
  border: 1px solid var(--line); border-radius: 24px; color: var(--ink);
  box-shadow: 0 20px 70px #2c143949;
}
dialog[open] { animation: reveal .25s ease both; }
dialog::backdrop { background: #2411389e; }
#notice, #form-error { color: #583986; background: #f1e6ff; padding: 10px 14px; border-radius: 13px; margin-bottom: 12px; font-size: .87rem; }
#form-error { color: #8b2849; background: #fbe9ef; }
@keyframes reveal { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes drift { to { transform: translateY(-48%) rotate(-13deg); } }

@media (max-width: 780px) {
  .overview { grid-template-columns: 1fr; }
  .dashboard-heading { align-items: start; flex-direction: column; }
}
@media (max-width: 520px) {
  .top { min-height: 62px; padding: 10px 14px; }
  main { padding: 16px 12px 36px; }
  .dashboard-heading { gap: 13px; margin: 4px 0 13px; }
  .toolbar { width: 100%; }
  .toolbar .primary { margin-left: auto; }
  .hero { min-height: 160px; border-radius: 23px; }
  .hero-art { right: -104px; width: 250px; height: 250px; opacity: .48; }
  .metrics { gap: 6px; margin: 11px 0; }
  .metric { flex-direction: column; align-items: start; gap: 6px; padding: 9px; border-radius: 15px; }
  .metric-icon { width: 30px; height: 30px; font-size: .95rem; border-radius: 9px; }
  .metric-label { font-size: .72rem; }
  .metric strong { font-size: .98rem; }
  .panel { padding: 14px; }
  .access { padding: 27px; }
  .section-title .quiet { font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
#period { text-transform: none; }
#period::first-letter { text-transform: uppercase; }
.toolbar { flex-wrap: wrap; }
@media (min-width: 781px) {
  .movement-list .item { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .movement-list .actions { grid-column: 2; margin-top: -7px; }
}
@media (max-width: 360px) {
  .toolbar input { flex: 1; }
  .toolbar .primary { margin-left: 0; }
}
