#lcep-root{
  --terracotta:#A47864;
  --terracotta-dark:#8a6350;
  --sand:#E8DDD6;
  --sage:#C9A99A;
  --ink:#2E2622;
  --paper:#FBF7F4;
  --paper-warm:#F5EDE8;
  --muted:#6B5D56;
  --line:rgba(46,38,34,0.12);
  --font-display:'Fraunces', Georgia, serif;
  --font-body:'Inter', -apple-system, system-ui, sans-serif;
  --shadow: 0 8px 24px rgba(46,38,34,0.10);
  border-radius:16px;
  overflow:hidden;
  border:1px solid var(--line);
  background:var(--paper);
}
#lcep-root, #lcep-root *{ box-sizing:border-box; }
#lcep-root{ font-family:var(--font-body); color:var(--ink); }

/* ---- Login ---- */
.lcep-login-wrap{ display:flex; justify-content:center; padding:40px 20px; }
.lcep-login-card{ background:#fff; border:1px solid var(--line); border-radius:16px; padding:32px; max-width:360px; width:100%; text-align:left; }
.lcep-login-logo{ height:38px; width:38px; object-fit:contain; display:block; margin-bottom:14px; }
.lcep-login-card p{ font-size:13px; color:var(--muted); margin-bottom:18px; }
.lcep-login-card label{ font-size:12px; font-weight:600; color:var(--muted); display:block; margin-bottom:4px; }
.lcep-login-card input[type=text], .lcep-login-card input[type=password]{ width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:8px; margin-bottom:14px; font-size:14px; font-family:var(--font-body); }
.lcep-login-card input[type=submit]{ width:100%; padding:11px; background:var(--terracotta); color:#fff; border:none; border-radius:8px; font-weight:700; cursor:pointer; font-size:14px; font-family:var(--font-body); }
.lcep-login-card input[type=submit]:hover{ background:var(--terracotta-dark); }
.lcep-error{ color:#B4544A; font-size:13px; margin-top:10px; }

/* ---- Admin project picker ---- */
.lcep-admin-bar{ display:flex; align-items:center; gap:10px; padding:10px 18px; background:var(--paper); border-bottom:1px solid var(--line); font-size:13px; }
.lcep-admin-bar select{ padding:6px 10px; border-radius:8px; border:1px solid var(--line); font-size:13px; font-family:var(--font-body); }
.lcep-loading{ padding:40px; text-align:center; color:var(--muted); }
.lcep-empty{ padding:40px; text-align:center; color:var(--muted); font-size:13.5px; }

/* ---- App shell ---- */
#lcep-app-inner{
  max-width:560px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  position:relative;
  background:
    radial-gradient(circle at 1px 1px, rgba(46,38,34,0.035) 1px, transparent 0) 0 0/14px 14px,
    var(--paper);
}

/* ---------- Header ---------- */
.lcep-header{
  padding:22px 20px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--line);
}
.lcep-brand{display:flex; flex-direction:column; line-height:1;}
.lcep-brand .lcep-logo-img{
  height:40px;
  width:auto;
  object-fit:contain;
  display:block;
}
.lcep-brand .lcep-mark{
  font-family:var(--font-display);
  font-weight:700;
  font-size:19px;
  letter-spacing:0.2px;
  color:var(--ink);
}
.lcep-brand .lcep-mark span{color:var(--terracotta);}
.lcep-brand .lcep-tag{
  font-size:9.5px;
  letter-spacing:1.6px;
  color:var(--muted);
  margin-top:3px;
  text-transform:uppercase;
}
.lcep-team-toggle{
  font-size:11px;
  color:var(--muted);
  background:none;
  border:1px solid var(--line);
  border-radius:20px;
  padding:6px 12px;
  cursor:pointer;
  font-family:var(--font-body);
  transition:all .15s ease;
}
.lcep-team-toggle.on{
  background:var(--ink);
  color:var(--paper);
  border-color:var(--ink);
}
.lcep-logout{
  font-size:11px;
  color:var(--muted);
  text-decoration:none;
  border:1px solid var(--line);
  border-radius:20px;
  padding:6px 12px;
  margin-left:8px;
  white-space:nowrap;
}

/* ---------- Main content ---------- */
.lcep-main{
  flex:1;
  padding:22px 20px 110px;
}
.lcep-tab-panel{display:none; animation:lcepFadeUp .32s ease both;}
.lcep-tab-panel.active{display:block;}
@keyframes lcepFadeUp{
  from{opacity:0; transform:translateY(8px);}
  to{opacity:1; transform:translateY(0);}
}

.lcep-eyebrow{
  font-size:11px;
  letter-spacing:2px;
  text-transform:uppercase;
  color:var(--terracotta);
  font-weight:600;
  margin-bottom:6px;
}
.lcep-section-title{
  font-family:var(--font-display);
  font-weight:600;
  font-size:26px;
  margin:0 0 6px;
}
.lcep-section-desc{
  font-size:13.5px;
  color:var(--muted);
  margin:0 0 22px;
  line-height:1.5;
  max-width:44ch;
}

/* ---------- Cards / generic ---------- */
.lcep-card{
  background:var(--paper-warm);
  border-radius:16px;
  padding:18px;
  margin-bottom:16px;
  border:1px solid var(--line);
}
.lcep-card h3{
  font-family:var(--font-display);
  font-size:15px;
  font-weight:600;
  margin:0 0 12px;
}

/* ---------- Pressupost ---------- */
.lcep-field-label{
  font-size:12px;
  font-weight:600;
  color:var(--ink);
  margin-bottom:8px;
  display:flex;
  justify-content:space-between;
}
.lcep-field-label b{color:var(--terracotta); font-weight:700;}
#lcep-app-inner input[type=range]{
  width:100%;
  accent-color:var(--terracotta);
  height:4px;
}
.lcep-tier-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:8px;
}
.lcep-tier-btn{
  border:1.5px solid var(--line);
  background:var(--paper);
  border-radius:12px;
  padding:12px 10px;
  text-align:left;
  cursor:pointer;
  font-family:var(--font-body);
  transition:all .15s ease;
}
.lcep-tier-btn strong{display:block; font-size:13px; margin-bottom:2px;}
.lcep-tier-btn span{display:block; font-size:11px; color:var(--muted);}
.lcep-tier-btn.selected{
  border-color:var(--terracotta);
  background:#fff;
  box-shadow:0 0 0 1px var(--terracotta) inset;
}
.lcep-extra-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 0;
  border-bottom:1px solid var(--line);
  gap:10px;
}
.lcep-extra-row:last-child{border-bottom:none;}
.lcep-extra-row .lcep-extra-label{font-size:13px;}
.lcep-extra-row .lcep-extra-price{font-size:11px; color:var(--muted); display:block; margin-top:2px;}

.lcep-switch{
  position:relative;
  width:38px;
  height:22px;
  flex:none;
}
.lcep-switch input{opacity:0; width:0; height:0; position:absolute;}
.lcep-switch .lcep-track{
  position:absolute; inset:0;
  background:#ddd6ca;
  border-radius:20px;
  transition:.15s ease;
  cursor:pointer;
}
.lcep-switch .lcep-track:before{
  content:"";
  position:absolute;
  width:16px; height:16px;
  left:3px; top:3px;
  background:#fff;
  border-radius:50%;
  transition:.15s ease;
  box-shadow:0 1px 3px rgba(0,0,0,0.2);
}
.lcep-switch input:checked + .lcep-track{background:var(--terracotta);}
.lcep-switch input:checked + .lcep-track:before{transform:translateX(16px);}

.lcep-stepper{
  display:flex;
  align-items:center;
  gap:10px;
}
.lcep-stepper button{
  width:26px; height:26px;
  border-radius:50%;
  border:1px solid var(--line);
  background:var(--paper);
  font-size:15px;
  line-height:1;
  cursor:pointer;
  color:var(--ink);
}
.lcep-stepper .lcep-count{font-size:13px; min-width:14px; text-align:center;}

.lcep-total-box{
  background:var(--ink);
  color:var(--paper);
  border-radius:16px;
  padding:20px;
  margin-top:6px;
}
.lcep-total-box .lcep-label{font-size:11px; letter-spacing:1.5px; text-transform:uppercase; color:var(--sage); margin-bottom:4px;}
.lcep-total-box .lcep-amount{font-family:var(--font-display); font-size:34px; font-weight:600;}
.lcep-breakdown{margin-top:16px;}
.lcep-breakdown-bar{
  display:flex;
  width:100%;
  height:10px;
  border-radius:6px;
  overflow:hidden;
  margin-bottom:10px;
}
.lcep-breakdown-seg{height:100%;}
.lcep-breakdown-legend{
  display:flex;
  flex-wrap:wrap;
  gap:10px 16px;
  font-size:11px;
  color:rgba(251,248,243,0.8);
}
.lcep-breakdown-legend .lcep-dot{
  width:8px; height:8px; border-radius:50%;
  display:inline-block; margin-right:5px;
}
.lcep-disclaimer{
  font-size:10.5px;
  color:var(--muted);
  margin-top:12px;
  line-height:1.5;
}

/* ---------- Acabats ---------- */
.lcep-category-block{margin-bottom:22px;}
.lcep-category-title{
  font-size:12px;
  font-weight:700;
  letter-spacing:0.5px;
  margin-bottom:10px;
  display:flex;
  align-items:center;
  gap:8px;
}
.lcep-category-title .lcep-num{
  width:20px; height:20px;
  border-radius:50%;
  background:var(--sand);
  color:var(--ink);
  font-size:10px;
  display:flex; align-items:center; justify-content:center;
  font-weight:700;
}
.lcep-swatch-row{
  display:flex;
  gap:10px;
  overflow-x:auto;
  padding-bottom:6px;
  -webkit-overflow-scrolling:touch;
}
.lcep-swatch-row::-webkit-scrollbar{height:0;}
.lcep-swatch{
  flex:none;
  width:74px;
  cursor:pointer;
  text-align:center;
}
.lcep-swatch-chip{
  width:74px; height:58px;
  border-radius:12px;
  border:2px solid transparent;
  margin-bottom:6px;
  transition:transform .15s ease, border-color .15s ease;
  position:relative;
}
.lcep-swatch.selected .lcep-swatch-chip{
  border-color:var(--ink);
  transform:scale(1.04);
}
.lcep-swatch.selected .lcep-swatch-chip:after{
  content:"✓";
  position:absolute;
  top:4px; right:6px;
  color:#fff;
  font-size:11px;
  text-shadow:0 1px 2px rgba(0,0,0,0.4);
}
.lcep-swatch-name{font-size:9.5px; color:var(--muted); line-height:1.25;}

.lcep-moodboard{
  background:var(--ink);
  border-radius:18px;
  padding:18px;
  margin-top:6px;
}
.lcep-moodboard .lcep-mb-title{
  font-family:var(--font-display);
  color:var(--paper);
  font-size:14px;
  margin-bottom:12px;
}
.lcep-moodboard-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}
.lcep-mb-tile{
  height:64px;
  border-radius:10px;
  display:flex;
  align-items:flex-end;
  padding:6px 8px;
  position:relative;
  overflow:hidden;
}
.lcep-mb-tile span{
  font-size:9px;
  color:#fff;
  text-shadow:0 1px 3px rgba(0,0,0,0.35);
  font-weight:600;
  letter-spacing:.3px;
}
.lcep-mb-tile.empty{
  background:rgba(255,255,255,0.05);
  border:1px dashed rgba(255,255,255,0.2);
}
.lcep-mb-tile.empty span{color:rgba(255,255,255,0.35); font-style:italic; font-weight:400;}
.lcep-mb-hint{font-size:10.5px; color:rgba(251,248,243,0.55); margin-top:12px; line-height:1.5;}

/* ---------- Propostes ---------- */
.lcep-proposal-card{
  background:var(--paper-warm);
  border-radius:16px;
  overflow:hidden;
  margin-bottom:14px;
  border:1px solid var(--line);
  cursor:pointer;
  position:relative;
}
.lcep-proposal-thumb{
  height:110px;
  background:var(--sand);
  display:flex;
  align-items:center;
  justify-content:center;
}
.lcep-proposal-body{padding:14px 16px; position:relative;}
.lcep-proposal-body .lcep-p-title{font-family:var(--font-display); font-weight:600; font-size:16px; margin-bottom:2px;}
.lcep-proposal-body .lcep-p-meta{font-size:11.5px; color:var(--muted);}
.lcep-like-btn{
  float:right;
  background:none;
  border:none;
  font-size:17px;
  cursor:pointer;
  color:var(--line);
}
.lcep-like-btn.liked{color:var(--terracotta);}
.lcep-team-edit-btn, .lcep-team-del-btn{
  position:absolute;
  top:10px;
  background:rgba(255,255,255,0.9);
  border:1px solid var(--line);
  border-radius:20px;
  font-size:11px;
  padding:4px 10px;
  cursor:pointer;
  color:var(--ink);
}
.lcep-team-edit-btn{right:86px;}
.lcep-team-del-btn{right:10px; color:#B4544A;}

.lcep-modal-overlay{
  position:fixed; inset:0;
  background:rgba(46,38,34,0.55);
  display:none;
  align-items:flex-end;
  justify-content:center;
  z-index:99999;
}
.lcep-modal-overlay.open{display:flex;}
.lcep-modal{
  background:var(--paper);
  width:100%;
  max-width:560px;
  border-radius:22px 22px 0 0;
  padding:22px 20px 28px;
  max-height:85vh;
  overflow-y:auto;
  animation:lcepSlideUp .25s ease both;
}
@keyframes lcepSlideUp{from{transform:translateY(24px); opacity:0;} to{transform:translateY(0); opacity:1;}}
.lcep-modal-close{
  display:block;
  margin:0 0 14px auto;
  background:var(--sand);
  border:none;
  width:28px; height:28px;
  border-radius:50%;
  cursor:pointer;
  font-size:14px;
}
.lcep-modal .lcep-p-title{font-family:var(--font-display); font-size:22px; font-weight:600; margin-bottom:4px;}
.lcep-modal .lcep-p-meta{font-size:12px; color:var(--muted); margin-bottom:16px;}
.lcep-modal .lcep-p-desc{font-size:13.5px; line-height:1.55; color:var(--ink); margin-bottom:18px;}

.lcep-team-form{margin-top:18px;}
.lcep-team-form input, .lcep-team-form textarea{
  width:100%;
  font-family:var(--font-body);
  font-size:13px;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#fff;
  margin-bottom:10px;
  resize:vertical;
}
.lcep-btn-primary{
  background:var(--terracotta);
  color:#fff;
  border:none;
  border-radius:12px;
  padding:12px 16px;
  font-size:13px;
  font-weight:600;
  cursor:pointer;
  width:100%;
  font-family:var(--font-body);
}
.lcep-btn-primary:active{background:var(--terracotta-dark);}
.lcep-btn-secondary{
  background:var(--paper);
  color:var(--ink);
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px 16px;
  font-size:12.5px;
  font-weight:600;
  cursor:pointer;
  width:100%;
  font-family:var(--font-body);
  margin-top:8px;
}

/* ---------- Tab bar ---------- */
.lcep-tab-bar{
  position:sticky;
  bottom:0; left:0; right:0;
  background:var(--paper);
  border-top:1px solid var(--line);
  display:flex;
  padding:8px 10px calc(8px + env(safe-area-inset-bottom));
  z-index:2;
}
.lcep-tab-btn{
  flex:1;
  background:none;
  border:none;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
  padding:6px 4px;
  cursor:pointer;
  color:var(--muted);
  font-family:var(--font-body);
}
.lcep-tab-btn svg{width:21px; height:21px; stroke:var(--muted); transition:stroke .15s ease;}
.lcep-tab-btn span{font-size:10px; font-weight:600;}
.lcep-tab-btn.active{color:var(--terracotta);}
.lcep-tab-btn.active svg{stroke:var(--terracotta);}

.lcep-toast{
  position:fixed;
  bottom:88px; left:50%;
  transform:translateX(-50%) translateY(10px);
  background:var(--ink);
  color:var(--paper);
  font-size:12px;
  padding:10px 18px;
  border-radius:20px;
  opacity:0;
  pointer-events:none;
  transition:all .2s ease;
  z-index:100000;
  white-space:nowrap;
}
.lcep-toast.show{opacity:1; transform:translateX(-50%) translateY(0);}

@media (min-width:640px){
  #lcep-app-inner{box-shadow:var(--shadow);}
}
