/* ABAP Bakery App — shared styles */
:root {
  --brown: #6B4F3A;
  --tan: #D8C3A5;
  --light: #F5EFE6;
  --dark: #2F2A26;
  --red: #B23A2E;
  --green: #4A7C4E;
  --card: #ffffff;
  --line: #E3D8C6;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--light);
  color: var(--dark);
  padding-bottom: 80px;
}
header.topbar {
  background: var(--brown);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
header.topbar h1 { font-size: 18px; margin: 0; font-weight: 700; }
header.topbar .who { font-size: 12px; opacity: 0.85; }
.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
h2.section { font-size: 15px; color: var(--brown); margin: 22px 4px 8px; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.row .txt { flex: 1; font-size: 15px; line-height: 1.35; }
.row .sub { font-size: 12px; color: #8a7d6d; margin-top: 2px; }
.row.done .txt { text-decoration: line-through; color: #a99; }
input[type=checkbox] { width: 26px; height: 26px; accent-color: var(--brown); flex-shrink: 0; }
input[type=number], input[type=text], input[type=email], input[type=password] {
  font-size: 16px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; width: 100%; background: #fff;
}
button {
  font-size: 15px; font-weight: 600; padding: 12px 18px; border: none;
  border-radius: 10px; background: var(--brown); color: #fff; cursor: pointer;
}
button.secondary { background: var(--tan); color: var(--dark); }
button:active { opacity: .85; }
.pill { font-size: 11px; padding: 3px 9px; border-radius: 20px; font-weight: 700; }
.pill.below { background: #f7d5d0; color: var(--red); }
.pill.extra { background: #d9ead3; color: var(--green); }
.count-num { width: 84px !important; text-align: center; }
.below-row { background: #fbeae7; }
.progress-wrap { background: var(--line); border-radius: 20px; height: 14px; overflow: hidden; }
.progress-bar { background: var(--green); height: 100%; transition: width .3s; }
.big-num { font-size: 34px; font-weight: 800; color: var(--brown); }
.muted { color: #8a7d6d; font-size: 13px; }
.center { text-align: center; }
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; background: #fff;
  border-top: 1px solid var(--line); display: flex; justify-content: space-around;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
}
nav.tabs a {
  flex: 1; text-align: center; text-decoration: none; color: #8a7d6d;
  font-size: 11px; font-weight: 600; padding: 4px;
}
nav.tabs a.active { color: var(--brown); }
nav.tabs a .ico { display: block; font-size: 20px; margin-bottom: 2px; }
.login-box { max-width: 380px; margin: 12vh auto; padding: 28px; }
.login-box h1 { color: var(--brown); text-align: center; margin-top: 0; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; margin-bottom: 5px; font-weight: 600; }
.error { color: var(--red); font-size: 14px; margin: 10px 0; min-height: 18px; }
.empty { text-align: center; color: #8a7d6d; padding: 30px 10px; }

/* ============ v2 additions ============ */

/* Role chip in top bar */
.rolechip {
  background: var(--tan); color: var(--dark); font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 20px; margin-left: 4px; vertical-align: middle;
}

/* Prominent Order Extra / Counted toggle chips */
.toggle-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 2px solid var(--line); border-radius: 22px; padding: 7px 14px;
  font-size: 13px; font-weight: 600; margin-right: 8px; margin-top: 6px;
  background: #fff; user-select: none; transition: all .15s;
}
.toggle-chip input { display: none; }
.toggle-chip.on { border-color: var(--green); background: #e4f0e2; color: var(--green); }
.toggle-chip.on.extra { border-color: var(--brown); background: var(--light); color: var(--brown); }
.toggle-chip .box { width: 16px; height: 16px; border-radius: 4px; border: 2px solid currentColor; display: inline-block; position: relative; }
.toggle-chip.on .box::after { content: "✓"; position: absolute; inset: -4px 0 0 1px; font-size: 13px; }

/* Ordered / struck-through order rows */
.order-row.ordered .txt { text-decoration: line-through; color: #a99; }
.order-date { font-size: 11px; color: var(--green); font-weight: 700; }
button.mini { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

/* Report tables */
table.rpt { width: 100%; border-collapse: collapse; font-size: 14px; }
table.rpt th, table.rpt td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.rpt th { background: var(--tan); font-size: 12px; }
table.rpt td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ============ Responsive: iPad & desktop ============ */
@media (min-width: 700px) {
  .wrap { max-width: 960px; padding: 24px; }
  /* Two-column card grids where useful */
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
  .grid2 > .card, .grid2 > * { margin-bottom: 0; }
}

@media (min-width: 1000px) {
  .wrap { max-width: 1100px; }
  .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }

  /* Turn the bottom tab bar into a left side rail on desktop */
  nav.tabs {
    top: 0; bottom: 0; right: auto; width: 92px; flex-direction: column;
    justify-content: flex-start; padding-top: 24px; gap: 6px; border-top: none;
    border-right: 1px solid var(--line);
  }
  nav.tabs a { flex: none; padding: 12px 4px; }
  body { padding-bottom: 0; padding-left: 92px; }
  header.topbar { padding-left: 110px; }
}

/* Larger tap targets already good on mobile; ensure inputs scale on desktop */
@media (min-width: 700px) {
  .count-num { width: 110px !important; }
}

/* ============ v3: toggle buttons, handoff note, alerts ============ */

/* Order Extra / Counted as real toggle buttons */
.tbtn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: none; border-radius: 10px; padding: 9px 16px; margin: 6px 8px 0 0;
  font-size: 13px; font-weight: 700; background: #ece5da; color: #6b5d4a;
  transition: all .12s; -webkit-appearance: none;
}
.tbtn:active { transform: scale(.96); }
.tbtn.on.counted { background: var(--green); color: #fff; }
.tbtn.on.extra   { background: var(--brown); color: #fff; }
.tbtn .dot { font-size: 14px; line-height: 1; }

/* Shift handoff note */
.handoff textarea {
  width: 100%; min-height: 70px; resize: vertical; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  font-family: inherit; background: #fffdf9;
}
.handoff .saved { font-size: 12px; color: var(--green); font-weight: 700; height: 16px; }
.handoff-banner {
  background: #fff8e8; border: 1px solid #e8d9a8; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 14px; font-size: 15px; line-height: 1.4;
}
.handoff-banner .lbl { font-size: 11px; font-weight: 800; color: #a07d2c; text-transform: uppercase; letter-spacing: .04em; }

/* Alert badge on nav */
.nav-badge {
  position: absolute; top: 2px; right: 50%; transform: translateX(18px);
  background: var(--red); color: #fff; font-size: 10px; font-weight: 800;
  min-width: 17px; height: 17px; border-radius: 10px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
}
nav.tabs a { position: relative; }
.freshness { font-size: 11px; color: #a99; margin-top: 3px; }

/* ============ v8: cozy bakery dashboard ============ */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,900&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --crust: #6B4F3A;
  --espresso: #3D2E23;
  --cream: #FBF6EE;
  --butter: #F5E6C8;
  --sage: #7F9B6E;
  --berry: #C15B4A;
  --honey: #E0A43B;
}

.dash { font-family: 'Inter', -apple-system, sans-serif; }

/* Greeting hero */
.hero {
  background: linear-gradient(135deg, var(--crust), var(--espresso));
  color: #fff; border-radius: 20px; padding: 22px 24px; margin-bottom: 18px;
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(245,230,200,.18), transparent 70%);
}
.hero h1 {
  font-family: 'Fraunces', Georgia, serif; font-weight: 900; font-size: 26px;
  margin: 0 0 4px; line-height: 1.1;
}
.hero .sub { font-size: 14px; opacity: .85; }
.hero-ring { flex-shrink: 0; }

/* Metric cards — masonry columns so each card sizes to its OWN content
   (no more one tall card stretching its neighbors) */
.grid-dash {
  column-gap: 14px;
  column-count: 1;
}
@media (min-width: 620px) { .grid-dash { column-count: 2; } }
@media (min-width: 1000px) { .grid-dash { column-count: 3; } }
@media (min-width: 1500px) { .grid-dash { column-count: 4; } }
.grid-dash > .wcard {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  margin-bottom: 14px;
  display: inline-block;
  width: 100%;
}

.wcard {
  background: #fff; border: 1px solid #EADFCB; border-radius: 18px; padding: 18px;
  position: relative; transition: box-shadow .2s, transform .2s;
  box-shadow: 0 1px 2px rgba(61,46,35,.04);
}
.wcard:hover { box-shadow: 0 6px 20px rgba(61,46,35,.10); }
.wcard.dragging { opacity: .5; }
.wcard.drag-over { border-color: var(--crust); border-style: dashed; }
.wcard h3 {
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 15px; color: var(--espresso);
  margin: 0 0 12px; display: flex; align-items: center; gap: 7px;
}
.wcard .grip {
  cursor: grab; color: #C9BBA5; font-size: 16px; margin-left: auto; touch-action: none;
  user-select: none; padding: 2px 4px;
}
.wcard .grip:active { cursor: grabbing; }
.wcard .wremove {
  background: none; border: none; color: #C9BBA5; cursor: pointer; font-size: 15px;
  padding: 2px 4px; margin-left: 2px;
}
.wcard .wremove:hover { color: var(--berry); }

.stat-big { font-family: 'Fraunces', serif; font-weight: 900; font-size: 40px; color: var(--crust); line-height: 1; }
.stat-label { font-size: 13px; color: #8A7B66; margin-top: 4px; }
.stat-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }

/* Progress ring (SVG) */
.ring-wrap { display: flex; align-items: center; justify-content: center; }
.ring-num { font-family: 'Fraunces', serif; font-weight: 900; font-size: 22px; fill: #fff; }

/* Chips / mini lists inside cards */
.mini-item { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid #F0E9DA; font-size: 14px; }
.mini-item:last-child { border-bottom: none; }
.dot-tag { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Widget tray (add removed widgets back) */
.tray { background: #F3ECDD; border: 1px dashed #D8C7A8; border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.tray-chip {
  display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid #E0D2B8;
  border-radius: 20px; padding: 6px 12px; font-size: 13px; margin: 4px 6px 0 0; cursor: pointer;
}
.tray-chip:hover { border-color: var(--crust); }

.dash-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.dash-toolbar .tbtn { margin: 0; }

/* clickable chart legend cue */
.clickable { cursor: pointer; }
.clickable:hover { filter: brightness(1.05); }

@media (prefers-reduced-motion: reduce) {
  .wcard { transition: none; }
}
