:root {
  --bg: #f4efe4;
  --surface: rgba(255, 255, 255, .84);
  --surface-strong: #fff;
  --text: #1d2b21;
  --muted: #5f6f65;
  --line: rgba(28, 50, 39, .12);
  --green: #245a42;
  --green-dark: #123524;
  --gold: #d6b86b;
  --shadow: 0 22px 60px rgba(33, 50, 40, .14);
  --hero: linear-gradient(135deg, #123524 0%, #2d6a4f 46%, #d6b86b 100%);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100%;
  margin: 0;
  padding: 32px 18px 48px;
  background:
    radial-gradient(circle at top left, rgba(214, 184, 107, .35), transparent 28%),
    radial-gradient(circle at bottom right, rgba(45, 106, 79, .2), transparent 30%),
    linear-gradient(180deg, var(--bg), #fbf8f1);
  color: var(--text);
  font-family: "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
}
button, input { font: inherit; }
button { color: inherit; }
.page-shell { max-width: 1180px; margin: 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.hero {
  position: relative;
  overflow: hidden;
  padding: 34px;
  border-radius: 28px;
  background: var(--hero);
  box-shadow: var(--shadow);
  color: #fffef8;
}
.hero::before, .hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.hero::before { width: 240px; height: 240px; top: -110px; right: -40px; }
.hero::after { width: 180px; height: 180px; bottom: -70px; left: 38%; }
.hero-content { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 28px; align-items: end; justify-content: space-between; }
.hero-copy { max-width: 650px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(10px);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.eyebrow i, .database-badge i { width: 8px; height: 8px; border-radius: 50%; background: #dff6a4; box-shadow: 0 0 0 4px rgba(223,246,164,.18); }
.hero h1 { margin: 18px 0 10px; font-size: clamp(2.35rem, 6vw, 4rem); line-height: 1; font-weight: 800; letter-spacing: -.045em; }
.hero p { margin: 0; max-width: 58ch; color: rgba(255,255,255,.84); font-size: 1.02rem; line-height: 1.65; }
.hero-stats { display: grid; grid-template-columns: repeat(2, minmax(130px, 1fr)); gap: 14px; min-width: min(100%, 350px); }
.stat-card { padding: 18px; border: 1px solid rgba(255,255,255,.18); border-radius: 20px; background: rgba(255,255,255,.1); backdrop-filter: blur(14px); }
.stat-label { display: block; color: rgba(255,255,255,.74); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.stat-value { display: block; margin-top: 9px; font-size: 1.45rem; line-height: 1.1; }
.current-total-card { grid-column: 1 / -1; background: rgba(255,255,255,.18); }
.current-total-card small { display: block; margin-top: 7px; color: rgba(255,255,255,.78); font-size: .68rem; }
.current-total-card small.positive { color: #e7ffc0; }
.current-total-card small.negative { color: #ffd1c7; }
.hero-action { flex: 0 0 100%; width: fit-content; padding: 13px 18px; display: inline-flex; align-items: center; gap: 9px; border: 1px solid rgba(255,255,255,.24); border-radius: 999px; background: #fffef8; color: var(--green-dark); font-size: .84rem; font-weight: 800; cursor: pointer; box-shadow: 0 14px 28px rgba(9,34,20,.18); }
.hero-action:hover { transform: translateY(-2px); }
.hero-action span { font-size: 1.1rem; }

.control-panel, .allocation-card, .highlights-card, .data-shell {
  border: 1px solid rgba(255,255,255,.58);
  background: var(--surface);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 32px rgba(57,77,65,.08);
}
.control-panel { margin-top: 24px; padding: 22px; border-radius: 24px; }
.controls-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 18px; align-items: end; }
.section-label { margin: 0 0 12px; color: var(--muted); font-size: .9rem; font-weight: 700; }
.category-group { display: flex; flex-wrap: wrap; gap: 10px; }
.category-chip {
  padding: 12px 17px;
  border: 0;
  border-radius: 999px;
  background: #e8eee9;
  color: var(--green-dark);
  font-size: .86rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.category-chip:hover { transform: translateY(-2px); }
.category-chip.active { background: var(--green); color: white; box-shadow: 0 12px 24px rgba(36,90,66,.2); }
.search-card { min-height: 56px; padding: 0 18px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.88); }
.search-icon { color: var(--muted); font-size: 1.5rem; transform: rotate(-15deg); }
.search-card input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-card input::placeholder { color: #829087; }
.meta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.meta-row span { padding: 8px 12px; border-radius: 999px; background: #eef1ec; color: var(--muted); font-size: .78rem; }
.meta-row b { color: var(--text); }

.overview-grid { display: grid; grid-template-columns: 1.35fr .8fr; gap: 24px; margin-top: 24px; }
.allocation-card, .highlights-card { padding: 26px; border-radius: 24px; }
.card-heading, .table-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.kicker { color: var(--green); font-size: .68rem; font-weight: 800; letter-spacing: .15em; }
h2 { margin: 5px 0 0; font-size: clamp(1.35rem, 3vw, 1.9rem); letter-spacing: -.025em; }
.pill, .database-badge { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .66rem; font-weight: 700; letter-spacing: .08em; }
.database-badge { display: inline-flex; align-items: center; gap: 9px; }
.database-badge i { background: #45966d; box-shadow: 0 0 0 4px rgba(69,150,109,.12); }
.chart-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 38px; align-items: center; margin-top: 30px; }
.donut { width: 220px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; position: relative; background: #e5e9e3; box-shadow: inset 0 0 0 1px rgba(29,43,33,.05); }
.donut::after { content: ""; position: absolute; inset: 28%; border-radius: 50%; background: #fbfaf6; box-shadow: 0 5px 18px rgba(33,50,40,.1); }
.donut > div { position: relative; z-index: 1; text-align: center; }
.donut b { display: block; font-size: 2rem; }
.donut span { color: var(--muted); font-size: .6rem; letter-spacing: .12em; }
.legend > div { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .8rem; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend strong { font-size: .75rem; }
.legend span:last-child { color: var(--muted); }
.ranking { margin-top: 18px; }
.ranking-item { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ranking-index { color: #9aa59e; font-size: .75rem; font-weight: 800; }
.ranking-top { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; }
.ranking-top span { color: var(--muted); }
.bar { height: 5px; margin-top: 9px; overflow: hidden; border-radius: 20px; background: #e0e5df; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green-dark), #79a96c); }

.data-shell { margin-top: 24px; padding: 26px; border-radius: 24px; }
.table-title { margin-bottom: 22px; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.74); }
table { width: 100%; min-width: 1090px; border-collapse: collapse; }
th { padding: 14px 16px; color: var(--muted); font-size: .65rem; letter-spacing: .09em; text-align: left; text-transform: uppercase; }
td { padding: 16px; border-top: 1px solid var(--line); font-size: .82rem; }
tbody tr { transition: background .18s ease; }
tbody tr:hover { background: rgba(231,239,232,.7); }
.asset { display: flex; align-items: center; gap: 12px; }
.asset-icon { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 14px; background: linear-gradient(145deg, #dfe9dc, #f7f6ef); color: var(--green-dark); font-size: .75rem; font-weight: 800; }
.asset strong, .asset small { display: block; }
.asset small { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.participation { min-width: 120px; }
.participation div { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--muted); font-size: .7rem; }
.details-button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #e9eee9; color: var(--green); cursor: pointer; font-weight: 800; }
.details-button:hover { background: var(--green); color: white; }
.loading, .empty { padding: 54px; color: var(--muted); text-align: center; }
.table-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; }
.quote-status { color: var(--muted); font-size: .68rem; }
.refresh-quotes { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--green); font-size: .69rem; font-weight: 800; cursor: pointer; }
.refresh-quotes:hover { background: var(--green); color: white; }
.refresh-quotes:disabled { cursor: wait; opacity: .55; }
.current-price strong, .current-price span { display: block; }
.current-price span { margin-top: 3px; color: var(--muted); font-size: .64rem; white-space: nowrap; }
.current-price .positive { color: #287049; }
.current-price .negative { color: #a3473e; }
.quote-placeholder { color: #8a958e; }
.position-value strong, .position-value span { display: block; }
.position-value span { margin-top: 3px; color: var(--muted); font-size: .64rem; white-space: nowrap; }
.manual-quote { margin-top: 5px; padding: 0; border: 0; border-bottom: 1px solid currentColor; background: transparent; color: var(--green); font-size: .65rem; font-weight: 800; cursor: pointer; }
.manual-quote:hover { color: var(--green-dark); }

dialog { width: min(720px, calc(100% - 28px)); max-height: calc(100vh - 40px); padding: 0; overflow: auto; border: 0; border-radius: 26px; background: #fbfaf6; color: var(--text); box-shadow: 0 30px 90px rgba(12,34,22,.35); }
dialog::backdrop { background: rgba(12,30,20,.55); backdrop-filter: blur(5px); }
.modal-topbar { position: sticky; top: 0; z-index: 2; padding: 24px 26px; display: flex; align-items: center; justify-content: space-between; background: linear-gradient(135deg, #f7f3e9, #e9f0e7); border-bottom: 1px solid var(--line); }
.close-button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: white; cursor: pointer; font-size: 1.5rem; }
.modal-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 22px 26px 10px; }
.modal-summary div { padding: 14px; border-radius: 16px; background: #eef1ec; }
.modal-summary span, .modal-summary b { display: block; }
.modal-summary span { color: var(--muted); font-size: .65rem; text-transform: uppercase; }
.modal-summary b { margin-top: 6px; font-size: .9rem; }
.operations { padding: 12px 26px 28px; }
.operation { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--line); font-size: .78rem; }
.operation span { color: var(--muted); }
.operation b { text-align: right; }
.error-banner { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(620px, calc(100% - 32px)); padding: 16px 20px; border-radius: 16px; background: #7d2929; color: white; box-shadow: var(--shadow); }

.manager-dialog { width: min(1100px, calc(100% - 28px)); }
.manager-layout { display: grid; grid-template-columns: minmax(330px, .75fr) minmax(430px, 1.25fr); min-height: 560px; }
.entry-form { padding: 28px; border-right: 1px solid var(--line); background: linear-gradient(180deg, #fbfaf6, #f4f2e9); }
.form-heading, .entries-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.form-heading h3, .entries-heading h3 { margin: 5px 0 0; font-size: 1.2rem; }
.text-button { padding: 7px 10px; border: 0; background: transparent; color: var(--green); font-size: .75rem; font-weight: 800; cursor: pointer; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.field input, .field select, .money-input { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 13px; outline: 0; background: white; color: var(--text); }
.field input, .field select { padding: 0 13px; }
.field input:focus, .field select:focus, .money-input:focus-within { border-color: #5c8b70; box-shadow: 0 0 0 3px rgba(92,139,112,.12); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .field:last-child { grid-column: 1 / -1; }
.money-input { display: flex; align-items: center; }
.money-input span { padding-left: 13px; color: var(--muted); font-size: .8rem; }
.money-input input { min-height: 42px; border: 0; box-shadow: none !important; }
.form-total { margin: 4px 0 18px; padding: 15px; display: flex; justify-content: space-between; align-items: center; border-radius: 14px; background: #e8eee9; }
.form-total span { color: var(--muted); font-size: .72rem; }
.form-total strong { color: var(--green-dark); }
.primary-button { width: 100%; min-height: 48px; border: 0; border-radius: 14px; background: var(--green); color: white; font-weight: 800; cursor: pointer; box-shadow: 0 12px 24px rgba(36,90,66,.2); }
.primary-button:hover { background: var(--green-dark); }
.entries-panel { min-width: 0; padding: 28px; }
.mini-search { width: 170px; min-height: 38px; padding: 0 11px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.mini-search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: .75rem; }
.entries-list { max-height: 460px; overflow: auto; padding-right: 5px; }
.entry-row { display: grid; grid-template-columns: 46px minmax(100px, 1fr) minmax(95px, .75fr) 78px; gap: 12px; align-items: center; padding: 13px 5px; border-bottom: 1px solid var(--line); }
.entry-date { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px; background: #e8eee9; color: var(--green-dark); font-size: .66rem; font-weight: 800; text-align: center; line-height: 1.15; }
.entry-info strong, .entry-info span, .entry-value strong, .entry-value span { display: block; }
.entry-info span, .entry-value span { margin-top: 3px; color: var(--muted); font-size: .67rem; }
.entry-info strong, .entry-value strong { font-size: .78rem; }
.entry-value { text-align: right; }
.edit-button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #edf0eb; color: var(--green); cursor: pointer; font-size: .9rem; }
.edit-button:hover { background: var(--green); color: white; }
.entry-actions { display: flex; gap: 6px; justify-content: flex-end; }
.delete-button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f4e9e6; color: #9a443b; cursor: pointer; font-size: .9rem; }
.delete-button:hover { background: #9a443b; color: white; }
.entries-empty { padding: 50px 10px; color: var(--muted); text-align: center; font-size: .8rem; }
.quote-dialog { width: min(470px, calc(100% - 28px)); }
.quote-form-body { padding: 26px; }
.quote-form-body > p { margin: 0 0 22px; color: var(--muted); font-size: .82rem; line-height: 1.6; }

@media (max-width: 850px) {
  .controls-grid, .overview-grid { grid-template-columns: 1fr; }
  .chart-wrap { grid-template-columns: 200px 1fr; }
  .donut { width: 200px; }
  .manager-layout { grid-template-columns: 1fr; }
  .entry-form { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 580px) {
  body { padding: 14px 10px 30px; }
  .hero, .control-panel, .allocation-card, .highlights-card, .data-shell { border-radius: 20px; }
  .hero { padding: 26px 22px; }
  .hero-stats { grid-template-columns: 1fr 1fr; width: 100%; min-width: 0; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 1.15rem; }
  .chart-wrap { grid-template-columns: 1fr; }
  .donut { margin: auto; }
  .table-title { align-items: flex-start; flex-direction: column; }
  .table-actions { justify-content: flex-start; }
  .modal-summary { grid-template-columns: 1fr; }
  .operation { grid-template-columns: 1fr 1fr; }
  .entries-heading { align-items: stretch; flex-direction: column; }
  .mini-search { width: 100%; }
  .entry-row { grid-template-columns: 42px 1fr 76px; }
  .entry-value { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
