:root{
    --hw-ink:#172033; --hw-muted:#667085; --hw-line:#e3e8f0; --hw-paper:#fff; --hw-bg:#f5f7fb;
    --hw-brand:#176b58; --hw-brand-dark:#0f5445; --hw-brand-soft:#e9f6f1; --hw-accent:#7fcbb0;
    --hw-red:#c0394b; --hw-red-soft:#fdeef0; --hw-amber:#8a6100; --hw-amber-soft:#fff6df;
    --hw-blue-soft:#eaf1ff; --hw-blue-ink:#28407a;
    --hw-shadow:0 10px 26px rgba(23,32,51,.08); --hw-radius:12px; --hw-radius-sm:8px;
  }
  *{box-sizing:border-box;}
  html,body{margin:0;padding:0;}
  body{
    font-family:'Inter',system-ui,-apple-system,"Segoe UI",sans-serif;
    background:var(--hw-bg); color:var(--hw-ink); font-size:14px; line-height:1.45;
  }
  button,input,select,textarea{font-family:inherit;}
  h1,h2,h3{font-family:inherit;}
  button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[tabindex]:focus-visible{
    outline:2px solid var(--hw-brand); outline-offset:1px;
  }

  .hw-topbar[hidden]{display:none;}
  body.hw-auth-locked{background:#fff;}
  .hw-topbar{
    display:flex; align-items:center; justify-content:space-between; gap:10px;
    padding:14px 20px; background:#0f2d2a; color:#eaf6f2;
  }
  .hw-brand{display:flex; align-items:center; gap:10px; font-weight:700; font-size:15px; letter-spacing:-.2px;}
  .hw-brand-mark{
    width:28px; height:28px; border-radius:8px; flex-shrink:0;
    background:linear-gradient(135deg,#7fcbb0,#176b58); color:#08201b;
    display:flex; align-items:center; justify-content:center; font-weight:800; font-size:14px;
  }
  .hw-topbar-right{display:flex; align-items:center; gap:12px; font-size:12px; flex-wrap:wrap; justify-content:flex-end;}
  .hw-sync-badge{white-space:nowrap;}
  .hw-sync-badge.hw-sync-ok{color:#8fe2c4;}
  .hw-sync-badge.hw-sync-error{color:#f2a0a6;}
  .hw-user-badge{color:#c8ded9; white-space:nowrap;}
  .hw-topbar .hw-btn-ghost{background:#183f3b; color:#dfeceb; height:30px; padding:0 11px;}
  .hw-topbar .hw-btn-ghost:hover{background:#214f4a;}

  .hw-main{padding:18px; max-width:920px; margin:0 auto;}
  .hw-panel{
    background:var(--hw-paper); border:1px solid var(--hw-line); border-radius:var(--hw-radius);
    box-shadow:var(--hw-shadow); padding:16px;
  }
  .hw-panel-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:12px;}
  .hw-panel-head h2{font-size:15px; margin:0; letter-spacing:-.2px;}

  .hw-error-banner{
    display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;
    background:var(--hw-amber-soft); color:var(--hw-amber); border:1px solid #f0dca6;
    border-radius:9px; padding:10px 14px; font-size:12.5px; margin-bottom:14px;
  }

  .hw-cal-toolbar{display:flex; align-items:center; gap:8px; margin-bottom:10px;}
  .hw-cal-title{flex:1; text-align:center; font-size:15px; font-weight:600;}
  .hw-cal-weekdays,.hw-cal-grid{
    display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:1px;
    background:var(--hw-line); border:1px solid var(--hw-line);
  }
  .hw-cal-weekdays{border-radius:8px 8px 0 0; overflow:hidden;}
  .hw-cal-weekdays span{
    background:#fafbfd; text-align:center; padding:7px 0; font-size:11px; color:var(--hw-muted);
    font-weight:700; text-transform:uppercase; letter-spacing:.05em;
  }
  .hw-cal-grid{border-radius:0 0 8px 8px; overflow:hidden; grid-auto-rows:minmax(92px,auto);}
  .hw-cal-cell{background:#fff; padding:7px;}
  .hw-cal-cell.hw-blank{background:#fafbfd;}
  .hw-cal-cell.hw-weekend{background:#f5faf7;}
  .hw-cal-cell:not(.hw-blank){cursor:pointer;}
  .hw-cal-cell:not(.hw-blank):hover{background:#f7f9fc;}
  .hw-cal-cell.hw-weekend:not(.hw-blank):hover{background:#eef8f2;}
  .hw-cal-cell.hw-today{box-shadow:inset 0 0 0 2px var(--hw-brand);}
  .hw-cal-cell>strong{display:block; font-size:12.5px; font-weight:700; color:var(--hw-muted); margin-bottom:5px;}
  .hw-cal-cell.hw-today>strong{color:var(--hw-brand);}
  .hw-cal-pill{
    display:block; width:100%; text-align:left; border:0; border-radius:5px; cursor:pointer;
    background:var(--hw-blue-soft); color:var(--hw-blue-ink); font:11.5px/1.35 inherit; padding:3px 6px;
    margin-bottom:3px; overflow-wrap:anywhere;
  }
  .hw-cal-pill:hover{filter:brightness(.96);}
  .hw-cal-pill.hw-done{opacity:.55; text-decoration:line-through;}

  .hw-task-list{display:grid; gap:8px; margin-bottom:12px;}
  .hw-task-row{display:flex; align-items:stretch; border:1px solid var(--hw-line); border-radius:8px; background:#fff; overflow:hidden;}
  .hw-task-row.hw-completed{opacity:.6; background:#f6faf8;}
  .hw-task-row.hw-completed strong{text-decoration:line-through;}
  .hw-check{
    width:34px; min-width:34px; border:0; border-right:1px solid var(--hw-line); background:#fff;
    color:var(--hw-brand); font-weight:800; cursor:pointer;
  }
  .hw-check:hover{background:var(--hw-brand-soft);}
  .hw-check:disabled{color:#c3cdda; cursor:not-allowed;}
  .hw-task-content{
    flex:1; min-width:0; text-align:left; border:0; background:transparent; padding:8px 10px; cursor:pointer;
    display:flex; flex-direction:column; gap:2px;
  }
  .hw-task-content strong{font-size:13px;}
  .hw-task-content span{font-size:11.5px; color:var(--hw-muted);}
  .hw-task-content p{margin:2px 0 0; font-size:12px; color:#475467; white-space:pre-wrap;}
  .hw-subtask-add{
    align-self:center; margin:0 8px; padding:5px 9px; border:0; border-radius:6px; white-space:nowrap;
    background:var(--hw-blue-soft); color:var(--hw-blue-ink); font:600 11px inherit; cursor:pointer;
  }
  .hw-subtasks{display:grid; gap:4px; margin:6px 0 2px 40px; padding-left:12px; border-left:2px solid var(--hw-line);}
  .hw-subtask-row{display:flex; align-items:center; gap:8px; font-size:12px; color:#455468;}
  .hw-subtask-row span{flex:1; word-break:break-word;}
  .hw-subtask-row.hw-completed{color:#8a94a6; text-decoration:line-through;}
  .hw-subtask-check{
    width:20px; height:20px; min-width:20px; border:1px solid #c3cdda; border-radius:5px; background:#fff;
    color:var(--hw-brand); font-weight:800; line-height:1; cursor:pointer; padding:0;
  }
  .hw-subtask-delete{width:20px; height:20px; min-width:20px; border:0; border-radius:5px; background:transparent; color:#8a94a6; font-size:14px; cursor:pointer;}
  .hw-subtask-delete:hover{color:var(--hw-red); background:var(--hw-red-soft);}
  .hw-empty{color:var(--hw-muted); font-size:13px; padding:18px 4px; text-align:center;}

  .hw-btn-primary,.hw-btn-ghost,.hw-btn-danger,.hw-icon-btn{
    font:600 12.5px 'Inter',inherit; border:0; border-radius:7px; cursor:pointer; height:34px; padding:0 13px;
    display:inline-flex; align-items:center; justify-content:center; white-space:nowrap;
  }
  .hw-btn-primary{background:var(--hw-brand); color:#fff;}
  .hw-btn-primary:hover{background:var(--hw-brand-dark);}
  .hw-btn-primary:disabled{opacity:.6; cursor:not-allowed;}
  .hw-btn-ghost{background:#eef1f6; color:#344054;}
  .hw-btn-ghost:hover{background:#e3e8f0;}
  .hw-btn-danger{background:var(--hw-red-soft); color:#9c1d32;}
  .hw-btn-danger:hover{background:#fbdfe3;}
  .hw-icon-btn{width:34px; padding:0; background:#eef1f6; color:#344054; font-size:15px;}
  .hw-icon-btn:hover{background:#e3e8f0;}
  .hw-add-task-btn{width:100%;}

  .hw-form{display:grid; gap:12px;}
  .hw-form label{display:grid; gap:5px; font-size:12.5px; font-weight:600; color:#344054;}
  .hw-form input,.hw-form select,.hw-form textarea{
    font:14px 'Inter',inherit; border:1px solid #d4dae3; border-radius:7px; padding:8px 10px;
    color:var(--hw-ink); background:#fff; width:100%;
  }
  .hw-form input:focus,.hw-form select:focus,.hw-form textarea:focus{outline:2px solid var(--hw-accent); border-color:var(--hw-brand);}
  .hw-form textarea{resize:vertical; min-height:64px; font-family:inherit;}
  .hw-form-row{display:grid; grid-template-columns:1fr 1fr; gap:12px;}
  @media (max-width:520px){ .hw-form-row{grid-template-columns:1fr;} }
  .hw-modal-actions{display:flex; align-items:center; justify-content:space-between; margin-top:4px; gap:10px; flex-wrap:wrap;}
  .hw-modal-actions-right{display:flex; gap:8px;}

  .hw-login-card{max-width:380px; margin:40px auto; background:var(--hw-paper); border:1px solid var(--hw-line); border-radius:var(--hw-radius); box-shadow:var(--hw-shadow); padding:24px;}
  .hw-login-card h2{margin:0 0 6px; font-size:18px;}
  .hw-muted{color:var(--hw-muted); font-size:12.5px; margin:0 0 16px;}
  .hw-login-submit{width:100%; margin-top:4px;}
  .hw-hint{color:#98a2b3; font-size:11px; margin:14px 0 0; text-align:center;}
  .hw-form-error{color:var(--hw-red); font-size:12.5px; margin:0;}

  #hw-modal-root[hidden]{display:none;}
  .hw-modal-backdrop{position:fixed; inset:0; background:rgba(15,25,35,.5); display:flex; align-items:center; justify-content:center; padding:16px; z-index:1000;}
  .hw-modal{background:#fff; border-radius:14px; width:100%; max-width:480px; max-height:88vh; overflow-y:auto; box-shadow:0 24px 60px rgba(10,16,28,.35);}
  .hw-modal.hw-modal-wide{max-width:560px;}
  .hw-modal-head{display:flex; align-items:center; justify-content:space-between; padding:16px 18px; border-bottom:1px solid var(--hw-line); position:sticky; top:0; background:#fff;}
  .hw-modal-head h3{margin:0; font-size:15px; text-transform:capitalize;}
  .hw-modal-close{border:0; background:transparent; font-size:20px; line-height:1; color:#8a94a6; cursor:pointer; width:28px; height:28px; border-radius:6px;}
  .hw-modal-close:hover{background:#f1f4f8;}
  .hw-modal-body{padding:18px;}
  .hw-confirm-message{color:#344054; font-size:13.5px; margin:0 0 18px; white-space:pre-wrap;}

  #hw-toast-root{position:fixed; bottom:16px; right:16px; display:flex; flex-direction:column; gap:8px; z-index:1200; max-width:90vw;}
  .hw-toast{
    background:#1b2534; color:#fff; padding:10px 14px; border-radius:8px; font-size:12.5px;
    box-shadow:0 8px 20px rgba(0,0,0,.25); opacity:0; transform:translateY(6px); transition:opacity .2s,transform .2s; max-width:300px;
  }
  .hw-toast-show{opacity:1; transform:translateY(0);}
  .hw-toast-error{background:#7a2231;}
  .hw-toast-success{background:#155f4c;}

  @media (max-width:520px){
    .hw-topbar{padding:12px 14px;}
    .hw-main{padding:12px;}
    .hw-cal-grid{grid-auto-rows:minmax(72px,auto);}
  }
  @media (prefers-reduced-motion:reduce){ .hw-toast{transition:none;} }