@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap');
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
  --bg:#ffffff;--bg2:#fdf5f7;--bg3:#f5e8ed;
  --tx:#2d1a22;--tx2:#9e7e8e;
  --bd:rgba(220,100,130,0.18);--bd2:rgba(220,100,130,0.4);
  --ac:#e8789a;--acd:#c2185b;--acl:#fce4ec;--act:#fff;
  --r:14px;--rl:22px;--rxl:28px;
  --font:'Nunito','Segoe UI',system-ui,sans-serif;
}
html,body{height:100%;overflow:hidden;font-family:var(--font);background:var(--bg);color:var(--tx)}

.shell{position:fixed;inset:0;display:flex;flex-direction:column}
.screens{flex:1;position:relative;overflow:hidden}
.screen{position:absolute;inset:0;overflow-y:auto;-webkit-overflow-scrolling:touch;
  background:#ffffff;
  transition:transform .3s cubic-bezier(.4,0,.2,1);will-change:transform}
.screen.off-left{transform:translateX(-100%);pointer-events:none}
.screen.off-right{transform:translateX(100%);pointer-events:none}
.screen.on{transform:translateX(0)}

/* Wordmark add button */

.wordmark-add{background:rgba(255,255,255,0.15);color:#eeedfe;
  border:1px solid rgba(255,255,255,0.25);
  padding:9px 18px;border-radius:99px;font-size:13px;font-weight:700;font-family:var(--font);
  cursor:pointer;letter-spacing:.02em;transition:opacity .15s,transform .15s;flex-shrink:0;
  display:flex;align-items:center;gap:6px}
.wordmark-add:hover{background:rgba(255,255,255,0.22);transform:translateY(-1px)}
.wordmark-add:active{transform:scale(.97)}
.wordmark-add svg{width:13px;height:13px;stroke:currentColor;stroke-width:2.5;fill:none}

/* App header — list screens (white, logo centered) */
.app-header{position:sticky;top:0;z-index:20;height:70px;
  background:#ffffff;border-bottom:1px solid var(--bd);
  display:flex;align-items:center;justify-content:space-between;
  padding:0 1.1rem;}
.app-header-logo{height:44px;width:auto;display:block;
  position:absolute;left:50%;transform:translateX(-50%);
  image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges;}
.app-header-side{width:44px;flex-shrink:0;}
.btn-header-add{width:40px;height:40px;border-radius:50%;border:1.5px solid var(--bd);
  background:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;
  color:var(--tx2);transition:background .15s,border-color .15s;}
.btn-header-add:hover{background:var(--acl);border-color:var(--ac);color:var(--ac);}
.btn-header-add svg{width:16px;height:16px;stroke:currentColor;stroke-width:2.5;fill:none;}
.btn-header-trash{width:40px;height:40px;border-radius:50%;border:none;
  background:none;cursor:pointer;display:flex;align-items:center;justify-content:center;
  color:var(--tx2);transition:background .15s,color .15s;}
.btn-header-trash:hover{background:#fee2e2;color:#e11d48;}
.btn-header-trash svg{width:20px;height:20px;stroke:currentColor;stroke-width:2;fill:none;}

/* Save button pinned at bottom of edit form */
.edit-save-footer{padding:1.5rem 0 2rem;display:flex;justify-content:center;}
.btn-save-bottom{background:var(--ac);color:#fff;border:none;border-radius:99px;
  padding:14px 48px;font-size:16px;font-weight:700;font-family:var(--font);
  cursor:pointer;transition:opacity .15s,transform .1s;}
.btn-save-bottom:hover{opacity:.88;}
.btn-save-bottom:active{transform:scale(.97);}

/* Top bar — detail screens (back arrow, logo centered, action icon) */
.top-bar{position:sticky;top:0;z-index:20;height:70px;
  background:#ffffff;border-bottom:1px solid var(--bd);
  padding:0 1.1rem;display:flex;align-items:center;justify-content:space-between;}
.top-bar-logo{height:44px;width:auto;display:block;
  position:absolute;left:50%;transform:translateX(-50%);pointer-events:none;
  image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges;}
.top-bar-title{display:none;}
.btn-back{background:none;border:none;cursor:pointer;display:flex;align-items:center;
  padding:4px 6px;flex-shrink:0;width:44px;}
.back-chevron{width:24px;height:24px;display:block;transition:opacity .15s;}
.btn-back:hover .back-chevron{opacity:.6;}
.top-bar-center{display:none;}
.top-bar-action{background:none;border:none;cursor:pointer;font-size:14px;font-weight:700;
  color:var(--tx2);font-family:var(--font);padding:6px 8px;border-radius:99px;
  transition:background .15s,color .15s;display:flex;align-items:center;}
.top-bar-action:hover{background:var(--acl);color:var(--ac);}
.top-bar-action svg{width:18px;height:18px;stroke:currentColor;stroke-width:1.8;fill:none;}

/* List */
.list-pad{padding:0 1rem 2rem;max-width:860px;margin:0 auto}
.list-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem;gap:8px}
.count-lbl{font-size:13px;color:var(--tx2);font-weight:600}
.btn-add{background:linear-gradient(135deg,#e8789a,#f0a8bf);color:#fff;border:none;
  padding:10px 20px;border-radius:99px;font-size:14px;font-weight:700;font-family:var(--font);
  cursor:pointer;box-shadow:0 4px 14px rgba(232,120,154,.35);transition:box-shadow .2s,transform .15s}
.btn-add:hover{box-shadow:0 6px 20px rgba(232,120,154,.45);transform:translateY(-1px)}
.btn-add:active{transform:scale(.97)}
.filters{display:flex;gap:8px;margin-top:0.75rem;margin-bottom:0.5rem;align-items:center}
.filters input,.filters select{padding:10px 18px;border:1.5px solid #dadfff;border-radius:12px;
  font-size:14px;background:#fff;color:var(--tx);font-family:var(--font);outline:none;
  transition:border-color .15s,box-shadow .15s}
.filters select{flex:1;height:44px;padding-right:38px;appearance:none;-webkit-appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a6a9a' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 14px center}
.filters input:focus,.filters select:focus{border-color:var(--ac)}
.filters input{flex:1;height:44px;}

/* Cards */
.grid{display:grid;grid-template-columns:1fr;gap:14px}
@media(min-width:600px){.grid{grid-template-columns:repeat(2,1fr)}}
.card{background:#ffffff;
  border:1.5px solid #dadfff;border-radius:var(--rxl);cursor:pointer;
  transition:border-color .2s,transform .15s,box-shadow .2s;
  box-shadow:0 2px 12px rgba(144,154,232,.12);overflow:hidden;position:relative}
.card:hover{border-color:#bfc7ff;transform:translateY(-3px);box-shadow:0 8px 28px rgba(144,154,232,.22)}
.card:active{border-color:#ffbfd8;transform:scale(.97)}
.card.selected{border-color:#909ae8}
.card-photo{width:100%;height:160px;object-fit:cover;display:block}
.card-photo-placeholder{width:100%;height:150px;background:linear-gradient(135deg,#e8e6ff,#ddd9ff);
  display:flex;align-items:center;justify-content:center;}

/* Pattern card photo */
.card-photo-pattern{width:100%;height:110px;object-fit:cover;display:block;position:relative}

.card-body{padding:1rem}
.card-top{display:flex;justify-content:space-between;align-items:flex-start;gap:8px;margin-bottom:8px}
.card-title{font-size:15px;font-weight:700;color:var(--tx);line-height:1.35}
.fav-btn{position:absolute;top:10px;right:10px;z-index:2;
  background:rgba(255,255,255,0.9);border:none;cursor:pointer;
  font-size:15px;color:#9b8ec4;
  width:34px;height:34px;border-radius:10px;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 1px 6px rgba(0,0,0,0.10);transition:transform .15s,background .15s,color .15s}
.fav-btn:hover{transform:scale(1.1);background:rgba(255,255,255,1)}
.fav-btn.active{color:#e8789a}
.badge{display:inline-block;padding:3px 10px;border-radius:99px;font-size:11px;font-weight:700}
.badge-easy{background:#d9f5e2;color:#2d6e4a}
.badge-medium{background:#fff0d4;color:#7a4f00}
.badge-hard{background:#fde0f0;color:#9b1d5a}
.card-badges{display:flex;gap:5px;flex-wrap:wrap;margin-top:9px}
.cat-tag{background:#ccfbf1;color:#0f766e;font-size:11px;padding:3px 10px;border-radius:99px;font-weight:700}
.crochet-level-tag{background:#ede9fe;color:#6d28d9;font-size:11px;padding:3px 10px;border-radius:99px;font-weight:700}
.pdf-badge{background:linear-gradient(135deg,#fce4ec,#f8bbd0);color:#c2185b;font-size:11px;font-weight:700;padding:3px 10px;border-radius:99px}
.card-meta{font-size:12px;color:var(--tx2);margin-top:9px;display:flex;flex-direction:column;gap:3px;font-weight:500}
.empty{text-align:center;padding:3rem 1rem;color:var(--tx2);font-size:14px;grid-column:1/-1}

/* Project status pills */
.status-pill{display:inline-flex;align-items:center;gap:4px;padding:3px 10px;border-radius:99px;font-size:11px;font-weight:700;flex-shrink:0;letter-spacing:.01em}
.status-pill::before{content:'';width:6px;height:6px;border-radius:50%;flex-shrink:0}
.status-active{background:#dcfce7;color:#15803d}
.status-active::before{background:#16a34a}
.status-done-proj{background:#fce7f3;color:#be185d}
.status-done-proj::before{background:#ec4899}
.status-frogged{background:#fef3c7;color:#b45309}
.status-frogged::before{background:#f59e0b}

/* Status-driven card treatments */
.card.card-done{background:rgba(252,231,243,.18)}
.card.card-frogged{background:rgba(254,243,199,.2);opacity:.82}
.card.card-frogged .proj-card-name{text-decoration:line-through;text-decoration-color:rgba(180,83,9,.35)}

/* Project card extras */
.proj-card-body{padding:.75rem .9rem .55rem}
.proj-card-row{display:flex;align-items:center;justify-content:space-between;gap:6px}
.proj-card-name{font-size:14px;font-weight:700;color:var(--tx);line-height:1.3;flex:1;min-width:0;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.proj-card-subtitle{font-size:11px;color:#8b7ec8;font-weight:600;margin-top:3px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.proj-card-progress-wrap{position:relative;margin-top:10px;height:30px;display:flex;align-items:center}
.proj-card-progress-bg{width:100%;height:6px;background:#f0eeff;border-radius:99px;overflow:hidden;position:relative}
.proj-card-progress-bar{height:100%;background:linear-gradient(90deg,#e8789a,#f0a8bf);border-radius:99px;transition:width .4s}
.proj-card-mascot{position:absolute;top:50%;transform:translate(-50%,-50%);
  width:28px;height:28px;object-fit:contain;filter:drop-shadow(0 1px 2px rgba(0,0,0,.15));
  transition:left .4s;pointer-events:none}
.proj-pattern-link{font-size:12px;color:var(--ac);font-weight:700;margin-top:6px}

/* Detail hero */
.detail-fav{background:none;border:none;cursor:pointer;font-size:24px;color:#e8789a;padding:2px}
.detail-photo-wrap{position:relative;width:100%;max-height:240px;overflow:hidden}
.detail-photo-wrap img{width:100%;object-fit:cover;display:block}
.detail-hero{padding:1.1rem 1.25rem;
  background:linear-gradient(135deg,#e8e6ff,#ddd9ff);
  position:relative;display:flex;align-items:center;
  min-height:130px;overflow:hidden}
.detail-hero-left{flex:1;min-width:0;padding-right:118px}
.detail-hero-title{font-size:20px;font-weight:800;color:var(--tx);line-height:1.3}
.detail-hero-badges{display:flex;gap:6px;flex-wrap:wrap;margin-top:9px}
.hero-info-pill{display:inline-flex;align-items:center;gap:5px;
  background:#dcfce7;color:#166534;
  border:none;border-radius:99px;
  font-size:12px;font-weight:600;padding:5px 12px}
.hero-info-pill--hook{background:#cffafe;color:#155e75}
.hero-info-pill--link{cursor:pointer;transition:opacity .15s}
.hero-info-pill--link:hover{opacity:.8}
.hero-pill-img{width:14px;height:14px;object-fit:contain;flex-shrink:0}
.detail-hero-photo-wrap{position:absolute;right:-72px;top:50%;
  transform:translateY(-50%);width:168px;height:168px;flex-shrink:0}
.detail-hero-img{width:168px;height:168px;border-radius:50%;object-fit:cover;
  display:block;border:4px solid rgba(255,255,255,.85)}
.detail-hero-photo-placeholder{width:168px;height:168px;border-radius:50%;
  background:rgba(255,255,255,.35);border:3px solid rgba(255,255,255,.6);
  display:flex;align-items:center;justify-content:center}
.detail-hero-fav{position:absolute;top:12px;right:12px;width:30px;height:30px;
  border-radius:8px;background:rgba(255,255,255,.92);border:none;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  font-size:14px;color:#9b8ec4;z-index:2;box-shadow:0 1px 4px rgba(0,0,0,.1);
  transition:color .15s,background .15s}
.detail-hero-fav.active{color:#e8789a}
.detail-hero-badges .status-pill{background:rgba(255,255,255,.65);color:var(--tx);border:none}
.detail-body{padding:1.25rem 1.25rem 0;max-width:640px;margin:0 auto}
.section{margin-bottom:1.4rem}
.section-lbl{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.08em;color:#909ae8;margin-bottom:10px;display:flex;justify-content:space-between;align-items:center}
.chips{display:flex;gap:8px;flex-wrap:wrap}
.chip{display:flex;align-items:center;gap:8px;background:rgba(255,255,255,.8);
  border:1.5px solid var(--bd);border-radius:99px;padding:9px 16px;
  font-size:14px;color:var(--tx);font-weight:600;box-shadow:0 1px 6px rgba(232,120,154,.06)}
.pattern-ref-card{background:rgba(255,255,255,.8);border:1.5px solid var(--bd);border-radius:var(--rl);
  padding:1rem;display:flex;align-items:center;gap:12px;cursor:pointer;transition:border-color .15s}
.pattern-ref-card:hover{border-color:rgba(232,120,154,.4)}
.pattern-ref-icon{width:40px;height:40px;border-radius:var(--r);
  background:linear-gradient(135deg,#e8789a,#f0a8bf);display:flex;align-items:center;justify-content:center;font-size:20px;flex-shrink:0}
.pattern-ref-name{font-size:14px;font-weight:700;color:var(--tx)}
.pattern-ref-meta{font-size:12px;color:var(--tx2);margin-top:2px;font-weight:500}
.detail-bar{display:flex;gap:10px;padding:.85rem 1.25rem;border-top:1px solid var(--bd);
  position:sticky;bottom:0;background:rgba(255,255,255,.92);backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);max-width:640px;margin:0 auto;align-items:center}
.btn-edit-full{background:none;border:none;color:var(--tx2);padding:8px 12px;border-radius:99px;font-size:13px;font-weight:700;cursor:pointer;font-family:var(--font)}
.btn-edit-full:hover{color:var(--tx);background:var(--bg2)}
.btn-pdf-open{background:linear-gradient(135deg,#fce4ec,#f8bbd0);color:var(--acd);
  border:1.5px solid rgba(220,100,130,.2);padding:10px 18px;border-radius:99px;
  font-size:14px;font-weight:700;cursor:pointer;font-family:var(--font)}
.btn-pdf-open:hover{background:linear-gradient(135deg,#f8bbd0,#f48fb1)}

/* Photo upload in detail */
.photo-upload-zone{border:2px dashed var(--bd2);border-radius:var(--rl);padding:1.5rem;
  text-align:center;cursor:pointer;background:var(--bg2);transition:border-color .15s,background .15s}
.photo-upload-zone:hover{border-color:var(--ac);background:var(--acl)}
.photo-upload-zone p{font-size:13px;color:var(--tx2);margin-top:6px;font-weight:600}
.photo-preview{width:100%;border-radius:var(--rl);object-fit:cover;max-height:260px;display:block}
.btn-remove-photo{background:none;border:1.5px solid var(--bd);color:var(--tx2);padding:6px 14px;
  border-radius:99px;font-size:12px;font-weight:700;cursor:pointer;font-family:var(--font);margin-top:8px}
.btn-remove-photo:hover{background:var(--bg2)}

/* Steps */
.steps-list{display:flex;flex-direction:column;gap:5px}
.step-row{display:flex;align-items:flex-start;gap:12px;padding:11px 14px;border-radius:var(--rl);
  cursor:pointer;border:1.5px solid transparent;user-select:none;transition:background .15s,opacity .35s;
  background:rgba(255,255,255,.55)}
.step-row:hover{background:rgba(255,255,255,.85);border-color:var(--bd)}
.step-row.done{opacity:.38}
.step-check{width:22px;height:22px;border-radius:50%;border:2px solid var(--ac);flex-shrink:0;margin-top:2px;
  display:flex;align-items:center;justify-content:center;transition:background .2s,border-color .2s}
.step-row.done .step-check{background:linear-gradient(135deg,#e8789a,#f0a8bf);border-color:transparent}
.step-tick{display:none;color:#fff;font-size:12px;font-weight:800}
.step-row.done .step-tick{display:block}
.step-text{font-size:15px;line-height:1.6;color:var(--tx);font-weight:500}
.step-row.done .step-text{text-decoration:line-through;color:var(--tx2)}
.progress-wrap{margin-bottom:4px}
.progress-meta{font-size:12px;color:var(--tx2);margin-bottom:6px;display:flex;justify-content:space-between;font-weight:600}
.detail-progress-wrap{position:relative;height:36px;display:flex;align-items:center;margin-bottom:10px}
.detail-progress-bg{width:100%;height:8px;background:#f0eeff;border-radius:99px;overflow:hidden;position:relative}
.detail-progress-bar{height:100%;background:linear-gradient(90deg,#e8789a,#f0a8bf);border-radius:99px;transition:width .4s}
.detail-progress-mascot{position:absolute;top:50%;transform:translate(-50%,-50%);
  width:32px;height:32px;object-fit:contain;filter:drop-shadow(0 1px 3px rgba(0,0,0,.15));
  transition:left .4s;pointer-events:none}
.btn-reset{background:none;border:none;font-size:12px;color:var(--tx2);cursor:pointer;font-family:var(--font);text-decoration:underline;font-weight:600}
/* Step sections accordion */
.steps-section{margin-bottom:8px;background:#fff;border-radius:var(--rl);
  overflow:hidden;border:1.5px solid var(--bd)}
.steps-section-hd{display:flex;align-items:center;padding:11px 14px;cursor:pointer;
  user-select:none;gap:10px}
.steps-section-dot{width:16px;height:16px;border-radius:50%;border:2px solid var(--bd);
  flex-shrink:0;transition:background .2s,border-color .2s}
.steps-section-dot.partial{border-color:var(--ac);background:rgba(232,120,154,.15)}
.steps-section-dot.full{background:linear-gradient(135deg,#e8789a,#f0a8bf);border-color:transparent}
.steps-section-title{font-size:14px;font-weight:700;color:var(--tx);flex:1}
.steps-section-chevron{flex-shrink:0;transition:transform .2s}
.steps-section-chevron.open{transform:rotate(180deg)}
.steps-section-body{display:none;padding:0 10px 10px;flex-direction:column;gap:5px}
.steps-section-body.open{display:flex}

/* Pattern picker in modal */
.picker-list{display:flex;flex-direction:column;gap:8px;max-height:220px;overflow-y:auto;margin-bottom:.5rem}
.picker-item{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:var(--rl);
  background:rgba(255,255,255,.7);border:1.5px solid var(--bd);cursor:pointer;transition:border-color .15s,background .15s}
.picker-item:hover,.picker-item.selected{border-color:var(--ac);background:var(--acl)}
.picker-item-icon{width:36px;height:36px;border-radius:var(--r);background:linear-gradient(135deg,#e8789a,#f0a8bf);
  display:flex;align-items:center;justify-content:center;font-size:18px;flex-shrink:0}
.picker-item-name{font-size:14px;font-weight:700;color:var(--tx)}
.picker-item-meta{font-size:12px;color:var(--tx2);font-weight:500}
.picker-none{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:var(--rl);
  background:rgba(255,255,255,.5);border:1.5px dashed var(--bd);cursor:pointer;transition:border-color .15s}
.picker-none:hover,.picker-none.selected{border-color:var(--ac);background:var(--acl)}

/* Edit screen uses s-edit full-page screen — no modal overlay needed */
.form-row{margin-bottom:16px}
.form-row label{font-size:12px;color:#646cae;display:block;margin-bottom:6px;font-weight:700}
.form-row input,.form-row select,.form-row textarea{width:100%;padding:11px 14px;border:1.5px solid #dadfff;border-radius:var(--r);font-size:15px;background:#fff;color:var(--tx);font-family:var(--font);outline:none;transition:border-color .15s,box-shadow .15s}
.form-row select{padding-right:40px;appearance:none;-webkit-appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a6a9a' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 14px center}
.form-row input:focus,.form-row select:focus,.form-row textarea:focus{border-color:var(--ac);box-shadow:0 0 0 3px rgba(232,120,154,.12)}
.form-row textarea{resize:none;min-height:90px;line-height:1.6;overflow:hidden}
.form-row-2{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:16px}

/* Form section labels */
.form-section-lbl{font-size:11px;font-weight:800;letter-spacing:.09em;text-transform:uppercase;
  color:#909ae8;margin:1.4rem 0 .75rem;padding-bottom:.5rem;border-bottom:1.5px solid var(--bd)}
.form-section-lbl:first-child{margin-top:0}

/* Pattern steps builder */
.pstep-section{border:1.5px solid var(--bd);border-radius:var(--r);margin-bottom:10px;overflow:hidden;background:#fff}
.pstep-section-header{display:flex;align-items:center;gap:8px;padding:10px 12px;
  background:var(--bg2);border-bottom:1.5px solid var(--bd)}
.pstep-section-title{flex:1;font-size:14px;font-weight:700;border:none;background:transparent;
  outline:none;color:var(--tx);font-family:var(--font);min-width:0}
.pstep-section-title::placeholder{color:var(--tx2);font-weight:500}
.pstep-move-btns{display:flex;flex-direction:column;gap:1px;flex-shrink:0}
.pstep-move-btn{width:22px;height:22px;border:none;background:none;cursor:pointer;
  color:var(--tx2);display:flex;align-items:center;justify-content:center;
  border-radius:6px;padding:0;transition:background .15s,color .15s}
.pstep-move-btn:hover:not(:disabled){background:var(--acl);color:var(--ac)}
.pstep-move-btn:disabled{opacity:0.25;cursor:default}
.pstep-sec-del{width:26px;height:26px;border:none;background:none;cursor:pointer;
  color:var(--tx2);display:flex;align-items:center;justify-content:center;border-radius:50%;flex-shrink:0;
  transition:background .15s,color .15s;padding:0}
.pstep-sec-del:hover{background:#fee2e2;color:#e11d48}
.pstep-section-chevron{flex-shrink:0;color:var(--tx2);transition:transform .2s}
.pstep-section-body{padding:10px 12px 12px}
.pstep-rows{display:flex;flex-direction:column;gap:6px;margin-bottom:8px}
.pstep-row{display:flex;align-items:center;gap:8px}
.pstep-row-num{font-size:11px;font-weight:800;color:var(--tx2);width:26px;flex-shrink:0;text-align:right}
.pstep-row-input{flex:1;padding:8px 12px;border:1.5px solid #dadfff;border-radius:10px;
  font-size:14px;font-family:var(--font);color:var(--tx);background:#fff;outline:none;
  transition:border-color .15s}
.pstep-row-input:focus{border-color:var(--ac)}
.pstep-row-del{width:26px;height:26px;border:none;background:none;cursor:pointer;color:var(--tx2);
  display:flex;align-items:center;justify-content:center;border-radius:50%;flex-shrink:0;
  transition:background .15s,color .15s;padding:0}
.pstep-row-del:hover{background:#fee2e2;color:#e11d48}
.pstep-add-row{width:100%;padding:7px;border:1.5px dashed var(--bd2);border-radius:10px;
  background:transparent;color:var(--ac);font-size:13px;font-weight:700;font-family:var(--font);
  cursor:pointer;transition:background .15s,border-color .15s}
.pstep-add-row:hover{background:var(--acl);border-color:var(--ac)}
.pstep-add-section{width:100%;padding:10px 16px;border:1.5px dashed var(--bd2);border-radius:var(--r);
  background:transparent;color:var(--ac);font-size:13px;font-weight:700;font-family:var(--font);
  cursor:pointer;margin-top:4px;transition:background .15s,border-color .15s}
.pstep-add-section:hover{background:var(--acl);border-color:var(--ac)}
.modal-acts{display:flex;gap:8px;justify-content:flex-end;margin-top:1.4rem;align-items:center}
.btn-sec{background:none;border:1.5px solid var(--bd);color:var(--tx2);padding:10px 18px;border-radius:99px;font-size:14px;cursor:pointer;font-family:var(--font);font-weight:600}
.btn-sec:hover{background:var(--bg2)}
.btn-del{background:none;border:1.5px solid #f8bbd0;color:#c2185b;padding:10px 18px;border-radius:99px;font-size:14px;cursor:pointer;margin-right:auto;font-family:var(--font);font-weight:600}
.btn-del:hover{background:var(--acl)}
.pdf-drop{border:2px dashed var(--bd2);border-radius:var(--rl);padding:1.4rem;text-align:center;cursor:pointer;background:var(--bg2);transition:border-color .15s,background .15s}
.pdf-drop:hover,.pdf-drop.drag-over{border-color:var(--ac);background:var(--acl)}
.pdf-drop p{font-size:13px;color:var(--tx2);margin-top:6px;font-weight:600}
.pdf-drop .pdf-icon{font-size:30px;display:block}
.pdf-attached{display:flex;align-items:center;gap:10px;background:linear-gradient(135deg,#fce4ec,#f8bbd0);border:1.5px solid rgba(220,100,130,.2);border-radius:var(--r);padding:10px 14px}
.pdf-attached span{font-size:13px;color:var(--acd);font-weight:700;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pdf-remove{background:none;border:none;cursor:pointer;font-size:16px;color:var(--acd);padding:0;line-height:1;flex-shrink:0}
.pattern-media-drop{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;
  min-height:85px;padding:16px;cursor:pointer;
  border:1.5px dashed #dadfff;border-radius:16px;
  background:#fff;
  box-shadow:0 4px 20px rgba(230,214,248,0.4);
  transition:border-color .15s,background .15s}
.pattern-media-drop:hover{border-color:#bfc7ff;background:#fafbff}
.pattern-media-drop.drag-over{border-color:#909ae8;background:#f0f1ff}
.pdf-attached-row{display:flex;align-items:center;gap:10px;padding:12px 14px;
  border:1.5px solid #dadfff;border-radius:var(--r);background:#fff}
.pdf-viewer{position:fixed;inset:0;background:rgba(42,31,74,.75);z-index:300;display:flex;flex-direction:column}
.pdf-bar{background:var(--bg);padding:10px 16px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--bd);flex-shrink:0}
.pdf-bar span{font-size:14px;font-weight:700;color:var(--tx)}
.pdf-bar button{background:none;border:none;font-size:22px;cursor:pointer;color:var(--tx2);font-family:var(--font);padding:0 4px}
.pdf-iframe{flex:1;width:100%;border:none}

/* Bottom tab bar */
.tab-bar { flex-shrink: 0; height: 64px; background: rgba(255,255,255,.96);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--bd); display: flex; align-items: stretch; padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom); }
.tab-btn { flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; background: none; border: none; cursor: pointer;
  font-family: var(--font); color: var(--tx2); transition: color .15s; padding: 6px 0;
  border-radius: var(--r); position: relative; }
.tab-btn.active { color: var(--ac); }
.tab-btn .t-icon { font-size: 22px; line-height: 1; }
.tab-btn .t-lbl { font-size: 10px; font-weight: 800; letter-spacing: .02em; }
.tab-btn.active::after { content: ''; position: absolute; bottom: 6px; left: 50%;
  transform: translateX(-50%); width: 20px; height: 3px;
  background: linear-gradient(90deg, #e8789a, #f0a8bf); border-radius: 99px; }
.tab-bar-hidden { display: none; }

/* Collapsible info strip */
.info-strip { background: rgba(255,255,255,.6); border: 1.5px solid var(--bd); border-radius: var(--rl);
  overflow: hidden; margin-bottom: 1.2rem; }
.info-strip-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px;
  cursor: pointer; user-select: none; }
.info-strip-header:active { background: rgba(0,0,0,.04); }
.info-strip-summary { flex: 1; font-size: 12px; color: var(--tx2); font-weight: 600;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-start; }
.info-strip-chevron { font-size: 20px; color: var(--tx2); transition: transform .2s; flex-shrink: 0; }
.info-strip-chevron.open { transform: rotate(90deg); }
.info-strip-body { border-top: 1px solid var(--bd); padding: 12px 14px;
  display: none; flex-direction: column; gap: 10px; }
.info-strip-body.open { display: flex; }
.info-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.info-row-label { color: var(--tx2); font-weight: 700; font-size: 11px; min-width: 60px; }
.info-row-val { color: var(--tx); font-weight: 600; }

/* Pattern detail header */
.pat-detail-img-wrap{position:relative;overflow:hidden}
.pat-detail-main-img{width:100%;aspect-ratio:4/3;object-fit:cover;display:block;max-height:180px}
.pat-detail-placeholder{width:100%;aspect-ratio:4/3;background:linear-gradient(135deg,#e8e6ff,#ddd9ff);
  display:flex;align-items:center;justify-content:center;max-height:180px}
@media(min-width:600px){
  .pat-detail-main-img{max-height:none}
  .pat-detail-placeholder{max-height:none}
}
.pat-detail-img-wrap .fav-btn{position:absolute;top:10px;right:10px}
.pat-detail-header{margin-bottom:1.2rem}
.pat-detail-name{font-size:20px;font-weight:800;color:var(--ac);line-height:1.3;margin-bottom:10px}
.pat-tag{background:#e0f2fe;color:#0369a1;font-size:11px;padding:3px 10px;border-radius:99px;font-weight:700}

/* Pattern image gallery */
.gallery-wrap { margin-bottom: 1.4rem; }
.gallery-main { width:100%; aspect-ratio:4/3; object-fit:cover; border-radius:var(--rl); display:block; background:var(--bg3); }
.gallery-main-empty { width:100%; aspect-ratio:4/3; border-radius:var(--rl); background:linear-gradient(135deg,#fce4ec,#fdd4e2);
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; cursor:pointer; border:2px dashed var(--bd2); transition:background .15s; }
.gallery-main-empty:hover { background:var(--acl); }
.gallery-main-empty span { font-size:36px; }
.gallery-main-empty p { font-size:13px; color:var(--tx2); font-weight:600; }
.gallery-thumbs { display:flex; gap:8px; margin-top:8px; flex-wrap:wrap; }
.gallery-thumb { width:56px; height:56px; object-fit:cover; border-radius:var(--r); cursor:pointer;
  border:2px solid transparent; transition:border-color .15s, opacity .15s; flex-shrink:0; }
.gallery-thumb.active { border-color:var(--ac); }
.gallery-thumb:hover { opacity:.85; }
.gallery-thumb-add { width:56px; height:56px; border-radius:var(--r); border:2px dashed var(--bd2);
  display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:22px; color:var(--tx2);
  flex-shrink:0; transition:border-color .15s, background .15s; background:rgba(255,255,255,.5); }
.gallery-thumb-add:hover { border-color:var(--ac); background:var(--acl); }

/* Full-screen image lightbox */
#img-lightbox {
  position:fixed; inset:0; z-index:9000;
  background:rgba(0,0,0,0.92);
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  animation:lb-fadein .18s ease;
}
@keyframes lb-fadein { from{opacity:0} to{opacity:1} }
.lightbox-close {
  position:absolute; top:14px; right:14px;
  width:40px; height:40px; border-radius:50%;
  background:rgba(255,255,255,.13); border:none;
  display:flex; align-items:center; justify-content:center;
  color:#fff; cursor:pointer; z-index:1;
  transition:background .15s;
}
.lightbox-close:hover { background:rgba(255,255,255,.25); }
.lightbox-img-wrap {
  width:100%; flex:1; display:flex;
  align-items:center; justify-content:center;
  padding:60px 16px 16px;
  box-sizing:border-box;
}
.lightbox-img {
  max-width:100%; max-height:100%;
  object-fit:contain; border-radius:10px;
  user-select:none; -webkit-user-drag:none;
}
.lightbox-dots {
  display:flex; gap:7px; padding:12px 0 20px;
  align-items:center; justify-content:center;
}
.lightbox-dot {
  width:7px; height:7px; border-radius:50%;
  background:rgba(255,255,255,.35); cursor:pointer;
  transition:background .15s, transform .15s;
}
.lightbox-dot.active {
  background:#fff; transform:scale(1.3);
}

/* Backup button in header */
.btn-header-backup {
  position:relative;
  width:36px; height:36px; border-radius:50%; border:1.5px solid var(--bd);
  background:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center;
  color:var(--tx2); transition:background .15s, border-color .15s, color .15s;
}
.btn-header-backup:hover { background:var(--acl); border-color:var(--ac); color:var(--ac); }
.backup-dot {
  position:absolute; top:5px; right:5px;
  width:8px; height:8px; border-radius:50%;
  border:1.5px solid #fff;
  background:#d1d5db; /* neutral grey until state is known */
  transition:background .3s;
}
.backup-dot.saved   { background:#22c55e; }
.backup-dot.unsaved { background:#ef4444; }

/* Backup action sheet */
.backup-scrim {
  position:fixed; inset:0; z-index:8000;
  background:rgba(30,14,60,0.45);
  display:flex; align-items:flex-end; justify-content:center;
}
.backup-sheet {
  width:100%; max-width:480px;
  background:#fff; border-radius:22px 22px 0 0;
  padding:12px 20px 32px;
  transform:translateY(100%);
  transition:transform .3s cubic-bezier(.4,0,.2,1);
  box-sizing:border-box;
}
.backup-sheet.open { transform:translateY(0); }
.backup-sheet-handle {
  width:38px; height:4px; border-radius:2px;
  background:var(--bd2); margin:0 auto 18px;
}
.backup-sheet-title {
  font-size:17px; font-weight:800; color:var(--tx);
  margin-bottom:8px;
}
.backup-sheet-desc {
  font-size:13px; color:var(--tx2); line-height:1.5;
  margin:0 0 20px;
}
.backup-btn {
  width:100%; padding:14px 18px;
  border-radius:14px; border:none; cursor:pointer;
  font-size:15px; font-weight:700;
  display:flex; align-items:center; gap:10px;
  margin-bottom:10px;
  transition:opacity .15s;
}
.backup-btn:active { opacity:.8; }
.backup-btn-export {
  background:linear-gradient(135deg,var(--ac),#c472d4);
  color:#fff;
}
.backup-btn-import {
  background:var(--bg2); color:var(--tx);
  border:1.5px solid var(--bd);
}
.backup-btn-cancel {
  background:none; color:var(--tx2);
  justify-content:center; margin-bottom:0;
}

/* Simple success toast */
.simple-toast {
  position:fixed; bottom:90px; left:50%; transform:translateX(-50%) translateY(12px);
  background:#2d2040; color:#fff;
  padding:11px 22px; border-radius:99px;
  font-size:14px; font-weight:700;
  z-index:9999; pointer-events:none;
  opacity:0; transition:opacity .25s, transform .25s;
  white-space:nowrap;
}
.simple-toast.show { opacity:1; transform:translateX(-50%) translateY(0); }

/* Finish toast animations */
@keyframes toastIn {
  from { opacity:0; transform:translateY(24px) scale(.92); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}

@keyframes scrimIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Finished projects sheet ─────────────────────────────────────── */
.finished-projects-sheet{max-height:85vh;display:flex;flex-direction:column;}
.finished-projects-header{display:flex;align-items:center;justify-content:space-between;padding:.25rem 1.25rem 1rem;}
.finished-projects-header-left{display:flex;align-items:baseline;gap:.6rem;}
.finished-projects-title{font-size:1.05rem;font-weight:700;color:#2d1b4e;margin:0;}
.finished-count-lbl{font-size:.78rem;color:#9b8ec4;font-weight:500;}
.finished-projects-close{background:none;border:none;cursor:pointer;color:#9b8ec4;padding:.35rem;line-height:1;border-radius:50%;display:flex;align-items:center;justify-content:center;transition:background .15s;}
.finished-projects-close:hover{background:#f0eaf8;color:#7B4FD8;}
.finished-projects-list{overflow-y:auto;flex:1;}
/* Card grid */
.finished-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;padding:0 1rem 1.5rem;}
.finished-card{background:#fff;border:1.5px solid #f0eaf8;border-radius:1rem;overflow:hidden;cursor:pointer;transition:transform .15s,box-shadow .15s;}
.finished-card:hover{transform:translateY(-2px);box-shadow:0 6px 20px rgba(123,79,216,.12);}
.finished-card:active{transform:scale(.97);}
.finished-card-media{position:relative;}
.finished-card-photo{width:100%;height:130px;object-fit:cover;display:block;}
.finished-card-photo-placeholder{width:100%;height:130px;background:linear-gradient(135deg,#fce7f3,#e8d5f5);display:flex;align-items:center;justify-content:center;}
.finished-card-badge{position:absolute;top:8px;right:8px;width:22px;height:22px;border-radius:50%;background:#ec4899;color:#fff;font-size:.7rem;font-weight:700;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 6px rgba(236,72,153,.35);}
.finished-card-body{padding:.65rem .75rem .75rem;}
.finished-card-name{font-size:.88rem;font-weight:700;color:#2d1b4e;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.finished-card-meta{font-size:.72rem;color:#9b8ec4;margin-top:.2rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.finished-card-date{font-size:.7rem;color:#c8b8e0;margin-top:.2rem;}
/* Empty state */
.finished-empty{padding:3rem 1.5rem 2rem;text-align:center;}
.finished-empty-icon{font-size:2.5rem;margin-bottom:.75rem;}
.finished-empty-title{font-size:1rem;font-weight:700;color:#2d1b4e;margin-bottom:.4rem;}
.finished-empty-sub{font-size:.85rem;color:#aaa;line-height:1.55;}

/* Badge on finished-projects button */
.sb-profile-action{position:relative;}
.sb-finished-badge{display:none;align-items:center;justify-content:center;margin-left:auto;min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:#ec4899;color:#fff;font-size:.7rem;font-weight:700;line-height:1;}
