/* HA Consent v1 — banner + preferences modal. All selectors prefixed .hac- */
.hac-root{
  --hac-bg:#fff;--hac-fg:#0F172A;--hac-muted:#64748B;--hac-border:rgba(15,23,42,.08);
  --hac-accent:#0F172A;--hac-accent-fg:#fff;--hac-radius:16px;--hac-shadow:0 12px 40px rgba(15,23,42,.14);
  --hac-line:rgba(15,23,42,.18);--hac-ring:#60B8FF;
  font-family:inherit;color:var(--hac-fg);font-size:14px;line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
.hac-root *,.hac-root *::before,.hac-root *::after{box-sizing:border-box}
.hac-root button{font-family:inherit}

/* Banner: compact card, bottom-left */
.hac-banner{
  position:fixed;right:20px;bottom:20px;z-index:2147483000;
  width:calc(100% - 40px);max-width:420px;padding:20px;
  background:var(--hac-bg);border:1px solid var(--hac-border);
  border-radius:var(--hac-radius);box-shadow:var(--hac-shadow);
  animation:hac-up .18s ease-out;
}
.hac-title{margin:0 0 6px;font-size:16px;font-weight:600;line-height:1.3;letter-spacing:-.01em;color:var(--hac-fg)}
.hac-text{margin:0;color:var(--hac-muted)}
.hac-root a{color:var(--hac-fg);text-decoration:underline;text-underline-offset:2px;border-radius:4px}
.hac-actions{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:16px}

/* Buttons: equal size; Accept solid, Reject outlined, Customise text-style */
.hac-btn{
  appearance:none;-webkit-appearance:none;margin:0;
  display:inline-flex;align-items:center;justify-content:center;
  height:40px;padding:0 14px;border-radius:10px;border:1px solid transparent;
  font-size:14px;font-weight:500;line-height:1;white-space:nowrap;cursor:pointer;
  transition:background-color .15s,border-color .15s,opacity .15s;
}
.hac-btn--solid{background:var(--hac-accent);color:var(--hac-accent-fg);border-color:var(--hac-accent)}
.hac-btn--solid:hover{opacity:.88}
.hac-btn--outline{background:transparent;color:var(--hac-fg);border-color:var(--hac-line)}
.hac-btn--outline:hover{border-color:var(--hac-fg)}
.hac-btn--text{background:transparent;color:var(--hac-fg);text-decoration:underline;text-underline-offset:3px}
.hac-btn--text:hover{background:rgba(15,23,42,.04)}

/* 4px focus rings */
.hac-btn:focus-visible,.hac-switch:focus-visible,.hac-close:focus-visible,.hac-root a:focus-visible{
  outline:4px solid var(--hac-ring);outline-offset:1px;
}

/* Modal */
.hac-overlay{
  position:fixed;inset:0;z-index:2147483001;
  display:flex;align-items:center;justify-content:center;padding:20px;
  background:rgba(15,23,42,.4);
}
.hac-modal{
  position:relative;width:100%;max-width:520px;max-height:calc(100vh - 40px);overflow:auto;
  padding:24px;background:var(--hac-bg);border-radius:var(--hac-radius);box-shadow:var(--hac-shadow);
  animation:hac-up .18s ease-out;
}
.hac-mtitle{font-size:18px;margin-bottom:6px;padding-right:40px}
.hac-close{
  position:absolute;top:14px;right:14px;width:32px;height:32px;
  display:flex;align-items:center;justify-content:center;
  border:0;border-radius:8px;background:transparent;color:var(--hac-muted);
  font-size:22px;line-height:1;cursor:pointer;
}
.hac-close:hover{background:rgba(15,23,42,.05);color:var(--hac-fg)}
.hac-rows{margin-top:16px}
.hac-row{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:14px 0;border-top:1px solid var(--hac-border)}
.hac-row:last-child{border-bottom:1px solid var(--hac-border)}
.hac-row-name{margin:0;font-weight:600;color:var(--hac-fg)}
.hac-row-desc{margin:2px 0 0;font-size:13px;color:var(--hac-muted)}
.hac-note{margin:6px 0 0;font-size:12px;font-weight:500;color:var(--hac-fg)}
.hac-mactions{display:flex;gap:8px;margin-top:20px}
.hac-mactions .hac-btn{flex:1 1 0}

/* Switch: 40x24 pill, 20px knob */
.hac-switch{
  position:relative;flex:none;width:40px;height:24px;margin-top:2px;padding:0;
  border:0;border-radius:999px;background:#CBD5E1;cursor:pointer;
  transition:background-color .18s;
}
.hac-switch[aria-checked="true"]{background:linear-gradient(90deg,#a3ffd6,#3facf8)}
.hac-knob{
  position:absolute;top:2px;left:2px;width:20px;height:20px;border-radius:50%;
  background:#fff;box-shadow:0 1px 3px rgba(15,23,42,.25);transition:transform .18s;
}
.hac-switch[aria-checked="true"] .hac-knob{transform:translateX(16px)}
.hac-switch:disabled{cursor:not-allowed;opacity:.55}

@keyframes hac-up{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}

/* Phones: bottom sheet */
@media (max-width:479px){
  .hac-banner{left:12px;right:12px;bottom:12px;width:auto;max-width:none;padding:16px}
  .hac-overlay{align-items:flex-end;padding:12px}
  .hac-modal{padding:20px;max-height:calc(100vh - 24px)}
  .hac-btn{padding:0 8px}
  .hac-mactions{flex-wrap:wrap}
  .hac-mactions .hac-btn{flex:1 1 40%}
  .hac-mactions .hac-btn--solid{flex-basis:100%}
}

@media (prefers-reduced-motion:reduce){
  .hac-banner,.hac-modal{animation:none}
  .hac-btn,.hac-switch,.hac-knob{transition:none}
}

.hac-hidden{display:none!important}
