  :root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface2: #f1f5f9;
    --border: rgba(0,0,0,0.08);
    --border2: rgba(0,0,0,0.14);
    --text: #1e293b;
    --text2: #64748b;
    --text3: #94a3b8;
    --blue: #3B82F6;
    --blue-light: #eff6ff;
    --blue-dark: #2563eb;
    --green: #22C55E;
    --green-light: #f0fdf4;
    --green-dark: #166534;
    --red: #EF4444;
    --red-light: #fef2f2;
    --amber: #F59E0B;
    --amber-light: #fffbeb;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #0f172a;
      --surface: #1e293b;
      --surface2: #273349;
      --border: rgba(255,255,255,0.08);
      --border2: rgba(255,255,255,0.14);
      --text: #f1f5f9;
      --text2: #94a3b8;
      --text3: #475569;
      --blue-light: #0c2340;
      --green-light: #052e16;
      --red-light: #2d0808;
      --amber-light: #2a1600;
    }
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

  /* Layout */
  .container { max-width: 900px; margin: 0 auto; padding: 2rem 1.25rem; }

  /* Header */
  .header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 2rem; }
  .header-left h1 { font-size: 20px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
  .header-left h1 i { color: var(--blue); font-size: 22px; }
  .header-left p { font-size: 13px; color: var(--text2); margin-top: 3px; }
  .user-select-wrap { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 6px 12px; }
  .user-select-wrap i { color: var(--text2); font-size: 16px; }
  .user-select-wrap select { border: none; background: transparent; color: var(--text2); font-size: 13px; outline: none; cursor: pointer; }

  /* Stats */
  .stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 1.75rem; }
  .stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
  .stat .lbl { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px; }
  .stat .val { font-size: 26px; font-weight: 700; line-height: 1; }
  .stat .val.c-blue { color: var(--blue); }
  .stat .val.c-green { color: #16a34a; }
  .stat .val.c-amber { color: #d97706; }
  .stat .val.c-red { color: var(--red); }

  /* Chart Card */
  .chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.75rem; }
  .chart-card .card-title { font-size: 13px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 12px; }
  .chart-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
  .chart-legend-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text2); }
  .chart-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
  .chart-wrap { position: relative; width: 100%; height: 200px; }

  /* Sectors grid */
  .sectors-label { font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
  .sectors-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 1.75rem; }
  .sector-btn { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 1rem; cursor: pointer; text-align: left; transition: all .15s; }
  .sector-btn:hover { border-color: var(--blue); transform: translateY(-1px); box-shadow: var(--shadow-md); }
  .sector-btn.active { border-color: var(--blue); border-width: 2px; background: var(--blue-light); }
  .sector-btn .s-icon { font-size: 22px; color: var(--blue); margin-bottom: 8px; display: block; }
  .sector-btn .s-name { font-size: 13px; font-weight: 600; color: var(--text); }
  .sector-btn .s-count { font-size: 11px; color: var(--text2); margin-top: 2px; }
  .sector-btn .mini-bar { height: 4px; background: var(--surface2); border-radius: 2px; margin-top: 8px; overflow: hidden; }
  .sector-btn .mini-fill { height: 4px; border-radius: 2px; background: var(--blue); transition: width .4s ease; }

  /* Panel */
  .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
  .panel-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; background: var(--surface2); }
  .panel-header i { font-size: 18px; color: var(--blue); }
  .panel-header .ph-title { font-size: 15px; font-weight: 600; color: var(--text); }
  .panel-header .ph-sub { font-size: 12px; color: var(--text2); margin-left: auto; }

  /* Tasks */
  .task-item { border-bottom: 1px solid var(--border); transition: background .15s; }
  .task-item:last-child { border-bottom: none; }
  .task-item.done { background: var(--green-light); }
  .task-main { display: flex; align-items: flex-start; gap: 12px; padding: 1rem 1.25rem; }
  .check-btn { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border2); background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s; color: transparent; font-size: 14px; margin-top: 1px; }
  .check-btn:hover { border-color: var(--blue); background: var(--blue-light); }
  .task-item.done .check-btn { background: var(--green); border-color: var(--green); color: white; }
  .task-item.done .check-btn:hover { background: var(--red); border-color: var(--red); }
  .task-info { flex: 1; min-width: 0; }
  .task-name { font-size: 14px; color: var(--text); line-height: 1.45; }
  .task-item.done .task-name { color: var(--text2); text-decoration: line-through; }
  .task-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
  .badge { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
  .b-done { background: #dcfce7; color: #166534; }
  .b-open { background: #fef3c7; color: #92400e; }
  .b-high { background: #fee2e2; color: #991b1b; }
  .b-med  { background: #fef9c3; color: #854d0e; }
  .b-low  { background: #dbeafe; color: #1e40af; }
  @media (prefers-color-scheme: dark) {
    .b-done { background: #052e16; color: #4ade80; }
    .b-open { background: #2d1f00; color: #fbbf24; }
    .b-high { background: #2d0808; color: #fc8181; }
    .b-med  { background: #2a1e00; color: #fcd34d; }
    .b-low  { background: #071e3d; color: #7dd3fc; }
  }
  .task-meta { font-size: 11px; color: var(--text2); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

  /* Obs */
  .obs-area { padding: 0 1.25rem 1rem 4rem; }
  .obs-lbl { font-size: 11px; color: var(--text2); font-weight: 600; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .03em; display: flex; align-items: center; gap: 4px; }
  .obs-lbl.warn { color: #d97706; }
  .obs-text { width: 100%; font-size: 13px; padding: 8px 10px; border: 1px solid var(--border2); border-radius: var(--radius-sm); background: var(--surface2); color: var(--text); resize: vertical; min-height: 56px; font-family: inherit; transition: border-color .15s; }
  .obs-text:focus { outline: none; border-color: var(--blue); }
  .obs-text:disabled { opacity: 0.5; cursor: not-allowed; }
  .obs-readonly { font-size: 13px; padding: 8px 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text2); line-height: 1.5; }
  .btn-save { margin-top: 6px; font-size: 12px; padding: 5px 14px; background: var(--blue); color: white; border: none; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; transition: background .15s; }
  .btn-save:hover { background: var(--blue-dark); }

  /* Empty */
  .empty { padding: 3rem; text-align: center; color: var(--text2); }
  .empty i { font-size: 36px; display: block; margin-bottom: 10px; opacity: .4; }
  .empty p { font-size: 14px; }

  /* Modal */
  .modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; align-items: center; justify-content: center; }
  .modal-overlay.open { display: flex; }
  .modal-box { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border2); padding: 1.75rem; width: 380px; max-width: 94vw; box-shadow: var(--shadow-md); animation: pop .18s ease; }
  @keyframes pop { from { transform: scale(.93); opacity: 0; } to { transform: scale(1); opacity: 1; } }
  .modal-box h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 7px; }
  .modal-box h3 i { color: var(--amber); }
  .modal-box .modal-desc { font-size: 13px; color: var(--text2); margin-bottom: 1rem; line-height: 1.5; }
  .modal-box textarea { width: 100%; font-size: 13px; padding: 10px; border: 1px solid var(--border2); border-radius: var(--radius-sm); background: var(--surface2); color: var(--text); resize: vertical; min-height: 80px; font-family: inherit; }
  .modal-box textarea:focus { outline: none; border-color: var(--blue); }
  .modal-box textarea.error { border-color: var(--red); }
  .modal-error { font-size: 12px; color: var(--red); margin-top: 4px; display: none; }
  .modal-error.show { display: block; }
  .modal-actions { display: flex; gap: 8px; margin-top: 1rem; justify-content: flex-end; }
  .btn-cancel { font-size: 13px; padding: 7px 16px; background: var(--surface2); border: 1px solid var(--border2); color: var(--text); border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; }
  .btn-cancel:hover { background: var(--border2); }
  .btn-reopen { font-size: 13px; padding: 7px 16px; background: var(--amber); color: white; border: none; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; }
  .btn-reopen:hover { background: #d97706; }

  /* Toast */
  .toast { position: fixed; bottom: 24px; right: 24px; background: var(--text); color: var(--bg); font-size: 13px; padding: 10px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow-md); display: none; z-index: 2000; animation: slideup .2s ease; }
  @keyframes slideup { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

  @media (max-width: 600px) {
    .header { flex-direction: column; align-items: flex-start; }
    .sectors-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  }