  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --bg: #0d1117; --bg2: #161b22; --bg3: #21262d;
    --border: #30363d; --text: #e6edf3; --text2: #8b949e; --text3: #484f58;
    --green: #39d353; --green-btn: #238636; --green-hover: #2ea043;
    --red: #f85149; --accent: #58a6ff; --yellow: #f0c040;
  }
  body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif; font-size: 14px; min-height: 100vh; padding: 0 0 40px; }
  .container { max-width: 960px; margin: 0 auto; padding: 0 16px; }
  a { color: var(--accent); text-decoration: none; }
  a:hover { text-decoration: underline; }
  code { background: var(--bg3); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

  /* TOP BAR */
  .topbar {
    background: var(--bg2); border-bottom: 1px solid var(--border);
    padding: 0 16px; height: 52px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 100;
  }
  .topbar-left { display: flex; align-items: center; gap: 10px; }
  .topbar-left h1 { font-size: 16px; font-weight: 600; }
  .topbar-left .badge { font-size: 10px; background: var(--bg3); border: 1px solid var(--border); border-radius: 20px; padding: 1px 8px; color: var(--text2); }
  .topbar-right { display: flex; align-items: center; gap: 10px; }
  .profile-link {
    display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text2);
    border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px;
    transition: border-color .15s, color .15s; text-decoration: none;
  }
  .profile-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
  .lang-select {
    background: var(--bg3); border: 1px solid var(--border); border-radius: 6px;
    color: var(--text); font-size: 12px; padding: 4px 8px; height: 30px; cursor: pointer; outline: none;
  }
  .lang-select:focus { border-color: var(--accent); }

  /* MAIN */
  .main { padding: 24px 0; }
  .card { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 14px; }
  .card-title { font-size: 11px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 14px; }
  .field { margin-bottom: 10px; }
  .field:last-child { margin-bottom: 0; }
  .field label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 4px; }
  .field-row { display: flex; gap: 10px; flex-wrap: wrap; }
  .field-row .field { flex: 1; min-width: 150px; margin-bottom: 0; }
  input[type=text], input[type=password], input[type=number], select {
    width: 100%; background: var(--bg3); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text); font-size: 13px;
    padding: 6px 10px; height: 34px; outline: none; transition: border-color .15s;
  }
  input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(88,166,255,.1); }
  input::placeholder { color: var(--text3); }
  .hint { font-size: 11px; color: var(--text3); margin-top: 4px; line-height: 1.5; }

  /* LEGEND */
  .legend { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
  .legend-label { font-size: 12px; color: var(--text2); }
  .swatch { width: 16px; height: 16px; border-radius: 3px; cursor: pointer; border: 2px solid transparent; transition: border-color .1s, transform .12s; flex-shrink: 0; }
  .swatch.sel { border-color: #fff; transform: scale(1.3); }
  .legend-key { font-size: 11px; color: var(--text3); margin-left: 4px; }

  /* GRAPH */
  .graph-wrap { position: relative; }
  .day-labels { position: absolute; left: 0; top: 20px; display: flex; flex-direction: column; gap: 3px; }
  .day-labels span { font-size: 9px; color: var(--text3); height: 13px; line-height: 13px; width: 22px; text-align: right; padding-right: 4px; }
  .graph-scroll { overflow-x: auto; padding-bottom: 4px; padding-left: 26px; }
  .month-row { display: grid; gap: 3px; min-width: 0; margin-bottom: 3px; }
  .month-row span { font-size: 10px; color: var(--text3); text-align: left; }
  .graph { display: grid; grid-template-rows: repeat(7, 13px); grid-auto-flow: column; gap: 3px; cursor: crosshair; user-select: none; }
  .cell { width: 13px; height: 13px; border-radius: 2px; transition: opacity .1s; }
  .cell:hover { opacity: .65; }
  .cell.out { opacity: 0; cursor: default; pointer-events: none; }
  .stats { display: flex; gap: 20px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
  .stat { font-size: 12px; color: var(--text2); }
  .stat b { color: var(--text); font-weight: 600; }

  /* BUTTONS */
  .btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
  .fill-percent-control { display: inline-flex; align-items: center; gap: 6px; color: var(--text2); font-size: 12px; }
  .fill-percent-control input { width: 70px; height: 34px; }
  button { height: 34px; padding: 0 16px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid var(--border); background: var(--bg3); color: var(--text); transition: background .15s, opacity .15s; white-space: nowrap; }
  button:hover { background: #30363d; }
  button:disabled { opacity: .4; cursor: not-allowed; }
  button.primary { background: var(--green-btn); border-color: #2ea043; color: #fff; }
  button.primary:hover:not(:disabled) { background: var(--green-hover); }
  button.danger { border-color: #6e2e2e; color: var(--red); }
  button.danger:hover { background: #2a1515; }

  /* PROGRESS */
  .progress { display: none; margin-top: 12px; }
  .progress.on { display: block; }
  .bar-wrap { background: var(--bg3); border-radius: 4px; height: 6px; overflow: hidden; margin-bottom: 8px; }
  .bar { height: 100%; background: var(--green); width: 0%; border-radius: 4px; transition: width .3s; }
  .log { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; font-family: 'SFMono-Regular', Consolas, monospace; font-size: 12px; color: var(--text2); max-height: 160px; overflow-y: auto; line-height: 1.8; white-space: pre-wrap; }
  .log .ok { color: var(--green); }
  .log .err { color: var(--red); }
  .status-bar { margin-top: 10px; padding: 8px 14px; border-radius: 6px; font-size: 13px; display: none; }
  .status-bar.ok { display: block; background: #0d2b1a; color: var(--green); border: 1px solid #1a4a2a; }
  .status-bar.err { display: block; background: #2a1515; color: var(--red); border: 1px solid #4a2020; }

  /* FOOTER */
  .footer {
    margin-top: 32px; border-top: 1px solid var(--border); padding-top: 20px;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  }
  .footer-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .footer-link {
    display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text2);
    border: 1px solid var(--border); border-radius: 6px; padding: 5px 12px;
    text-decoration: none; transition: border-color .15s, color .15s, background .15s;
  }
  .footer-link:hover { border-color: var(--text2); color: var(--text); text-decoration: none; }
  .footer-link.star { border-color: #5a4a00; color: var(--yellow); }
  .footer-link.star:hover { background: #1a1400; border-color: var(--yellow); }
  .footer-text { font-size: 12px; color: var(--text3); }

  @media (max-width: 640px) {
    .topbar { height: auto; padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
    .field-row { flex-direction: column; }
    .footer { flex-direction: column; align-items: flex-start; }
  }
