/* SIMMER — app shell: top bar, tabs, buttons, forms, chips, toasts */

#app { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.topbar {
  height: var(--bar);
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
  background: var(--pine);
  color: #F1EFE6;
  box-shadow: var(--shadow-1);
  position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: baseline; gap: 9px; text-decoration: none; color: inherit; }
.brand b {
  font-family: var(--serif); font-size: 23px; font-weight: 600;
  letter-spacing: .09em;
}
.brand small {
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: rgba(241,239,230,.62);
}

.tabs { display: flex; gap: 2px; margin-left: 12px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  color: rgba(241,239,230,.72);
  font: inherit; font-size: 13.5px; font-weight: 500;
  padding: 8px 13px; border-radius: var(--r); white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.tab:hover { background: rgba(255,255,255,.09); color: #fff; }
.tab.on { background: rgba(255,255,255,.15); color: #fff; font-weight: 600; }
.tab .badge {
  background: var(--copper); color: #fff; border-radius: 20px;
  font-size: 10.5px; font-weight: 700; padding: 1px 6px; line-height: 1.5;
}

.topbar-right { display: flex; align-items: center; gap: 8px; }
.who { font-size: 12px; color: rgba(241,239,230,.7); white-space: nowrap; }
.who b { color: #fff; font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 8px 14px; border-radius: var(--r);
  border: 1px solid var(--shade-2); background: var(--paper-2); color: var(--ink);
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: #fff; border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--pine); border-color: var(--pine-dk); color: #fff; }
.btn-primary:hover { background: var(--pine-dk); border-color: var(--pine-dk); }
.btn-accent { background: var(--copper); border-color: #96521f; color: #fff; }
.btn-accent:hover { background: #96521f; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--shade); border-color: transparent; color: var(--ink); }
.btn-danger { color: var(--expired); border-color: #e3c3c3; background: var(--expired-bg); }
.btn-danger:hover { background: #f0cccc; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 7px 9px; }

.topbar .btn {
  background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.22); color: #fff;
}
.topbar .btn:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.4); }
.topbar .btn-accent { background: var(--copper); border-color: #96521f; }
.topbar .btn-accent:hover { background: #c87136; }

/* ---------- forms ---------- */
label.fld { display: block; margin-bottom: 12px; }
label.fld > span {
  display: block; margin-bottom: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .11em;
  text-transform: uppercase; color: var(--ink-3);
}
input[type=text], input[type=number], input[type=date], input[type=password],
input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--shade-2); border-radius: var(--r);
  background: var(--enamel); color: var(--ink);
  box-shadow: var(--shadow-in);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--pine);
  box-shadow: 0 0 0 3px var(--pine-lt);
}
textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
select { cursor: pointer; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; line-height: 1;
  padding: 4px 9px; border-radius: 20px;
  background: var(--shade); color: var(--ink-2);
  border: 1px solid transparent; white-space: nowrap;
}
.chip.fresh   { background: var(--fresh-bg);   color: var(--fresh);   }
.chip.soon    { background: var(--soon-bg);    color: #8a6a12;        }
.chip.urgent  { background: var(--urgent-bg);  color: var(--urgent);  }
.chip.expired { background: var(--expired-bg); color: var(--expired); }
.chip.pine    { background: var(--pine-lt);    color: var(--pine);    }
.chip.copper  { background: var(--copper-lt);  color: var(--copper);  }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.fresh { background: var(--fresh); } .dot.soon { background: var(--soon); }
.dot.urgent { background: var(--urgent); } .dot.expired { background: var(--expired); }

/* filter pills */
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  appearance: none; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 5px 12px; border-radius: 20px;
  border: 1px solid var(--shade-2); background: var(--paper-2); color: var(--ink-2);
}
.pill:hover { border-color: var(--ink-3); color: var(--ink); }
.pill.on { background: var(--pine); border-color: var(--pine); color: #fff; }

/* ---------- layout primitives ---------- */
.view { flex: 1; padding: 20px; display: none; }
.view.on { display: block; }
.view-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.view-head h1 { font-size: 26px; }
.view-head .sub { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.view-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--paper-2); border: 1px solid var(--shade);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.card-head {
  padding: 13px 16px; border-bottom: 1px solid var(--shade);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h3 { font-size: 16px; }
.card-body { padding: 16px; }

.empty {
  text-align: center; padding: 46px 20px; color: var(--ink-3);
}
.empty .big { font-size: 34px; margin-bottom: 10px; opacity: .5; }
.empty h3 { font-size: 17px; color: var(--ink-2); margin-bottom: 6px; }
.empty p { font-size: 13.5px; margin: 0 auto; max-width: 420px; }

/* ---------- toasts ---------- */
#toasts {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--ink); color: #F4EFE4;
  padding: 10px 18px; border-radius: 22px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-2);
  animation: toast-in .18s ease-out;
  max-width: 90vw;
}
.toast.good { background: var(--pine); }
.toast.warn { background: var(--copper); }
.toast.bad  { background: var(--expired); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- misc ---------- */
.hidden { display: none !important; }
.spin {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- the hamburger (mobile only) ---------- */
.menu-btn {
  display: none;
  position: relative;
  appearance: none; border: 0; background: transparent; cursor: pointer;
  width: 38px; height: 38px; border-radius: var(--r);
  align-items: center; justify-content: center; flex: none;
  padding: 0;
}
.menu-btn:hover { background: rgba(255,255,255,.12); }
/* three bars drawn from one element */
.menu-btn .bars,
.menu-btn .bars::before,
.menu-btn .bars::after {
  content: ""; display: block;
  width: 19px; height: 2px; border-radius: 2px;
  background: #F1EFE6;
  transition: transform .18s ease, opacity .14s ease;
}
.menu-btn .bars { position: relative; }
.menu-btn .bars::before { position: absolute; top: -6px; }
.menu-btn .bars::after  { position: absolute; top: 6px; }
/* becomes an X when open */
.menu-btn[aria-expanded="true"] .bars { background: transparent; }
.menu-btn[aria-expanded="true"] .bars::before { transform: translateY(6px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .bars::after  { transform: translateY(-6px) rotate(-45deg); }

.menu-badge {
  position: absolute; top: 3px; right: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 10px; background: var(--copper); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--pine);
}

.menu-scrim {
  display: none;
  position: fixed; inset: var(--bar) 0 0; z-index: 35;
  background: rgba(34,37,30,.45);
}
.menu-scrim.on { display: block; }

/* the desktop-only footer block inside the nav */
.menu-foot { display: none; }

@media (max-width: 860px) {
  .topbar { padding: 0 8px; gap: 6px; }
  .brand small { display: none; }
  .brand b { font-size: 20px; }
  .topbar > .who { display: none; }
  .topbar-right > #btn-auth,
  .topbar-right > #btn-settings { display: none; }

  .menu-btn { display: flex; }

  /* the tab strip becomes a drawer that slides down from the bar */
  .tabs {
    position: fixed; top: var(--bar); left: 0; right: 0; z-index: 36;
    margin: 0; flex-direction: column; gap: 2px; overflow: visible;
    background: var(--pine-dk);
    padding: 8px;
    box-shadow: var(--shadow-2);
    transform: translateY(-8px);
    opacity: 0; pointer-events: none;
    transition: transform .16s ease, opacity .14s ease;
    max-height: calc(100vh - var(--bar)); overflow-y: auto;
  }
  .tabs.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .tab {
    width: 100%; justify-content: flex-start;
    font-size: 15px; padding: 12px 14px; border-radius: var(--r);
  }
  .tab .badge { margin-left: auto; }

  .menu-foot {
    display: block;
    margin-top: 8px; padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,.16);
  }
  .menu-foot .who {
    display: block; text-align: center;
    font-size: 12px; color: rgba(241,239,230,.7); margin-bottom: 9px;
  }
  .menu-foot .btn { margin-bottom: 6px; }

  .view { padding: 14px 12px 90px; }
  .view-head h1 { font-size: 21px; }
  .view-head { gap: 10px; margin-bottom: 14px; }
  .view-actions { width: 100%; }
  .view-actions .btn { flex: 1; justify-content: center; }
}
