/* Paleta */
:root{
  --blue:#8FD3FF;
  --pink:#FF7BC4;
  --ink:#1E2A3A;
  --bg:#F7FBFF;
  --card:#ffffff;
  --muted:#7a8a9a;
  --shadow:0 6px 24px rgba(30,42,58,0.08);
  --radius:16px;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0;background:linear-gradient(160deg, rgba(143,211,255,0.45) 0%, rgba(255,123,196,0.40) 100%);color:var(--ink);font-family:Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, 'Helvetica Neue', 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', Arial, sans-serif;}
img{max-width:100%;display:block}
body::before{
  content:""; position:fixed; right:-80px; top:-60px; width:520px; height:520px; z-index:-1;
  background:url('assets/user-art.svg') no-repeat center/contain; opacity:.12; filter:drop-shadow(0 10px 30px rgba(30,42,58,.12));
  pointer-events:none;
}

#app{min-height:100dvh;padding-bottom:72px;}

.app-header{
  position:sticky;top:0;z-index:5;
  background:linear-gradient(135deg,var(--blue),var(--pink));
  color:#fff;padding:12px 16px;box-shadow:var(--shadow);
}
.app-header .brand{display:flex;align-items:center;gap:10px}
.brand .brand-icon{width:32px;height:32px;display:inline-block;background:var(--pink);-webkit-mask:url('assets/brand.svg') no-repeat center/contain;mask:url('assets/brand.svg') no-repeat center/contain}
.brand .brand-icon.small{width:24px;height:24px}
.app-header h1{font-size:28px;letter-spacing:3px;text-transform:uppercase;margin:0;font-weight:900;
  background:linear-gradient(135deg,#fff,#ffe0f3);-webkit-background-clip:text;background-clip:text;color:transparent;}

main{padding:16px;}

h2{margin:12px 0 10px;font-size:22px;
  background:linear-gradient(135deg,#1E2A3A,#7a1b54);-webkit-background-clip:text;background-clip:text;color:transparent}
h3{margin:0 0 12px 0}

.card{
  background:rgba(255,255,255,0.92);border-radius:var(--radius);padding:14px;margin:12px 0;box-shadow:var(--shadow);
  backdrop-filter:saturate(120%) blur(2px);
}

.row{display:flex;flex-direction:column;gap:6px;margin:10px 0}
.row-inline{display:flex;gap:8px;align-items:center;margin:10px 0}
.row-inline > *{flex:1}
.row-inline > button{flex:0 0 auto}

input,select,textarea,button{
  font-size:16px;padding:10px 12px;border-radius:12px;border:1px solid #e3edf6;background:#fff;outline:none;
}
input[type="date"]{padding:8px 10px}
textarea{resize:vertical}

.btn{background:#eef7ff;border-color:#d7eafa;cursor:pointer;transition:transform .06s ease, box-shadow .12s ease}
.btn:hover{filter:brightness(0.98)}
.btn:active{transform:scale(.98)}
.btn.primary{background:var(--pink);border-color:#ff60b8;color:#fff;font-weight:700;box-shadow:0 6px 16px rgba(255,123,196,.35)}

.img-preview{margin-top:8px;border:1px dashed #d7eafa;border-radius:12px;padding:8px;min-height:80px;display:flex;align-items:center;justify-content:center;background:#fbfdff}
.img-preview img{max-height:160px;border-radius:12px}

.list{list-style:none;padding:0;margin:0}
.list li{display:flex;align-items:center;justify-content:space-between;padding:10px;border-bottom:1px solid #eef2f7}
.list li:last-child{border-bottom:none}
.list.spaced li{align-items:flex-start;gap:8px}
.list .meta{font-size:12px;color:var(--muted)}

.badge{padding:4px 8px;border-radius:999px;background:#f3f8ff;color:#2b4a63;font-size:12px;border:1px solid #e2edf7}
.badge.ok{background:#E6FAE6;color:#185A18;border-color:#B6F0B6}

.skill-badge{padding:4px 10px;border-radius:999px;font-size:12px;border:1px solid transparent;display:inline-flex;gap:6px;align-items:center}
.skill-badge.progress{background:#FFF4E5;border-color:#FFD8A8;color:#9A5B00}
.skill-badge.done{background:#E6FAE6;border-color:#B6F0B6;color:#185A18}

.tab{display:none}
.tab.active{display:block}

.tabbar{
  position:fixed;left:0;right:0;bottom:0;height:64px;background:rgba(255,255,255,0.9);backdrop-filter:blur(6px);border-top:1px solid #e7eff8;
  display:flex;justify-content:space-around;align-items:center;gap:12px;padding:6px 8px;box-shadow:0 -6px 20px rgba(30,42,58,.06);
}
.tabbtn{display:flex;flex-direction:column;align-items:center;gap:4px;padding:6px 10px;background:transparent;border:none;border-radius:12px;color:#345}
.tabbtn.active{background:linear-gradient(135deg,rgba(143,211,255,.35),rgba(255,123,196,.35));}
.tabbtn img{width:24px;height:24px}
.tabbtn span{font-size:12px}

.chart-controls{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px;flex-wrap:wrap}
.chart-controls .range{display:flex;align-items:center;gap:6px}
.svg-wrap{background:#fff;border:1px solid #e6eef8;border-radius:12px;padding:8px}
svg{width:100%;height:auto}

.overlay{
  position:fixed;inset:0;background:rgba(0,0,0,.4);display:flex;align-items:center;justify-content:center;backdrop-filter:blur(2px);z-index:20;
}
.overlay.hidden{display:none}
.overlay-card{
  background:#fff;border-radius:20px;padding:20px 24px;box-shadow:var(--shadow);font-size:22px;font-weight:800; text-align:center;
  background-image: radial-gradient(40% 60% at 70% 20%, rgba(255,123,196,.25), transparent), radial-gradient(50% 70% at 20% 80%, rgba(143,211,255,.25), transparent);
}

.toast{
  position:fixed;left:8px;right:8px;bottom:80px;background:#1E2A3A;color:#fff;padding:12px 14px;border-radius:14px;box-shadow:var(--shadow);
}
.toast.hidden{display:none}

/* Lightbox */
.thumb{cursor:pointer}
.lightbox{position:fixed; inset:0; background:rgba(0,0,0,.75); display:none; align-items:center; justify-content:center; z-index:50; padding:24px}
.lightbox.open{display:flex}
.lightbox img{max-width:92vw; max-height:82vh; border-radius:16px; box-shadow:0 20px 60px rgba(0,0,0,.45)}
.lightbox .close{position:absolute; top:18px; right:18px; background:#fff; border:none; border-radius:999px; padding:8px 12px; font-weight:700; box-shadow:0 6px 18px rgba(0,0,0,.25); cursor:pointer}


/* === Mobile overflow fixes (v3.2) === */
html, body, #app { max-width:100%; overflow-x:hidden; }
main, .card, .app-header, .tabbar { max-width:100%; overflow-x:hidden; }

/* Ensure form controls never exceed container width */
input, select, textarea, button { width:100%; max-width:100%; }
.row-inline { flex-wrap: wrap; }
.row-inline > * { flex: 1 1 160px; min-width:0; } /* stack gracefully on small widths */
.row-inline > button.btn { flex: 1 1 140px; }

/* Chart controls – stack on small screens */
.chart-controls { flex-direction: column; align-items: stretch; }
.chart-controls .range { flex-wrap: wrap; }
.chart-controls .range > * { flex: 1 1 140px; min-width:0; }
.chart-controls label { flex: 0 0 auto; width:auto; }

/* Prevent long notes from causing overflow */
.list .meta { word-break: break-word; overflow-wrap: anywhere; max-width:100%; }

/* Images and SVGs safe sizing */
svg, .svg-wrap, .img-preview, .thumb { max-width:100%; }
.thumb { height:auto; }
.img-preview img { max-width:100%; height:auto; }

/* Decorative background should never cause horizontal scroll */
body::before { overflow:hidden; max-width:100vw; left:auto; right:-10vw; }

/* Very small devices tweaks */
@media (max-width: 420px){
  .app-header h1{ font-size:24px; letter-spacing:2px; }
  .brand .brand-icon{ width:28px; height:28px; }
  .tabbtn{ padding:4px 6px; }
}
