
:root{
  --bg0:#070a12;
  --bg1:#0b0f1a;
  --glass: rgba(255,255,255,.06);
  --stroke: rgba(255,255,255,.10);
  --text:#f3f6ff;
  --muted: rgba(243,246,255,.72);
  --shadow: 0 14px 50px rgba(0,0,0,.55);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color:var(--text);
  background:
    radial-gradient(1200px 800px at 20% 0%, rgba(90,120,255,.10), transparent 60%),
    radial-gradient(900px 600px at 90% 10%, rgba(255,120,180,.10), transparent 55%),
    radial-gradient(900px 800px at 70% 120%, rgba(46,229,157,.08), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  overflow:hidden;
}
.hidden{ display:none !important; }

.app-shell{ height:100%; display:flex; flex-direction:column; }

.topbar{
  padding: 12px 14px;
  display:flex; align-items:center; justify-content:space-between; gap:10px;
}
.brand{ display:flex; align-items:center; gap:10px; }
.logo{
  width:42px; height:42px; border-radius: 14px;
  display:grid; place-items:center;
  background: linear-gradient(135deg, rgba(255,255,255,.16), rgba(255,255,255,.06));
  border:1px solid var(--stroke);
  box-shadow: 0 10px 35px rgba(0,0,0,.35);
  font-weight:800;
}
.brand-text .title{ font-weight:900; line-height:1.0; }
.brand-text .subtitle{ font-size:12px; color:var(--muted); margin-top:2px; }

.topbar-actions{ display:flex; gap:8px; }
.icon-btn{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  color:var(--text);
  border-radius: 14px;
  height:42px; min-width:42px;
  padding:0 12px;
  font-size:16px;
  display:grid; place-items:center;
  box-shadow: 0 10px 35px rgba(0,0,0,.25);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:active{ transform: translateY(1px); }

.main{ flex:1; overflow:auto; padding: 6px 14px 94px; }
.view{ max-width: 720px; margin:0 auto; }

.card, .glass{
  background: rgba(255,255,255,.04);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.auth-card h1{ margin:0 0 8px; font-size:22px; }
.muted{ color:var(--muted); }

.field{ display:flex; flex-direction:column; gap:7px; margin: 10px 0; }
label{ font-size:12px; color:var(--muted); letter-spacing:.2px; }

input, textarea, select{
  width:100%;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(10,12,20,.65);
  color: var(--text);
  padding: 12px 12px;
  outline:none;
  font-size: 15px;
}
textarea{ resize:none; }

.row{ display:flex; gap:10px; margin-top: 8px; }
.grid2{ display:grid; grid-template-columns: 1fr 1fr; gap:10px; }
@media (max-width: 420px){ .grid2{ grid-template-columns: 1fr; } }

.btn{
  flex:1;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 12px 12px;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
  -webkit-tap-highlight-color: transparent;
}
.btn.primary{
  background: linear-gradient(135deg, rgba(90,120,255,.32), rgba(255,120,180,.18));
  border-color: rgba(90,120,255,.35);
}
.btn.subtle{
  background: rgba(255,255,255,.04);
}
.btn.full{ width:100%; }
.btn:active{ transform: translateY(1px); }

.msg{ margin-top:10px; min-height: 18px; font-size: 13px; color: rgba(255,255,255,.90); }

.composer-top{ display:flex; align-items:center; gap:10px; margin-bottom: 8px; }
.pill{
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  font-size: 12px;
  color: var(--muted);
}
.spacer{ flex:1; }
.tiny{ font-size: 12px; }
.status-row{ display:flex; align-items:center; gap:8px; }

.dot{
  display:inline-block;
  width:10px; height:10px;
  border-radius: 99px;
  background: rgba(255,255,255,.35);
  margin-right: 6px;
  vertical-align: -1px;
}

.filters{ margin-top: 12px; }
.filters-row{ display:flex; align-items:center; gap:8px; }
.chips{ display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.chip{
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--text);
  font-size: 13px;
  -webkit-tap-highlight-color: transparent;
}
.chip.active{ background: rgba(90,120,255,.20); border-color: rgba(90,120,255,.35); }
.chip:active{ transform: translateY(1px); }

.list{ margin-top: 14px; display:flex; flex-direction:column; gap:12px; }

.postit{
  max-width: 560px;
  margin-left:auto;
  margin-right:auto;

  position:relative;
  border-radius: 18px;
  padding: 14px 14px 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
  border: 1px solid rgba(0,0,0,.12);
  transform: rotate(var(--rot, -1deg));
  overflow:hidden;
}
.postit::before{
  content:"";
  position:absolute;
  inset:-40px -40px auto auto;
  width:140px; height:140px;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.55), transparent 60%);
  opacity:.25;
  transform: rotate(22deg);
}
.postit .top{ display:flex; align-items:flex-start; gap:12px; }
.check{
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 2px solid rgba(0,0,0,.38);
  background: rgba(255,255,255,.22);
  display:grid; place-items:center;
  color: rgba(0,0,0,.85);
  font-weight: 950;
  -webkit-tap-highlight-color: transparent;
}
.check span{ font-size: 14px; line-height: 1; }
.check.done{ background: rgba(0,0,0,.22); color: rgba(255,255,255,.92); border-color: rgba(0,0,0,.55); }

.thought-ico{
  width: 28px; height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.18);
  background: rgba(255,255,255,.45);
  display:grid; place-items:center;
  color: rgba(0,0,0,.75);
  font-weight:900;
}
.content{ flex:1; }
.text{
  white-space: pre-wrap;
  word-break: break-word;
  color: rgba(10,10,10,.86);
  font-size: 16px;
  line-height: 1.25;
  font-weight: 800;
}
.meta{
  margin-top: 10px;
  font-size: 12px;
  color: rgba(10,10,10,.72);
  display:flex; flex-wrap:wrap; gap:10px;
}
.badge{
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.35);
  border: 1px solid rgba(0,0,0,.10);
}
.actions{ margin-top: 10px; display:flex; gap:10px; }
.small-btn{
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.16);
  background: rgba(255,255,255,.45);
  color: rgba(0,0,0,.78);
  font-weight: 900;
  padding: 10px 12px;
  font-size: 13px;
  -webkit-tap-highlight-color: transparent;
}
.small-btn.danger{ background: rgba(255,77,109,.22); }
.small-btn:active{ transform: translateY(1px); }

.bottom-tabs{
  position:fixed; left:0; right:0; bottom:0;
  padding: 10px 10px max(10px, env(safe-area-inset-bottom));
  display:flex; gap:10px;
  background: linear-gradient(180deg, rgba(7,10,18,0), rgba(7,10,18,.95) 30%, rgba(7,10,18,.98));
  backdrop-filter: blur(10px);
}
.tab{
  flex:1;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color: var(--muted);
  padding: 10px 8px;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px;
  -webkit-tap-highlight-color: transparent;
}
.tab .tab-ico{ font-size: 16px; }
.tab .tab-txt{ font-size: 11px; font-weight: 900; letter-spacing:.2px; }
.tab.active{
  color: var(--text);
  background: rgba(90,120,255,.14);
  border-color: rgba(90,120,255,.26);
}

.modal{ position:fixed; inset:0; display:grid; place-items:end center; z-index: 20; }
.modal-backdrop{ position:absolute; inset:0; background: rgba(0,0,0,.55); }
.modal-sheet{
  position:relative;
  width:min(740px, 100%);
  border-radius: 22px 22px 0 0;
  background: rgba(12,16,28,.92);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 -20px 60px rgba(0,0,0,.65);
  padding: 14px;
  max-height: 78vh;
  overflow:auto;
}
.modal-head{ display:flex; align-items:flex-start; gap:10px; }
.modal-title{ font-weight: 950; font-size:18px; }
.sep{ height:1px; background: rgba(255,255,255,.10); margin: 14px 0; }

.themes-list{ display:flex; flex-direction:column; gap:10px; }
.theme-item{
  display:flex; align-items:center; gap:10px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.10);
}
.swatch{ width:20px; height:20px; border-radius: 7px; border: 1px solid rgba(255,255,255,.22); }
.theme-name{ font-weight: 950; }
.theme-actions{ margin-left:auto; display:flex; gap:8px; }

.palette{ display:flex; flex-wrap:wrap; gap:8px; margin-top: 10px; }
.palette button{
  width: 34px; height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.06);
  -webkit-tap-highlight-color: transparent;
}
.palette button:active{ transform: translateY(1px); }

.debug{
  position: fixed;
  inset: 12px 12px 92px 12px;
  z-index: 30;
  border-radius: 22px;
  background: rgba(12,16,28,.92);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.debug-head{ display:flex; align-items:center; gap:10px; padding: 12px; border-bottom: 1px solid rgba(255,255,255,.10); }
.debug-title{ font-weight: 950; }
.debug-body{ height: calc(100% - 54px); overflow:auto; padding: 12px; }
.debug pre{ margin:0; font-size: 12px; color: rgba(255,255,255,.85); white-space: pre-wrap; word-break: break-word; }

.grid3{ display:grid; grid-template-columns: 1fr 1fr 1fr; gap:10px; }
@media (max-width: 520px){ .grid3{ grid-template-columns: 1fr; } }

.stamp{
  position:absolute;
  top:10px; right:10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.20);
  color: rgba(255,255,255,.92);
  font-weight: 900;
  font-size: 12px;
  border: 1px solid rgba(0,0,0,.18);
}
.info-btn{
  z-index: 3;

  width: 34px; height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.18);
  background: rgba(255,255,255,.55);
  color: rgba(0,0,0,.75);
  font-weight: 950;
  display:grid; place-items:center;
  -webkit-tap-highlight-color: transparent;
}
.info-btn:active{ transform: translateY(1px); }
.meta.compact{ margin-top: 10px; }

.add-btn{ width:42px; font-size:22px; font-weight:950; }

/* FIX7 overrides */
.stamp{
  position:absolute;
  right:10px;
  bottom:10px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,.18);
  color: rgba(255,255,255,.92);
  font-weight: 900;
  font-size: 11px;
  border: 1px solid rgba(0,0,0,.16);
}
.swatch.big{ width:34px; height:34px; border-radius: 12px; }
.color-picker-row{ display:flex; align-items:center; gap:10px; }
.palette{
  display:grid;
  grid-template-columns: repeat(6, 34px);
  gap: 8px;
  margin-top: 10px;
}
@media (max-width: 420px){
  .palette{ grid-template-columns: repeat(5, 34px); }
}
.palette button{
  width: 34px; height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.06);
  -webkit-tap-highlight-color: transparent;
}
.palette button.selected{
  outline: 2px solid rgba(90,120,255,.9);
  outline-offset: 2px;
}

/* FIX8 overrides */
@media (min-width: 860px){
  #list.list{
    display: grid;
    grid-template-columns: repeat(auto-fill, 300px);
    gap: 16px;
    align-items: start;
    justify-content: center;
  }
}
.tab-filter{
  opacity: .95;
}
.pwa-hint{
  margin-top: 14px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}
.sep-inline{ opacity:.6; margin: 0 8px; }

.color-select{
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(10,12,20,.65);
  color: var(--text);
  padding: 10px 10px;
  font-weight: 900;
  font-size: 13px;
}

.postit-actions{
  margin-top: 10px;
  display:flex;
  justify-content:flex-end;
}
.done-btn{
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.16);
  background: rgba(255,255,255,.45);
  color: rgba(0,0,0,.78);
  font-weight: 950;
  padding: 9px 12px;
  font-size: 12px;
  -webkit-tap-highlight-color: transparent;
}
.done-btn.is-done{
  background: rgba(0,0,0,.18);
  color: rgba(255,255,255,.92);
  border-color: rgba(0,0,0,.20);
}
.done-btn:active{ transform: translateY(1px); }
.postit .content{ display:flex; flex-direction:column; min-width:0; }
.postit .text{ line-height: 1.25; }
.postit .stamp{
  position: static;
  align-self: flex-end;
  margin-top: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,.18);
  color: rgba(255,255,255,.92);
  font-weight: 900;
  font-size: 11px;
  border: 1px solid rgba(0,0,0,.16);
}

/* FIX10: clearer done checkbox */
.check{
  cursor:pointer;
  user-select:none;
}
.check.unchecked{
  background: rgba(255,255,255,.18);
  color: rgba(0,0,0,.65);
}
.check.unchecked span{
  opacity: 0;
}
.check.done{
  opacity: 1;
}

/* color grid palette */
.color-grid{
  display:grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 8px;
  align-content:start;
  width: 100%;
  max-width: 420px;
}
.color-cell{
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  cursor:pointer;
  -webkit-tap-highlight-color: transparent;
}
.color-cell.is-active{
  outline: 3px solid rgba(255,255,255,.82);
  outline-offset: 2px;
}


/* --- Logo image --- */
.logo{
  width:44px; height:44px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.10);
}

/* --- Postit: more 'paper' feel --- */
.postit{
  padding: 14px 14px 14px;
  cursor: default;
}
.postit::before{
  content:"";
  position:absolute; inset:0;
  border-radius: 18px;
  background: radial-gradient(120px 80px at 18% 18%, rgba(255,255,255,.45), transparent 60%);
  opacity:.55;
  pointer-events:none;
}
.postit::after{
  content:"";
  position:absolute; inset:0;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  pointer-events:none;
}

/* Line layout: [done] [info] [text] */
.postit-line{ display:none !important; /* deprecated */

  position: relative;
  z-index: 2;
  display:flex;
  align-items:flex-start;
  gap:10px;
}
.postit-text{
  font-weight: 950;
  font-size: 18px;
  line-height: 1.2;
  color: rgba(0,0,0,.82);
  word-break: break-word;
  padding-top: 1px;
}

/* Delightful buttons */
.postit-btn{
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 2px solid rgba(0,0,0,.32);
  background: rgba(255,255,255,.25);
  display:grid;
  place-items:center;
  padding:0;
  cursor:pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, background .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.postit-btn:hover{
  background: rgba(255,255,255,.45);
  box-shadow: 0 10px 18px rgba(0,0,0,.16);
}
.postit-btn:active{ transform: translateY(1px) scale(.98); }

/* Done checkbox */
.done-box{
  border-radius: 7px;
}
.done-box span{
  font-size: 16px;
  font-weight: 1000;
  opacity:0;
  transform: scale(.6);
  transition: opacity .14s ease, transform .14s ease;
}
.done-box.done{
  background: rgba(255,255,255,.68);
  border-color: rgba(0,0,0,.38);
  box-shadow: 0 12px 22px rgba(0,0,0,.18);
}
.done-box.done span{
  opacity:1;
  transform: scale(1);
}

/* Info button */
.info-dot{
  border-radius: 999px;
  font-weight: 1000;
  font-size: 14px;
  line-height: 1;
}

/* Filter toggle */
.filter-toggle{ margin-top: 14px; }
.toggle{ display:flex; align-items:center; gap:10px; user-select:none; cursor:pointer; }
.toggle input{ display:none; }
.toggle-ui{
  width: 44px; height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.10);
}
.toggle-ui::after{
  content:"";
  width: 20px; height: 20px;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  position:absolute;
  top: 2.5px; left: 3px;
  transition: transform .16s ease;
  box-shadow: 0 10px 18px rgba(0,0,0,.22);
}
.toggle input:checked + .toggle-ui{
  background: rgba(90,120,255,.30);
  border-color: rgba(90,120,255,.45);
}
.toggle input:checked + .toggle-ui::after{
  transform: translateX(18px);
}
.toggle-text{ font-weight: 900; color: rgba(255,255,255,.92); }

/* old actions row not used anymore */
.postit-actions{ display:none !important; }
.postit .top{ display:none !important; }


/* Done: subtle strike-through + softer text */
.postit.is-done .postit-text{
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  opacity: .72;
}

/* Make the done checkmark a bit bigger and the box slightly bigger */
.postit-btn{
  width: 24px;
  height: 24px;
}
.done-box span{
  font-size: 18px;
}


.postit-row{
  position: relative;
  z-index: 2;
  display:flex;
  align-items:flex-start;
  gap:12px;
}
.postit-tools{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 2px;
}
.postit-btn{
  width: 26px;
  height: 26px;
  border-radius: 8px;
}
.info-dot{
  border-radius: 8px;
  font-size: 14px;
}
.done-box span{
  font-size: 19px;
}

@media (min-width: 860px){
  .postit{
    width: 300px;
    max-width: 300px;
  }
}

.postit.editing{ box-shadow: 0 28px 70px rgba(0,0,0,.55); transform: rotate(var(--rot)) scale(1.01); }
.postit-edit{
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font: inherit;
  font-weight: 950;
  font-size: 18px;
  line-height: 1.25;
  color: rgba(0,0,0,.82);
  padding: 0;
  margin: 0;
}

.done-box.done{ animation: popDone .18s ease-out; }
@keyframes popDone{
  0%{ transform: translateY(0) scale(1); }
  55%{ transform: translateY(-1px) scale(1.08); }
  100%{ transform: translateY(0) scale(1); }
}
.postit.is-done .postit-text{ transition: opacity .16s ease; }

.thought-stamp{
  position:absolute;
  top: 10px;
  right: 10px;
  font-size: 16px;
  opacity: .55;
  user-select:none;
}

/* Sort buttons */
.sort-btn{
  font-size: 14px;
  line-height: 1;
}
.sort-btn:active{ transform: translateY(1px) scale(.98); }

.postit-btn{ display:flex; align-items:center; justify-content:center; }

/* Prio highlight */
.postit.is-prio{
  box-shadow: 0 30px 78px rgba(0,0,0,.58);
  outline: 2px solid rgba(255,255,255,.55);
}
.prio-btn{
  grid-column: 1 / span 2;
  height: 26px;
  font-size: 12px;
  letter-spacing: .08em;
}
.prio-btn.active{
  background: rgba(255,255,255,.82);
  box-shadow: 0 14px 26px rgba(0,0,0,.18);
}

/* PRIO button */
.prio-btn{
  grid-column: 1 / span 2; /* spans full width in 2-col tool grid */
  height: 28px;
  width: auto;
  border-radius: 10px;
  font-size: 12px;
  letter-spacing: .5px;
  font-weight: 950;
  background: rgba(255,255,255,.62);
  box-shadow: 0 10px 18px rgba(0,0,0,.14);
}
.prio-btn.active{
  background: rgba(255,255,255,.78);
  box-shadow: 0 14px 26px rgba(0,0,0,.22);
}
.prio-btn:active{ transform: translateY(1px) scale(.99); }

/* PRIO highlight: thick bottom stripe neon red/white alternating */
.postit.is-prio{
  box-shadow: 0 26px 70px rgba(0,0,0,.55);
}
.postit.is-prio::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  height: 14px;
  border-radius: 0 0 18px 18px;
  background: repeating-linear-gradient(90deg,
    rgba(255,255,255,.95) 0px, rgba(255,255,255,.95) 18px,
    rgba(255,36,86,.98) 18px, rgba(255,36,86,.98) 36px
  );
  box-shadow: 0 -6px 18px rgba(255,36,86,.25);
  opacity: .95;
}

/* Grid tuning: 4 on desktop, 2 on mobile */
@media (min-width: 1200px){
  #list.list{ grid-template-columns: repeat(4, 280px); justify-content: center; }
  .postit{ width: 280px; max-width: 280px; }
}
@media (max-width: 640px){
  #list.list{ display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; justify-content: center; }
  .postit{ width: auto; max-width: none; }
}

/* Offline hint */
body.offline #syncDot, body.offline #statusDot{
  filter: grayscale(1) brightness(.85);
}
