*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg: #f7f6f3;
      --bg2: #ffffff;
      --bg3: #eeecea;
      --border: #e0ddd8;
      --border2: #ccc9c3;
      --text: #1a1917;
      --text2: #706e69;
      --text3: #b0ada8;
      --accent: #008000;
      --accent-dim: #006600;
      --accent-bg: #e6f4e6;
      --danger: #cc3333;
      --mono: 'DM Mono', monospace;
      --sans: 'DM Sans', sans-serif;
      --radius: 8px;
      --radius-lg: 12px;
    }

    [data-theme="dark"] {
      --bg: #0f0f0f;
      --bg2: #181818;
      --bg3: #222;
      --border: #2e2e2e;
      --border2: #3a3a3a;
      --text: #f0ede8;
      --text2: #888;
      --text3: #555;
      --accent: #4ade80;
      --accent-dim: #3abf6a;
      --accent-bg: #0d2b1a;
      --danger: #ff5f5f;
    }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: var(--sans);
      min-height: 100vh;
      padding: 2rem 1.5rem 4rem;
      scrollbar-width: thin;
      scrollbar-color: var(--border2) transparent;
    }

    .container {
      max-width: 960px;
      margin: 0 auto;
    }

    header {
      margin-bottom: 2.5rem;
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 1rem;
      flex-wrap: wrap;
    }

    .logo-block h1 {
      font-size: 22px;
      font-weight: 600;
      letter-spacing: -0.5px;
      color: var(--text);
    }

    .logo-block h1 span {
      color: var(--accent);
    }

    .logo-block p {
      font-size: 13px;
      color: var(--text2);
      margin-top: 4px;
    }

    .tag {
      font-family: var(--mono);
      font-size: 11px;
      padding: 3px 10px;
      border-radius: 999px;
      border: 1px solid var(--border2);
      color: var(--text2);
      align-self: flex-start;
      margin-top: 4px;
    }

    .grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 1rem;
      margin-bottom: 1rem;
    }

    @media (max-width: 640px) {
      .grid { grid-template-columns: 1fr; }
    }

    .field { display: flex; flex-direction: column; gap: 6px; }

    label {
      font-size: 11px;
      font-weight: 500;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text2);
    }

    textarea, input[type="text"], input[type="date"] {
      background: var(--bg2);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      color: var(--text);
      font-family: var(--mono);
      font-size: 12.5px;
      padding: 10px 12px;
      width: 100%;
      transition: border-color 0.15s;
      outline: none;
    }

    textarea:focus, input:focus {
      border-color: var(--border2);
    }

    textarea {
      height: 380px;
      resize: none;
      line-height: 1.6;
    }

    input[type="text"], input[type="date"] {
      height: 38px;
    }

    .right-col {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .row2 {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    .section-map {
      background: var(--bg2);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 14px;
      height: 330px;
      overflow-y: auto;
      scrollbar-width: thin;
      scrollbar-color: var(--border2) transparent;
    }

    ::-webkit-scrollbar {
      width: 4px;
    }

    ::-webkit-scrollbar-track {
      background: transparent;
    }

    ::-webkit-scrollbar-thumb {
      background: var(--border2);
      border-radius: 999px;
    }

    ::-webkit-scrollbar-thumb:hover {
      background: var(--text3);
    }

    .section-map-title {
      font-size: 11px;
      font-weight: 500;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text2);
      margin-bottom: 10px;
    }

    .srow {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 7px;
    }

    .srow-key {
      font-family: var(--mono);
      font-size: 11px;
      color: var(--text3);
      min-width: 130px;
      white-space: nowrap;
    }


    .srow input[type="text"] {
      font-size: 11px;
      height: 30px;
      padding: 5px 8px;
      flex: 1;
    }

    .actions {
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
    }

    button {
      font-family: var(--sans);
      font-size: 13px;
      font-weight: 500;
      padding: 9px 18px;
      border-radius: var(--radius);
      border: 1px solid var(--border2);
      background: transparent;
      color: var(--text);
      cursor: pointer;
      transition: all 0.15s;
    }

    button:hover { background: var(--bg3); }
    button:active { transform: scale(0.98); }

    button.primary {
      background: var(--accent);
      color: #ffffff;
      border-color: var(--accent);
      font-weight: 600;
    }

    button.primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); }

    .output-section { margin-top: 1.5rem; }

    .output-header {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 8px;
      flex-wrap: wrap;
    }

    .count-badge {
      font-family: var(--mono);
      font-size: 11px;
      padding: 2px 8px;
      border-radius: 999px;
      background: var(--accent-bg);
      color: var(--accent);
      border: 1px solid #2e4010;
    }

    .copied-msg {
      font-size: 12px;
      color: var(--accent);
      opacity: 0;
      transition: opacity 0.3s;
      font-family: var(--mono);
    }

    .copied-msg.show { opacity: 1; }

    .output-box {
      background: var(--bg2);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 16px;
      font-family: var(--mono);
      font-size: 12.5px;
      line-height: 1.75;
      color: var(--text);
      white-space: pre-wrap;
      min-height: 160px;
      overflow-y: auto;
    }

    .empty-state {
      color: var(--text3);
      font-style: italic;
    }

    .divider {
      border: none;
      border-top: 1px solid var(--border);
      margin: 1.5rem 0;
    }

    /* Syntax highlight in output */
    .out-header { color: var(--text2); }
    .out-project { color: var(--accent); font-weight: 500; }
    .out-section { color: #7dd3fc; }
    .out-item { color: var(--text); }
    .out-num { color: var(--accent); }

    .project-block {
      background: var(--bg2);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      margin-bottom: 1rem;
      overflow: hidden;
    }

    .project-block-toprow {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 4px;
    }

    .project-block-firstline {
      font-family: var(--mono);
      font-size: 12.5px;
      color: var(--text);
    }

    .project-block-copy {
      font-size: 12px;
      padding: 4px 14px;
      border-radius: var(--radius);
      border: 1px solid var(--border2);
      background: transparent;
      color: var(--text2);
      cursor: pointer;
      font-family: var(--sans);
      transition: all 0.15s;
    }

    .project-block-copy:hover {
      background: var(--bg3);
      color: var(--text);
    }

    .project-block-content {
      padding: 10px 16px 16px;
      font-family: var(--mono);
      font-size: 12.5px;
      line-height: 1.75;
      color: var(--text);
    }

    .project-block-rest {
      white-space: pre-wrap;
    }

    .reminder {
      margin-top: 1rem;
      padding: 12px 16px;
      background: #fffbea;
      border: 1px solid #f0d080;
      border-radius: var(--radius);
      font-size: 13px;
      color: #7a5c00;
      font-family: var(--sans);
    }

    [data-theme="dark"] .reminder {
      background: #2a2200;
      border-color: #5a4400;
      color: #f0c040;
    }

    footer {
      margin-top: 3rem;
      font-size: 12px;
      color: var(--text3);
      font-family: var(--mono);
      text-align: center;
    }
    .datepicker-wrap {
      position: relative;
    }

    .datepicker-input {
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 38px;
      padding: 0 12px;
      background: var(--bg2);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      cursor: pointer;
      font-family: var(--mono);
      font-size: 12.5px;
      color: var(--text);
      transition: border-color 0.15s;
      user-select: none;
    }

    .datepicker-input:hover { border-color: var(--border2); }

    .datepicker-icon {
      color: var(--text3);
      font-size: 14px;
    }

    .datepicker-dropdown {
      display: none;
      position: absolute;
      top: calc(100% + 6px);
      left: 0;
      right: 0;
      background: var(--bg2);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 12px;
      z-index: 100;
      box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    }

    .datepicker-dropdown.open { display: block; }

    .dp-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 10px;
    }

    .dp-month-year {
      font-size: 13px;
      font-weight: 500;
      color: var(--text);
    }

    .dp-nav {
      background: none;
      border: none;
      font-size: 18px;
      color: var(--text2);
      cursor: pointer;
      padding: 2px 8px;
      border-radius: var(--radius);
      line-height: 1;
    }

    .dp-nav:hover { background: var(--bg3); color: var(--text); }

    .dp-weekdays {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      text-align: center;
      margin-bottom: 6px;
    }

    .dp-weekdays span {
      font-size: 10px;
      font-weight: 500;
      color: var(--text3);
      padding: 2px 0;
      text-transform: uppercase;
    }

    .dp-days {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 2px;
    }

    .dp-day {
      text-align: center;
      padding: 6px 2px;
      font-size: 12px;
      font-family: var(--mono);
      color: var(--text);
      border-radius: var(--radius);
      cursor: pointer;
      transition: background 0.1s;
    }

    .dp-day:hover { background: var(--bg3); }
    .dp-day.empty { cursor: default; }
    .dp-day.today { color: var(--accent); font-weight: 600; }
    .dp-day.selected { background: var(--accent); color: #fff; font-weight: 600; }
    .dp-day.selected:hover { background: var(--accent-dim); }

    .dp-footer {
      display: flex;
      justify-content: space-between;
      margin-top: 10px;
      padding-top: 10px;
      border-top: 1px solid var(--border);
    }

    .dp-footer-btn {
      font-size: 12px;
      padding: 5px 14px;
      border-radius: var(--radius);
      border: 1px solid var(--border2);
      background: transparent;
      color: var(--text2);
      cursor: pointer;
      font-family: var(--sans);
    }

    .dp-footer-btn:hover { background: var(--bg3); color: var(--text); }

    .dp-today-btn {
      color: var(--accent);
      border-color: var(--accent);
      font-weight: 500;
    }

    .dp-today-btn:hover { background: var(--accent-bg); }

    .toast {
      position: fixed;
      top: 2rem;
      right: 2rem;
      background: #f0faf0;
      color: #1a5e1a;
      border: 1px solid #b6e0b6;
      font-family: var(--sans);
      font-size: 13px;
      font-weight: 500;
      padding: 12px 20px;
      border-radius: 999px;
      opacity: 0;
      transform: translateY(-8px);
      transition: opacity 0.2s ease, transform 0.2s ease;
      pointer-events: none;
      z-index: 9999;
      box-shadow: 0 2px 8px rgba(0,100,0,0.1);
    }

    .toast.show {
      opacity: 1;
      transform: translateY(0);
    }