:root {
  --cream: #F7F1E8;
  --paper: #FFFDF9;
  --ink: #1F1A17;
  --ink-2: #5E5348;
  --muted: #8A7D6E;
  --gold: #B8913A;
  --gold-dark: #8C6C25;
  --gold-soft: #F1E6CC;
  --line: #E8DFD1;
  --green: #1E8E4E;
  --wa: #1FA855;
  --red: #B3372B;
  --warn-bg: #FFF4DA;
  --radius: 12px;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { font-feature-settings: 'lnum' 1; margin: 0; background: var(--cream); color: var(--ink); font: 15px/1.5 var(--sans); padding-bottom: 84px; }
body.bare { padding-bottom: 0; }
a { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { font-variant-numeric: lining-nums; font-feature-settings: 'lnum' 1; font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 12px; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h1 small, h2 small { font-family: var(--sans); font-size: 15px; font-weight: 400; }
.muted { color: var(--muted); }
small { color: var(--muted); }
code { background: var(--gold-soft); padding: 1px 6px; border-radius: 4px; font-size: 13px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 18px 16px 24px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px; padding: 10px 16px;
  background: rgba(247, 241, 232, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-family: var(--serif); font-size: 22px; font-weight: 600; }
.brand:hover { text-decoration: none; }
.topnav { display: flex; gap: 4px; flex: 1; }
.topnav a { padding: 6px 12px; border-radius: 20px; color: var(--ink-2); font-weight: 500; }
.topnav a.on, .topnav a:hover { background: var(--gold-soft); color: var(--ink); text-decoration: none; }
.who { display: flex; gap: 12px; align-items: center; color: var(--ink-2); font-size: 14px; }

/* bottom tab bar (phones) */
.tabbar { display: none; }
@media (max-width: 760px) {
  .topnav, .who span { display: none; }
  .topbar { justify-content: space-between; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--paper);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 500; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a.on { color: var(--ink); }
  .tabbar a[data-add] svg { background: var(--ink); color: var(--cream); border-radius: 50%; padding: 4px; width: 32px; height: 32px; margin-top: -6px; }
  h1 { font-size: 26px; }
}

/* cards & layout */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.page-head h1 { margin: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols > .card:only-child { grid-column: 1 / -1; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; gap: 0; } }
.narrow { max-width: 460px; }
.empty { text-align: center; padding: 28px 16px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0 22px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; }
.stat span { color: var(--muted); font-size: 13px; }
.stat b { font-size: 26px; font-weight: 600; letter-spacing: -.01em; line-height: 1.1; margin-top: 2px; }

.fu-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 22px; }
@media (max-width: 760px) { .fu-grid { grid-template-columns: repeat(2, 1fr); } }
.fu-tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: var(--ink-2); display: flex; flex-direction: column; }
.fu-tile b { font-size: 24px; font-weight: 600; color: var(--muted); line-height: 1.1; }
.fu-tile span { font-size: 13px; }
.fu-tile.has { border-color: var(--gold); background: #FFF9EC; }
.fu-tile.has b { color: var(--gold-dark); }
.fu-tile:hover { text-decoration: none; border-color: var(--gold-dark); }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list li > a, .list li > span:first-child { display: flex; flex-direction: column; min-width: 0; color: var(--ink); }
.list li > a:hover { text-decoration: none; }
.list li > a b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li.off { opacity: .5; }
.list.compact li { padding: 7px 0; }
.list.card { padding: 4px 16px; }
.amt { font-weight: 600; white-space: nowrap; }
.actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.actions form { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.btn-icon { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.btn-icon svg { width: 20px; height: 20px; fill: #fff; }
.btn-icon.call { background: var(--ink); }
.btn-icon.wa { background: var(--wa); }
.btn-icon:hover { opacity: .85; }
.actions.big .btn-icon { width: 48px; height: 48px; }
.actions.big .btn-icon svg { width: 24px; height: 24px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--line); white-space: nowrap; }
.count { font-family: var(--sans); font-size: 14px; background: var(--gold-soft); color: var(--gold-dark); border-radius: 10px; padding: 1px 9px; vertical-align: middle; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: 500 15px var(--sans); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--gold); text-decoration: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.btn.primary:hover { background: #3a312b; }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); }
.btn.full { width: 100%; }

/* forms */
label { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: 14px; margin-bottom: 14px; color: var(--ink-2); }
input, select, textarea { font: 16px var(--sans); color: var(--ink); background: #fff; border: 1px solid #D9CEBD; border-radius: 10px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; color: var(--ink); }
label.check input { width: 20px; height: 20px; margin-top: 1px; flex-shrink: 0; accent-color: var(--ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid2 .span2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.search { display: flex; gap: 8px; margin-bottom: 16px; }
.search input { flex: 1; font-size: 17px; padding: 13px 16px; border-radius: 12px; }

.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; background: #E6F4EA; color: #14532D; border: 1px solid #BFE3CB; }
.flash.err { background: #FDECEA; color: #7A1F16; border-color: #F3C4BE; }
.flash.warn { background: var(--warn-bg); color: #6B4E00; border-color: #F0DBA0; }

/* login */
.login { max-width: 380px; margin: 6vh auto 0; padding: 0 16px; }
.login-logo { display: block; width: 210px; margin: 0 auto 18px; border-radius: 16px; }

/* client profile */
.profile-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.profile-top h1 { margin-bottom: 2px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 16px; margin: 16px 0; }
.facts dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 2px 0 0; }
.notes { background: var(--cream); border-radius: 8px; padding: 10px 12px; white-space: normal; }
.wa-pick { position: relative; }
.wa-pick summary { list-style: none; }
.wa-pick summary::-webkit-details-marker { display: none; }
.wa-pick .menu { position: absolute; z-index: 5; top: 46px; left: 0; background: var(--paper); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(31, 26, 23, .12); min-width: 190px; padding: 6px; }
.wa-pick .menu a { display: block; padding: 9px 12px; border-radius: 6px; color: var(--ink); }
.wa-pick .menu a:hover { background: var(--gold-soft); text-decoration: none; }
.visits { list-style: none; margin: 0; padding: 0; }
.visits li { position: relative; padding: 12px 0; border-top: 1px solid var(--line); }
.visits li:first-child { border-top: 0; }
.v-head { display: flex; justify-content: space-between; padding-right: 0; }
.v-items { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { background: var(--gold-soft); color: #5B4515; border-radius: 14px; padding: 3px 10px; font-size: 13px; }
.edit-link { position: absolute; right: 0; bottom: 12px; font-size: 13px; }
.danger-zone { text-align: center; margin: 8px 0 16px; }

/* visit form */
.svc-filter { margin-bottom: 14px; font-size: 16px; }
.svc-group { padding: 8px 16px; }
fieldset { border: 1px solid var(--line); }
legend { font-family: var(--serif); font-size: 20px; font-weight: 600; padding: 0 6px; }
.svc { flex-direction: row; align-items: center; gap: 10px; margin: 0; padding: 9px 0; border-top: 1px solid var(--line); font-weight: 400; color: var(--ink); cursor: pointer; }
.svc:first-of-type { border-top: 0; }
.svc input[type=checkbox] { width: 22px; height: 22px; flex-shrink: 0; accent-color: var(--ink); }
.svc-name { flex: 1; }
.svc.on .svc-name { font-weight: 600; }
.svc-price { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.svc-price input { width: 92px; padding: 7px 8px; text-align: right; }
.extra-row { display: flex; gap: 10px; margin-bottom: 8px; }
.extra-row > input { flex: 1; }
.totalbar { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--ink);
  color: var(--cream); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
.totalbar small { color: #CDBFA9; display: block; }
.totalbar b { font-size: 26px; font-weight: 600; }
.totalbar .btn.primary { background: var(--gold); border-color: var(--gold); color: var(--ink); }
@media (max-width: 760px) { .totalbar { bottom: 70px; } }

/* services table */
.table-wrap { overflow-x: auto; }
.svc-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.svc-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 6px; }
.svc-table td { padding: 4px; }
.svc-table td input { padding: 7px 8px; font-size: 14px; }
.svc-table td:nth-child(3) input, .svc-table td:nth-child(4) input { width: 100px; }
.svc-table td:nth-child(5) input { width: 70px; }
.svc-table td:last-child { text-align: center; }
.svc-table td:last-child input { width: 20px; height: 20px; accent-color: var(--ink); }
.svc-table tr.off input:not([type=checkbox]) { color: var(--muted); }
.svc-table .new-row td { padding-top: 12px; }

.menu-list { padding: 4px 16px; }
.menu-list a { display: flex; flex-direction: column; padding: 13px 0; border-top: 1px solid var(--line); color: var(--ink); }
.menu-list a:first-child { border-top: 0; }
.menu-list a:hover { text-decoration: none; color: var(--gold-dark); }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; }

.web-alert { display: block; margin-top: 4px; color: #6B4E00; }
.web-alert:hover { text-decoration: none; border-color: var(--gold); }

/* website photos */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.slot { display: flex; flex-direction: column; gap: 4px; }
.slot-img { aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: repeating-linear-gradient(135deg, #EFE6D8 0 12px, #EAE0CF 12px 24px);
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.slot-img img { width: 100%; height: 100%; object-fit: cover; }
.slot small { margin-bottom: 6px; line-height: 1.35; }
.slot .btn { align-self: flex-start; }
.upload-btn { cursor: pointer; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.gal-item { display: flex; flex-direction: column; gap: 6px; }
.gal-item img { aspect-ratio: 1; width: 100%; object-fit: cover; border-radius: 8px; }
.upload-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(31, 26, 23, .45); display: flex; align-items: center; justify-content: center; }
.upload-overlay[hidden] { display: none; }
.upload-overlay .card { font-weight: 600; padding: 20px 28px; }
