/* ===== BBTH modern UI reskin (preview) =====
   Loaded AFTER style.css / admin.css / items.css. Visual-only:
   same DOM, same JS, same data, same PDF output (PDF styles not touched). */
:root {
  --m-green: #4f6f5e;
  --m-green-d: #3a5546;
  --m-green-l: #64856f;
  --m-gold: #c9a227;
  --m-bg: #f1f3ec;
  --m-card: #ffffff;
  --m-ink: #1e2b26;
  --m-mut: #66756e;
  --m-line: #dcdfd2;
  --m-radius: 14px;
  --m-shadow: 0 2px 10px rgba(58,85,70,.08);
  --m-shadow-l: 0 10px 30px rgba(58,85,70,.16);
  --f-head: 'Poppins', sans-serif;
}
body { background: var(--m-bg); color: var(--m-ink); -webkit-font-smoothing: antialiased; }

/* ---------- shared form components ---------- */
.field input, .field textarea, .search, .pick, .add-row input, .edit-row input, textarea, .svc-fields input {
  border: 1.5px solid var(--m-line) !important; border-radius: 10px !important; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .search:focus, .pick:focus, textarea:focus {
  border-color: var(--m-green) !important; box-shadow: 0 0 0 3px rgba(79,111,94,.16); outline: none;
}
.next-btn, .generate-btn, .small-btn, #loginBtn {
  border-radius: 10px !important; letter-spacing: .2px;
  transition: transform .06s ease, filter .15s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(58,85,70,.18);
}
.next-btn:active, .generate-btn:active, .small-btn:active { transform: scale(.985); }
.next-btn:hover, .small-btn:hover { filter: brightness(1.06); }

/* ---------- login ---------- */
.login-full { background: linear-gradient(165deg, #3a5546 0%, #4f6f5e 46%, #eef1ef 46.2%, #eef1ef 100%); }
.login-card { border: none !important; border-radius: 18px !important; box-shadow: var(--m-shadow-l) !important; }
.login-card h2 { font-family: 'Poppins', sans-serif !important; font-weight: 600; }

/* ---------- admin shell: top app bar ---------- */
.shell { background: var(--m-bg); }
.topbar {
  background: #fff !important; border-bottom: 1px solid var(--m-line) !important;
  box-shadow: var(--m-shadow) !important; margin: 0 -26px 20px !important; padding: 12px 20px !important;
  gap: 10px;
}
.topbar h1 { font-family: 'Poppins', sans-serif !important; font-size: 19px !important; font-weight: 600; color: var(--m-green-d) !important; }
#menuBtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border: none; border-radius: 12px; cursor: pointer;
  background: var(--m-green); color: #fff; flex: 0 0 auto;
  transition: background .15s, transform .06s ease;
}
#menuBtn:hover { background: var(--m-green-l); }
#menuBtn:active { transform: scale(.94); }
#menuBtn svg { width: 22px; height: 22px; }

/* ---------- admin: sidebar = drawer on phone, always visible on web (Deep 31 Oct) ---------- */
.side {
  position: fixed !important; left: 0; top: 0; z-index: 200;
  width: 280px !important; flex-basis: 280px !important; max-width: 84vw;
  height: 100dvh !important;
  transform: translateX(-102%);
  transition: transform .22s cubic-bezier(.2,.8,.25,1);
  box-shadow: none;
}
body.menu-open .side { transform: translateX(0); box-shadow: var(--m-shadow-l); }
#menuScrim {
  position: fixed; inset: 0; z-index: 190; background: rgba(28,40,33,.45);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
body.menu-open #menuScrim { opacity: 1; pointer-events: auto; }
.main-wrap { width: 100%; }
@media (min-width: 900px) {
  .side { position: sticky !important; transform: none !important; max-width: none;
    transition: width .22s cubic-bezier(.2,.8,.25,1), padding .22s, opacity .2s; overflow: hidden; }
  body:not(.menu-open) .side { width: 0 !important; flex-basis: 0 !important; padding-left: 0 !important; padding-right: 0 !important; opacity: 0; border: 0 !important; }
  #menuScrim { display: none !important; }
  .main-wrap { width: auto; flex: 1; min-width: 0; }
}

/* ---------- dashboard & cards ---------- */
.dash-hero { border-radius: var(--m-radius); box-shadow: var(--m-shadow); }
.stat-card { border-radius: var(--m-radius); box-shadow: var(--m-shadow); }
.tab-panel { border-radius: var(--m-radius); border: 1px solid var(--m-line) !important; box-shadow: var(--m-shadow) !important; }
.tab-panel h2 { font-family: 'Poppins', sans-serif !important; font-weight: 600; border-bottom-color: var(--m-line) !important; }
.qrow, .order-row, .svc-item, .summary, .ucard, .user-form, .dash-card {
  border-radius: 12px !important; border-color: var(--m-line) !important;
}
.dash-card { background: #fff; box-shadow: var(--m-shadow); }

/* ---------- /app quotation maker header ---------- */
.app-header { background: var(--m-green); box-shadow: var(--m-shadow); position: sticky; top: 0; z-index: 40; }
.app-header h1 { font-weight: 600; }
.steps { box-shadow: var(--m-shadow); }
.steps .step-btn { border: 1.5px solid var(--m-line) !important; border-radius: 999px !important; font-size: 14px !important; padding: 10px 14px !important; }
.steps .step-btn.active { background: var(--m-green) !important; border-color: var(--m-green) !important; }

/* drawer buttons: keep list layout against generic .step-btn rules */
.side-nav { display: flex !important; flex-direction: column !important; flex-wrap: nowrap !important; gap: 4px; }
.side-nav .step-btn {
  display: flex !important; flex-direction: row !important; align-items: center; gap: 11px;
  width: 100% !important; min-width: 0 !important; flex: 0 0 auto !important;
  text-align: left; background: transparent !important; border: none !important;
  border-radius: 10px !important; color: #e8eee4 !important; font-size: 14px !important;
  padding: 12px 14px !important; box-shadow: none !important; white-space: normal !important;
}
.side-nav .step-btn:hover { background: rgba(255,255,255,.08) !important; color: #fff !important; }
.side-nav .step-btn.active { background: rgba(255,255,255,.14) !important; color: #fff !important; box-shadow: inset 3px 0 0 var(--m-gold) !important; }

/* topbar: hamburger + title share row 1; actions wrap to row 2 right-aligned */
.topbar { flex-wrap: wrap; row-gap: 8px; }
.topbar h1 { flex: 1; min-width: 0; }
.top-right { margin-left: auto; }

/* ---------- catalogue (items) polish ---------- */
.svc-item { box-shadow: var(--m-shadow); border-width: 1.5px !important; }
.svc-item.on { background: #f2f7f4 !important; border-color: var(--m-green) !important; }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  .topbar { margin: 0 -14px 16px !important; padding: 10px 14px !important; }
  .main-wrap { padding: 0 14px 50px !important; }
  #topDate { display: none; }
  /* 31 Oct fix: at phone width hamburger+title+actions all "fit" one row by crushing
     the h1 (flex:1 1 0) until the title cropped under Refresh. Force actions to
     their own row so the title keeps its full width. */
  .top-right { flex: 0 0 100%; margin-left: 0; justify-content: flex-end; }
  .dash-hero { padding: 20px; }
}

/* ---------- gold accents (sage + gold theme) ---------- */
.generate-btn, .small-btn, .countpill { background: var(--m-gold) !important; color: #2e2a17 !important; }
.dash-cta { background: linear-gradient(120deg, #d9b845, #c9a227) !important; color: #2e2a17 !important; }
.side { background: linear-gradient(180deg, #33473b 0%, #40584a 60%, #4a6354 100%) !important; }
.side-nav .step-btn.active { box-shadow: inset 3px 0 0 var(--m-gold) !important; }
.svc-head input[type=checkbox] { accent-color: var(--m-gold) !important; }
#admRemember { accent-color: var(--m-green) !important; }

/* ---------- light professional animations ---------- */
@keyframes mPanelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tab-panel:not(.hidden) { animation: mPanelIn .22s ease-out; }
@keyframes mFadeIn { from { opacity: 0; } to { opacity: 1; } }
.step-panel:not(.hidden) { animation: mPanelIn .22s ease-out; }
.side-nav .step-btn { transition: background .15s, color .15s, transform .06s ease !important; }
.side-nav .step-btn:active { transform: scale(.97); }
.step-btn { transition: background .18s, color .18s, border-color .18s !important; }
.qrow, .svc-item, .order-row, .ucard { transition: box-shadow .18s, border-color .18s; }
.qrow:hover, .svc-item:hover { box-shadow: var(--m-shadow); }
.next-btn, .generate-btn, .small-btn { position: relative; }
.next-btn:focus-visible, .small-btn:focus-visible, #menuBtn:focus-visible, .step-btn:focus-visible {
  outline: 2px solid var(--m-gold); outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .tab-panel:not(.hidden), .step-panel:not(.hidden) { animation: none !important; }
  .side { transition: none !important; }
  * { scroll-behavior: auto !important; }
}

/* ---------- catalogue editor (iframe) mobile fit ---------- */
#toolbar, .toolbar, .tools-row { flex-wrap: wrap !important; }
input[placeholder*="Search"], input[type=search] { max-width: 100% !important; min-width: 0 !important; flex: 1 1 100% !important; width: 100% !important; box-sizing: border-box !important; }
.cat-head, .cat-header { flex-wrap: wrap !important; row-gap: 6px; }

/* editable category-name inputs must not clip */
.cat-head input, .cat-header input, input.cat-name { min-width: 0 !important; flex: 1 1 auto !important; width: auto !important; max-width: 100%; box-sizing: border-box !important; }
input.cname { flex: 1 1 130px !important; min-width: 110px !important; width: auto !important; }

/* ---------- polish pass 2 ---------- */
/* any text-ish input must never overflow its card */
.tab-panel input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]):not([type=date]),
.dash-card input:not([type=checkbox]) { max-width: 100% !important; box-sizing: border-box !important; }
/* editor category header: keep delete button inside the card */
.cathead { display: flex !important; flex-wrap: wrap !important; align-items: center; gap: 8px; }
.cathead .cname { flex: 1 1 120px !important; min-width: 100px !important; }
.cathead .cnt { flex: 0 0 auto; }
.cathead .ibtn.del { flex: 0 0 auto; padding: 8px 10px !important; font-size: 13px !important; white-space: nowrap; }
/* staff /app header: tighter on phones */
@media (max-width: 720px) {
  .app-header { flex-wrap: wrap; align-items: center; row-gap: 6px; column-gap: 6px; padding: 10px 12px !important; }
  .app-header img { width: 34px !important; }
  .app-header h1 { font-size: 16px !important; }
  .app-header p { display: none; }
  .app-header .backlink, .app-header button, #mkUndo, #mkRedo { padding: 4px 10px !important; font-size: 12px !important; }
}

/* --- 31 Oct: Clients sub-tabs, Completed docs toggle, in-panel quotation form --- */
button.dash-cta { border: 0; cursor: pointer; font-family: inherit; }
.reg-subtabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.reg-sub { border: 1.5px solid #264a3b; background: #fff; color: #264a3b; border-radius: 999px; padding: 8px 16px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; }
.reg-sub.active { background: #264a3b; color: #f2d765; }
.reg-sub-n { display: inline-block; min-width: 20px; text-align: center; background: rgba(201,162,39,.25); border-radius: 999px; padding: 1px 6px; font-size: 11.5px; }
.reg-sub.active .reg-sub-n { background: rgba(242,215,101,.25); }
tr.reg-grp td { background: #264a3b; color: #f2d765; font-weight: 600; font-size: 12.5px; letter-spacing: .6px; text-transform: uppercase; padding: 7px 12px; border-radius: 0; }
tr.reg-grp .reg-grp-n { background: rgba(242,215,101,.25); border-radius: 999px; padding: 1px 8px; font-size: 11px; margin-left: 4px; }
.reg-nodate { color: #a33; font-size: 12px; font-style: italic; }
#compToggle.on { background: #264a3b; color: #f2d765; border-color: #264a3b; }
#tab-quote iframe { display: block; }
a.foot-tab { cursor: pointer; }
