:root {
    --accent: #D72C58;
    --bg: #EEEEEE;
    --text: #111113;
    --muted: #71717A;
    --soft: #909090;
    --faint: #A1A1AA;
    --unit: #C4C4C4;
    --line: #F1F1F3;
    --border: #E4E4E7;
    --field: #FAFAFA;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; }
  body { background: var(--bg); color: var(--text); font-family: "Sora", system-ui, sans-serif; -webkit-font-smoothing: antialiased; font-size: 14px; }
  button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
  button { cursor: pointer; background: none; border: none; padding: 0; }
  .wrap { max-width: 55rem; margin: 0 auto; padding: 16px; }
  [hidden] { display: none !important; }

  /* header */
  .top { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 32px; padding-top: 8px; }
  .wordmark { font-size: 30px; font-weight: 800; letter-spacing: -0.05em; color: var(--faint); margin: 0; cursor: pointer; }
  .top-right { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--muted); }
  .fx input { width: 46px; border: none; background: transparent; font-weight: 600; color: var(--text); outline: none; text-align: right; padding: 0; }
  .circle { width: 42px; height: 42px; border-radius: 50%; background: white; border: 1px solid var(--border); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,0.04); transition: all .15s; }
  .circle:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
  .circle.on { background: var(--text); border-color: var(--text); color: white; }

  .label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
  .big { font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; margin-top: 6px; }
  .unit { color: var(--unit); }
  .head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

  /* range: plain text toggles */
  .range { display: flex; align-items: center; gap: 14px; font-size: 13px; flex-wrap: wrap; justify-content: flex-end; }
  .range button { color: var(--faint); font-weight: 500; }
  .range button.on { color: var(--text); font-weight: 700; }
  .range .dates { color: var(--faint); font-size: 12px; }
  .range input { border: none; background: transparent; color: var(--muted); font-size: 12px; width: 108px; padding: 0; outline: none; }

  /* cards */
  .card { background: white; border-radius: 16px; padding: 20px; box-shadow: 0 4px 12px rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.04); }
  .card + .card, .card + .section { margin-top: 16px; }
  .chart-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 10px; }
  .legend { flex: 1 1 0; min-width: 0; display: flex; gap: 4px 14px; flex-wrap: wrap; font-size: 12px; }
  .legend span { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; color: var(--text); }
  .legend span i { width: 14px; height: 0; border-top: 2px solid; display: inline-block; }
  .legend span.off { color: var(--unit); }
  .legend span.off i { border-color: var(--unit) !important; }
  .toggle { display: flex; gap: 12px; font-size: 12px; flex-shrink: 0; }
  .toggle button { color: var(--faint); }
  .toggle button.on { color: var(--text); font-weight: 600; }
  .chart { position: relative; height: 290px; }
  .chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
  .tooltip { position: absolute; pointer-events: none; background: var(--text); color: white; border-radius: 10px; padding: 8px 10px; font-size: 12px; min-width: 180px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); opacity: 0; transition: opacity .1s; z-index: 5; }
  .tooltip .t-date { color: var(--faint); font-size: 11px; margin-bottom: 4px; }
  .tooltip .t-row { display: flex; justify-content: space-between; gap: 14px; line-height: 1.6; }
  .tooltip .t-row i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 6px; }
  .tooltip .neg { color: #FF8FAE; font-weight: 600; }

  /* warnings: plain lines */
  .warnings { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 6px; font-size: 13px; }
  .warnings div { display: flex; gap: 8px; align-items: baseline; cursor: pointer; }
  .warnings div::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; transform: translateY(-1px); }
  .warnings div.ok { color: var(--muted); cursor: default; }
  .warnings div.ok::before { background: #00B894; }
  .warnings b { font-weight: 600; }
  .red { color: var(--accent); }

  /* tiles (lifekpi) */
  .section { display: flex; justify-content: space-between; align-items: center; margin: 32px 0 12px; }
  .grid { display: grid; gap: 16px; grid-template-columns: repeat(4, 1fr); }
  @media (max-width: 860px) { .grid { grid-template-columns: repeat(3, 1fr); } }
  @media (max-width: 600px) { .grid { grid-template-columns: repeat(2, 1fr); } .big { font-size: 32px; } }
  .tile { background: white; border-radius: 16px; padding: 20px; border: 1px solid rgba(0,0,0,0.06); box-shadow: 0 4px 12px rgba(0,0,0,0.03); cursor: pointer; display: flex; flex-direction: column; overflow: hidden; transition: box-shadow .15s, transform .15s; min-height: 150px; }
  .tile:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
  .tile:active { transform: scale(0.97); }
  .tile-head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
  .tile-head .ic { font-size: 18px; line-height: 1; }
  .tile-head .nm { font-size: 13px; font-weight: 300; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tile-val { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1; margin-bottom: 8px; white-space: nowrap; }
  .tile-note { font-size: 11px; color: var(--soft); margin-top: auto; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .spark { height: 22px; }
  .spark svg { width: 100%; height: 100%; display: block; overflow: visible; }
  .stack { display: flex; height: 6px; border-radius: 3px; overflow: hidden; gap: 2px; }
  .quick { display: flex; margin: auto -20px -20px; height: 48px; }
  .quick button { flex: 1; color: white; font-size: 24px; font-weight: 300; transition: filter .15s; }
  .quick button:hover { filter: brightness(0.92); }
  .quick button:first-child { filter: brightness(0.85); }
  .quick button:first-child:hover { filter: brightness(0.78); }

  /* detail */
  .back { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
  .back:hover { color: var(--text); }
  .d-name { display: flex; align-items: center; gap: 8px; color: var(--soft); font-weight: 300; font-size: 15px; }
  .stats { display: flex; gap: 32px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
  .stats .v { font-size: 17px; font-weight: 600; margin-top: 4px; letter-spacing: -0.02em; }
  .stats .s { font-size: 11px; color: var(--soft); margin-top: 2px; }
  .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  @media (max-width: 700px) { .cols { grid-template-columns: 1fr; } }
  .col-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
  .col-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
  .col-head button { font-size: 20px; color: var(--faint); line-height: 1; }
  .col-head button:hover { color: var(--text); }
  .row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; align-items: baseline; }
  .row:last-child { border-bottom: none; }
  .row:hover .n { text-decoration: underline; text-decoration-color: var(--unit); }
  .row .d { width: 48px; flex-shrink: 0; font-size: 12px; color: var(--soft); }
  .row .main { flex: 1; min-width: 0; }
  .row .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .row .m { font-size: 11px; color: var(--soft); margin-top: 2px; }
  .row .a { text-align: right; font-weight: 600; white-space: nowrap; }
  .row .a small { display: block; font-size: 11px; font-weight: 400; color: var(--soft); margin-top: 2px; }
  .row.past { opacity: 0.4; }
  .month { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--unit); margin: 14px 0 0; }
  .col-foot { display: flex; justify-content: space-between; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--border); font-weight: 600; }
  .empty { color: var(--faint); font-size: 13px; padding: 14px 0; }
  .sub-tag { color: var(--soft); }

  /* subaccounts (bindme tiles, flatter) */
  .subs { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
  @media (max-width: 700px) { .subs { grid-template-columns: repeat(2, 1fr); } }
  .sub { padding: 14px; border-radius: 14px; background: var(--field); cursor: pointer; transition: background .15s; }
  .sub:hover { background: #F4F4F5; }
  .sub .nm { font-size: 13px; font-weight: 300; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sub .val { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; margin: 10px 0 2px; }
  .sub .of { font-size: 11px; color: var(--soft); }
  .bar { height: 4px; border-radius: 2px; background: #E9E9EB; margin: 10px 0 8px; overflow: hidden; }
  .bar div { height: 100%; border-radius: 2px; }
  .sub .fc { font-size: 11px; color: var(--muted); }

  /* modal (lifekpi) */
  .overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
  .overlay.open { display: flex; }
  .modal { background: white; border-radius: 16px; width: 100%; max-width: 380px; box-shadow: 0 25px 50px rgba(0,0,0,0.25); max-height: calc(100vh - 32px); overflow: auto; }
  .modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 20px 12px; }
  .modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
  .modal-head button { font-size: 18px; color: var(--muted); }
  .modal-body { padding: 0 20px 20px; display: grid; gap: 12px; }
  .field label { display: block; margin-bottom: 4px; }
  .field input, .field select { width: 100%; border: 1px solid var(--border); background: var(--field); border-radius: 12px; padding: 10px 14px; outline: none; }
  .field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(215,44,88,0.15); }
  .row2 { display: flex; gap: 8px; } .row2 > * { flex: 1; min-width: 0; }
  .types { display: flex; gap: 16px; font-size: 13px; padding-bottom: 2px; }
  .types button { color: var(--faint); font-weight: 500; padding-bottom: 4px; border-bottom: 2px solid transparent; }
  .types button.on { color: var(--text); border-color: var(--text); }
  .hint { font-size: 11px; color: var(--muted); }
  .modal-foot { display: flex; gap: 12px; align-items: center; margin-top: 4px; }
  .modal-foot .del { color: var(--accent); font-size: 12px; font-weight: 600; margin-right: auto; }
  .save { flex: 1; background: var(--text); color: white; border-radius: 12px; padding: 11px; font-weight: 600; }
  .save:hover { background: #2C2C2E; }
  .linkish { font-size: 12px; color: var(--muted); margin-top: 8px; }
  .linkish button { color: var(--text); font-weight: 600; font-size: 12px; text-decoration: underline; text-decoration-color: var(--unit); text-underline-offset: 3px; }
  .adj-row { display: grid; grid-template-columns: 1fr 120px; gap: 4px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .adj-row:last-child { border-bottom: none; }
  .adj-row .nm { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .adj-row.child .nm { padding-left: 22px; color: var(--soft); font-weight: 300; }
  .adj-row input { width: 100%; border: 1px solid var(--border); background: var(--field); border-radius: 10px; padding: 7px 10px; outline: none; text-align: right; }
  .adj-row input:focus { border-color: var(--text); }
  .adj-row .exp { grid-column: 1 / -1; font-size: 11px; color: var(--soft); text-align: right; min-height: 0; }
  .adj-row .exp:empty { display: none; }

/* bind additions */
.hlink { font-size: 12px; color: var(--muted); font-weight: 600; }
.hlink:hover { color: var(--text); }
.edit { font-size: 12px; color: var(--faint); font-weight: 400; margin-left: 4px; }
.edit:hover { color: var(--text); }
.section .add { font-size: 20px; color: var(--faint); line-height: 1; }
.section .add:hover { color: var(--text); }
.month { display: flex; justify-content: space-between; gap: 8px; cursor: pointer; padding: 6px 0; margin: 8px 0 0; user-select: none; }
.month span:last-child { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--soft); }
.month.past { opacity: 0.5; }
.row.skip .n, .row.skip .a { text-decoration: line-through; color: var(--faint); }
.row.child { padding-left: 16px; }
.more { font-size: 12px; color: var(--muted); padding: 10px 0 0; font-weight: 600; }
.sub { position: relative; }
.sub-edit { position: absolute; top: 10px; right: 12px; color: var(--unit); font-size: 13px; }
.sub-edit:hover { color: var(--text); }
.acts { display: flex; gap: 14px; margin-right: auto; }
.acts .del { margin: 0; }
.acts .plain { color: var(--muted); }
.hrow { display: flex; gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.hrow .main { flex: 1; min-width: 0; }
.hrow .m { font-size: 11px; color: var(--soft); margin-top: 2px; }
.hrow button { font-size: 12px; font-weight: 600; color: var(--muted); }
.hrow.undone .n { text-decoration: line-through; color: var(--faint); }
.cp-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; align-items: baseline; }
.cp-row:last-child { border-bottom: none; }
.cp-row .d { width: 90px; color: var(--soft); font-size: 12px; }
.cp-row .a { flex: 1; font-weight: 600; }
.cp-row .x { color: var(--unit); }
.cp-row .x:hover { color: var(--accent); }
.field input[type=color] { padding: 4px; height: 42px; }
div.past > .row { opacity: 0.5; }
.head .linkish { margin-top: 8px; }
.card:has(+ .issues) { position: relative; z-index: 1; }
.issues { background: #E4E4E7; border-radius: 0 0 16px 16px; margin: -16px 12px 0; padding: 22px 16px 10px; }
.issues-toggle { display: flex; align-items: center; justify-content: flex-start; gap: 6px; width: 100%; font-size: 12px; font-weight: 600; color: var(--muted); }
.issues-toggle:hover { color: var(--text); }
.issues-toggle .arr { display: inline-block; transition: transform .15s; }
.issues-toggle .arr.up { transform: rotate(180deg); }
.issues .warnings { margin-top: 10px; padding: 10px 4px 4px; border-top: 1px solid rgba(0,0,0,0.06); }
.warnings div::before { display: none; }
.issues-toggle { padding-left: 4px; }
