/* FORME — soft pink & white palette */
:root{
  --ivory:#faf6f1;
  --ivory-2:#f4ece2;
  --white:#ffffff;
  --blush:#f7d4d4;
  --blush-soft:#fde7e7;
  --blush-deep:#e8b4b8;
  --dusty:#c98a96;
  --taupe:#b39b8e;
  --wine:#6b2d3a;
  --wine-deep:#4a1f29;
  --text:#3a2026;
  --text-muted:#8a6f76;
  --border:#f0e0e0;
  --ok:#7ba886;
  --warn:#d49b66;
  --shadow:0 6px 20px rgba(107,45,58,.06);
  --shadow-up:0 -8px 24px rgba(107,45,58,.08);
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0;background:var(--ivory);color:var(--text);font:17px/1.55 -apple-system,BlinkMacSystemFont,"Segoe UI",system-ui,sans-serif}
body{min-height:100vh;overscroll-behavior:none}
input,button,select,textarea{font:inherit;color:inherit}
button{background:none;border:0;cursor:pointer;padding:0}
h1,h2,h3,h4,p{margin:0}

/* APP FRAME */
.app{max-width:480px;margin:0 auto;min-height:100vh;background:var(--ivory);position:relative;padding-bottom:96px}

/* HEADER */
.top{
  display:flex;align-items:center;justify-content:space-between;
  padding:18px 20px 14px;
  background:linear-gradient(180deg,var(--ivory) 60%,rgba(250,246,241,0));
  position:sticky;top:0;z-index:5;
}
.brand{display:flex;flex-direction:column;line-height:1}
.logo{font-family:Georgia,"Times New Roman",serif;font-style:italic;font-size:30px;letter-spacing:.04em;color:var(--wine);font-weight:400}
.logo-sub{font-size:11px;color:var(--text-muted);letter-spacing:.18em;text-transform:uppercase;margin-top:4px}
.profile{
  width:42px;height:42px;border-radius:50%;
  background:linear-gradient(135deg,var(--blush),var(--blush-deep));
  color:var(--wine);display:flex;align-items:center;justify-content:center;
  font-weight:600;font-family:Georgia,serif;font-style:italic;font-size:18px;
  box-shadow:var(--shadow);
}

/* MAIN */
.screen{padding:6px 18px 24px}
.section-title{font-family:Georgia,serif;font-style:italic;color:var(--wine);font-size:22px;margin:14px 0 12px}
.hint{color:var(--text-muted);font-size:13px;margin:-6px 0 14px}

/* CARD */
.card{
  background:var(--white);border-radius:18px;padding:16px 16px 14px;
  margin-bottom:12px;box-shadow:var(--shadow);
  border:1px solid rgba(240,224,224,.6);
}
.card-row{display:flex;align-items:center;gap:12px}
.card-icon{
  width:40px;height:40px;border-radius:12px;flex-shrink:0;
  background:var(--blush-soft);color:var(--wine);
  display:flex;align-items:center;justify-content:center;
}
.card-icon svg{width:20px;height:20px;fill:currentColor}
.card-head{flex:1;min-width:0}
.card-title{font-weight:600;font-size:15px;color:var(--text)}
.card-target{font-size:12px;color:var(--text-muted);margin-top:2px}
.card-inputs{display:flex;gap:10px;margin-top:12px;flex-wrap:wrap}
.input-wrap{flex:1;min-width:0;position:relative}
.input-wrap input{
  width:100%;height:48px;border-radius:12px;
  border:1px solid var(--border);background:var(--ivory);
  padding:0 14px;font-size:17px;color:var(--text);
  outline:none;transition:border-color .15s;
}
.input-wrap input:focus{border-color:var(--dusty)}
.input-wrap .unit{position:absolute;right:14px;top:50%;transform:translateY(-50%);font-size:12px;color:var(--text-muted);pointer-events:none}
.check{
  margin-top:12px;display:flex;align-items:center;justify-content:space-between;
  padding:10px 12px;border-radius:12px;background:var(--blush-soft);
  cursor:pointer;user-select:none;min-height:44px;
}
.check.on{background:linear-gradient(135deg,var(--blush),var(--blush-deep))}
.check-label{font-size:14px;color:var(--wine);font-weight:500}
.check-state{
  width:24px;height:24px;border-radius:50%;
  border:1.5px solid var(--dusty);background:transparent;
  display:flex;align-items:center;justify-content:center;
}
.check.on .check-state{background:var(--wine);border-color:var(--wine);color:#fff}
.check-state svg{width:14px;height:14px;fill:currentColor;opacity:0;transition:opacity .15s}
.check.on .check-state svg{opacity:1}

/* HERO for week */
.hero{
  background:linear-gradient(135deg,#fff 0%,var(--blush-soft) 100%);
  border-radius:20px;padding:18px 18px 16px;margin-bottom:14px;
  border:1px solid rgba(240,224,224,.6);
}
.hero-label{font-size:12px;color:var(--text-muted);letter-spacing:.14em;text-transform:uppercase}
.hero-pct{font-family:Georgia,serif;font-style:italic;font-size:46px;color:var(--wine);line-height:1.1;margin-top:4px}
.hero-sub{font-size:13px;color:var(--text-muted);margin-top:4px}
.bar{height:8px;border-radius:4px;background:var(--blush-soft);overflow:hidden;margin-top:12px}
.bar-fill{height:100%;background:linear-gradient(90deg,var(--blush-deep),var(--dusty));border-radius:4px;transition:width .4s}

/* WEEK GRID */
.week-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;margin-top:6px}
.week-grid .day{aspect-ratio:1;border-radius:8px;background:var(--blush-soft);display:flex;align-items:center;justify-content:center;font-size:11px;color:var(--text-muted)}
.week-grid .day.has{background:var(--blush)}
.week-grid .day.full{background:linear-gradient(135deg,var(--dusty),var(--wine));color:#fff}
.week-grid .day.today{outline:1.5px dashed var(--dusty);outline-offset:1px}

.legend{display:flex;gap:14px;font-size:12px;color:var(--text-muted);margin-top:10px;flex-wrap:wrap}
.legend i{display:inline-block;width:10px;height:10px;border-radius:3px;vertical-align:middle;margin-right:5px}

/* METRIC LIST */
.metric-row{
  display:flex;align-items:center;gap:12px;padding:12px 14px;
  background:var(--white);border-radius:14px;margin-bottom:8px;
  border:1px solid rgba(240,224,224,.6);
}
.metric-name{flex:1;font-size:15px}
.metric-pct{font-family:Georgia,serif;font-style:italic;font-size:18px;color:var(--wine);min-width:50px;text-align:right}
.metric-bar{flex-basis:90px;height:6px;border-radius:3px;background:var(--blush-soft);overflow:hidden}
.metric-bar i{display:block;height:100%;background:linear-gradient(90deg,var(--blush-deep),var(--dusty));border-radius:3px}
.metric-days{font-size:11px;color:var(--text-muted);margin-top:2px}

/* MEASUREMENTS */
.measure-list{display:flex;flex-direction:column;gap:10px}
.measure-card{
  background:var(--white);border-radius:18px;padding:16px;
  border:1px solid rgba(240,224,224,.6);box-shadow:var(--shadow);
}
.measure-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}
.measure-tag{
  font-family:Georgia,serif;font-style:italic;font-size:17px;color:var(--wine);
}
.measure-tag.start{color:var(--dusty)}
.measure-date{font-size:12px;color:var(--text-muted)}
.measure-actions{display:flex;gap:6px}
.icon-btn{
  width:34px;height:34px;border-radius:10px;background:var(--blush-soft);
  display:flex;align-items:center;justify-content:center;color:var(--wine);
}
.icon-btn svg{width:16px;height:16px;fill:currentColor}
.measure-vals{display:grid;grid-template-columns:repeat(2,1fr);gap:8px 14px;font-size:14px}
.measure-vals span{color:var(--text-muted);margin-right:6px}
.measure-vals b{color:var(--text);font-weight:600}
.diff{font-size:11px;margin-left:6px;color:var(--text-muted)}
.diff.down{color:var(--ok)}
.diff.up{color:var(--warn)}

.add-btn{
  margin-top:14px;width:100%;height:50px;border-radius:14px;
  background:linear-gradient(135deg,var(--blush),var(--blush-deep));
  color:var(--wine);font-weight:600;font-size:15px;display:flex;align-items:center;justify-content:center;gap:8px;
}
.add-btn svg{width:18px;height:18px;fill:currentColor}

/* FORM / NORM */
.field{display:block;margin-bottom:14px}
.field span{display:block;font-size:12px;color:var(--text-muted);letter-spacing:.1em;text-transform:uppercase;margin-bottom:6px}
.field input{
  width:100%;height:48px;border-radius:12px;border:1px solid var(--border);
  background:var(--white);padding:0 14px;font-size:17px;outline:none;
}
.field input:focus{border-color:var(--dusty)}

.save-btn{
  width:100%;height:52px;border-radius:14px;
  background:linear-gradient(135deg,var(--dusty),var(--wine));
  color:#fff;font-weight:600;font-size:16px;margin-top:8px;
}

/* TABS */
.tabs{
  position:fixed;left:0;right:0;bottom:0;
  background:var(--white);border-top:1px solid var(--border);
  display:grid;grid-template-columns:repeat(4,1fr);
  padding:8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index:10;
}
.app{max-width:480px}
.app .tabs{left:50%;right:auto;width:100%;max-width:480px;transform:translateX(-50%)}
.tab{
  display:flex;flex-direction:column;align-items:center;gap:3px;
  padding:6px 4px;color:var(--text-muted);font-size:10px;letter-spacing:.04em;
  border-radius:10px;min-height:48px;justify-content:center;
}
.tab svg{width:22px;height:22px;fill:currentColor;opacity:.7;transition:opacity .15s}
.tab.active{color:var(--wine)}
.tab.active svg{opacity:1}
.tab.active::after{
  content:"";display:block;width:18px;height:2px;background:var(--dusty);
  border-radius:1px;margin-top:2px;
}

/* SHEET */
.sheet{position:fixed;inset:0;z-index:20;display:flex;align-items:flex-end}
.sheet-bg{position:absolute;inset:0;background:rgba(58,32,38,.4);animation:fade .2s}
.sheet-body{
  position:relative;width:100%;max-width:480px;margin:0 auto;
  background:var(--ivory);border-radius:24px 24px 0 0;padding:20px 18px calc(20px + env(safe-area-inset-bottom));
  animation:up .25s;
}
.sheet h3{font-family:Georgia,serif;font-style:italic;color:var(--wine);font-size:22px;margin-bottom:14px}
.sheet-actions{display:flex;gap:10px;margin-top:10px}
.btn{flex:1;height:50px;border-radius:14px;background:linear-gradient(135deg,var(--dusty),var(--wine));color:#fff;font-weight:600}
.btn.ghost{background:var(--blush-soft);color:var(--wine)}

.sheet[hidden]{display:none}
@keyframes up{from{transform:translateY(100%)}to{transform:translateY(0)}}
@keyframes fade{from{opacity:0}to{opacity:1}}

/* TOAST */
.toast{
  position:fixed;left:50%;bottom:120px;transform:translateX(-50%);
  background:var(--wine);color:#fff;padding:10px 18px;border-radius:24px;
  font-size:14px;z-index:30;box-shadow:var(--shadow-up);animation:up .2s;
}

/* EMPTY */
.empty{
  text-align:center;padding:40px 20px;color:var(--text-muted);
  background:var(--white);border-radius:18px;border:1px dashed var(--border);
}
.empty .e-title{font-family:Georgia,serif;font-style:italic;color:var(--wine);font-size:18px;margin-bottom:6px}

/* PROFILE EDIT */
.profile-edit{
  background:var(--white);border-radius:18px;padding:16px;margin-bottom:14px;
  border:1px solid rgba(240,224,224,.6);
}
.profile-edit label span{font-size:12px;color:var(--text-muted);letter-spacing:.1em;text-transform:uppercase}
.profile-edit input{
  width:100%;height:44px;border-radius:10px;border:1px solid var(--border);
  background:var(--ivory);padding:0 14px;font-size:16px;outline:none;margin-top:6px;
}
