/* =============================================================
   Sheapril Closet — app.css
   Mobile-first PWA styling. Plain CSS, no build step.
   Direction A (cash & hero focus) redesign.
   ============================================================= */

/* ---------- Tokens ---------- */
:root{
  /* Brand */
  --ink:        #43182A;   /* primary text          */
  --ink-2:      #6E2E44;   /* secondary text        */
  --bloom:      #CE3F6B;   /* primary / brand        */
  --bloom-deep: #B12B57;   /* hover / pressed        */
  --bloom-soft: #FCE6EE;   /* tint fill              */
  --leaf:       #6E8C5A;

  /* Surfaces */
  --blush:      #F7F5F1;   /* page background        */
  --petal:      #ECE7E0;   /* subtle fill            */
  --card:       #FFFFFF;
  --line:       #F2EAEF;   /* hairline divider       */
  --muted:      #9B7C89;   /* tertiary / captions    */
  --muted-2:    #B49AA6;

  /* Gradient (shared with landing hero) */
  --grad: linear-gradient(158deg,#E782AC 0%,#CE3F6B 54%,#A8244F 100%);
  --grad-btn: linear-gradient(140deg,#E782AC,#CE3F6B 60%,#B12B57);

  /* Multi-colour category / chart accents */
  --c-dresses:     #CE3F6B;
  --c-bags:        #9B6DD6;
  --c-shoes:       #2BB7B3;
  --c-accessories: #F2994A;
  --c-fabrics:     #6E8C5A;

  /* Semantic */
  --ok:      #1F9D6B;  --ok-bg:   #E6F7EF;
  --warn:    #C67A1E;  --warn-bg: #FFF1E2;
  --info:    #2C82B8;  --info-bg: #E7F4FB;
  --neutral: #5B6B8C;  --neutral-bg:#EEF1F6;
  --danger:  #B3261E;  --danger-bg:#FDEAEA;

  /* Shape & depth */
  --r-sm: 12px;
  --r:    18px;
  --r-lg: 24px;
  --shadow-sm: 0 6px 18px -12px rgba(67,24,42,.20);
  --shadow:    0 10px 28px -16px rgba(67,24,42,.22);
  --shadow-lg: 0 18px 38px -20px rgba(67,24,42,.30);

  /* Layout */
  --maxw: 720px;          /* desktop content cap */
  --tabbar-h: 64px;       /* mobile bottom nav   */
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ---------- Reset / base ---------- */
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  font-family:'Jost',system-ui,sans-serif;
  font-size:16px;
  line-height:1.55;
  color:var(--ink);
  background:var(--blush);
  -webkit-font-smoothing:antialiased;
  /* room for sticky top bar + fixed bottom tab bar on mobile */
  padding-bottom:calc(var(--tabbar-h) + var(--safe-b) + 24px);
}
h1,h2,h3,h4{font-family:'Fraunces',Georgia,serif;font-weight:600;color:var(--ink);margin:0;line-height:1.15;}
a{color:var(--bloom);text-decoration:none;}
.tnum{font-variant-numeric:tabular-nums;}
.muted{color:var(--muted);}
img{max-width:100%;display:block;}
::-webkit-scrollbar{height:0;width:0;}

/* shell that centres content on desktop */
.wrap{max-width:var(--maxw);margin:0 auto;padding:0 20px;}

/* =============================================================
   TOP BAR  (sticky)
   ============================================================= */
.topbar{
  position:sticky;top:0;z-index:40;
  background:rgba(247,245,241,.86);
  backdrop-filter:saturate(1.2) blur(10px);
  border-bottom:1px solid var(--line);
}
.topbar__inner{
  max-width:var(--maxw);margin:0 auto;
  height:58px;padding:0 18px;
  display:flex;align-items:center;justify-content:space-between;
}
.brand{display:flex;align-items:center;gap:10px;font-family:'Fraunces';font-weight:600;font-size:18px;color:var(--ink);}
.brand__mark{
  width:34px;height:34px;border-radius:11px;
  background:var(--grad-btn);color:#fff;
  display:flex;align-items:center;justify-content:center;
  font-size:14px;font-weight:600;
}
/* desktop horizontal nav — hidden on mobile */
.topnav{display:none;gap:6px;}
.topnav a{
  padding:8px 14px;border-radius:12px;font-size:14px;font-weight:500;color:var(--ink-2);
}
.topnav a.is-active{background:var(--bloom-soft);color:var(--bloom);font-weight:600;}

/* account dropdown */
.acct{position:relative;}
.acct__btn{
  width:38px;height:38px;border-radius:12px;background:var(--card);
  border:1px solid var(--line);
  display:flex;align-items:center;justify-content:center;cursor:pointer;
}
.acct__menu{
  position:absolute;right:0;top:46px;min-width:180px;
  background:var(--card);border-radius:var(--r);box-shadow:var(--shadow-lg);
  padding:6px;display:none;
}
.acct__menu.open{display:block;}
.acct__menu a{display:flex;align-items:center;gap:10px;padding:11px 12px;border-radius:11px;color:var(--ink);font-size:14px;min-height:44px;}
.acct__menu a:hover{background:var(--blush);}
.acct__menu .danger{color:var(--danger);}

/* =============================================================
   HERO  (Direction A gradient card)
   ============================================================= */
.hero{
  background:var(--grad);
  border-radius:0 0 30px 30px;
  padding:22px 20px 28px;
  color:#fff;position:relative;overflow:hidden;
  margin-bottom:-22px;            /* let stat cards overlap */
}
.hero::before,.hero::after{content:"";position:absolute;border-radius:50%;background:rgba(255,255,255,.10);}
.hero::before{top:-46px;right:-34px;width:168px;height:168px;}
.hero::after{bottom:-54px;left:-22px;width:128px;height:128px;}
.hero__top{display:flex;align-items:center;justify-content:space-between;position:relative;}
.hero__brand{display:flex;align-items:center;gap:10px;}
.hero__brand .brand__mark{background:rgba(255,255,255,.22);}
.hero__brand b{font-family:'Fraunces';font-weight:600;font-size:16px;display:block;line-height:1.1;}
.hero__brand span{font-size:11.5px;opacity:.82;}
.month-chip{
  display:inline-flex;align-items:center;gap:9px;
  background:rgba(255,255,255,.18);border-radius:20px;
  padding:7px 13px;font-size:12.5px;font-weight:500;color:#fff;
}
.hero__main{display:flex;align-items:flex-end;justify-content:space-between;margin-top:22px;position:relative;}
.hero__label{font-size:12.5px;opacity:.85;font-weight:500;}
.hero__value{font-family:'Fraunces';font-weight:600;font-size:42px;line-height:1.02;margin-top:5px;}
.hero__delta{font-size:12px;opacity:.85;margin-top:8px;display:inline-flex;align-items:center;gap:7px;}
.hero__delta b{background:rgba(255,255,255,.24);border-radius:8px;padding:2px 8px;font-weight:600;}
/* overlapping client avatars */
.avatars{display:flex;align-items:center;}
.avatars .av{
  width:32px;height:32px;border-radius:50%;border:2px solid #fff;
  display:flex;align-items:center;justify-content:center;
  font-size:11px;font-weight:600;color:#fff;margin-left:-11px;
}
.avatars .av:first-child{margin-left:0;}

/* =============================================================
   STAT CARDS  (horizontal scroller, overlaps hero)
   ============================================================= */
.stat-scroller{
  display:flex;gap:12px;overflow-x:auto;
  padding:0 20px 6px;position:relative;
  scroll-snap-type:x mandatory;-webkit-overflow-scrolling:touch;
}
.stat-card{
  flex:none;width:142px;scroll-snap-align:start;
  background:var(--card);border-radius:20px;padding:14px;
  box-shadow:0 12px 28px -16px rgba(67,24,42,.30);
}
.stat-card__head{display:flex;align-items:center;justify-content:space-between;}
.stat-ico{
  width:30px;height:30px;border-radius:10px;
  display:flex;align-items:center;justify-content:center;
  background:var(--bloom-soft);color:var(--bloom);
}
.stat-ico.teal {background:#E4F4F2;color:#1FA39C;}
.stat-ico.amber{background:#FBEEDD;color:#D98A24;}
.stat-card__delta{font-size:11px;font-weight:600;}
.stat-card__label{font-size:12px;color:var(--ink-2);margin-top:10px;}
.stat-card__value{font-family:'Fraunces';font-weight:600;font-size:21px;color:var(--ink);}
.up{color:var(--ok);} .down{color:var(--warn);}

/* =============================================================
   CARDS / SECTIONS
   ============================================================= */
.card{background:var(--card);border-radius:var(--r-lg);padding:18px;box-shadow:var(--shadow);}
.card--tight{padding:14px;border-radius:var(--r);box-shadow:var(--shadow-sm);}
.section{padding:20px 20px 0;}
.section__head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;}
.section__head h3{font-size:18px;}
.link-more{color:var(--bloom);font-size:13px;font-weight:600;}

/* business overview progress */
.overview__row{display:flex;justify-content:space-between;font-size:11.5px;color:var(--muted);}
.overview__row b{display:block;font-family:'Fraunces';font-weight:600;font-size:16px;color:var(--ink);margin-top:2px;}
.bar{height:10px;border-radius:6px;background:var(--petal);overflow:hidden;display:flex;margin-top:14px;}
.bar > span{display:block;height:100%;background:linear-gradient(90deg,#E782AC,#CE3F6B);}
.note-ok{font-size:12px;color:var(--ok);margin-top:10px;font-weight:600;display:flex;align-items:center;gap:6px;}
.note-ok::before{content:"";width:7px;height:7px;border-radius:50%;background:var(--ok);}

/* category rows (top categories + breakdown legend) */
.cat-row{display:flex;align-items:center;gap:12px;padding:9px 0;}
.cat-dot{width:10px;height:10px;border-radius:3px;flex:none;}
.cat-body{flex:1;}
.cat-body .t{display:flex;justify-content:space-between;font-size:13.5px;}
.cat-body .t b{font-weight:600;}
.cat-track{height:6px;border-radius:4px;background:var(--petal);margin-top:6px;overflow:hidden;}
.cat-track > span{display:block;height:100%;border-radius:4px;}
.cat-pct{font-size:13px;font-weight:600;width:36px;text-align:right;}

/* =============================================================
   LISTS  (clients / orders / expenses)
   ============================================================= */
.list{padding:0 20px;}
.row-card{
  display:flex;align-items:center;gap:13px;
  background:var(--card);border-radius:var(--r);
  padding:13px 14px;margin-bottom:11px;box-shadow:var(--shadow-sm);
}
.row-card__body{flex:1;min-width:0;}
.row-card__body .name{font-size:14.5px;font-weight:600;}
.row-card__body .sub{font-size:12px;color:var(--muted);}
.row-card__end{text-align:right;flex:none;}

/* monogram avatars (cycle colours via .a1–.a5) */
.mono{
  width:44px;height:44px;border-radius:14px;flex:none;
  display:flex;align-items:center;justify-content:center;
  font-weight:600;font-size:15px;
}
.mono.sm{width:36px;height:36px;border-radius:12px;font-size:12px;}
.a1{background:#FCE6EE;color:#CE3F6B;}
.a2{background:#EEE6F8;color:#9B6DD6;}
.a3{background:#E4F4F2;color:#1FA39C;}
.a4{background:#FBEEDD;color:#D98A24;}
.a5{background:#EAF1E4;color:#5E7A47;}

/* clickable whole-row */
.clickable-row{cursor:pointer;}
.clickable-row:focus-visible{outline:2px solid var(--bloom);outline-offset:2px;}

/* =============================================================
   STATUS / BALANCE PILLS
   ============================================================= */
.status{display:inline-block;border-radius:9px;padding:3px 9px;font-size:12px;font-weight:600;white-space:nowrap;}
.status.ordered  {background:var(--neutral-bg);color:var(--neutral);}
.status.part_paid{background:var(--warn-bg);color:var(--warn);}
.status.paid     {background:var(--ok-bg);color:var(--ok);}
.status.delivered{background:var(--info-bg);color:var(--info);}
.status.returned {background:var(--danger-bg);color:var(--danger);}
.status.pending  {background:var(--neutral-bg);color:var(--neutral);}
.status.shipped  {background:var(--info-bg);color:var(--info);}
.pill-owed   {background:var(--danger-bg);color:var(--danger);border-radius:9px;padding:3px 9px;font-size:12.5px;font-weight:600;}
.pill-settled{background:var(--ok-bg);color:var(--ok);border-radius:9px;padding:3px 9px;font-size:12.5px;font-weight:600;}

/* filter chips (orders/sms) */
.chips{display:flex;gap:8px;overflow-x:auto;padding:16px 20px 4px;scrollbar-width:none;}
.chip{
  flex:none;border-radius:20px;padding:8px 15px;font-size:13px;font-weight:500;
  background:var(--card);color:var(--ink-2);box-shadow:0 4px 12px -8px rgba(67,24,42,.30);cursor:pointer;
}
.chip.is-active{background:var(--bloom);color:#fff;font-weight:600;box-shadow:none;}

/* =============================================================
   DONUT + SEGMENTED (dashboard C / charts page)
   ============================================================= */
.segmented{display:flex;background:#F1E7ED;border-radius:16px;padding:5px;gap:4px;}
.segmented > *{flex:1;text-align:center;padding:11px;font-size:13.5px;font-weight:500;color:var(--muted);border-radius:12px;cursor:pointer;}
.segmented > .is-active{background:#fff;color:var(--ink);font-weight:600;box-shadow:0 4px 10px -6px rgba(67,24,42,.30);}

.donut-wrap{display:flex;justify-content:center;padding:22px 0 8px;}
.donut{width:206px;height:206px;border-radius:50%;position:relative;display:flex;align-items:center;justify-content:center;box-shadow:var(--shadow);}
.donut__hole{width:142px;height:142px;border-radius:50%;background:var(--blush);display:flex;flex-direction:column;align-items:center;justify-content:center;}
.donut__hole .lbl{font-size:12px;color:var(--muted);}
.donut__hole .val{font-family:'Fraunces';font-weight:600;font-size:27px;}

/* =============================================================
   SUMMARY GRID  (order view)
   ============================================================= */
.summary-grid{display:flex;gap:10px;}
.summary-grid > div{flex:1;background:var(--card);border-radius:16px;padding:13px;text-align:center;box-shadow:var(--shadow-sm);}
.summary-grid .lbl{font-size:11px;color:var(--muted);}
.summary-grid .val{font-family:'Fraunces';font-weight:600;font-size:16px;}
.summary-total{
  background:linear-gradient(150deg,#43182A,#6E2E44);
  border-radius:20px;padding:18px;color:#fff;
}
.summary-total .t{display:flex;justify-content:space-between;align-items:center;}
.summary-total .t b{font-family:'Fraunces';font-weight:600;font-size:24px;}
.summary-total hr{border:none;border-top:1px solid rgba(255,255,255,.16);margin:13px 0;}
.summary-total .bal{display:flex;justify-content:space-between;font-size:13px;}
.summary-total .bal .due{color:#FFC9DC;font-weight:600;}

/* collapsible item card (order view) */
details.item-card{background:var(--card);border-radius:16px;padding:14px;margin-bottom:10px;box-shadow:var(--shadow-sm);}
details.item-card > summary{list-style:none;cursor:pointer;display:flex;align-items:flex-start;justify-content:space-between;}
details.item-card > summary::-webkit-details-marker{display:none;}
details.item-card .meta{font-size:11.5px;color:var(--muted);margin-top:3px;}
details.item-card .detail{font-size:12px;color:var(--ink-2);margin-top:10px;padding-top:10px;border-top:1px solid var(--line);}

/* =============================================================
   FORMS
   ============================================================= */
.form-card{background:var(--card);border-radius:var(--r);padding:16px;box-shadow:var(--shadow-sm);max-width:560px;margin:0 auto;}
.field{margin-top:14px;}
.field:first-child{margin-top:0;}
.field > label,.field-label{display:block;font-size:12px;color:var(--muted);font-weight:600;margin-bottom:7px;letter-spacing:.02em;}
input,select,textarea{
  width:100%;font-family:inherit;font-size:14px;color:var(--ink);
  background:#F7F2F4;border:1px solid #ECE0E6;border-radius:var(--r-sm);
  padding:12px 13px;min-height:44px;outline:none;
}
textarea{min-height:96px;resize:vertical;line-height:1.5;}
input:focus,select:focus,textarea:focus{border-color:var(--bloom);background:#fff;box-shadow:0 0 0 3px rgba(206,63,107,.12);}
.input-money{display:flex;align-items:center;background:#F7F2F4;border:1px solid #ECE0E6;border-radius:var(--r-sm);padding:0 13px;}
.input-money::before{content:"₵";color:var(--muted);font-family:'Fraunces';font-weight:600;margin-right:6px;}
.input-money input{border:none;background:none;padding-left:0;box-shadow:none;}

/* repeatable item rows (order form) */
.repeat-row{display:flex;flex-direction:column;gap:9px;}
.grid-2{display:flex;gap:9px;}
.grid-2 > *{flex:1;}
.grid-3{display:flex;gap:9px;}
.grid-3 > *{flex:1;}
.grid-3 > .qty{width:70px;flex:none;}
.add-row{border:1.5px dashed #D9BECB;border-radius:14px;padding:13px;text-align:center;color:var(--bloom);font-size:14px;font-weight:600;background:none;cursor:pointer;}

/* editable item row card (order_form.php) */
.item-row-edit{background:var(--blush);border-radius:var(--r-sm);padding:12px;margin-bottom:9px;}

/* checkbox pills (tags) */
.checkbox-list{display:flex;flex-wrap:wrap;gap:8px;}
.checkbox-list label{
  display:inline-flex;align-items:center;background:#F7F2F4;color:var(--ink-2);
  border-radius:18px;padding:8px 14px;font-size:13px;font-weight:500;cursor:pointer;min-height:auto;
}
.checkbox-list input{display:none;}
.checkbox-list input:checked + span,
.checkbox-list label.is-active{}
.checkbox-list label:has(input:checked){background:var(--bloom);color:#fff;font-weight:600;}

/* =============================================================
   BUTTONS
   ============================================================= */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:44px;padding:13px 18px;border-radius:15px;border:none;cursor:pointer;
  font-family:inherit;font-size:15px;font-weight:600;width:100%;text-align:center;
}
.btn-primary{background:var(--grad-btn);color:#fff;box-shadow:0 12px 24px -10px rgba(206,63,107,.6);}
.btn-primary:hover{filter:brightness(.97);}
.btn-ghost{background:var(--card);color:var(--ink-2);box-shadow:var(--shadow-sm);}
.btn-danger{background:var(--danger-bg);color:var(--danger);}
.btn-view{background:var(--bloom-soft);color:var(--bloom);}
.btn-row{display:flex;gap:10px;}
.actions{display:flex;gap:8px;align-items:center;}

/* =============================================================
   BOTTOM TAB BAR + FAB  (mobile only)
   ============================================================= */
.tabbar{
  position:fixed;left:0;right:0;bottom:0;z-index:50;
  height:calc(var(--tabbar-h) + var(--safe-b));
  padding:0 24px var(--safe-b);
  background:#fff;border-top:1px solid var(--line);
  box-shadow:0 -10px 28px -18px rgba(67,24,42,.30);
  display:flex;align-items:flex-start;justify-content:space-between;
}
.tabbar__inner{
  max-width:var(--maxw);margin:0 auto;width:100%;
  display:flex;align-items:flex-start;justify-content:space-between;
  padding-top:9px;position:relative;
}
.tab{
  display:flex;flex-direction:column;align-items:center;gap:4px;width:46px;
  color:var(--muted-2);font-size:9.5px;font-weight:600;text-decoration:none;
}
.tab.is-active{color:var(--bloom);}
.tab svg{width:23px;height:23px;}
/* centre FAB */
.fab{
  position:absolute;top:-26px;left:50%;transform:translateX(-50%);
  width:58px;height:58px;border-radius:50%;border:4px solid #fff;
  background:var(--grad-btn);color:#fff;
  display:flex;align-items:center;justify-content:center;cursor:pointer;
  box-shadow:0 14px 24px -6px rgba(206,63,107,.6);
}
.fab svg{width:26px;height:26px;}
/* quick-add sheet (opened by FAB) */
.fab-sheet{position:fixed;inset:0;z-index:60;display:none;}
.fab-sheet.open{display:block;}
.fab-sheet__scrim{position:absolute;inset:0;background:rgba(40,12,26,.35);}
.fab-sheet__panel{
  position:absolute;left:0;right:0;bottom:0;
  background:#fff;border-radius:24px 24px 0 0;padding:18px 20px calc(20px + var(--safe-b));
  box-shadow:var(--shadow-lg);
}
.fab-sheet__panel a{display:flex;align-items:center;gap:13px;padding:14px 10px;border-radius:14px;color:var(--ink);font-size:15px;font-weight:600;min-height:44px;}
.fab-sheet__panel a:hover{background:var(--blush);}

/* home indicator (cosmetic, optional) */
.home-indicator{position:absolute;bottom:7px;left:50%;transform:translateX(-50%);width:120px;height:5px;border-radius:3px;background:var(--ink);opacity:.18;}

/* =============================================================
   RESPONSIVE  (tables→cards, grids, desktop nav)
   ============================================================= */

/* dashboard stat grid spacing */
@media (min-width:420px){ .stat-card{width:160px;} }
@media (min-width:560px){
  .summary-grid > div{padding:15px;}
  .repeat-row{display:grid;grid-template-columns:1fr;gap:10px;}
}

/* --- TABLES become CARDS below 767px --- */
@media (max-width:767px){
  table.cards{border:none;}
  table.cards thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);}
  table.cards tr{
    display:block;background:var(--card);border-radius:var(--r);
    padding:13px 14px;margin-bottom:11px;box-shadow:var(--shadow-sm);
  }
  table.cards td{
    display:flex;justify-content:space-between;align-items:center;gap:12px;
    padding:6px 0;border:none;font-size:14px;
  }
  table.cards td::before{
    content:attr(data-label);color:var(--muted);font-size:12px;font-weight:600;
  }
}

/* --- DESKTOP ≥768px: top nav shows, bottom bar hides --- */
@media (min-width:768px){
  body{padding-bottom:40px;}
  .topnav{display:flex;}
  .tabbar,.home-indicator{display:none;}
  .hero{border-radius:var(--r-lg);margin:20px 0 -22px;}
  .stat-scroller{flex-wrap:wrap;overflow:visible;}
  .stat-card{flex:1 1 0;min-width:150px;}

  /* real table layout on desktop */
  table.cards{width:100%;border-collapse:separate;border-spacing:0;background:var(--card);border-radius:var(--r-lg);overflow:hidden;box-shadow:var(--shadow-sm);}
  table.cards thead{position:static;width:auto;height:auto;clip:auto;}
  table.cards th{text-align:left;font-size:12px;color:var(--muted);font-weight:600;padding:14px 16px;background:var(--blush);}
  table.cards td{padding:14px 16px;border-top:1px solid var(--line);font-size:14px;}
  table.cards td::before{display:none;}
}

/* =============================================================
   AUTH (login)
   ============================================================= */
.auth-hero{
  height:300px;background:var(--grad);border-radius:0 0 44px 44px;
  position:relative;overflow:hidden;color:#fff;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
}
.auth-hero .logo{width:84px;height:84px;border-radius:28px;background:rgba(255,255,255,.2);border:1.5px solid rgba(255,255,255,.3);display:flex;align-items:center;justify-content:center;font-family:'Fraunces';font-weight:600;font-size:34px;}
.auth-hero h1{margin-top:16px;font-size:26px;}
.auth-hero p{margin:4px 0 0;font-size:13.5px;opacity:.88;}
.auth-form{padding:28px 24px;max-width:440px;margin:0 auto;}

/* =============================================================
   MOTION  (respect reduced-motion)
   ============================================================= */
@media (prefers-reduced-motion:no-preference){
  .row-card,.stat-card,.card{transition:transform .15s ease, box-shadow .15s ease;}
  .clickable-row:active{transform:scale(.99);}
  .btn{transition:filter .15s ease, transform .1s ease;}
  .btn:active{transform:translateY(1px);}
}
