/* =========================================================================
   Wakulima Farmers Milk — Design System
   Palette:  pasture #1F4D36 · cowhide #A85C32 · milk #FBF8F1
             gold #C9A227 · steel #3D6B7D · ink #26221D
   Type:     Fraunces (display) · Inter (body/UI) · IBM Plex Mono (data)
   ========================================================================= */

:root{
  --pasture:      #1F4D36;
  --pasture-dark: #123424;
  --cowhide:      #A85C32;
  --milk:         #FBF8F1;
  --milk-dim:     #F1ECDD;
  --gold:         #C9A227;
  --steel:        #3D6B7D;
  --ink:          #26221D;
  --ink-soft:     #5B5449;
  --line:         #E4DDC9;
  --danger:       #B3382C;
  --success:      #2F6E4A;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'IBM Plex Mono', 'Courier New', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --shadow-card: 0 12px 32px -12px rgba(31, 77, 54, 0.22);
  --shadow-soft: 0 4px 14px -6px rgba(38, 34, 29, 0.15);
}

*, *::before, *::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--milk);
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3{ font-family: var(--font-display); color: var(--pasture-dark); margin: 0; }
p{ margin: 0; }
a{ color: inherit; }
.mono{ font-family: var(--font-mono); letter-spacing: 0.01em; }

@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------------------------------------------------------------------
   Buttons & form controls (shared)
--------------------------------------------------------------------- */
.btn{
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; font-family: var(--font-body); font-weight: 600; font-size: 0.95rem;
  padding: 13px 22px; border-radius: var(--radius-sm); border: none;
  cursor: pointer; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, background .2s ease;
}
.btn:focus-visible{ outline: 3px solid var(--gold); outline-offset: 2px; }
.btn-primary{ background: var(--pasture); color: var(--milk); box-shadow: var(--shadow-soft); }
.btn-primary:hover{ background: var(--pasture-dark); transform: translateY(-1px); }
.btn-block{ width: 100%; }
.btn-ghost{ background: transparent; color: var(--milk); border: 1.5px solid rgba(251,248,241,0.4); }
.btn-ghost:hover{ background: rgba(251,248,241,0.12); }
.btn-sm{ padding: 8px 16px; font-size: 0.85rem; }

.field{ margin-bottom: 18px; }
.field label{
  display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft);
  margin-bottom: 6px; letter-spacing: 0.01em;
}
.input-wrap{ position: relative; }
.field input{
  width: 100%; font-family: var(--font-body); font-size: 0.98rem; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px 14px; transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus{
  outline: none; border-color: var(--pasture); box-shadow: 0 0 0 3px rgba(31,77,54,0.12);
}
.field input.has-error{ border-color: var(--danger); }
.field-hint{ font-size: 0.78rem; color: var(--ink-soft); margin-top: 5px; }
.field-row{ display: flex; gap: 14px; }
.field-row .field{ flex: 1; }

.toggle-pass{
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--ink-soft); font-size: 0.8rem; font-weight: 600;
  padding: 4px 6px;
}
.toggle-pass:hover{ color: var(--pasture); }

.alert{
  border-radius: var(--radius-sm); padding: 13px 16px; font-size: 0.9rem; margin-bottom: 18px;
  display: none; align-items: flex-start; gap: 10px; line-height: 1.45;
}
.alert.show{ display: flex; }
.alert-error{ background: #FBEAE7; color: var(--danger); border: 1px solid #EEC5BD; }
.alert-success{ background: #E9F3EC; color: var(--success); border: 1px solid #C6E2CE; }
.alert ul{ margin: 0; padding-left: 18px; }

/* ---------------------------------------------------------------------
   Auth layout (index.html / register.html)
--------------------------------------------------------------------- */
.auth-shell{
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr;
}
@media (max-width: 900px){ .auth-shell{ grid-template-columns: 1fr; } }

.auth-brand{
  background: linear-gradient(165deg, var(--pasture) 0%, var(--pasture-dark) 100%);
  color: var(--milk); padding: 56px 52px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
}
@media (max-width: 900px){ .auth-brand{ padding: 36px 28px 60px; } }

.auth-brand-top{ display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; position: relative; z-index: 2; }
.auth-brand-mark{ display: flex; }

.auth-brand-mid{ position: relative; z-index: 2; max-width: 460px; margin: 40px 0; }
.auth-brand-mid .eyebrow{ color: var(--gold); }
.auth-brand-mid h1{ color: var(--milk); font-size: clamp(1.9rem, 3.2vw, 2.6rem); font-weight: 600; line-height: 1.18; margin: 10px 0 16px; }
.auth-brand-mid p{ color: rgba(251,248,241,0.82); font-size: 1.02rem; line-height: 1.6; }

.auth-brand-stats{ display: flex; gap: 28px; position: relative; z-index: 2; flex-wrap: wrap; }
.auth-brand-stats div{ min-width: 110px; }
.auth-brand-stats strong{ display: block; font-family: var(--font-mono); font-size: 1.5rem; color: var(--gold); }
.auth-brand-stats span{ font-size: 0.8rem; color: rgba(251,248,241,0.7); }

/* Ambient milk-drop / pasture-line motif, purely decorative */
.auth-brand::before{
  content: ""; position: absolute; right: -120px; bottom: -140px; width: 420px; height: 420px;
  border-radius: 50%; background: radial-gradient(circle, rgba(201,162,39,0.16) 0%, transparent 70%);
}
.auth-brand::after{
  content: ""; position: absolute; left: -80px; top: -80px; width: 260px; height: 260px;
  border-radius: 50%; background: radial-gradient(circle, rgba(251,248,241,0.08) 0%, transparent 70%);
}
.pasture-lines{ position: absolute; left: 0; right: 0; bottom: 0; height: 90px; z-index: 1; opacity: 0.5; }

.auth-form-side{
  display: flex; align-items: center; justify-content: center; padding: 48px 32px;
  background: var(--milk);
}
.auth-card{
  width: 100%; max-width: 430px; animation: rise .5s ease both;
}
@keyframes rise{ from{ opacity: 0; transform: translateY(10px); } to{ opacity: 1; transform: translateY(0); } }

.auth-card-head{ margin-bottom: 28px; }
.auth-card-head .eyebrow{ margin-bottom: 6px; }
.auth-card-head h2{ font-size: 1.7rem; }
.auth-card-head p{ color: var(--ink-soft); margin-top: 8px; font-size: 0.95rem; }

.eyebrow{
  display: inline-block; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--cowhide); font-weight: 600;
}

.auth-switch{ margin-top: 26px; text-align: center; font-size: 0.9rem; color: var(--ink-soft); }
.auth-switch a{ color: var(--pasture); font-weight: 600; text-decoration: none; border-bottom: 1.5px solid var(--gold); }

.form-check{ display: flex; align-items: flex-start; gap: 9px; font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 20px; }
.form-check input{ margin-top: 3px; }

.divider-line{ height: 1px; background: var(--line); margin: 24px 0; border: none; }

/* ---------------------------------------------------------------------
   Dashboard
--------------------------------------------------------------------- */
.dash-body{ background: var(--milk-dim); }

.dash-topbar{
  display: flex; align-items: center; justify-content: space-between;
  background: var(--pasture); color: var(--milk); padding: 16px 32px;
  position: sticky; top: 0; z-index: 10; box-shadow: 0 4px 16px -6px rgba(18,52,36,0.35);
}
.dash-brand{ display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.15rem; }
.dash-user{ display: flex; align-items: center; gap: 16px; }
.dash-user-info{ display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.dash-user-name{ font-weight: 600; font-size: 0.92rem; }
.dash-user-code{ font-family: var(--font-mono); font-size: 0.74rem; color: rgba(251,248,241,0.7); }

.dash-main{ max-width: 1180px; margin: 0 auto; padding: 32px 24px 60px; }

.hero-panel{
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: center;
  background: linear-gradient(120deg, var(--pasture) 0%, var(--pasture-dark) 100%);
  color: var(--milk); border-radius: var(--radius-lg); padding: 40px; margin-bottom: 28px;
  box-shadow: var(--shadow-card);
}
@media (max-width: 800px){ .hero-panel{ grid-template-columns: 1fr; padding: 30px 24px; } }
.hero-copy h1{ color: var(--milk); font-size: clamp(1.5rem, 2.6vw, 2.05rem); font-weight: 600; line-height: 1.25; margin: 10px 0 12px; }
.hero-sub{ color: rgba(251,248,241,0.8); line-height: 1.6; max-width: 480px; }

.gauge-card{ display: flex; flex-direction: column; align-items: center; gap: 10px; justify-self: center; }
.gauge-svg{ width: 168px; height: 168px; }
.gauge-track{ fill: none; stroke: rgba(251,248,241,0.16); stroke-width: 11; }
.gauge-fill{
  fill: none; stroke: var(--gold); stroke-width: 11; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 50% 50%;
  transition: stroke-dashoffset 1s cubic-bezier(.4,0,.2,1);
}
.gauge-label{ text-align: center; }
.gauge-label strong{ display: block; font-family: var(--font-mono); font-size: 1.35rem; color: var(--milk); }
.gauge-label span{ font-size: 0.78rem; color: rgba(251,248,241,0.7); }

.stat-grid{ display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 28px; }
@media (max-width: 900px){ .stat-grid{ grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px){ .stat-grid{ grid-template-columns: 1fr; } }

.stat-card{
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 20px 22px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-soft);
  border-left: 4px solid var(--steel);
}
.stat-card.accent-gold{ border-left-color: var(--gold); }
.stat-card.accent-green{ border-left-color: var(--pasture); }
.stat-label{ font-size: 0.8rem; color: var(--ink-soft); font-weight: 600; }
.stat-value{ font-size: 1.5rem; font-weight: 600; color: var(--ink); }

.chart-panel, .table-panel{
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 26px 28px; margin-bottom: 24px; box-shadow: var(--shadow-soft);
}
.chart-panel-head{ display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.chart-panel-head p{ color: var(--ink-soft); font-size: 0.88rem; margin-top: 4px; }
.last-paid-pill{
  background: var(--milk-dim); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-size: 0.8rem; font-family: var(--font-mono); color: var(--pasture-dark); white-space: nowrap;
}
.chart-canvas-wrap{ position: relative; }

.table-panel h2{ margin-bottom: 16px; font-size: 1.25rem; }
.table-scroll{ overflow-x: auto; }
.data-table{ width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th{
  text-align: left; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-soft); padding: 10px 12px; border-bottom: 2px solid var(--line);
}
.data-table td{ padding: 12px; border-bottom: 1px solid var(--line); }
.data-table tr:last-child td{ border-bottom: none; }
.empty-row{ text-align: center; color: var(--ink-soft); padding: 24px !important; }

.badge{ display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; }
.badge-morning{ background: #FCF1D8; color: #8A6412; }
.badge-evening{ background: #E4EEF1; color: var(--steel); }

.dash-footer{ text-align: center; padding: 24px; color: var(--ink-soft); font-size: 0.82rem; }
