/*
 * brand.css: a business's own look (audit 14a and 14b, 2026-11-18). Loaded
 * last, after core.css, the modules' stylesheets and theme-grainpath.css.
 *
 * Every color comes from the --brand-* custom properties the shell writes
 * from App\Platform\BrandPalette, worked out from the business's one accent.
 */

/* ------------------------------------------------ Settings, Your brand */
.br-head{display:flex;flex-direction:column;gap:var(--space-1);margin-bottom:var(--space-4);}
.br-layout{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:var(--space-5);align-items:start;}
.br-form{display:flex;flex-direction:column;gap:var(--space-5);min-width:0;}
.br-section{display:flex;flex-direction:column;gap:var(--space-3);min-width:0;}
.br-label{font-weight:600;font-size:var(--text-md);display:flex;align-items:center;gap:var(--space-2);flex-wrap:wrap;}
.br-aside{position:sticky;top:var(--space-4);display:flex;flex-direction:column;gap:var(--space-3);padding:var(--space-4);border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--subtle-bg);}

.br-logos{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--space-3);}
.br-logo-slot{display:flex;gap:var(--space-3);align-items:center;padding:var(--space-3);border:1px solid var(--line);border-radius:var(--radius-md);background:var(--paper-raised);min-width:0;}
.br-logo-box{width:64px;height:64px;flex:none;border-radius:var(--radius-md);display:flex;align-items:center;justify-content:center;background:#FFFFFF;border:1px solid var(--line);overflow:hidden;}
.br-logo-slot.dark .br-logo-box{background:var(--brand-deep, #1F2E27);border-color:transparent;}
.br-logo-box img{max-width:52px;max-height:52px;object-fit:contain;}
.br-logo-empty{font-weight:600;font-size:var(--text-xl);color:var(--text-muted);}
.br-logo-slot.dark .br-logo-empty{color:#FFFFFF;opacity:.6;}
.br-logo-text{display:flex;flex-direction:column;gap:var(--space-1);min-width:0;}
.br-logo-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.br-logo-btns{display:flex;gap:var(--space-2);flex-wrap:wrap;}
.br-file{cursor:pointer;}
.br-file input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none;}

.br-names{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--space-3);}
.br-names .field:last-child{grid-column:1 / -1;}
.br-names .field, .br-switches .field{margin:0;}

.br-swatch-row{display:flex;align-items:center;gap:var(--space-2);flex-wrap:wrap;}
.br-swatch-label{min-width:96px;}
.br-swatch{width:32px;height:32px;border-radius:50%;border:0;padding:0;cursor:pointer;box-shadow:inset 0 0 0 1px rgba(0,0,0,.12);}
.br-swatch.on{box-shadow:0 0 0 2px var(--paper-raised), 0 0 0 4px var(--ink);}
.br-hex{display:flex;align-items:center;gap:var(--space-2);flex-wrap:wrap;}
.br-hex input[type="color"]{width:44px;height:36px;padding:0;border:1px solid var(--line-strong);border-radius:var(--radius-md);background:var(--paper-raised);cursor:pointer;}
.br-hex input[type="text"]{width:120px;}
.br-check{display:flex;align-items:center;gap:var(--space-2);font-size:var(--text-sm);}
.br-check.ok{color:var(--green-dot);}
.br-check.warn{color:var(--brick);}
.br-check .ic{width:16px;height:16px;}

.br-theme-grid{grid-template-columns:repeat(3,minmax(0,1fr));}
.br-more{align-self:flex-start;}
.br-font-pills button{white-space:nowrap;}

.br-switches{gap:0;}
.br-switch-row{display:flex;align-items:center;gap:var(--space-3);justify-content:space-between;min-height:56px;border-bottom:1px solid var(--line);cursor:pointer;}
.br-switch-text{display:flex;align-items:center;gap:var(--space-2);flex-wrap:wrap;font-weight:600;font-size:var(--text-md);}
.br-switches .field{padding-top:var(--space-4);}

.br-actions{display:flex;align-items:center;justify-content:space-between;gap:var(--space-3);flex-wrap:wrap;padding-top:var(--space-4);border-top:1px solid var(--line);}
.br-actions-end{display:flex;gap:var(--space-2);flex-wrap:wrap;}

/* The preview: small drawings of the app, a customer page and the icon. */
.br-pv-app{display:flex;height:220px;border-radius:var(--radius-md);overflow:hidden;border:1px solid var(--line);}
.br-pv-rail{width:96px;flex:none;padding:var(--space-2);display:flex;flex-direction:column;gap:var(--space-1);}
.br-pv-brand{display:flex;align-items:center;gap:var(--space-1);margin-bottom:var(--space-1);min-width:0;}
.br-pv-brand > span{display:flex;flex-direction:column;min-width:0;}
.br-pv-name{font-size:11px;font-weight:600;line-height:1.15;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;} /* raw on purpose: the preview is a small drawing, sized to scale */
.br-pv-byline{font-size:7px;letter-spacing:.12em;text-transform:uppercase;opacity:.7;} /* raw on purpose: the preview is a small drawing, sized to scale */
.br-pv-logo{width:20px;height:20px;object-fit:contain;border-radius:4px;background:#FFFFFF;flex:none;}
.br-pv-mark{width:20px;height:20px;border-radius:5px;display:flex;align-items:center;justify-content:center;font-size:8px;font-weight:700;flex:none;} /* raw on purpose: the preview is a small drawing, sized to scale */
.br-pv-tab{height:10px;border-radius:4px;background:currentColor;opacity:.18;}
.br-pv-tab.on{opacity:.4;}
.br-pv-main{flex:1;min-width:0;padding:var(--space-3);display:flex;flex-direction:column;gap:var(--space-2);}
.br-pv-hello{font-size:var(--text-md);font-weight:600;}
.br-pv-stats{display:grid;grid-template-columns:1fr 1fr;gap:var(--space-1);}
.br-pv-stats span{height:30px;border-radius:6px;}
.br-pv-chart{flex:1;border-radius:6px;display:flex;align-items:flex-end;gap:var(--space-1);padding:var(--space-2);}
.br-pv-chart span{flex:1;border-radius:3px 3px 0 0;}
.br-pv-btn{display:inline-flex;align-self:flex-start;align-items:center;justify-content:center;padding:var(--space-1) var(--space-3);border-radius:6px;font-size:var(--text-xs);font-weight:600;}
.br-pv-page{border-radius:var(--radius-md);overflow:hidden;border:1px solid var(--line);}
.br-pv-band{display:flex;align-items:center;gap:var(--space-2);padding:var(--space-2) var(--space-3);font-size:var(--text-sm);font-weight:600;}
.br-pv-card{margin:var(--space-3);padding:var(--space-3);border-radius:var(--radius-md);background:#FFFFFF;display:flex;flex-direction:column;gap:var(--space-1);color:#1F2E27;}
.br-pv-small{font-size:10px;opacity:.7;} /* raw on purpose: the preview is a small drawing, sized to scale */
.br-pv-big{font-size:var(--text-lg);font-weight:600;}
.br-pv-line{height:6px;border-radius:3px;background:rgba(0,0,0,.08);}
.br-pv-line.short{width:60%;}
.br-pv-foot{font-size:10px;text-align:center;padding:0 var(--space-3) var(--space-3);opacity:.75;} /* raw on purpose: the preview is a small drawing, sized to scale */
.br-pv-icons{display:flex;flex-direction:column;align-items:center;gap:var(--space-2);padding:var(--space-4) 0;}
.br-pv-icon{width:96px;height:96px;border-radius:22px;display:flex;align-items:center;justify-content:center;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,.15);}
.br-pv-icon img{max-width:72%;max-height:72%;object-fit:contain;}
.br-pv-icon span{font-size:36px;font-weight:600;} /* raw on purpose: the preview is a small drawing, sized to scale */

@media (max-width:1100px){
  .br-layout{grid-template-columns:minmax(0,1fr);}
  /* On a narrow screen the preview comes first, as on the phone mockup. */
  .br-aside{position:static;order:-1;}
  .br-theme-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media (max-width:820px){
  .br-logos, .br-names{grid-template-columns:minmax(0,1fr);}
  .br-swatch{width:44px;height:44px;}
  .br-swatch-label{min-width:0;width:100%;}
  .br-hex input[type="color"]{height:44px;}
  .br-hex input[type="text"]{flex:1;}
  .br-actions{flex-direction:column-reverse;align-items:stretch;}
  .br-actions-end{flex-direction:column-reverse;}
  .br-actions .btn{width:100%;min-height:48px;}
  .br-switch-row{min-height:64px;}
  .br-switch-row .dash-warn-switch{width:52px;height:30px;}
  .br-switch-row .dash-warn-switch::after{width:26px;height:26px;}
  .br-switch-row .dash-warn-switch:checked::after{left:24px;}
}

/* Pill rows wrap rather than squeeze: a narrow aside and a phone have no room for six in one line. */
.br-preview-pills, .br-font-pills{display:flex;flex-wrap:wrap;gap:var(--space-2);overflow:visible;}
.br-preview-pills button, .br-font-pills button{flex:none;}
.br-file{display:inline-flex;align-items:center;justify-content:center;position:relative;}

/* ------------------------------------------------ the accent, everywhere
   Only where the business has set one (the shell writes data-accent on
   <html> with the --brand-* colors). It drives main buttons, the chosen pill
   in a row, focus rings, the current bar on a chart, links and the round
   button in the middle of the phone's tab bar. */
html[data-accent]{
  --focus-ring:var(--brand-accent);
  --chart-a:var(--brand-accent);
  --chart-a-soft:var(--brand-chart);
}
html[data-accent] .btn:not(.ghost):not(.danger):not(.cf-danger),
html[data-accent] .login-card .btn,
html[data-accent] .topbar-add{background:var(--brand-accent);border-color:var(--brand-accent);color:var(--brand-on-accent);}
html[data-accent] .btn:not(.ghost):not(.danger):not(.cf-danger):hover,
html[data-accent] .login-card .btn:hover{background:var(--brand-accent-hover);border-color:var(--brand-accent-hover);}
html[data-accent] .seg button.active{background:var(--brand-accent-soft);border-color:var(--brand-accent);color:var(--brand-accent-ink);}
html[data-accent] .seg button.active .seg-count{background:var(--brand-accent);color:var(--brand-on-accent);}
html[data-accent] .main a[href]:not([class]),
html[data-accent] .modal a[href]:not([class]){color:var(--brand-accent-ink);}
html[data-accent] .gs-box:focus-within{border-color:var(--brand-accent);box-shadow:0 0 0 3px var(--brand-accent-soft);}
@media (max-width:820px){
  html[data-accent] .tabbar-wheel{background:var(--brand-accent);color:var(--brand-on-accent);}
  html[data-accent] .tabbar-wheel:focus-visible{outline-color:var(--brand-accent);}
}
/* On a dark theme the accent is lightened until it reads on the dark page. */
html[data-accent][data-scheme="dark"]{--focus-ring:var(--brand-dark-accent);--chart-a:var(--brand-dark-accent);}
html[data-accent][data-scheme="dark"] .btn:not(.ghost):not(.danger):not(.cf-danger){background:var(--brand-dark-accent);border-color:var(--brand-dark-accent);color:var(--brand-dark-on-accent);}
html[data-accent][data-scheme="dark"] .seg button.active{background:color-mix(in srgb, var(--brand-dark-accent) 22%, var(--paper-raised));border-color:var(--brand-dark-accent);color:var(--ink);}
html[data-accent][data-scheme="dark"] .main a[href]:not([class]),
html[data-accent][data-scheme="dark"] .modal a[href]:not([class]){color:var(--brand-dark-accent);}

/* The two "Your brand" swatches on Appearance. */
.theme-swatch[data-theme="brand"]{--sw-paper:var(--brand-page-bg);--sw-rail:var(--brand-deep);--sw-card:var(--brand-paper);--sw-line:var(--brand-line);}
.theme-swatch[data-theme="brand-dark"]{--sw-paper:var(--brand-dark-paper);--sw-rail:var(--brand-dark-rail);--sw-card:var(--brand-dark-raised);--sw-line:var(--brand-dark-line);}

/* ------------------------------------------------ "Your brand"
   The Grainpath layout (data-theme="grainpath") in the business's colors:
   the menu in a deep shade of the accent, the pages in faint tints of it,
   and Grainpath's own green contour art left out. */
html[data-look="brand"]{
  --ink:var(--brand-ink); --ink-soft:var(--brand-ink-soft);
  --paper:var(--brand-paper); --subtle-bg:var(--brand-subtle);
  --line:var(--brand-line); --line-strong:var(--brand-line-strong);
  --text-muted:var(--brand-muted);
  --sage:var(--brand-accent); --sage-soft:var(--brand-accent-soft); --sage-ink:var(--brand-accent-ink);
  --gp-bg:var(--brand-page-bg);
  --gp-forest:var(--brand-deep); --gp-pill:var(--brand-deep-pill);
  --gp-on-forest:var(--brand-on-deep); --gp-on-forest-muted:var(--brand-on-deep-muted);
  --gp-card-shadow:0 1px 2px rgba(0,0,0,0.05), 0 4px 16px rgba(0,0,0,0.06);
}
html[data-look="brand"]{--loader-ink:var(--brand-muted);}
html[data-look="brand"] body{background-image:none;background-color:var(--brand-page-bg);}
html[data-look="brand"] .dock{background:var(--brand-subtle);}
html[data-look="brand"] .modal{background:var(--paper-raised);}
html[data-look="brand"] .modal.is-tall > .modal-actions{background:var(--paper-raised);}
html[data-look="brand"] .overlay{background:rgba(0,0,0,.42);}
html[data-look="brand"] .login-art{background:var(--brand-deep);}
html[data-look="brand"] .modal input, html[data-look="brand"] .modal select, html[data-look="brand"] .modal textarea,
html[data-look="brand"] .num-step, html[data-look="brand"] .back-btn{border-color:var(--brand-line-strong);}
html[data-look="brand"] .num-step-btn{background:var(--brand-accent-soft);color:var(--brand-accent-ink);}
@media (min-width:821px){
  html[data-look="brand"] .rail,
  html[data-look="brand"] .rail > .brand{background:var(--brand-deep);}
}
@media (max-width:820px){
  html[data-look="brand"] .rail:not(.menu-collapsed),
  html[data-look="brand"] .mmod-head{background:var(--brand-deep);}
}

/* ------------------------------------------------ "Your brand, dark"
   The Slate layout (data-theme="slate") in a night version of the accent's hue. */
html[data-look="brand-dark"]{
  --ink:var(--brand-dark-ink); --ink-soft:var(--brand-dark-ink-soft);
  --paper:var(--brand-dark-paper); --paper-raised:var(--brand-dark-raised); --subtle-bg:var(--brand-dark-raised);
  --line:var(--brand-dark-line); --line-strong:var(--brand-dark-line);
  --text-muted:var(--brand-dark-muted);
  --sage:var(--brand-dark-accent);
}
html[data-look="brand-dark"] body{background:var(--brand-dark-paper);}
@media (min-width:821px){
  html[data-look="brand-dark"] .rail{background:var(--brand-dark-rail);}
}

/* Your brand, Customer pages (options B to G). */
.br-tabs{display:flex;gap:var(--space-2);}
.br-reach-pills, .br-words-pills, .br-corner-pills, .br-tabs{flex-wrap:wrap;overflow:visible;}
.br-reach-pills button, .br-words-pills button, .br-corner-pills button, .br-tabs button{flex:none;}
.br-signer{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:var(--space-3);align-items:end;}
.br-signer .field{margin:0;}
.br-photo{display:flex;align-items:center;gap:var(--space-2);flex-wrap:wrap;}
.br-photo-face{width:44px;height:44px;border-radius:50%;background:var(--subtle-bg);border:1px solid var(--line);display:flex;align-items:center;justify-content:center;overflow:hidden;font-size:var(--text-xs);color:var(--text-muted);text-align:center;}
.br-photo-face img{width:100%;height:100%;object-fit:cover;}
.br-cover{position:relative;display:block;width:100%;height:120px;border:0;padding:0;border-radius:var(--radius-md);background-size:cover;background-repeat:no-repeat;cursor:crosshair;}
.br-cover-dot{position:absolute;width:18px;height:18px;margin:-9px 0 0 -9px;border-radius:50%;border:3px solid #FFFFFF;box-shadow:0 0 0 2px rgba(0,0,0,.45);pointer-events:none;}
.br-link-rows{display:flex;flex-direction:column;gap:var(--space-2);}
.br-link-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2fr) auto;gap:var(--space-2);align-items:center;}
.br-pages .ve{min-height:44px;}
@media (max-width:820px){
  .br-signer{grid-template-columns:minmax(0,1fr);}
  .br-link-row{grid-template-columns:minmax(0,1fr);padding-bottom:var(--space-3);border-bottom:1px solid var(--line);}
  .br-reach-pills button, .br-words-pills button, .br-corner-pills button, .br-tabs button{min-height:44px;}
}
.br-pages{display:flex;flex-direction:column;gap:var(--space-6);}
.br-pages .br-names .field:last-child{grid-column:auto;}
.br-pages .br-section + .br-section{padding-top:var(--space-5);border-top:1px solid var(--line);}
