/* ==========================================================================
   Tahara — shared app shell
   The single source of truth for the logged-in app (dashboard, calendar,
   cycles, veset kavuah, reminders, settings, billing, support).

   Rules of the road:
   - Do NOT redefine any selector from this file inside a page's <style>.
     Page <style> blocks are for genuinely page-specific layout only.
   - No glow. Solid colours, tight shadows. No gradient-clip text.
   - The whole shell is one flat tone (--bg). Header, sidebar and page body
     all paint the same token so they can never drift apart.
   ========================================================================== */

:root{
  /* Shell tone — header, sidebar and page body are all exactly this. */
  --bg:#FEF9F9;
  --rose-hover:#FEF9F9;      /* button/row hover fill — same tone as the shell */
  --rose-tint:#FDF7F7;       /* quiet fill for rows/inputs sitting on white */
  --rose-hairline:rgba(200,148,149,0.14);

  --surface:rgba(255,255,255,0.65);
  --surface-solid:#FFFFFF;

  --text:#1A1219;
  --text-muted:#6B5C64;
  --text-light:#9E8E95;

  --rose:#C89495;
  --rose-deep:#A86E6F;
  --rose-press:#96595A;
  --rose-light:#F3E0E0;      /* legacy decorative fill only — never for hover */
  --violet:#4A3750;
  --emerald:#34D399;
  --amber:#F59E0B;

  --font-sans:'Inter', sans-serif;
  --font-serif:'Playfair Display',Georgia,serif;

  --radius-sm:12px; --radius-md:20px; --radius-lg:32px;
  --radius-xl:48px; --radius-full:100px;

  --ease-out:cubic-bezier(0.16,1,0.3,1);
  --transition:background 0.35s cubic-bezier(0.16,1,0.3,1), color 0.35s cubic-bezier(0.16,1,0.3,1), border-color 0.35s cubic-bezier(0.16,1,0.3,1), box-shadow 0.35s cubic-bezier(0.16,1,0.3,1), transform 0.35s cubic-bezier(0.16,1,0.3,1), opacity 0.35s cubic-bezier(0.16,1,0.3,1);
}

/* ---- Reset ---- */
*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}
html{font-size:16px;-webkit-font-smoothing:antialiased;scroll-behavior:smooth}
body{font-family:var(--font-sans);color:var(--text);background:var(--bg);overflow-x:hidden;line-height:1.6;min-height:100vh}
a{text-decoration:none;color:inherit}
button{border:none;background:none;cursor:pointer;font:inherit}
ul,ol{list-style:none}
*:focus-visible{outline:2px solid var(--rose);outline-offset:2px}

/* ---- Icons ----
   Lucide REPLACES <i data-lucide> with <svg class="lucide" data-lucide>, so any
   `<selector> i {width:..}` rule is dead code — it matches nothing after render.
   Always size icons via [data-lucide], which matches both before and after. */
svg.lucide{flex-shrink:0}
[data-lucide]{width:20px;height:20px}

.skip-link{position:absolute;top:-100%;left:16px;padding:8px 16px;background:var(--text);color:var(--bg);border-radius:var(--radius-full);font-weight:600;font-size:0.9rem;z-index:10000;transition:top 0.2s}
.skip-link:focus{top:16px}

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{animation-duration:0.01ms !important;animation-iteration-count:1 !important;transition-duration:0.01ms !important}
}

/* ---- App shell ---- */
.app-shell{display:flex;min-height:100vh}
.sidebar-overlay{display:none;position:fixed;inset:0;background:rgba(26,18,25,0.35);z-index:49;opacity:0;transition:opacity .3s ease}
.sidebar-overlay.open{display:block;opacity:1}

.sidebar{width:280px;background:var(--bg);border-right:1px solid var(--rose-hairline);padding:32px 0;position:fixed;top:56px;left:0;bottom:0;z-index:50;display:flex;flex-direction:column;transition:transform .35s var(--ease-out)}
.sidebar-brand{padding:0 32px 28px;text-align:center;border-bottom:1px solid var(--rose-hairline);margin-bottom:24px}
.sidebar-brand a{display:flex;align-items:center;justify-content:center;gap:10px;text-decoration:none}
.sidebar-brand-icon{width:40px;height:40px;border-radius:50%;background:linear-gradient(135deg,var(--rose-light),rgba(200,148,149,0.2));border:1.5px solid rgba(200,148,149,0.25);display:flex;align-items:center;justify-content:center;color:var(--rose-deep);flex-shrink:0}
.sidebar-brand-text{font-family:var(--font-serif);font-size:1.25rem;font-weight:700;color:var(--text);letter-spacing:-0.02em}
.sidebar-nav{list-style:none;padding:0 16px;flex:1}
.sidebar-nav li{margin-bottom:4px}
.sidebar-nav li a{display:flex;align-items:center;gap:14px;padding:12px 18px;border-radius:var(--radius-md);color:var(--text-light);font-size:0.95rem;font-weight:500;transition:var(--transition);border:1px solid transparent}
.sidebar-nav li a [data-lucide]{width:20px;height:20px}
.sidebar-nav li a:hover{background:rgba(255,255,255,0.72);border-color:rgba(255,255,255,0.9);box-shadow:0 2px 12px rgba(168,110,111,0.08),0 1px 0 rgba(255,255,255,0.9) inset;color:var(--rose-deep);transform:translateX(3px)}
.sidebar-nav li a.active{background:rgba(255,255,255,0.85);border-color:rgba(255,255,255,0.95);box-shadow:0 4px 16px rgba(168,110,111,0.13),0 1px 0 rgba(255,255,255,1) inset,0 0 0 1px rgba(200,148,149,0.18);color:var(--rose-deep);font-weight:700}
.sidebar-footer{padding:20px 28px;border-top:1px solid var(--rose-hairline);display:flex;flex-direction:column;gap:8px}
.user-info{display:flex;align-items:center;gap:10px;font-weight:600;color:var(--text)}
.avatar{width:36px;height:36px;border-radius:50%;background:linear-gradient(135deg,var(--rose-light),rgba(74,55,80,0.1));display:flex;align-items:center;justify-content:center;color:var(--rose-deep);font-weight:700;font-size:0.85rem;flex-shrink:0}

/* ---- Top header ---- */
.top-header{position:fixed;top:0;left:0;right:0;z-index:60;height:56px;background:var(--bg);border-bottom:1px solid rgba(200,148,149,0.12);display:flex;align-items:center;justify-content:space-between;padding:0 24px}
.top-header-left{display:flex;align-items:center;gap:10px}
.top-header-brand{display:flex;align-items:center;gap:8px;text-decoration:none}
.top-header-brand-icon{width:32px;height:32px;border-radius:50%;background:linear-gradient(135deg,var(--rose-light),rgba(200,148,149,0.2));border:1.5px solid rgba(200,148,149,0.25);display:flex;align-items:center;justify-content:center;color:var(--rose-deep);flex-shrink:0}
.top-header-brand-text{font-family:var(--font-serif);font-size:1.05rem;font-weight:700;color:var(--text);letter-spacing:-0.02em}
.top-header-right{display:flex;align-items:center;gap:6px}
.top-header-divider{width:1px;height:28px;background:var(--rose-hairline);margin:0 6px}
.top-header-user{display:flex;align-items:center;gap:8px;padding:4px 10px;border-radius:var(--radius-full);transition:var(--transition);cursor:default}
.top-header-user:hover{background:var(--rose-hover)}
.top-header-user .avatar{width:30px;height:30px;font-size:0.75rem}
.top-header-user-info{display:flex;flex-direction:column}
.top-header-user-name{font-size:0.82rem;font-weight:700;color:var(--text);line-height:1.15}
.top-header-user-email{font-size:0.68rem;color:var(--text-light)}
.top-header-signout{font-size:0.75rem;color:var(--text-light);display:flex;align-items:center;gap:3px;transition:var(--transition);padding:5px 10px;border-radius:var(--radius-full);border:1px solid rgba(200,148,149,0.1)}
.top-header-signout:hover{color:var(--rose-deep);background:var(--rose-hover);border-color:rgba(200,148,149,0.25)}
.top-header-signout [data-lucide]{width:13px;height:13px}

/* ---- Main layout & page hero ---- */
/* min-width:0 is load-bearing. As a flex item this defaults to min-width:auto, which
   refuses to shrink below its widest content — so one wide table/grid stretched the
   whole page and produced horizontal scroll on mobile. */
.main-content{flex:1;min-width:0;margin-left:280px;padding:40px 56px;padding-top:88px;min-height:100vh}
.mobile-menu-btn{display:none !important}

.page-hero{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:16px;margin-bottom:24px;padding-bottom:12px;border-bottom:1px solid rgba(200,148,149,0.12)}
.page-hero-left{display:flex;flex-direction:column;gap:4px}
.page-hero-greeting{font-size:0.8rem;color:var(--text-muted);font-weight:700;text-transform:uppercase;letter-spacing:0.08em}
/* Solid colour — never a gradient-clip glow. */
.page-hero h1{font-family:var(--font-sans);font-weight:800;font-size:2.1rem;line-height:1.2;color:var(--text);letter-spacing:-0.025em}
.page-hero-sub{font-size:0.9rem;color:var(--text-muted)}

.current-phase-pill{display:inline-flex;align-items:center;gap:8px;padding:10px 22px;border-radius:var(--radius-full);font-weight:700;font-size:0.9rem;background:rgba(52,211,153,0.1);color:#059669;border:1px solid rgba(52,211,153,0.28);white-space:nowrap}
.current-phase-pill [data-lucide]{width:18px;height:18px}

/* ---- Buttons ---- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:11px 24px;border-radius:var(--radius-full);font-family:var(--font-sans);font-size:0.92rem;font-weight:600;cursor:pointer;border:none;transition:var(--transition);text-decoration:none}
.btn [data-lucide]{width:16px;height:16px}
.btn-primary{background:var(--rose-deep);color:white;box-shadow:0 2px 8px rgba(168,110,111,0.2)}
.btn-primary:hover{background:var(--rose-press);transform:translateY(-1px);box-shadow:0 6px 16px rgba(168,110,111,0.26);color:white}
.btn-ghost{background:rgba(255,255,255,0.6);color:var(--text-muted);border:1px solid rgba(200,148,149,0.18)}
.btn-ghost:hover{background:var(--rose-hover);border-color:rgba(200,148,149,0.3);color:var(--rose-deep)}
.btn-sm{padding:7px 16px;font-size:0.82rem}

/* ---- Cards ---- */
.dash-card{background:var(--surface-solid);border:1px solid var(--rose-hairline);border-radius:24px;padding:28px;transition:var(--transition);display:flex;flex-direction:column;position:relative;overflow:hidden}
.dash-card:hover{border-color:rgba(200,148,149,0.24);box-shadow:0 12px 32px rgba(26,18,25,0.045)}
.dash-card h2{font-size:0.78rem;font-weight:700;text-transform:uppercase;letter-spacing:0.09em;color:var(--text-muted);margin-bottom:20px;display:flex;align-items:center;gap:8px}
.dash-card h2 [data-lucide]{width:16px;height:16px;color:var(--rose-deep)}
.dash-card-full{grid-column:1/-1}

/* ---- Status badges ----
   One definition. Previously duplicated in settings.css and vest-kavuah.css with
   diverging padding and borders for the same badge. */
.info-badge{display:inline-flex;align-items:center;gap:5px;padding:5px 14px;border-radius:var(--radius-full);font-size:0.78rem;font-weight:700;white-space:nowrap}
.info-badge.green{background:rgba(52,211,153,0.12);color:#059669;border:1px solid rgba(52,211,153,0.3)}
.info-badge.amber{background:rgba(245,158,11,0.12);color:#b45309;border:1px solid rgba(245,158,11,0.28)}
.info-badge.red{background:rgba(239,68,68,0.08);color:#dc2626;border:1px solid rgba(239,68,68,0.25)}
.info-badge.grey{background:rgba(200,148,149,0.08);color:var(--text-light);border:1px solid rgba(200,148,149,0.15)}
.info-badge.teal{background:rgba(130,168,168,0.15);color:#3d7a7a;border:1px solid rgba(130,168,168,0.3)}

/* ---- Day / Night onah toggle ----
   One definition. Previously redefined in dashboard.css, cycles.css and calendar.css
   with three different colour schemes for an identical control. */
.day-night-tabs{display:flex;background:var(--rose-tint);border:1px solid var(--rose-hairline);border-radius:16px;padding:6px;position:relative;margin-top:8px}
.day-night-tabs input[type="radio"]{display:none}
.dn-tab{flex:1;text-align:center;padding:12px;cursor:pointer;font-weight:700;color:var(--text-light);border-radius:12px;transition:var(--transition);display:flex;align-items:center;justify-content:center;gap:10px;position:relative;z-index:2;font-family:var(--font-sans);font-size:0.9rem}
.dn-tab [data-lucide]{width:18px;height:18px}
.dn-slider{position:absolute;top:6px;left:6px;bottom:6px;width:calc(50% - 6px);background:var(--surface-solid);border-radius:12px;box-shadow:0 2px 8px rgba(168,110,111,0.12);transition:transform .4s cubic-bezier(0.25,1,0.5,1);z-index:1}
#onah-day:checked ~ .dn-slider{transform:translateX(0);background:linear-gradient(135deg,#fdfbf7,#fdf6e3)}
#onah-night:checked ~ .dn-slider{transform:translateX(100%);background:linear-gradient(135deg,#FDF7F7,#F7EBEB)}
#onah-day:checked ~ label[for="onah-day"]{color:#b45309}
#onah-night:checked ~ label[for="onah-night"]{color:var(--rose-deep)}

/* ---- Alert banners ---- */
.alert-banner{display:flex;align-items:flex-start;gap:13px;padding:15px 20px;border-radius:18px;margin-bottom:12px}
.alert-banner [data-lucide]{width:20px;height:20px;flex-shrink:0;margin-top:2px}
.alert-banner-text h4{font-size:0.95rem;font-weight:700;margin-bottom:2px}
.alert-banner-text p{font-size:0.85rem;line-height:1.5}
.alert-banner-actions{margin-left:auto;display:flex;gap:8px;flex-shrink:0;align-items:center}
.alert-banner.kavuah{background:rgba(245,158,11,0.07);border:1px solid rgba(245,158,11,0.2);color:#92400e}
.alert-banner.kavuah h4{color:#b45309}
.alert-banner.kavuah p{color:#78350F}
.alert-banner.pregnancy{background:rgba(52,211,153,0.07);border:1px solid rgba(52,211,153,0.22);color:#166534}
.alert-banner.pregnancy h4{color:#15803D}

/* ---- Notifications ---- */
.notif-wrapper{position:relative}
.notif-bell{width:44px;height:44px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:rgba(255,255,255,0.8);border:1px solid var(--rose-hairline);cursor:pointer;transition:var(--transition);position:relative;flex-shrink:0}
.notif-bell:hover{background:var(--rose-hover);border-color:rgba(200,148,149,0.3)}
.notif-bell [data-lucide]{width:20px;height:20px;color:var(--text-muted)}
.notif-badge{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;border-radius:100px;background:#dc2626;color:white;font-size:0.7rem;font-weight:800;display:flex;align-items:center;justify-content:center;padding:0 5px;border:2px solid var(--bg)}
.notif-dropdown{position:absolute;top:calc(100% + 8px);right:0;width:380px;max-width:calc(100vw - 2rem);max-height:440px;background:rgba(255,255,255,0.98);border:1px solid var(--rose-hairline);border-radius:20px;box-shadow:0 16px 48px rgba(26,18,25,0.12);z-index:200;opacity:0;visibility:hidden;transform:translateY(8px);transition:transform .25s var(--ease-out), opacity .25s var(--ease-out);overflow:hidden}
.notif-dropdown.open{opacity:1;visibility:visible;transform:translateY(0)}
.notif-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px 12px;border-bottom:1px solid rgba(200,148,149,0.1)}
.notif-header h4{font-size:1rem;font-weight:800;color:var(--text)}
.notif-header a{font-size:0.82rem;font-weight:600;color:var(--rose-deep)}
.notif-filters{display:flex;gap:4px;padding:10px 20px;border-bottom:1px solid rgba(200,148,149,0.06)}
.notif-filter{padding:4px 12px;border-radius:var(--radius-full);font-size:0.75rem;font-weight:600;color:var(--text-light);background:transparent;border:1px solid rgba(200,148,149,0.12);cursor:pointer;transition:var(--transition);font-family:var(--font-sans)}
.notif-filter:hover{background:var(--rose-hover);color:var(--rose-deep)}
.notif-filter.active{background:var(--rose-hover);color:var(--rose-deep);border-color:rgba(200,148,149,0.35)}
.notif-list{max-height:300px;overflow-y:auto}
.notif-item{display:flex;align-items:flex-start;gap:12px;padding:14px 20px;border-bottom:1px solid rgba(200,148,149,0.06);cursor:pointer;transition:background .2s}
.notif-item:hover{background:var(--rose-hover)}
.notif-item.unread{background:var(--rose-tint)}
.notif-item-icon{width:36px;height:36px;border-radius:10px;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.notif-item-icon [data-lucide]{width:16px;height:16px}
.notif-item-icon.reminder{background:rgba(200,148,149,0.14);color:var(--rose-deep)}
.notif-item-icon.bedikah{background:rgba(52,211,153,0.12);color:#059669}
.notif-item-icon.kavuah{background:rgba(245,158,11,0.12);color:#b45309}
.notif-item-icon.system{background:rgba(74,55,80,0.08);color:var(--violet)}
.notif-item-body{flex:1;min-width:0}
.notif-item-body h5{font-size:0.88rem;font-weight:600;color:var(--text);margin-bottom:1px}
.notif-item-body p{font-size:0.78rem;color:var(--text-muted)}
.notif-item-time{font-size:0.72rem;color:var(--text-light);white-space:nowrap;flex-shrink:0}
.notif-unread-dot{width:8px;height:8px;border-radius:50%;background:var(--rose-deep);flex-shrink:0;margin-top:6px}
.notif-footer{padding:12px 20px;text-align:center;border-top:1px solid rgba(200,148,149,0.1)}
.notif-footer a{font-size:0.85rem;font-weight:600;color:var(--rose-deep)}

/* ---- Modal ---- */
.modal-overlay{position:fixed;inset:0;background:rgba(26,18,25,0.35);backdrop-filter:blur(8px);z-index:1000;display:flex;align-items:center;justify-content:center;opacity:0;pointer-events:none;transition:opacity .4s ease}
.modal-overlay.open{opacity:1;pointer-events:all}
.modal{background:var(--surface-solid);width:90%;max-width:480px;border-radius:var(--radius-xl);padding:36px;box-shadow:0 24px 60px rgba(0,0,0,0.15);border:1px solid var(--rose-hairline);transform:scale(0.96) translateY(16px);transition:transform .4s cubic-bezier(0.25,1,0.5,1), opacity .4s cubic-bezier(0.25,1,0.5,1)}
.modal-overlay.open .modal{transform:scale(1) translateY(0)}
.modal h2{font-family:var(--font-serif);font-size:1.45rem;font-weight:700;margin-bottom:22px;color:var(--text)}
.modal-actions{display:flex;justify-content:flex-end;gap:12px;margin-top:28px}

/* ---- Forms ---- */
.form-group{margin-bottom:20px;position:relative}
.form-group label{display:block;font-weight:600;font-size:0.85rem;color:var(--text);margin-bottom:8px}
.form-group .hint{display:block;font-size:0.78rem;color:var(--text-light);margin-top:5px}
.form-control{width:100%;background:var(--rose-tint);border:1.5px solid rgba(200,148,149,0.22);border-radius:14px;padding:12px 16px;font-family:var(--font-sans);font-size:0.95rem;color:var(--text);transition:var(--transition)}
.form-control:focus{border-color:var(--rose);box-shadow:0 0 0 4px rgba(200,148,149,0.12);background:#fff;outline:none}
select.form-control{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239E8E95' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 16px center;padding-right:44px}
.form-row{display:flex;gap:16px}
.form-row .form-group{flex:1}

/* ---- Responsive ---- */
@media (max-width:900px){
  .sidebar{transform:translateX(-100%);box-shadow:8px 0 40px rgba(0,0,0,0.1)}
  .sidebar.open{transform:translateX(0)}
  .main-content{margin-left:0;padding:24px 20px;padding-top:76px}
  .mobile-menu-btn{display:flex !important}
  .notif-dropdown{width:calc(100vw - 40px);right:-60px}
  .alert-banner{flex-wrap:wrap}
  .alert-banner-actions{margin-left:0;margin-top:12px}
  .top-header{padding:0 16px}
  .top-header-user-info{display:none}
  .top-header-signout span{display:none}
  .page-hero{flex-direction:column;align-items:flex-start;gap:12px}
  .form-row{flex-direction:column;gap:0}
}
@media (max-width:600px){
  /* Must restate padding-top: the shorthand above would reset it to 16px and the
     page title would slide under the fixed 56px header. */
  .main-content{padding:16px;padding-top:72px}
  .modal{padding:28px 20px;border-radius:32px}
}
