:root {
  color-scheme: dark;
  font-family: 'Segoe UI', system-ui, sans-serif;
  --background: #121317;
  --sidebar: #15161a;
  --surface: #1a1b21;
  --surface-raised: #24252d;
  --border: #2d2e36;
  --text: #f4f1f0;
  --muted: #a7a7b2;
  --accent: #f6aa72;
  --accent-hover: #ffbb8c;
  --accent-ink: #21160f;
  --accent-soft: #32251f;
  --radius: 15px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.main:focus, h1:focus { outline: none; }

.skip-link {
  position: fixed;
  z-index: 2;
  top: .75rem;
  left: .75rem;
  padding: .75rem 1rem;
  transform: translateY(-200%);
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 8px;
}
.skip-link:focus { transform: none; }

.app-shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 25px 15px 18px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}

.brand { display: flex; align-items: center; align-self: flex-start; gap: 11px; padding: 0 10px; }
.brand > span { font-size: 1.28rem; font-weight: 760; letter-spacing: -.055em; }
.brand > span > span { margin-left: 3px; color: var(--accent); }
.nav { display: grid; gap: 5px; margin-top: 39px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
}
.nav a:hover { color: var(--text); background: var(--surface-raised); }
.nav a[aria-current] { color: var(--accent); background: var(--accent-soft); border-color: #4a3328; }
.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: auto 2px 0;
  padding: 15px 7px 3px;
  border-top: 1px solid var(--border);
}
.sidebar-profile strong, .sidebar-profile span { display: block; }
.sidebar-profile strong { font-size: .875rem; }
.sidebar-profile span { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: .73rem;
  font-weight: 740;
  background: #352a41;
  color: #e8c8ff;
}
.avatar-creator { background: linear-gradient(145deg, #613957, #35213e); color: #ffdded; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 clamp(22px, 3vw, 48px);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: .875rem;
}
.preview-label, .chart-legend { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.topbar-actions, .language-picker { display: flex; align-items: center; gap: 8px; }
.language-picker { gap: 2px; }
.language-picker button { padding: 4px 6px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--muted); font-size: .75rem; }
.language-picker button[aria-pressed='true'] { color: var(--text); border-color: var(--border); }
.preview-label {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--sidebar);
  color: #d3c9c2;
  font-size: .8rem;
}
.preview-label > span, .chart-legend > span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.main { max-width: 1450px; margin: 0 auto; padding: 43px clamp(22px, 3vw, 48px) 50px; }
.page-header, .section-heading, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.page-header { margin-bottom: 37px; }
h1 { font-size: clamp(2rem, 3vw, 2.75rem); line-height: 1.09; letter-spacing: -.055em; }
h2 { font-size: 1.2rem; font-weight: 680; letter-spacing: -.025em; }
.page-header p, .section-heading p, .panel-heading p, .donation-panel > p {
  color: var(--muted);
  line-height: 1.5;
  margin-top: 5px;
}
.page-header p { margin-top: 9px; }
.section-heading p, .panel-heading p { font-size: .875rem; }
.section-heading { margin-bottom: 14px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: .875rem;
  line-height: 1.35;
  font-weight: 710;
  text-align: center;
}
.button .icon { width: 17px; height: 17px; }
.button-accent { background: var(--accent); color: var(--accent-ink); }
.button-accent:hover { background: var(--accent-hover); }
.button-accent[aria-disabled='true'] { opacity: .65; cursor: default; background: var(--accent); }
.button-full { width: 100%; }
.button-outline { background: var(--surface); color: var(--text); border-color: var(--border); }
.button-outline:hover { background: var(--surface-raised); }

.select-wrap { position: relative; }
.select-wrap select {
  appearance: none;
  min-height: 40px;
  padding: 8px 35px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: .875rem;
}
.select-wrap .icon { position: absolute; top: 12px; right: 11px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
body[data-mode='creator'] .workspace .panel { background: none; border: 0; border-radius: 0; }
body[data-mode='creator'] .metrics { gap: 0; border-block: 1px solid var(--border); }
body[data-mode='creator'] .metric + .metric { border-inline-start: 1px solid var(--border); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 19px; }
.metric { padding: 19px; }
.metric-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  border: 1px solid #4a3328;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.metric h3 { color: var(--muted); font-size: .875rem; font-weight: 590; }
.metric p { margin-top: 4px; font-size: clamp(1.5rem, 2.65vw, 2rem); font-weight: 690; letter-spacing: -.04em; }
.metric p, .activity-amount, .fee-summary dd { font-variant-numeric: tabular-nums; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.66fr) minmax(0, 1fr); gap: 16px; }
.chart-panel, .recent-panel, .tools-panel, .donation-panel { padding: 20px; }
.chart-legend, .panel-icon { color: var(--muted); }
.chart-legend { font-size: .8rem; }
.chart {
  display: grid;
  grid-template: 211px auto / max-content minmax(0, 1fr);
  gap: 12px 10px;
  margin-top: 25px;
  color: var(--muted);
  font-size: .75rem;
}
.chart-y, .chart-gridlines { display: flex; flex-direction: column; justify-content: space-between; }
.chart-y { align-items: flex-end; margin-block: -.5rem; }
.chart-plot { position: relative; }
.chart-gridlines, .chart-series { position: absolute; inset: 0; width: 100%; height: 100%; }
.chart-gridlines span { border-top: 1px solid var(--border); }
.chart-dates { grid-column: 2; display: flex; justify-content: space-between; white-space: nowrap; }
.chart-stroke { fill: none; stroke: var(--accent); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.chart-stop { stop-color: var(--accent); }

.activity-list { margin-top: 11px; }
.activity-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 13px 0; }
.activity-list li + li { border-top: 1px solid var(--border); }
.activity-list li:last-child { padding-bottom: 0; }
.activity-list .avatar { width: 34px; height: 34px; border-radius: 9px; }
.avatar-blue { background: #27384b; color: #bad8ff; }
.avatar-green { background: #273d37; color: #b5ead8; }
.avatar-neutral { background: var(--surface-raised); color: #c6c5d0; }
.avatar-peach { background: var(--accent-soft); color: var(--accent); }
.activity-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; font-weight: 650; }
.activity-date { display: block; margin-top: 3px; color: var(--muted); font-size: .8rem; }
.activity-amount { color: #f5c098; white-space: nowrap; font-size: .875rem; font-weight: 660; }
.activity-empty { padding-block: 25px; }
.activity-empty p { color: var(--muted); line-height: 1.5; margin-top: 5px; }

.donation-layout { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 16px; max-width: 960px; align-items: start; }
.creator-panel { overflow: hidden; }
.creator-cover {
  height: 125px;
  background: radial-gradient(ellipse at 80% 5%, #89554d, transparent 62%), linear-gradient(110deg, #302440, #562e46);
}
.creator-info { position: relative; margin-top: -34px; padding: 0 22px 24px; }
.creator-info .avatar { width: 68px; height: 68px; margin-bottom: 13px; border: 4px solid var(--surface); border-radius: 17px; font-size: 1.2rem; }
.creator-info p { color: var(--muted); line-height: 1.6; margin-top: 8px; }
.donation-panel form { margin-top: 19px; }
.donation-panel fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.donation-panel legend, .field-label { padding: 0; font-size: .875rem; font-weight: 620; }
.amount-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin: 8px 0 12px; }
.amount-options button, .donation-panel input:not([type='checkbox'], [type='hidden']), .donation-panel textarea {
  min-height: 41px;
  padding: 8px 10px;
  background: var(--background);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.amount-options button:hover, .amount-options button[aria-pressed='true'] { border-color: #936449; color: var(--accent); background: var(--accent-soft); }
.donation-panel input:not([type='checkbox'], [type='hidden']), .donation-panel textarea { display: block; width: 100%; margin-top: 6px; }
.donation-panel textarea { resize: vertical; }
.donation-panel small, .field-label span { color: var(--muted); font-size: .8rem; font-weight: 400; }
.donation-panel small { display: block; margin-top: 6px; }
.field-label { display: block; margin-top: 12px; }
.field-label span { margin-left: 4px; }
.check-label { display: flex; align-items: center; gap: 8px; margin: 14px 0; font-size: .875rem; cursor: pointer; }
.check-label input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.fee-summary { display: grid; gap: 8px; border-block: 1px solid var(--border); padding: 12px 0; margin-bottom: 14px; font-size: .875rem; }
.fee-summary div { display: flex; gap: 16px; justify-content: space-between; }
.fee-summary div:first-child { color: var(--muted); }
.fee-summary div:last-child { font-weight: 690; }
.notice { margin-top: 13px; padding: 10px 12px; border-radius: 8px; background: #263b34; color: #d3fae9; font-size: .875rem; }

.tools-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.overlay-stage {
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 20px;
  margin-top: 17px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: repeating-conic-gradient(#22232a 0 25%, #25262e 0 50%) 0 0 / 22px 22px;
  text-align: center;
}
.overlay-stage > * { grid-area: 1 / 1; }
.overlay-stage > p { color: var(--muted); font-size: .875rem; }
.overlay-content:not(:empty) { display: grid; gap: 3px; padding: 14px 18px; color: var(--accent); border: 1px solid #936449; border-radius: 12px; background: var(--background); }
.overlay-content strong { font-size: 1.2rem; }
.overlay-content span { color: var(--text); font-size: .875rem; }
.goal-preview { display: grid; gap: 8px; margin-top: 17px; padding: 14px; border-radius: 9px; background: var(--background); }
.goal-preview span { color: var(--muted); font-size: .875rem; }
.goal-preview strong { font-size: 1.4rem; }
.goal-preview small { color: var(--muted); font-size: .8rem; font-weight: 500; }
.goal-preview progress { width: 100%; accent-color: var(--accent); }

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 192px minmax(0, 1fr); }
  .dashboard-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
}

@media (max-width: 890px) {
  .dashboard-grid, .tools-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 740px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; padding: 16px 16px 8px; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { padding: 0 3px; }
  .brand img { width: 30px; height: 30px; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 13px; }
  .nav a { gap: 6px; padding: 8px 7px; font-size: .8125rem; min-height: 38px; }
  .nav .icon { width: 16px; height: 16px; }
  .sidebar-profile { display: none; }
  .topbar { min-height: 45px; padding-inline: 16px; }
  .main { padding: 27px 16px 38px; }
  .page-header { margin-bottom: 25px; }
  .donation-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .page-header { align-items: flex-start; flex-direction: column; gap: 14px; }
  .metrics { gap: 7px; }
  .metric { padding: 11px 9px; }
  .metric-icon { width: 31px; height: 31px; margin-bottom: 10px; }
  .metric-icon .icon { width: 17px; height: 17px; }
  .metric h3 { font-size: .8rem; }
  .metric p { font-size: 1.25rem; }
  .chart-panel, .recent-panel, .tools-panel, .donation-panel { padding: 15px; }
  .chart { grid-template-rows: 155px auto; gap: 10px 6px; }
  .chart-dates span:nth-child(even) { visibility: hidden; }
}
