:root{
  --paper:#F7F2E7;
  --paper-2:#EFE7D3;
  --ink:#2E2A24;
  --ink-soft:#726A58;
  --rule:#E1D6B8;
  --card:#FFFDF7;
  --shadow: rgba(46,42,36,0.10);

  --sage:#7A8F6D;
  --indigo:#5B6C8F;
  --ochre:#C08B2E;
  --clay:#B06B60;
  --plum:#5E4463;

  --oxblood:#7B2D3B;
  --gold:#B8923F;
  --forest:#4B6455;
  --navy:#3C4A6B;

  --danger:#A6453B;
  --whatsapp:#4E8C6E;
  --pin:#C08B2E;
}

.ws-app *{box-sizing:border-box;}

.ws-app{
  font-family:'IBM Plex Sans Arabic', sans-serif;
  background:var(--paper);
  color:var(--ink);
  min-height:100vh;
  padding:26px 16px 70px;
  direction:rtl;
}
.ws-wrap{max-width:860px; margin:0 auto;}

/* ===== Header ===== */
.ws-header{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
  margin-bottom:16px;
  padding-bottom:14px;
  border-bottom:2px solid var(--ink);
  flex-wrap:wrap;
}
.ws-title{
  font-family:'Amiri', serif;
  font-weight:700;
  font-size:26px;
  margin:0;
}
.ws-date{font-size:13.5px; color:var(--ink-soft); font-weight:500; white-space:nowrap;}
.ws-date b{color:var(--ink); font-weight:600;}

/* ===== Tabs ===== */
.ws-tabs{
  display:flex;
  gap:8px;
  margin-bottom:22px;
  flex-wrap:wrap;
}
.ws-tab{
  display:flex; align-items:center; gap:7px;
  border:1px solid var(--rule);
  background:var(--card);
  color:var(--ink-soft);
  font-family:inherit;
  font-size:14px;
  font-weight:600;
  padding:9px 18px;
  border-radius:10px;
  cursor:pointer;
  transition:all .15s;
}
.ws-tab:hover{background:var(--paper-2);}
.ws-tab.active{
  background:var(--ink);
  color:var(--paper);
  border-color:var(--ink);
}
.ws-panel{display:none;}
.ws-panel.active{display:block;}

/* ===== Shared: composer blocks ===== */
.card-block{
  background:var(--card);
  border:1px solid var(--rule);
  border-radius:14px;
  padding:16px;
  box-shadow:0 2px 10px var(--shadow);
  margin-bottom:22px;
}
.ws-textarea{
  width:100%;
  min-height:70px;
  border:none;
  outline:none;
  resize:none;
  font-family:inherit;
  font-size:16px;
  line-height:1.7;
  background:transparent;
  color:var(--ink);
}
.ws-textarea::placeholder{color:#B7AF9E;}
.ws-row{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:10px;
  padding-top:12px;
  border-top:1px dashed var(--rule);
  flex-wrap:wrap;
}
.ws-row2{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:8px;
  flex-wrap:wrap;
}
.ws-select{
  appearance:none; -webkit-appearance:none;
  border:1px solid var(--rule);
  background:var(--paper-2);
  color:var(--ink);
  font-family:inherit;
  font-size:13.5px;
  font-weight:500;
  padding:8px 32px 8px 12px;
  border-radius:9px;
  cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236B6659'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:left 12px center;
}
.ws-text-input{
  border:1px solid var(--rule);
  background:var(--paper-2);
  border-radius:9px;
  padding:7px 12px;
  font-family:inherit;
  font-size:13px;
  color:var(--ink);
}
.ws-icon-btn{
  border:1px solid var(--rule);
  background:var(--paper-2);
  color:var(--ink-soft);
  width:32px; height:32px;
  border-radius:9px;
  cursor:pointer;
  font-size:15px;
  line-height:1;
  display:flex; align-items:center; justify-content:center;
  transition:background .15s;
}
.ws-icon-btn:hover{background:var(--rule);}
.ws-save{
  margin-inline-start:auto;
  background:var(--ink);
  color:var(--paper);
  border:none;
  padding:9px 22px;
  border-radius:9px;
  font-family:inherit;
  font-size:14.5px;
  font-weight:600;
  cursor:pointer;
}
.ws-save:hover{opacity:0.85;}

.ws-newcat{display:flex; align-items:center; gap:6px;}
.ws-newcat input[type=text]{width:110px;}
.ws-newcat input[type=color]{
  width:28px; height:28px; border:none; border-radius:50%; padding:0; cursor:pointer; background:none;
}
.ws-newcat input[type=color]::-webkit-color-swatch-wrapper{padding:0;}
.ws-newcat input[type=color]::-webkit-color-swatch{border-radius:50%; border:2px solid var(--paper);}

/* ===== Toolbar (search/filter/stats) ===== */
.ws-toolbar{display:flex; flex-direction:column; gap:12px; margin-bottom:20px;}
.ws-search{
  display:flex; align-items:center; gap:8px;
  background:var(--card); border:1px solid var(--rule); border-radius:10px; padding:9px 14px;
}
.ws-search svg{flex-shrink:0; opacity:0.5;}
.ws-search input{border:none; outline:none; background:transparent; font-family:inherit; font-size:14.5px; color:var(--ink); width:100%;}
.ws-search input::placeholder{color:#B7AF9E;}

.ws-statsrow{display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;}
.ws-stats{font-size:12.5px; color:var(--ink-soft);}
.ws-stats b{color:var(--ink); font-weight:600;}
.ws-toolbtns{display:flex; gap:8px; flex-wrap:wrap;}
.ws-toolbtn{
  display:flex; align-items:center; gap:5px;
  border:1px solid var(--rule); background:var(--card); color:var(--ink-soft);
  font-family:inherit; font-size:12.5px; font-weight:500;
  padding:6px 12px; border-radius:8px; cursor:pointer; transition:background .15s;
}
.ws-toolbtn:hover{background:var(--paper-2); color:var(--ink);}
.ws-toolbtn.accent{background:var(--ink); color:var(--paper);}
.ws-toolbtn.accent:hover{opacity:0.85;}

.ws-chips{display:flex; flex-wrap:wrap; gap:8px;}
.ws-chip{
  display:flex; align-items:center; gap:6px;
  border:1px solid var(--rule); background:var(--card); color:var(--ink-soft);
  font-family:inherit; font-size:13px; font-weight:500;
  padding:6px 14px; border-radius:999px; cursor:pointer; transition:all .15s;
}
.ws-chip .dot{width:8px; height:8px; border-radius:50%; flex-shrink:0;}
.ws-chip.active{background:var(--ink); color:var(--paper); border-color:var(--ink);}
.ws-chip.active .dot{outline:2px solid var(--paper); outline-offset:1px;}

/* ===== Day grouping ===== */
.ws-pinned-group{margin-bottom:26px;}
.ws-pinned-label{font-size:13px; font-weight:700; color:var(--pin); margin:0 0 10px 2px; display:flex; align-items:center; gap:6px;}
.ws-daygroup{margin-bottom:26px;}
.ws-daylabel{font-size:13px; font-weight:700; color:var(--ink-soft); margin:0 0 10px 2px; display:flex; align-items:center; gap:10px;}
.ws-daylabel::after{content:""; flex:1; height:1px; background:var(--rule);}

/* ===== Note card ===== */
.ws-card{
  position:relative; background:var(--card); border:1px solid var(--rule);
  border-radius:12px 6px 6px 12px; padding:14px 20px 14px 16px; margin-bottom:10px;
  box-shadow:0 1px 6px var(--shadow); transition:box-shadow .15s;
}
.ws-card:hover{box-shadow:0 4px 14px var(--shadow);}
.ws-card::before{content:""; position:absolute; top:10px; bottom:10px; right:0; width:6px; border-radius:4px; background:var(--tab-color, var(--sage));}
.ws-card.is-pinned{border-color:var(--pin);}
.ws-card-top{display:flex; justify-content:space-between; align-items:flex-start; gap:10px; margin-bottom:6px;}
.ws-card-meta{display:flex; align-items:center; gap:8px; font-size:12px; color:var(--ink-soft); flex-wrap:wrap;}
.ws-card-cat{display:flex; align-items:center; gap:5px; font-weight:600;}
.ws-card-cat .dot{width:7px; height:7px; border-radius:50%; background:var(--tab-color, var(--sage));}
.ws-card-project{font-size:11.5px; color:var(--ink-soft); background:var(--paper-2); border-radius:6px; padding:2px 8px; font-weight:500;}
.ws-card-actions{display:flex; gap:4px;}
.ws-mini-btn{background:none; border:none; cursor:pointer; color:var(--ink-soft); font-size:13px; padding:2px 5px; border-radius:5px; transition:background .15s, color .15s;}
.ws-mini-btn:hover{background:var(--paper-2); color:var(--ink);}
.ws-mini-btn.danger:hover{color:var(--danger);}
.ws-mini-btn.pinned{color:var(--pin);}
.ws-mini-btn.whatsapp:hover{color:var(--whatsapp);}
.ws-card-text{font-size:15px; line-height:1.8; white-space:pre-wrap; word-break:break-word;}
.ws-followup-badge{display:inline-flex; align-items:center; gap:5px; font-size:11.5px; font-weight:600; padding:3px 9px; border-radius:999px; margin-bottom:8px;}
.ws-followup-badge.due{background:#F5E7D6; color:var(--pin);}
.ws-followup-badge.overdue{background:#F4DEDC; color:var(--danger);}
.ws-followup-badge.upcoming{background:var(--paper-2); color:var(--ink-soft);}

.ws-card-edit{
  width:100%; font-family:inherit; font-size:15px; line-height:1.8;
  border:1px solid var(--rule); border-radius:8px; padding:8px 10px; resize:vertical;
  background:var(--paper-2); color:var(--ink);
}
.ws-edit-actions{margin-top:8px; display:flex; gap:8px;}
.ws-edit-actions button{font-family:inherit; font-size:12.5px; font-weight:600; border-radius:7px; padding:5px 14px; cursor:pointer; border:1px solid var(--rule);}
.ws-edit-save{background:var(--ink); color:var(--paper); border-color:var(--ink)!important;}
.ws-edit-cancel{background:var(--card); color:var(--ink-soft);}

.ws-empty{text-align:center; padding:44px 20px; color:var(--ink-soft);}
.ws-empty-title{font-family:'Amiri', serif; font-size:22px; color:var(--ink); margin-bottom:6px;}
.ws-empty p{font-size:14px; margin:0;}

/* ===== Books shelf ===== */
.bk-shelf-wrap{margin-bottom:22px;}
.bk-shelf{
  display:flex; gap:10px; overflow-x:auto; padding:6px 2px 16px;
  border-bottom:6px solid var(--ink); align-items:flex-end;
}
.bk-shelf::-webkit-scrollbar{height:6px;}
.bk-shelf::-webkit-scrollbar-thumb{background:var(--rule); border-radius:4px;}
.bk-spine{
  flex-shrink:0; width:52px; height:172px; border-radius:4px 4px 2px 2px;
  background:var(--spine-color, var(--oxblood));
  box-shadow:inset -6px 0 10px rgba(0,0,0,0.15), 0 3px 6px var(--shadow);
  cursor:pointer; position:relative; display:flex; align-items:center; justify-content:center;
  padding:10px 0; transition:transform .15s, box-shadow .15s;
}
.bk-spine:hover{transform:translateY(-4px);}
.bk-spine.active{
  transform:translateY(-8px);
  box-shadow:inset -6px 0 10px rgba(0,0,0,0.15), 0 8px 16px var(--shadow);
  outline:2px solid var(--ink); outline-offset:2px;
}
.bk-spine-label{
  writing-mode:vertical-rl; text-orientation:mixed; color:#FFFCF5;
  font-family:'Amiri', serif; font-weight:700; font-size:14px;
  max-height:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.bk-spine-count{
  position:absolute; bottom:4px; right:50%; transform:translateX(50%);
  background:rgba(255,255,255,0.25); color:#fff; font-size:9.5px; font-weight:700;
  padding:1px 6px; border-radius:999px;
}
.bk-spine-new{background:var(--paper-2); border:2px dashed var(--rule); box-shadow:none; color:var(--ink-soft); font-size:22px;}
.bk-spine-new:hover{background:var(--card);}

.bk-panel-empty{text-align:center; padding:60px 20px; color:var(--ink-soft);}
.bk-panel-empty .t{font-family:'Amiri', serif; font-size:22px; color:var(--ink); margin-bottom:6px;}
.bk-book-head{
  display:flex; justify-content:space-between; align-items:flex-start; gap:14px;
  padding-bottom:16px; margin-bottom:18px; border-bottom:2px solid var(--rule); flex-wrap:wrap;
}
.bk-book-titlewrap{border-right:5px solid var(--spine-color, var(--oxblood)); padding-right:14px;}
.bk-book-title{font-family:'Amiri', serif; font-weight:700; font-size:25px; margin:0 0 4px;}
.bk-book-author{font-size:13.5px; color:var(--ink-soft);}
.bk-book-actions{display:flex; gap:8px; flex-wrap:wrap;}
.bk-export-btn, .bk-delbook-btn{
  display:flex; align-items:center; gap:6px; border:1px solid var(--rule); background:var(--paper-2);
  color:var(--ink); font-family:inherit; font-size:12.5px; font-weight:600; padding:7px 14px;
  border-radius:8px; cursor:pointer; transition:background .15s;
}
.bk-export-btn:hover{background:var(--rule);}
.bk-delbook-btn{color:var(--danger); border-color:#ECD9D5;}
.bk-delbook-btn:hover{background:#F7EAE8;}

.bk-note{
  position:relative; padding:14px 18px 14px 16px; margin-bottom:14px;
  border-radius:4px 12px 12px 4px; background:var(--card); border:1px solid var(--rule);
}
.bk-note::before{content:""; position:absolute; top:0; bottom:0; right:0; width:4px; background:var(--type-color, var(--gold)); border-radius:0 4px 4px 0;}
.bk-note-top{display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;}
.bk-note-tag{display:flex; align-items:center; gap:6px; font-size:12px; font-weight:700; color:var(--type-color, var(--gold));}
.bk-note-page{font-size:11.5px; color:var(--ink-soft); background:var(--paper-2); padding:2px 9px; border-radius:999px; margin-inline-start:8px;}
.bk-note-text{font-size:15.5px; line-height:1.85; white-space:pre-wrap; word-break:break-word;}
.bk-note.type-quote .bk-note-text{font-family:'Amiri', serif; font-style:italic; font-size:17px;}
.bk-note.type-quote .bk-note-text::before{content:"❝ ";}
.bk-note.type-quote .bk-note-text::after{content:" ❞";}
.bk-notes-empty{text-align:center; padding:34px 20px; color:var(--ink-soft); font-size:14px;}

/* ===== Tasks ===== */
.tk-progress-wrap{margin-bottom:18px;}
.tk-progress-top{display:flex; justify-content:space-between; font-size:12.5px; color:var(--ink-soft); margin-bottom:6px;}
.tk-progress-bar{height:8px; background:var(--paper-2); border-radius:999px; overflow:hidden;}
.tk-progress-fill{height:100%; background:var(--forest); border-radius:999px; transition:width .25s;}
.tk-motivation{
  margin-top:10px;
  font-size:13.5px;
  font-weight:600;
  color:var(--ochre);
  display:flex;
  flex-direction:column;
  gap:2px;
}
.tk-motivation .tk-sub{
  font-size:11.5px;
  font-weight:500;
  color:var(--ink-soft);
  font-style:italic;
}

.tk-item{
  display:flex; align-items:flex-start; gap:12px;
  background:var(--card); border:1px solid var(--rule); border-radius:10px;
  padding:12px 14px; margin-bottom:8px;
}
.tk-checkbox{
  flex-shrink:0; width:22px; height:22px; border-radius:6px; border:2px solid var(--rule);
  cursor:pointer; display:flex; align-items:center; justify-content:center;
  background:var(--card); margin-top:1px; transition:background .15s, border-color .15s;
}
.tk-checkbox.done{background:var(--forest); border-color:var(--forest); color:#fff; font-size:13px;}
.tk-body{flex:1; min-width:0;}
.tk-text{font-size:15px; line-height:1.6; word-break:break-word;}
.tk-item.done .tk-text{color:var(--ink-soft); text-decoration:line-through;}
.tk-meta{display:flex; align-items:center; gap:8px; margin-top:4px; font-size:11.5px; color:var(--ink-soft); flex-wrap:wrap;}
.tk-project{background:var(--paper-2); border-radius:6px; padding:1px 8px; font-weight:500;}
.tk-person{background:var(--paper-2); border-radius:6px; padding:1px 8px; font-weight:600; color:var(--indigo);}
.tk-actions{display:flex; gap:2px;}

.tk-edit{
  width:100%; font-family:inherit; font-size:15px; border:1px solid var(--rule); border-radius:8px;
  padding:7px 10px; background:var(--paper-2); color:var(--ink);
}

.tk-preview-card{
  background:var(--card);
  border:1px solid var(--rule);
  border-radius:14px;
  padding:20px 22px;
  margin-bottom:16px;
  box-shadow:0 2px 10px var(--shadow);
}
.tk-preview-header{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  padding-bottom:12px;
  margin-bottom:14px;
  border-bottom:2px solid var(--ink);
  flex-wrap:wrap;
  gap:8px;
}
.tk-preview-title{
  font-family:'Amiri', serif;
  font-weight:700;
  font-size:21px;
}
.tk-preview-date{
  font-size:13px;
  color:var(--ink-soft);
}
.tk-preview-list{
  list-style:none;
  counter-reset:tknum;
  padding:0;
  margin:0 0 6px;
}
.tk-preview-item{
  position:relative;
  padding-right:38px;
  margin-bottom:12px;
  font-size:15.5px;
  line-height:1.7;
  min-height:26px;
}
.tk-preview-item::before{
  counter-increment:tknum;
  content:counter(tknum);
  position:absolute;
  right:0; top:0;
  width:26px; height:26px;
  border-radius:50%;
  background:var(--ochre);
  color:#fff;
  font-size:13px;
  font-weight:700;
  display:flex;
  align-items:center;
  justify-content:center;
}
.tk-preview-item.done{color:var(--ink-soft); text-decoration:line-through;}
.tk-preview-item.done::before{background:var(--forest);}
.tk-preview-empty{font-size:14px; color:var(--ink-soft); text-align:center; padding:10px 0;}
.tk-preview-footer{
  display:flex;
  justify-content:flex-end;
  margin-top:4px;
}

.tk-history-card{
  background:var(--card);
  border:1px solid var(--rule);
  border-radius:14px;
  padding:20px 22px;
  margin-bottom:22px;
  box-shadow:0 2px 10px var(--shadow);
}
.tk-history-topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:14px;
  flex-wrap:wrap;
}
.tk-history-title{
  font-family:'Amiri', serif;
  font-size:19px;
  margin:0 0 12px;
}
.tk-period-chips{display:flex; gap:8px; flex-wrap:wrap;}
.tk-table{width:100%; border-collapse:collapse; font-size:13.5px;}
.tk-table th, .tk-table td{border:1px solid var(--rule); padding:8px 10px; text-align:right;}
.tk-table thead th{background:var(--paper-2); font-weight:700; color:var(--ink);}
.tk-table-daytr td{background:var(--paper-2); font-weight:700; color:var(--ink-soft); font-size:12px;}
.tk-status-badge{font-size:11px; font-weight:600; padding:2px 10px; border-radius:999px; white-space:nowrap;}
.tk-status-badge.done{background:#E3ECE4; color:var(--forest);}
.tk-status-badge.pending{background:#F5E7D6; color:var(--ochre);}

@media (max-width:520px){
  .ws-title{font-size:20px;}
  .ws-save{margin-inline-start:0; width:100%;}
  .ws-row{justify-content:flex-start;}
  .bk-book-head{flex-direction:column;}
}

@media print{
  body.print-book *{visibility:hidden;}
  body.print-book #bkPrintArea, body.print-book #bkPrintArea *{visibility:visible;}
  body.print-book #bkPrintArea{position:absolute; top:0; right:0; left:0; padding:20px;}
  body.print-book .bk-note-actions{display:none!important;}

  body.print-tasks *{visibility:hidden;}
  body.print-tasks #tHistoryPrintArea, body.print-tasks #tHistoryPrintArea *{visibility:visible;}
  body.print-tasks #tHistoryPrintArea{position:absolute; top:0; right:0; left:0; padding:20px;}
}

.bk-note-actions{display:flex; gap:2px;}

/* ===== Toast ===== */
.tk-toast{
  position:fixed;
  bottom:26px;
  left:50%;
  transform:translateX(-50%) translateY(20px);
  background:var(--ink);
  color:var(--paper);
  font-family:'IBM Plex Sans Arabic', sans-serif;
  font-size:14px;
  font-weight:600;
  padding:12px 22px;
  border-radius:999px;
  box-shadow:0 6px 20px rgba(0,0,0,0.25);
  z-index:200;
  opacity:0;
  pointer-events:none;
  transition:opacity .25s, transform .25s;
  white-space:nowrap;
}
.tk-toast.show{
  opacity:1;
  transform:translateX(-50%) translateY(0);
}

/* ===== Duck celebration ===== */
.tk-balloon-layer{
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:300;
  overflow:hidden;
}
.tk-balloon{
  position:absolute;
  bottom:-160px;
  display:flex;
  flex-direction:column;
  align-items:center;
  animation:tkBalloonRise 3.2s ease-in forwards;
}
.tk-balloon-body{
  font-size:64px;
  line-height:1;
  filter:drop-shadow(0 6px 10px rgba(0,0,0,0.2));
}
.tk-balloon-label{
  margin-top:2px;
  font-family:'IBM Plex Sans Arabic', sans-serif;
  font-size:12px;
  font-weight:700;
  color:var(--ink);
  background:var(--paper);
  border:1px solid var(--rule);
  padding:2px 8px;
  border-radius:999px;
  white-space:nowrap;
  box-shadow:0 2px 6px rgba(0,0,0,0.12);
}
@keyframes tkBalloonRise{
  0%{ transform:translateY(0) rotate(0deg); opacity:0; }
  8%{ opacity:1; }
  100%{ transform:translateY(-115vh) rotate(var(--b-rot, 8deg)); opacity:0.95; }
}

.tk-daily-banner{
  display:flex;
  flex-direction:column;
  gap:4px;
  background:linear-gradient(135deg, var(--paper-2), var(--card));
  border:1px solid var(--rule);
  border-radius:12px;
  padding:12px 16px;
  margin-bottom:16px;
  font-size:13.5px;
}
.tk-daily-quote{font-weight:700; color:var(--ochre);}
.tk-daily-countdown{color:var(--ink-soft); font-weight:600; font-size:12.5px;}

.tk-morning-input{
  width:100%;
  border:none;
  outline:none;
  background:transparent;
  font-family:'Amiri', serif;
  font-weight:700;
  font-size:19px;
  color:var(--ink);
  padding:2px 0;
}
.tk-morning-input::placeholder{color:#B7AF9E; font-weight:600; font-size:16px;}
.tk-morning-wrap{flex:1; min-width:0;}

/* ===== Weekly chick track ===== */
.tk-week-wrap{
  background:var(--card);
  border:1px solid var(--rule);
  border-radius:14px;
  padding:34px 18px 16px;
  margin-bottom:18px;
  box-shadow:0 2px 10px var(--shadow);
}
.tk-week-track{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  position:relative;
}
.tk-week-line{
  position:absolute;
  top:6px;
  right:8%;
  left:8%;
  height:3px;
  background:var(--rule);
  border-radius:2px;
  z-index:0;
}
.tk-week-line-fill{
  position:absolute;
  top:6px;
  right:8%;
  height:3px;
  background:var(--forest);
  border-radius:2px;
  z-index:1;
  transition:width .3s;
}
.tk-week-day{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  flex:1;
  position:relative;
  z-index:2;
}
.tk-week-dot{
  width:14px; height:14px; border-radius:50%;
  background:var(--paper-2);
  border:2px solid var(--rule);
}
.tk-week-dot.passed{ background:var(--forest); border-color:var(--forest); }
.tk-week-dot.current{ background:var(--ochre); border-color:var(--ochre); box-shadow:0 0 0 5px rgba(192,139,46,0.22); }
.tk-week-label{font-size:11px; color:var(--ink-soft); font-weight:700;}
.tk-week-day.current .tk-week-label{color:var(--ochre);}
.tk-week-chick{
  position:absolute;
  top:-34px;
  line-height:1;
  animation:tkChickBounce 1.6s ease-in-out infinite;
}
@keyframes tkChickBounce{
  0%,100%{ transform:translateY(0); }
  50%{ transform:translateY(-7px); }
}
.tk-week-note{
  text-align:center;
  font-weight:700;
  color:var(--ochre);
  margin-top:16px;
  font-size:14px;
}

/* ===== Greeting popup ===== */
.ws-greeting-overlay{
  position:fixed;
  inset:0;
  background:rgba(46,42,36,0.5);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:400;
  padding:20px;
}
.ws-greeting-card{
  background:var(--paper);
  border:1px solid var(--rule);
  border-radius:16px;
  padding:28px 24px 24px;
  max-width:420px;
  width:100%;
  box-shadow:0 20px 50px rgba(46,42,36,0.28);
  text-align:center;
  animation:wsGreetingPop .28s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes wsGreetingPop{
  0%{ opacity:0; transform:translateY(10px) scale(.96); }
  100%{ opacity:1; transform:translateY(0) scale(1); }
}
.ws-greeting-text{
  font-family:'IBM Plex Sans Arabic', sans-serif;
  font-size:16.5px;
  font-weight:600;
  line-height:1.9;
  color:var(--ink);
  margin-bottom:18px;
}

/* ===== Ticker bar ===== */
.ws-ticker-wrap{
  overflow:hidden;
  background:var(--ink);
  border-radius:10px;
  padding:11px 0;
  margin-bottom:18px;
  position:relative;
}
.ws-ticker-track{
  display:flex;
  width:max-content;
  animation:wsTickerScroll 55s linear infinite;
}
.ws-ticker-wrap:hover .ws-ticker-track{
  animation-play-state:paused;
}
.ws-ticker-item{
  padding:0 26px;
  font-family:'IBM Plex Sans Arabic', sans-serif;
  font-size:13.5px;
  font-weight:600;
  color:var(--paper);
  white-space:nowrap;
  display:flex;
  align-items:center;
  gap:10px;
}
.ws-ticker-item .star{ color:var(--gold); opacity:0.8; }
@keyframes wsTickerScroll{
  from{ transform:translateX(0); }
  to{ transform:translateX(-50%); }
}

/* ===== KPI grid ===== */
.ews-kpi-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(130px, 1fr));
  gap:12px;
}
.ews-kpi-box{
  background:var(--paper-2);
  border:1px solid var(--rule);
  border-radius:10px;
  padding:12px 14px;
  text-align:center;
}
.ews-kpi-num{
  font-family:'Amiri', serif;
  font-weight:700;
  font-size:26px;
  color:var(--forest);
  display:block;
}
.ews-kpi-label{
  font-size:12px;
  color:var(--ink-soft);
  font-weight:600;
  margin-top:4px;
  display:block;
}

/* ===== Auth screen (login/register) — "notebook cover" ===== */
.ews-auth-page{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:32px 16px;
  font-family:'IBM Plex Sans Arabic', sans-serif;
  direction:rtl;
  background:
    radial-gradient(circle at 15% 12%, rgba(184,146,63,0.10), transparent 45%),
    radial-gradient(circle at 88% 82%, rgba(75,100,85,0.10), transparent 40%),
    var(--paper);
}

.ews-auth-card{
  position:relative;
  width:100%;
  max-width:420px;
  background:var(--card);
  border:1px solid var(--rule);
  border-radius:4px 16px 16px 4px;
  padding:34px 30px 26px;
  box-shadow:0 16px 40px rgba(46,42,36,0.14), 0 2px 8px var(--shadow);
  overflow:hidden;
}
/* stitched spine along the right edge, like a bound notebook */
.ews-auth-card::before{
  content:"";
  position:absolute;
  top:0; bottom:0; right:0;
  width:10px;
  background:repeating-linear-gradient(
    to bottom,
    var(--oxblood) 0 6px,
    transparent 6px 14px
  );
  opacity:0.55;
}
/* folded corner, top-left */
.ews-auth-card::after{
  content:"";
  position:absolute;
  top:0; left:0;
  width:0; height:0;
  border-style:solid;
  border-width:0 34px 34px 0;
  border-color:transparent var(--paper-2) transparent transparent;
  filter:drop-shadow(-2px 2px 3px rgba(46,42,36,0.12));
}

.ews-auth-ribbon{
  display:inline-block;
  font-family:'Amiri', serif;
  font-weight:700;
  font-size:24px;
  color:var(--ink);
  margin:0 0 4px;
  padding-inline-start:12px;
}
.ews-auth-tagline{
  font-size:13px;
  color:var(--ink-soft);
  margin:0 0 22px;
  padding-inline-start:12px;
}

.ews-auth-tabs{
  display:flex;
  gap:6px;
  background:var(--paper-2);
  border:1px solid var(--rule);
  border-radius:11px;
  padding:4px;
  margin-bottom:18px;
}
.ews-auth-tab{
  flex:1;
  border:none;
  background:transparent;
  color:var(--ink-soft);
  font-family:inherit;
  font-size:13.5px;
  font-weight:600;
  padding:9px 10px;
  border-radius:8px;
  cursor:pointer;
  transition:background .15s, color .15s;
}
.ews-auth-tab:hover{ color:var(--ink); }
.ews-auth-tab.active{ background:var(--ink); color:var(--paper); box-shadow:0 2px 6px rgba(46,42,36,0.18); }

.ews-auth-error{
  display:flex;
  align-items:center;
  gap:8px;
  background:#F4DEDC;
  color:var(--danger);
  font-size:13.5px;
  font-weight:600;
  padding:10px 12px;
  border-radius:9px;
  margin-bottom:16px;
  border:1px solid #E9C3BE;
}
.ews-auth-error svg{ flex-shrink:0; }

.ews-auth-box{ display:flex; flex-direction:column; gap:4px; }
.ews-auth-field{ margin-bottom:12px; }
.ews-auth-field label{
  display:block;
  font-size:12.5px;
  font-weight:700;
  color:var(--ink-soft);
  margin-bottom:6px;
}
.ews-auth-inputwrap{
  position:relative;
  display:flex;
  align-items:center;
}
.ews-auth-inputwrap svg.ews-auth-icon{
  position:absolute;
  right:12px;
  color:var(--ink-soft);
  opacity:0.6;
  pointer-events:none;
}
.ews-auth-box input{
  width:100%;
  border:1.5px solid var(--rule);
  background:var(--paper-2);
  border-radius:9px;
  padding:11px 40px 11px 12px;
  font-family:inherit;
  font-size:14.5px;
  color:var(--ink);
  transition:border-color .15s, background .15s;
}
.ews-auth-box input::placeholder{ color:#B7AF9E; }
.ews-auth-box input:focus{
  outline:none;
  border-color:var(--gold);
  background:var(--card);
}
.ews-auth-pw-toggle{
  position:absolute;
  left:10px;
  background:none;
  border:none;
  cursor:pointer;
  color:var(--ink-soft);
  font-size:16px;
  padding:4px;
  line-height:1;
  border-radius:6px;
}
.ews-auth-pw-toggle:hover{ color:var(--ink); background:var(--rule); }

.ews-auth-submit{
  margin-top:10px;
  width:100%;
  background:var(--ink);
  color:var(--paper);
  border:none;
  padding:12px 18px;
  border-radius:10px;
  font-family:inherit;
  font-size:15px;
  font-weight:700;
  cursor:pointer;
  transition:opacity .15s, transform .1s;
}
.ews-auth-submit:hover{ opacity:0.88; }
.ews-auth-submit:active{ transform:translateY(1px); }

.ews-auth-hint{
  font-size:12px;
  color:var(--ink-soft);
  margin-top:8px;
  text-align:center;
}

.ews-auth-quote{
  display:flex;
  align-items:center;
  gap:6px;
  justify-content:center;
  margin-top:22px;
  padding-top:16px;
  border-top:1px dashed var(--rule);
  font-size:12.5px;
  font-weight:600;
  color:var(--ochre);
  text-align:center;
}
.ews-auth-quote .star{ color:var(--gold); }

@media (max-width:480px){
  .ews-auth-card{ padding:28px 20px 22px; }
  .ews-auth-ribbon{ font-size:21px; }
}
