:root {
  color-scheme: dark;
  --bg: #0a101c;
  --panel: #121b2a;
  --panel-raised: #172234;
  --line: #2b3a4e;
  --text: #eef4ff;
  --muted: #a4b4ca;
  --teal: #62e9c5;
  --teal-ink: #092d2b;
  --violet: #c5b1ff;
  --red: #ffa39c;
  --radius: 18px;
  --sans: "Pretendard", "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
}

.monthly-goal {
  background: radial-gradient(ellipse at 92% 4%, #2e2453 0, transparent 58%), var(--panel);
}
.goal-rate { color: var(--teal); font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1; }
.goal-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 20px 0 14px; }
.goal-stats span { display: block; color: var(--muted); font-size: .85rem; }
.goal-stats strong { display: block; margin-top: 6px; font-size: clamp(1.1rem, 4vw, 1.75rem); overflow-wrap: anywhere; }
.goal-progress { display: block; appearance: none; width: 100%; height: 30px; border: 1px solid #465673; border-radius: 999px; overflow: hidden; background: #202a40; }
.goal-progress::-webkit-progress-bar { background: #202a40; }
.goal-progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(100deg, #41dcbc, #73a9ff 55%, #c5a4ff); transform-origin: left; animation: goal-fill .65s ease-out both; }
.goal-progress::-moz-progress-bar { border-radius: 999px; background: linear-gradient(100deg, #41dcbc, #73a9ff 55%, #c5a4ff); transform-origin: left; animation: goal-fill .65s ease-out both; }
@keyframes goal-fill { from { transform: scaleX(0); opacity: .5; } to { transform: scaleX(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .goal-progress::-webkit-progress-value { animation: none; }
  .goal-progress::-moz-progress-bar { animation: none; }
}
.earnings-bulk { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 18px 0; padding: 14px; background: var(--panel-raised); border-radius: 14px; }
.earnings-bulk .field { flex: 1 1 185px; }
.earnings-bulk p { width: 100%; margin: 0; }
.earning-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 12px; margin-top: 16px; }
.earning-day { min-width: 0; }
.earning-day input { min-width: 0; }
.earning-day input:disabled { opacity: .48; }
.investment-cards { display: none; }
.button.investment-register { background: linear-gradient(135deg, #275dce, #2b75e4); border-color: #5794f5; color: #fff; font-weight: 750; }
.button.investment-register:hover { background: #326fdb; }
.investment-investor, .investment-investor small { display: block; }
.investment-investor small { margin-top: 3px; }
.investment-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .earning-days { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .earnings-bulk .button { width: 100%; }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  background: radial-gradient(ellipse 58rem 30rem at 78% -10rem,#173448 0%,transparent 74%),var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  display: flex;
  flex-direction: column;
}
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .56; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 3px;
}
h1,h2,h3,p { margin: 0; }
h1,h2,h3 { line-height: 1.18; letter-spacing: -.035em; word-break: keep-all; }
h1 { font-size: clamp(2.05rem,5vw,3.4rem); }
h2 { font-size: clamp(1.22rem,2.4vw,1.55rem); }
h3 { font-size: 1.05rem; }
small { font-size: .82em; }
[hidden] { display: none !important; }
.topbar, .footer {
  width: min(100% - 48px,1160px);
  margin-inline: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.topbar { min-height: 77px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; gap: 11px; align-items: center; color: var(--text); text-decoration: none; font-weight: 850; letter-spacing: .14em; line-height: 1.08; }
.brand-icon {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none;
  border-radius: 11px; background: linear-gradient(140deg,#a5ffe2,#55c9b5);
  color: #0a2928; font: 900 21px/1 var(--sans); letter-spacing: -.12em; padding-right: 2px;
  box-shadow: 0 4px 17px #62e9c533;
}
.brand small { display: block; margin-top: 5px; color: var(--muted); font-size: 8px; letter-spacing: .17em; }
.account-actions { display: flex; align-items: center; gap: 11px; min-width: 0; }
.account-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; max-width: 175px; }
.footer { min-height: 74px; border-top: 1px solid var(--line); color: var(--muted); font-size: .81rem; }
.footer a { text-underline-offset: 3px; }
.frame { width: min(100% - 48px,1160px); margin: 36px auto 52px; flex: 1; }
.stack { display: grid; gap: 18px; }
.muted { color: var(--muted); }
.eyebrow { display: block; font-size: .69rem; font-weight: 800; letter-spacing: .15em; color: var(--teal); text-transform: uppercase; }
.tabular, .amount { font-variant-numeric: tabular-nums lining-nums; }
.button {
  min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 15px; border: 1px solid var(--line); border-radius: 10px; color: var(--text);
  background: var(--panel-raised); font-weight: 740; text-decoration: none;
}
.button:hover:not(:disabled) { border-color: #5d748b; background: #23344a; }
.button.primary { background: var(--teal); color: #0b2c27; border-color: transparent; }
.button.primary:hover:not(:disabled) { background: #98f6db; border-color: transparent; }
.button.ghost { background: transparent; }
.button.danger { color: var(--red); }
.button.small { min-height: 34px; padding: 5px 11px; font-size: .84rem; }
.button.full { width: 100%; }
.panel {
  min-width: 0; background: linear-gradient(150deg,#162131 0%,var(--panel) 65%);
  border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px,2.5vw,25px);
  box-shadow: 0 16px 45px #05081040;
}
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 13px; margin-bottom: 18px; }
.section-head .muted { margin-top: 7px; }
.section-head > * { min-width: 0; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 4px 9px; border: 1px solid #365467; border-radius: 999px;
  background: #152c38; color: #b7dcea; font-size: .73rem; font-weight: 800;
}
.badge.good { background: #143832; border-color: #32665a; color: var(--teal); }
.badge.demo { color: var(--violet); background: #2d2542; border-color: #554378; }
.badge.bad { color: var(--red); background: #35252b; border-color: #66414b; }
.good-text { color: var(--teal); }
.negative { color: var(--red); }
.loading, .empty { border: 1px dashed #40526b; border-radius: 13px; padding: 23px 16px; color: var(--muted); text-align: center; }
.empty strong { color: var(--text); display: block; margin-bottom: 4px; }
.hero {
  display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 16px;
  padding: 32px 32px 29px; border: 1px solid #325264; border-radius: 23px;
  background: radial-gradient(ellipse at 86% 9%,#174450,transparent 62%),linear-gradient(115deg,#19263c,#142030);
}
.hero h1 { margin: 7px 0 11px; }
.hero .muted { max-width: 44rem; }
.hero-meta { align-self: start; text-align: right; font-variant-numeric: tabular-nums; }
.hero-meta small { display: block; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; }
.metric { min-width: 0; padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; background: #131d2e; }
.metric span, .metric small { display: block; color: var(--muted); }
.metric strong { display: block; font-size: clamp(1.1rem,2.5vw,1.75rem); margin: 4px 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.22; }
.metric small { font-size: .73rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(270px,1fr); gap: 17px; align-items: start; }
.control-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.control-row label { color: var(--muted); font-size: .83rem; }
.control-row select { max-width: 100%; min-width: 0; }
.chart-frame { margin-top: 8px; }
.chart-frame svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-values { display: flex; gap: 8px; justify-content: space-between; color: var(--muted); font-size: .74rem; margin: 3px 0 0; }
.chart-axis { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart-grid { stroke: #354359; stroke-width: 1; stroke-dasharray: 4 5; }
.chart-line { stroke: var(--teal); stroke-width: 2.5; fill: none; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-dot { fill: var(--teal); stroke: var(--panel); stroke-width: 2; }
.chart-area { fill: #62e9c5; fill-opacity: .10; }
.chart-demo .chart-area { fill: var(--violet); }
.chart-demo .chart-dot { fill: var(--violet); }
.chart-demo .chart-line { stroke: var(--violet); }
.chart-comparison .chart-projection { stroke: #baa6ff; stroke-dasharray: 5 5; }
.chart-comparison .chart-series { animation: monthly-series-reveal .85s ease-out both; }
@keyframes monthly-series-reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
.monthly-chart-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; list-style: none; margin: 16px 0 8px; padding: 0; }
.monthly-chart-legend li { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 6px 9px; border-radius: 8px; background: #1b263d; color: var(--muted); font-size: .8rem; }
.monthly-chart-legend strong { color: var(--text); font-variant-numeric: tabular-nums; }
.legend-forecast,.legend-actual { width: 16px; border-top: 2px solid var(--teal); }
.legend-forecast { border-color: #baa6ff; border-top-style: dashed; }
.monthly-forecast-note { margin-top: 12px; font-size: .82rem; }
@media (prefers-reduced-motion: reduce) { .chart-comparison .chart-series { animation: none; } }
.inline-info { padding: 12px 13px; border-radius: 10px; border: 1px solid #355465; background: #122b36; color: #c3dce7; margin: 0 0 14px; }
.inline-info p + p { margin-top: 4px; }
.inline-info.demo-info { border-color: #584a77; background: #241d36; color: #ddd0fa; }
.keyline { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.keyline span { color: var(--muted); }
.keyline strong { text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.withdraw-panel .button { margin-top: 13px; }
.withdraw-panel .muted { font-size: .85rem; margin-top: 9px; }
.withdrawal-settings { margin-top: 18px; max-width: 560px; }
.withdrawal-example-note { margin-top: 11px; font-size: .85rem; }
.example-amount { color: var(--violet); }
.scenario { border-color: #4f426a; }
.scenario .section-head { margin-bottom: 11px; }
.scenario .stats-inline { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 13px; }
.scenario .stats-inline span { color: var(--muted); display: block; font-size: .82rem; }
.scenario .stats-inline strong { font-size: 1.2rem; color: var(--violet); }
.table-wrap { overflow: auto; max-width: 100%; }
.table-wrap:focus-visible { outline: 2px solid var(--teal); }
table { border-collapse: collapse; width: 100%; text-align: left; }
th,td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .78rem; color: var(--muted); white-space: nowrap; font-weight: 700; }
td { font-size: .9rem; }
td.nowrap { white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td .muted { display: block; font-size: .8em; }
.admin-table { min-width: 660px; }
.investment-earnings { white-space: nowrap; }
.investment-earnings strong { font-variant-numeric: tabular-nums; }
.member-list { display: grid; gap: 8px; list-style: none; padding: 0; margin: 0; }
.member-row {
  display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 12px;
  width: 100%; min-height: 55px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 11px;
  background: #131d2e; color: var(--text); text-align: left;
}
.member-row:hover { background: #1c2d3f; border-color: #507067; }
.member-row-identity { min-width: 0; overflow-wrap: anywhere; }
.member-row-identity small { display: block; }
.member-row-arrow { color: var(--teal); font-size: 1.4rem; line-height: 1; }
.member-management-link { margin-top: 12px; }
.member-picker { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 13px; }
.member-picker select { min-width: 0; text-overflow: ellipsis; }
.member-search-status { grid-column: 1 / -1; margin-top: 5px; font-size: .78rem; }
#admin-member-list { margin-top: 14px; }
.panel > .member-search { max-width: 420px; }
.payout-date-pair { display: grid; grid-column: span 2; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; align-items: start; }
.payout-date-pair input[readonly] { color: var(--teal); background: #142437; }
.form-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; }
.form-grid .span-all { grid-column: 1 / -1; }
form .actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.field { display: grid; gap: 5px; color: var(--muted); min-width: 0; font-weight: 650; font-size: .86rem; }
input, select, textarea {
  width: 100%; min-height: 43px; padding: 9px 11px; color: var(--text);
  border: 1px solid #41516a; border-radius: 9px; background: #0c1524;
}
textarea { min-height: 78px; resize: vertical; }
input::placeholder,textarea::placeholder { color: #95a6bd; }
form .error { color: var(--red); font-weight: 650; min-height: 1em; margin-top: 10px; }
.tabs { display: flex; flex-wrap: wrap; gap: 7px; }
.tabs button { background: #111b29; color: var(--muted); border: 1px solid var(--line); border-radius: 9px; min-height: 42px; padding: 8px 13px; font-weight: 780; }
.tabs button[aria-pressed="true"] { color: var(--teal); background: #183735; border-color: #3d6b62; }
.auth-shell { display: grid; grid-template-columns: minmax(0,1.12fr) minmax(0,1fr); gap: 18px; max-width: 920px; margin: 21px auto; align-items: stretch; }
.auth-intro {
  position: relative; min-height: 400px; overflow: hidden; padding: clamp(23px,4vw,37px);
  border: 1px solid #3a6573; border-radius: 23px;
  background: radial-gradient(ellipse at 75% 60%,#20594f,transparent 68%),linear-gradient(145deg,#1a3b4b,#122136);
}
.auth-intro h1 { margin: 12px 0; font-size: clamp(2rem,5.2vw,3.3rem); position: relative; z-index: 1; }
.auth-intro p { max-width: 26rem; position: relative; z-index: 1; color: #bbd2df; }
.auth-intro .auth-lines { position: absolute; inset: auto -2% 0; width: 104%; height: 44%; opacity: .64; }
.auth-panel { display: grid; align-content: center; padding: clamp(20px,3.5vw,31px); }
.auth-panel h2 { margin: 5px 0 9px; }
.auth-panel form { display: grid; gap: 12px; margin-top: 17px; }
.auth-panel .tabs { margin-top: 14px; }
.auth-panel .tabs button { flex: 1 1 auto; }
.auth-panel .error { margin: 0; }
.session-card { max-width: 500px; margin: 38px auto; }
.session-card h1 { font-size: 1.8rem; margin: 7px 0; }
.session-card form { margin-top: 18px; }
.notice {
  position: fixed; z-index: 20; inset: auto 14px 16px auto; max-width: min(92%,420px);
  padding: 13px 16px; border-radius: 11px; border: 1px solid #4a7d73; color: var(--text);
  background: #1b3c3d; box-shadow: 0 7px 25px #060b14aa; overflow-wrap: anywhere;
}
dialog {
  width: min(100% - 30px,460px); border: 1px solid #486478; border-radius: 17px;
  background: var(--panel-raised); color: var(--text); padding: 23px;
  box-shadow: 0 20px 60px #0009;
}
dialog::backdrop { background: #03060caa; backdrop-filter: blur(2px); }
dialog h2 { margin: 0 0 10px; }
dialog form { margin-top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 780px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .auth-intro { min-height: 335px; }
}
@media (max-width: 560px) {
  .topbar,.footer,.frame { width: calc(100% - 26px); }
  .topbar { min-height: 65px; }
  .frame { margin-top: 18px; margin-bottom: 32px; }
  .auth-shell { grid-template-columns: 1fr; gap: 11px; margin: 0; }
  .auth-intro { min-height: 211px; }
  .auth-intro .auth-lines { height: 39%; }
  .hero { grid-template-columns: 1fr; padding: 18px; }
  .hero-meta { text-align: left; }
  .section-head { flex-wrap: wrap; }
  .section-head h2 { margin-top: 1px; }
  .chart-axis { font-size: 17px; }
  .metric { padding: 11px 10px; }
  .metric span { font-size: .82rem; }
  .metric small { font-size: .68rem; }
  th,td { padding: 9px 8px; }
  .member-picker,.payout-date-pair { grid-column: 1 / -1; grid-template-columns: 1fr; row-gap: 8px; }
  .member-search-status { margin-top: 0; }
}
@media (max-width: 365px) {
  .form-grid { grid-template-columns: 1fr; }
  .account-name { max-width: 75px; }
  .account-actions { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

@media (max-width: 780px) {
  .admin-dashboard { gap: 16px; }
  .admin-dashboard .hero { background: #141f32; border-color: #2a3b58; padding: 18px; }
  .admin-dashboard .metric { background: #131d2e; border-color: #283850; box-shadow: none; }
  .admin-dashboard .tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .admin-dashboard .tabs button { padding-inline: 4px; min-width: 0; min-height: 44px; font-size: .8rem; }
  .admin-dashboard .investment-list { padding: 0; border: 0; background: transparent; box-shadow: none; }
  .investment-list .section-head { align-items: center; flex-wrap: wrap; margin: 0 0 14px; }
  .investment-list .investment-register { min-height: 44px; background: #326de3; box-shadow: none; }
  .investment-desktop { display: none; }
  .investment-cards { display: grid; gap: 14px; }
  .investment-card { min-width: 0; padding: 16px; border: 1px solid #2b3b56; border-radius: 19px; background: #141e30; }
  .investment-card-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; }
  .investment-avatar { display: grid; place-items: center; width: 44px; aspect-ratio: 1; border-radius: 14px; background: #26385b; color: #cadbff; font-size: 1.2rem; font-weight: 800; }
  .investment-card:nth-child(even) .investment-avatar { background: #312d50; color: #e1d7ff; }
  .investment-identity { min-width: 0; overflow-wrap: anywhere; }
  .investment-card-label, .investment-identity small { display: block; color: var(--muted); font-size: .76rem; }
  .investment-identity h3 { margin: 2px 0 3px; font-size: 1.12rem; word-break: normal; }
  .button.investment-card-edit { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; padding: 6px 10px; color: #d8e6ff; background: #1d2b42; border-color: #354867; }
  .investment-card dl { display: grid; margin: 0; gap: 10px; }
  .investment-card dt { color: var(--muted); font-size: .75rem; }
  .investment-card dd { margin: 4px 0 0; overflow-wrap: anywhere; }
  .investment-card .investment-money { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 15px; }
  .investment-money > div { padding: 11px; border-radius: 13px; background: #1e2c45; }
  .investment-money > div:nth-child(2) { background: #1c343c; }
  .investment-money strong { display: block; color: #eef4ff; font-size: clamp(1rem, 4.3vw, 1.38rem); font-variant-numeric: tabular-nums; line-height: 1.2; }
  .investment-money .investment-long-amount { font-size: clamp(.78rem, 3.3vw, 1.08rem); }
  .investment-money small { display: block; color: #a6d2ca; margin-top: 5px; font-size: .71rem; }
  .investment-actual { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; padding: 10px 1px; color: var(--muted); font-size: .83rem; }
  .investment-actual strong { color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .investment-card .investment-dates { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-top: 10px; border-top: 1px solid #2b3b56; }
  .investment-dates dd { font-size: .81rem; font-weight: 700; }
  .investment-card-note { margin-top: 11px; padding-top: 9px; border-top: 1px solid #2b3b56; overflow-wrap: anywhere; font-size: .83rem; }
  .investment-card-note span { margin-right: 8px; color: var(--muted); }
}
@media (max-width: 560px) {
  .investment-list .investment-register { width: 100%; }
  body[data-portal="admin"] dialog:has(form[data-form="investment"]) { width: calc(100% - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; padding: 17px; }
  body[data-portal="admin"] dialog form[data-form="investment"] .form-grid { grid-template-columns: minmax(0, 1fr); }
  body[data-portal="admin"] dialog form[data-form="investment"] :is(input, select, textarea) { min-height: 44px; font-size: 16px; }
  body[data-portal="admin"] dialog form[data-form="investment"] .actions { position: sticky; bottom: -17px; padding: 10px 0; background: var(--panel-raised); }
}
