/* GlassFinders CRM design tokens and shared classes (same language as the showerglassfinder.com redesign).
   Modules use these classes; never hard-code colors in a module, use the variables.
   Classes: .gf-page-head .gf-title .gf-sub .gf-card .gf-grid (auto columns) .gf-row (flex row, wraps) .gf-stack (vertical gap)
            .gf-btn (.primary .ghost .danger .small) .gf-input .gf-table-wrap .gf-table .gf-badge .gf-muted .gf-empty
            .gf-stat .gf-tabs .gf-tab .gf-toolbar .gf-form .gf-field .gf-kv (label/value list) .gf-call (big green call button) */
:root {
  --bg: #FAFAF7; --ink: #192724; --primary: #245C52; --primary-ink: #fff; --primary-soft: #E3EEEA;
  --sand: #EDE7DC; --sand-2: #F5F1EA; --brass: #B49A70; --slate: #5A6762; --line: #E3DDD2; --card: #FFFFFF;
  --red: #A23B32; --red-soft: #F6E3E0; --green: #2E7D4F; --green-soft: #E2F1E7; --blue: #2F5D8A; --blue-soft: #E3ECF5; --amber: #8A6512; --amber-soft: #F6EDD9;
  --radius: 12px; --radius-sm: 10px; --shadow: 0 1px 2px rgba(25, 39, 36, .06), 0 2px 8px rgba(25, 39, 36, .04);
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; --serif: "DM Serif Display", Georgia, "Times New Roman", serif;
  --nav-w: 220px; --tap: 44px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-text-size-adjust: 100%; }
a { color: var(--primary); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; } h2 { font-size: 18px; } h3 { font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- shell ---------- */
.gf-shell { display: flex; min-height: 100vh; }
.gf-nav { width: var(--nav-w); flex: none; background: var(--sand-2); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; }
.gf-brand { font-family: var(--serif); font-size: 22px; color: var(--primary); padding: 4px 10px 16px; }
.gf-brand small { display: block; font-family: var(--font); font-size: 11px; color: var(--slate); letter-spacing: .08em; text-transform: uppercase; }
.gf-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--ink); font-weight: 500; }
.gf-nav a:hover { background: var(--sand); text-decoration: none; }
.gf-nav a.on { background: var(--primary); color: var(--primary-ink); }
.gf-nav svg { width: 18px; height: 18px; flex: none; }
.gf-nav .gf-me { margin-top: auto; padding: 10px; font-size: 13px; color: var(--slate); border-top: 1px solid var(--line); }
.gf-nav .gf-me b { color: var(--ink); display: block; }
.gf-main { flex: 1; min-width: 0; padding: 24px 28px 60px; max-width: 1400px; }
.gf-bottom { display: none; }

/* ---------- page parts ---------- */
.gf-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.gf-title { font-family: var(--serif); font-weight: 400; font-size: 30px; margin: 0; }
.gf-sub { color: var(--slate); margin: 2px 0 0; }
.gf-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.gf-card > h2:first-child, .gf-card > h3:first-child { margin-top: 0; }
.gf-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.gf-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.gf-stack { display: flex; flex-direction: column; gap: 14px; }
.gf-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.gf-muted { color: var(--slate); }
.gf-empty { padding: 28px; text-align: center; color: var(--slate); background: var(--sand-2); border: 1px dashed var(--line); border-radius: var(--radius); }
.gf-kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.gf-kv dt { color: var(--slate); } .gf-kv dd { margin: 0; overflow-wrap: anywhere; }
.gf-stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.gf-stat .n { font-size: 26px; font-weight: 700; line-height: 1.1; } .gf-stat .l { color: var(--slate); font-size: 13px; } .gf-stat .s { color: var(--slate); font-size: 12px; margin-top: 2px; }

/* ---------- controls ---------- */
.gf-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; }
.gf-btn:hover { background: var(--sand-2); text-decoration: none; }
.gf-btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); } .gf-btn.primary:hover { filter: brightness(1.08); }
.gf-btn.danger { color: var(--red); border-color: #E6C3BE; } .gf-btn.danger:hover { background: var(--red-soft); }
.gf-btn.ghost { background: transparent; border-color: transparent; } .gf-btn.ghost:hover { background: var(--sand); }
.gf-btn.small { min-height: 30px; padding: 3px 10px; font-size: 13px; }
.gf-btn:disabled { opacity: .5; cursor: not-allowed; }
.gf-call { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 8px 18px; border-radius: 999px; background: var(--green); color: #fff; font-weight: 700; border: 0; cursor: pointer; }
.gf-call:hover { text-decoration: none; filter: brightness(1.08); } .gf-call.off { background: var(--line); color: var(--slate); pointer-events: none; }
.gf-input, .gf-field input, .gf-field select, .gf-field textarea { width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.gf-input:focus, .gf-field :is(input, select, textarea):focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.gf-toolbar .gf-input { width: auto; min-width: 140px; }
.gf-field textarea { min-height: 90px; resize: vertical; }
.gf-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.gf-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; } .gf-field.full { grid-column: 1 / -1; }
.gf-field > span { font-size: 13px; font-weight: 600; } .gf-field small { color: var(--slate); font-size: 12px; }
.gf-field.check { flex-direction: row; align-items: center; gap: 8px; } .gf-field.check input { width: 20px; min-height: 20px; }
.gf-form .gf-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.gf-form .gf-err { grid-column: 1 / -1; color: var(--red); font-size: 14px; }
.gf-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.gf-tab { padding: 8px 14px; border: 0; background: none; cursor: pointer; font-weight: 600; color: var(--slate); border-bottom: 2px solid transparent; white-space: nowrap; }
.gf-tab.on { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- tables ---------- */
.gf-table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.gf-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.gf-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--slate); background: var(--sand-2); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
.gf-table th.sortable { cursor: pointer; } .gf-table th.sortable:hover { color: var(--ink); }
.gf-table th .arrow { font-size: 10px; margin-left: 4px; }
.gf-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.gf-table tr:last-child td { border-bottom: 0; }
.gf-table tr.click { cursor: pointer; } .gf-table tr.click:hover td { background: var(--sand-2); }
.gf-table .right { text-align: right; }

/* ---------- badges ---------- */
.gf-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; background: var(--sand); color: var(--ink); }
.gf-badge.green { background: var(--green-soft); color: var(--green); } .gf-badge.red { background: var(--red-soft); color: var(--red); }
.gf-badge.brass { background: var(--amber-soft); color: var(--amber); } .gf-badge.blue { background: var(--blue-soft); color: var(--blue); }
.gf-badge.primary { background: var(--primary-soft); color: var(--primary); } .gf-badge.slate { background: #ECEEEC; color: var(--slate); }
.gf-badge.solid { background: var(--primary); color: #fff; }

/* ---------- modal and toast ---------- */
.gf-modal-bg { position: fixed; inset: 0; background: rgba(25, 39, 36, .4); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.gf-modal { background: var(--card); border-radius: var(--radius); width: 100%; max-width: 560px; box-shadow: 0 10px 40px rgba(0, 0, 0, .2); }
.gf-modal.wide { max-width: 860px; }
.gf-modal header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.gf-modal header h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 22px; }
.gf-modal .body { padding: 16px 18px; } .gf-modal footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); }
.gf-x { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--slate); width: 36px; height: 36px; border-radius: 8px; } .gf-x:hover { background: var(--sand); }
.gf-toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.gf-toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); max-width: 360px; font-size: 14px; }
.gf-toast.error { background: var(--red); } .gf-toast.ok { background: var(--primary); }

/* ---------- phone: bottom tab bar, big tap targets ---------- */
@media (max-width: 767px) {
  .gf-nav { display: none; }
  .gf-main { padding: 14px 12px 90px; }
  .gf-title { font-size: 24px; }
  .gf-bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); z-index: 40; padding-bottom: env(safe-area-inset-bottom); }
  .gf-bottom a, .gf-bottom button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; font-size: 11px; color: var(--slate); background: none; border: 0; cursor: pointer; }
  .gf-bottom a.on { color: var(--primary); font-weight: 700; } .gf-bottom svg { width: 22px; height: 22px; }
  .gf-bottom a:hover { text-decoration: none; }
  .gf-btn { min-height: var(--tap); } .gf-btn.small { min-height: 36px; }
  .gf-form { grid-template-columns: 1fr; }
  .gf-toasts { left: 12px; right: 12px; bottom: 74px; }
  .gf-modal-bg { padding: 0; align-items: flex-end; } .gf-modal { border-radius: var(--radius) var(--radius) 0 0; max-height: 92vh; overflow-y: auto; }
  .gf-field input, .gf-field select, .gf-field textarea, .gf-input { min-height: var(--tap); font-size: 16px; }
}

/* ---------- login page ---------- */
.gf-login { max-width: 400px; margin: 8vh auto; padding: 0 16px; }
.gf-login .gf-brand { text-align: center; font-size: 32px; padding-bottom: 20px; }
.gf-nav .gf-me a { display: inline; padding: 0; color: var(--primary); font-weight: 600; } .gf-nav .gf-me a:hover { background: none; text-decoration: underline; }
.gf-nav .gf-count { margin-left: auto; }
