/* AP Calendar — shared design tokens & primitives
   Extracted from purina-post-calendar.html so both admin
   and calendar views share one source of truth. */

/* Vendored Inter - matches the PDF export font exactly. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/vendor/fonts/Inter-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/vendor/fonts/Inter-Medium.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/vendor/fonts/Inter-Bold.ttf") format("truetype");
}

:root {
  --navy:     #1a2e3d;
  --navy-mid: #1f3a4d;
  --beige:    #e8e0d0;
  --white:    #ffffff;
  --border:   rgba(26,46,61,0.11);
  --font:     "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--font);
  background: #eae4d9;
  color: var(--navy);
  min-width: 900px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ───────────────────────────────────────────────── */
.page-header {
  background: var(--navy);
  padding: 18px 36px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}
.logo { display: flex; align-items: center; }
.logo svg.logo-full { height: 46px; width: auto; display: block; }
.ap { fill: var(--beige); }
.header-center { text-align: center; }
.header-center h1 {
  font-size: 17px; font-weight: 300; color: var(--white);
  letter-spacing: .5px; white-space: nowrap;
}
.header-center h1 strong { font-weight: 700; }
.header-center .header-sub {
  font-size: 10px; font-weight: 500; letter-spacing: 2.5px;
  color: rgba(232,224,208,.45); text-transform: uppercase; margin-top: 5px;
}
.header-right {
  display: flex; align-items: center; gap: 12px; justify-content: flex-end;
}

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn-primary {
  background: var(--navy); color: var(--beige); border: none;
  padding: 9px 16px; border-radius: 3px; font-family: var(--font);
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-primary:hover  { background: var(--navy-mid); }
.btn-primary:active { transform: scale(.97); }

.btn-ghost {
  background: none; border: 1px solid rgba(26,46,61,.2); border-radius: 3px;
  padding: 6px 12px; font-family: var(--font); font-size: 10px;
  font-weight: 600; color: var(--navy); cursor: pointer;
  transition: all .12s; letter-spacing: .3px; text-transform: uppercase;
}
.btn-ghost:hover { background: rgba(26,46,61,.06); border-color: rgba(26,46,61,.35); }

.btn-ghost-light {
  background: none; border: 1px solid rgba(232,224,208,.35);
  border-radius: 3px; padding: 6px 12px; font-family: var(--font);
  font-size: 10px; font-weight: 600; color: rgba(232,224,208,.85);
  cursor: pointer; transition: all .12s; letter-spacing: .3px;
  text-transform: uppercase;
}
.btn-ghost-light:hover { background: rgba(232,224,208,.08); color: var(--beige); }

/* Primary action on a dark header. Solid beige fill + navy text reads
   as the obvious "do this" target against the navy setup-head bar.
   Same shape/sizing as .btn-ghost-light so it composes neatly with
   neighboring secondary buttons. */
.btn-save-light {
  background: var(--beige); color: var(--navy);
  border: 1px solid var(--beige); border-radius: 3px;
  padding: 6px 14px; font-family: var(--font);
  font-size: 10px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; cursor: pointer;
  transition: background .12s, border-color .12s, transform .1s;
}
.btn-save-light:hover  { background: #f1e9d6; border-color: #f1e9d6; }
.btn-save-light:active { transform: scale(.97); }

.btn-close-form {
  background: none; border: none; padding: 4px 8px;
  font-size: 16px; line-height: 1; color: rgba(232,224,208,.55);
  cursor: pointer; border-radius: 3px; transition: color .12s, background .12s;
  display: flex; align-items: center; justify-content: center;
}
.btn-close-form:hover { color: var(--beige); background: rgba(232,224,208,.1); }

.btn-danger {
  background: none; border: 1.5px solid rgba(169,50,38,.35);
  color: #a93226; padding: 7px 14px; border-radius: 3px;
  font-family: var(--font); font-size: 10px; font-weight: 700;
  letter-spacing: .8px; text-transform: uppercase; cursor: pointer;
  transition: all .12s;
}
.btn-danger:hover { background: rgba(169,50,38,.07); border-color: rgba(169,50,38,.6); }

/* ── AP-styled confirmation modal ──────────────────────────
   Drop-in replacement for the browser's confirm(). Used by
   confirmModal() in toast.js; markup is built on demand. */
.ap-modal-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: ap-modal-in .14s ease-out;
}
.ap-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 25, 35, .55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.ap-modal-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0,0,0,.28), 0 4px 12px rgba(0,0,0,.10);
  padding: 22px 22px 18px;
  animation: ap-modal-card-in .18s ease-out;
}
.ap-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -.1px;
}
.ap-modal-body {
  font-size: 13px;
  font-weight: 400;
  color: rgba(26,46,61,.72);
  line-height: 1.5;
  margin-top: 8px;
  white-space: pre-wrap;
}
.ap-modal-body:empty { display: none; }
.ap-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 22px;
}
.ap-modal-btn {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  border-radius: 3px;
  padding: 9px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s, transform .1s;
}
.ap-modal-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(26,46,61,.18);
}
.ap-modal-btn:active { transform: scale(.98); }
.ap-modal-btn-ghost {
  background: none;
  border-color: rgba(26,46,61,.25);
  color: var(--navy);
}
.ap-modal-btn-ghost:hover { background: rgba(26,46,61,.06); border-color: rgba(26,46,61,.4); }
.ap-modal-btn-primary {
  background: var(--navy);
  color: var(--beige);
  border-color: var(--navy);
}
.ap-modal-btn-primary:hover { background: var(--navy-mid); border-color: var(--navy-mid); }
.ap-modal-btn-primary.is-danger {
  background: #a93226;
  border-color: #a93226;
  color: #fff;
}
.ap-modal-btn-primary.is-danger:hover { background: #8e2a20; border-color: #8e2a20; }
.ap-modal-btn-primary.is-danger:focus { box-shadow: 0 0 0 3px rgba(169,50,38,.25); }

@keyframes ap-modal-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ap-modal-card-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1);  }
}

.btn-modal {
  border: none; padding: 8px 16px; border-radius: 3px;
  font-family: var(--font); font-size: 10px; font-weight: 700;
  letter-spacing: .8px; text-transform: uppercase; cursor: pointer;
  transition: background .12s, transform .1s;
}
.btn-modal:active { transform: scale(.97); }
.btn-save   { background: var(--navy); color: var(--beige); }
.btn-save:hover { background: #122030; }
.btn-cancel { background: #eae6de; color: var(--navy); }
.btn-cancel:hover { background: #e0dbd0; }

/* ── FORM INPUTS ─────────────────────────────────────────── */
.field-label {
  display: block; font-size: 9.5px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: rgba(26,46,61,.5); margin-bottom: 7px;
}
.text-input, .select-input {
  width: 100%; padding: 8px 10px;
  border: 1.5px solid rgba(26,46,61,.2); border-radius: 4px;
  font-family: var(--font); font-size: 12px; color: var(--navy);
  background: white; transition: border-color .12s; appearance: none;
}
.text-input:focus, .select-input:focus {
  outline: none; border-color: var(--navy);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* color-swatch wrapper around hidden <input type="color"> */
.color-swatch-btn {
  width: 32px; height: 22px; border-radius: 3px;
  flex-shrink: 0; display: block; position: relative; overflow: hidden;
  cursor: pointer; transition: transform .12s;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
}
.color-swatch-btn:hover { transform: scale(1.1); }
.color-swatch-btn input[type="color"] {
  opacity: 0; position: absolute; inset: -4px;
  width: calc(100% + 8px); height: calc(100% + 8px);
  cursor: pointer; border: none; padding: 0;
}

/* ── FOOTER ──────────────────────────────────────────────── */
.page-footer {
  background: var(--navy); padding: 13px 36px;
  display: flex; justify-content: space-between; align-items: center;
  border-top: 3px solid rgba(232,224,208,.12);
  margin-top: auto;
}
.footer-text {
  font-size: 9px; color: rgba(232,224,208,.3);
  letter-spacing: 1.5px; text-transform: uppercase;
}
.footer-center {
  font-size: 9px; color: rgba(232,224,208,.2);
  letter-spacing: 1px; text-transform: uppercase; text-align: center;
}

/* ── TOAST ───────────────────────────────────────────────── */
/* Compound layout: icon + message + optional Undo button. The
   colored left border is the kind signal; the icon reinforces it
   without forcing the user to read the text. */
#toast {
  position: fixed; bottom: 22px; left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--navy); color: var(--beige);
  padding: 8px 14px 8px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 500; letter-spacing: .3px;
  opacity: 0; pointer-events: none; white-space: nowrap;
  transition: opacity .2s, transform .2s; z-index: 9999;
  display: inline-flex; align-items: center; gap: 9px;
  border-left: 3px solid var(--beige);     /* default */
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;                     /* allow clicking Undo */
}
.toast-icon {
  display: inline-flex; align-items: center;
  flex-shrink: 0; line-height: 0;
  color: var(--beige);
}
.toast-msg { line-height: 1.2; }
.toast-undo {
  background: none; border: 1px solid rgba(232,224,208,.35);
  color: var(--beige); font-family: var(--font);
  font-size: 9.5px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; padding: 3px 8px; border-radius: 3px;
  cursor: pointer; margin-left: 4px;
  transition: background .12s, border-color .12s;
}
.toast-undo:hover { background: rgba(232,224,208,.12); border-color: var(--beige); }

/* Per-kind border + icon tint */
#toast.toast-success { border-left-color: #4baf5a; }
#toast.toast-success .toast-icon { color: #6ed084; }
#toast.toast-delete  { border-left-color: #c0392b; }
#toast.toast-delete  .toast-icon { color: #e57463; }
#toast.toast-sync    { border-left-color: #2e6da4; }
#toast.toast-sync    .toast-icon { color: #5b9ed8; }
#toast.toast-warn    { border-left-color: #d4a437; }
#toast.toast-warn    .toast-icon { color: #f0c264; }
#toast.toast-info    { border-left-color: var(--beige); }

/* ── DIALOG / MODAL BASE ─────────────────────────────────── */
.modal-dialog {
  border: none; border-radius: 6px; padding: 0;
  box-shadow: 0 8px 32px rgba(0,0,0,.28), 0 2px 8px rgba(0,0,0,.14);
  overflow: hidden;
  max-height: 92vh;
  /* The * { margin: 0 } reset above wipes out the UA's
     `dialog { margin: auto }` rule that centers showModal() dialogs in
     the inset:0 containing block. Restore it. */
  margin: auto;
}
.modal-dialog::backdrop { background: rgba(26,46,61,.52); }
.modal-head {
  background: var(--navy); color: var(--white);
  padding: 14px 18px 13px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: move;
  user-select: none;
}
.modal-head-title {
  font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
}
.modal-close {
  background: none; border: none; color: rgba(232,224,208,.6);
  font-size: 20px; cursor: pointer; line-height: 1;
  padding: 0 2px; transition: color .12s;
}
.modal-close:hover { color: var(--beige); }
.modal-body {
  padding: 20px 18px 4px;
  max-height: calc(92vh - 130px);
  overflow-y: auto;
}
.modal-foot {
  padding: 14px 18px 18px; display: flex; align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(26,46,61,.08); margin-top: 4px;
}
.modal-foot-right { display: flex; gap: 8px; }

/* ── APP SHELL (sidebar + main content row) ──────────────── */
.app-shell {
  display: flex;
  flex: 1;
  min-height: 0;       /* allow inner scroll without ballooning */
}
.app-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--navy-mid);
  border-right: 1px solid rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  box-shadow: 1px 0 0 rgba(232,224,208,.04) inset;
}
/* Main content takes the remaining width. Width comes from flex
   sizing now, not from the historical full-page assumption. */
.app-shell > .main-content {
  flex: 1;
  min-width: 0;
}

/* ── TAB STRIP — vertical sidebar nav ─────────────────────── */
.tab-strip {
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 14px 0 8px;
  border-bottom: none;
  box-shadow: none;
}
.tab-strip-btn {
  position: relative;
  background: none;
  border: none;
  padding: 11px 24px 11px 25px;
  margin: 0;
  text-align: left;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: rgba(232,224,208,.55);
  cursor: pointer;
  border-bottom: none;
  border-left: 3px solid transparent;
  transition: color .14s, background .14s, border-color .14s;

  /* Icon + label sit side-by-side; the SVG inherits color via
     currentColor so hover and active states tint both at once. */
  display: flex;
  align-items: center;
  gap: 12px;
}
.tab-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: .85;
  transition: opacity .14s;
}
.tab-strip-btn:hover .tab-icon,
.tab-strip-btn.is-active .tab-icon {
  opacity: 1;
}
.tab-strip-btn:hover {
  color: var(--beige);
  background: rgba(232,224,208,.04);
}
.tab-strip-btn.is-active {
  color: var(--beige);
  background: rgba(232,224,208,.06);
  border-left-color: var(--beige);
  border-bottom-color: transparent;
}
/* Subtle dot on the right edge of the active item — small visual
   anchor that mirrors the left accent stripe. */
.tab-strip-btn.is-active::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--beige);
  opacity: .8;
}

/* ── STATUS BADGE (shared by estimate list + future uses) ── */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  border-radius: 10px;
  line-height: 1.55;
}
.status-badge.status-draft    { background: #eae6de; color: rgba(26,46,61,.7); }
.status-badge.status-sent     { background: #d6e8f5; color: #1a5276; }
.status-badge.status-approved { background: #d4edda; color: #1e6b3c; }
.status-badge.status-archived { background: #ede7d6; color: rgba(26,46,61,.5); }

/* ── MAIN SHELL ──────────────────────────────────────────── */
.main-content { padding: 28px 28px 48px; flex: 1; }

/* hide attribute */
[hidden] { display: none !important; }

/* small print helpers */
.muted { color: rgba(26,46,61,.55); }
.tiny  { font-size: 10px; letter-spacing: .2px; }

/* ── MOBILE — let the page fit narrower viewports ───────── */
@media (max-width: 1024px) {
  body { min-width: 0; }
}

/* ── Phase A: hover + focus consistency ──────────────────────
   Single hover pattern for clickable rows, list items, and
   pills: faint cream tint + slight border darkening. Three
   different hover behaviors → one. */
:root {
  --hover-tint:    #faf8f2;
  --hover-border:  rgba(26,46,61,.18);
  --focus-ring:    var(--beige);
  --focus-ring-on-light: var(--navy);
}

/* Keyboard focus ring — visible only when focused via keyboard.
   The :focus-visible pseudo-class drops the ring on mouse clicks
   (which would be annoying noise) and shows it on Tab navigation. */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus-ring-on-light);
  outline-offset: 2px;
  border-radius: 3px;
}
/* Sidebar lives on a dark surface — flip the ring color so it
   reads against navy instead of disappearing. */
.app-sidebar button:focus-visible,
.page-header button:focus-visible,
.setup-head button:focus-visible {
  outline-color: var(--focus-ring);
}

/* Unify hover state for the linked-pill buttons so their hover
   matches the row pattern (cream tint, no harsh recolor). */
.prj-link-pill.is-clickable:hover {
  background: var(--hover-tint);
  color: var(--navy);
  box-shadow: 0 0 0 1px var(--hover-border) inset;
}
